CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Calling a cell with its reference id and obtain it's temperature

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 25, 2020, 13:00
Default Calling a cell with its reference id and obtain it's temperature
  #1
Senior Member
 
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0
visitor is on a distinguished road
Any tips please? Scheme please.

Need to call a cell with its id and obtain it's temperature. Can be in a loopz starting with cell 1, then next cell, ..
visitor is offline   Reply With Quote

Old   August 26, 2020, 01:07
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
what is cell ID from your point of view?

this is a code to get temperature of all cells in the domain

Code:
#include "udf.h"
DEFINE_ADJUST(adjust_temp, domain)
{
Thread *t;
cell_t c;

real T 

thread_loop_c (t,domain)
{
begin_c_loop (c,t)
{
C_UDMI(c,t,0) = C_T(c,t);
}
end_c_loop (c,t)
}
}
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   August 26, 2020, 06:29
Default
  #3
Senior Member
 
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0
visitor is on a distinguished road
Thanks Alexander

This will have all cells referenced cell 1, cell 2, .....

Some how I have to pass each cell to TUI , and then allow Scheme take an action. I am looking at a while loop in a Scheme, which calls a cell number and then loops.
"
In TUI Scheme
GET cell 1 temperature
(if (cell 1 temperature>0) (k-ϵ RNG) (k-ϵ))
next cell reference ....
"
That is Scheme reads the UDF and then take an action to switch between k-e and k-e RNG.

Just found this on the web for a scheme while loop. Can use this to call in UDF, and then get cell 1 temperature, and then loop for next cells. The 5
"
(define i 5)

(define f
(lambda (x)
(if (not (= i 0))
(begin
(display i)
(set! i (- i 1))
(x x))
'done)))
"

Here is another example, the count to 10 is not applicable. The figure 10 can be equal to the number of cells in the fluid domain. The (newline) and (display x) are not necessary.
"
(define x 0)
(while (<= x 10)
(display "x is ")
(display x)
(newline)
(newline)
(set! x (+ x 1))
)
"

Last edited by visitor; August 27, 2020 at 07:02. Reason: Just adding more examples.
visitor is offline   Reply With Quote

Old   August 26, 2020, 13:20
Default
  #4
Senior Member
 
AH
Join Date: Apr 2014
Posts: 287
Rep Power: 0
visitor is on a distinguished road
Dear Alexander, posting #2.

Actually i think it's alot easier if i can convert your C++ UDF into a Scheme.
I am new to Scheme, but something similar to the above, but without define. Keep it an open continuous loop.

I will try something, but i am totally new to Scheme.😑
visitor is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 16:40.