|
[Sponsors] |
March 9, 2017, 18:50 |
store and access the value in UDM
|
#1 |
New Member
Jing
Join Date: Feb 2013
Posts: 25
Rep Power: 13 |
Hi,
I have a question about using UDM to store a single value and then retrieve it to do other calculation. so far from all the manual and examples I could read, people always use UDM to store an array, e.g. store the Temperature of each cell on a wall. the code will be like: begin_f_loop(c,t) { C_UDMI(c,t,0)=C_T(c,t); } end_f_loop(c,t) Now, I'm trying to store a single value calculated from my code, and then in another code I might need to use it. If I do this, begin_f_loop(c,t) { C_UDMI(c,t,0)=h; } end_f_loop(c,t) the value of h will be stored in every cell on the wall. But what if I need to use the value stored in UDM_0 in another code? How can I retrieve it? It doesn't work if I simply use the value of h in the other code without storing it in UDM. Because if I stop the calculation and write the data, value of h won't be saved. When I read the data, I'm not able to use the value of h again. That's why I have to store it in UDM and then retrieve it. Anyone could help me with that? I really appreciate that. I tried a long time but still couldn't make it. |
|
March 13, 2017, 07:00 |
|
#2 | |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
Quote:
Code:
h=C_UDMI(c,t,0); |
||
March 13, 2017, 14:38 |
|
#3 | |
New Member
Jing
Join Date: Feb 2013
Posts: 25
Rep Power: 13 |
Quote:
Thank you so much for your reply. If I do h=C_UDMI(c,t,0), do I need to loop along the line? From the UDF instruction, I see that when I store something in UDM, it's actually storing them in specifit cells. My concern is, if I only need to store one value, how do I locate the cell I want to store it into? What I did was I selected a wall and loop along the wall, store the value to each cell on that wall, when I need to retrieve this value, I use Fluent to calculate the average number of values in that UDM. I know it's such a bad idea, but I still couldn't find a way to locate the cell of UDM that could store the value. Or, maybe I don't need to do that??? I appreciate your help. Thanks a lot. |
||
February 24, 2018, 04:07 |
|
#4 | |
Member
Join Date: Oct 2017
Posts: 52
Rep Power: 9 |
Quote:
hello, I am working on creating a new energy transport UDS in fluent and i am stuck in storing the values of liquid fraction. when i compile and run the code it works fine but when i check the contour for liquid fraction using UDM it does not show anything. description: i have initialized all the UDM as zero in DEFINE_INIT and i am using these UDMs to store values in DEFINE_ADJUST do you know how to sort it out? |
||
February 25, 2018, 21:34 |
|
#5 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
how could you know, that it works well?
try to initialize your initial variables using predefined values, so you can clearly see, that initialization works well. for instance variable 1 = 1.0, value 2 = 2.0 and so on best regards |
|
February 26, 2018, 00:31 |
|
#6 | |
Member
Join Date: Oct 2017
Posts: 52
Rep Power: 9 |
Quote:
i have attached init function below please tell me where is the error? //------------------------------------ DEFINE_INIT(initialize,d) { cell_t c; Thread *t; int i; /*----------------------------------------------*/ /*----------------------------------------------*/ thread_loop_c(t,d) /* Loop over all cell threads in domain */ { if (FLUID_THREAD_P(t)) { begin_c_loop(c,t) /* Loop over all cells in a cell thread*/ { for(i=0; i<sg_udm; ++i) C_UDMI(c,t,i) = 0.0; } end_c_loop(c,t) } } } |
||
February 26, 2018, 00:50 |
|
#7 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
looks like there is no error in code for INIT function.
I suggest to put other value, not zero, to check the contours after debugging change values back to zero best regards |
|
April 15, 2018, 15:41 |
|
#8 | |
New Member
maji nouri
Join Date: Dec 2016
Posts: 2
Rep Power: 0 |
Quote:
I have the same problem. can any one help please? |
||
April 16, 2018, 02:21 |
|
#9 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
||
Tags |
udf, udm |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Access value in cell across an interior interface | iteration | Fluent UDF and Scheme Programming | 1 | July 13, 2016 05:38 |
Way to access fluent report variables | ravi.karamarkar1 | Fluent UDF and Scheme Programming | 1 | August 18, 2015 08:13 |
How to access VOF of a face | gandesk | Fluent UDF and Scheme Programming | 1 | February 2, 2011 22:24 |
How to access or generate double derivatives? | Vishal | FLUENT | 1 | March 11, 2006 22:15 |
Help on UDF: access to wall shear stress | Zhihua Li | FLUENT | 2 | May 26, 2004 12:55 |