store and access the value in UDM
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. |
Quote:
Code:
h=C_UDMI(c,t,0); |
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. |
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? |
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 |
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) } } } |
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 |
Quote:
I have the same problem. can any one help please? |
Quote:
best regards |
All times are GMT -4. The time now is 12:36. |