|
[Sponsors] |
Question about C_UDMI and F_UDMI and How to define the gradient of a UDM? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 19, 2015, 04:52 |
Question about C_UDMI and F_UDMI and How to define the gradient of a UDM?
|
#1 |
Member
Peter Aestas
Join Date: Dec 2013
Posts: 64
Rep Power: 13 |
Hello friends, I found a way to define the gradient of any quantities by UDS in fluent UDF manual:
DEFINE_ADJUST(adjust_gradient, domain) { Thread *t; cell_t c; face_t f; domain = Get_Domain(domain_ID); /* Fill UDS with the variable. */ thread_loop_c (t,domain) { begin_c_loop (c,t) { C_UDSI(c,t,0) = C_VOF(c,t); } end_c_loop (c,t) } thread_loop_f (t,domain) { if (THREAD_STORAGE(t,SV_UDS_I(0))!=NULL) begin_f_loop (f,t) { F_UDSI(f,t,0) = F_VOF(f,t); } end_f_loop (f,t) } } Then the gradient would be C_UDSI_G(c,t,0) Question is, 1. In my UDF, sometimes I need both the cell value and face value of the same UDM I am confused whether if C_UDMI(c,t,0) and F_UDMI(c,t,0) could be defined at the same time in DEFINE_ADJUST MACRO? 2. As the example above shows, to define the gradient of a variable by C_UDSI_G(c,t,0), the UDF defined both cell values and face values of UDS, instead of just cell value, why?Does this matter? 3.If want to define a gradient of UDM 0, should I first both define the value of C_UDMI(c,t,0) and F_UDMI(c,t,0) , and then let C_UDSI(c,t,0) = C_UDMI(c,t,0); F_UDSI(f,t,0) = F_UDMI(c,t,0); Is this necessary? Or I just have to let C_UDSI(c,t,0) = C_UDMI(c,t,0) and ignore the face value of UDS? |
|
May 22, 2015, 07:34 |
|
#2 |
Member
Jim
Join Date: May 2015
Posts: 47
Rep Power: 11 |
Hi, I'm just a beginner myself, so please take my advice with a pinch of salt.
My understanding is that user-defined scalars and user defined memory are two different things. User defined memory is stores a new value in every cell in the model. but this is just an artibary value in the cell. but these values are not subject to the generalised transport equation - they don't experience diffusion, convection etc. the values just "sit there" in the cell, like a cell in an excel spreadsheet. User defined scalars are also stored as a new value in the every cell like user defined memory, but unlike user-defined memory they are also subject to a generalised transport equation. I'm suggesting this could be the source of your problem - getting user-defined memory and user-defined scalars confused ? |
|
May 22, 2015, 07:43 |
|
#3 | |
Member
Peter Aestas
Join Date: Dec 2013
Posts: 64
Rep Power: 13 |
Thanks for your replay, my friend.
I can understand the difference between UDS and UDM. In fluent, the gradient of a UDS could be calculated and used by C_UDSI_G,but there is no such way for UDM. I am trying to use UDS to calculate the gradient of any varibles and to use it in my UDF(by only assign the value to UDS in UDF but not solve the uds equation in fluent.). NOW, I have found that the face vaule of the UDS should also be assigned. If not, the gradient value, especially near and at the boundary would be wrong. Quote:
|
||
May 11, 2018, 12:55 |
|
#4 |
New Member
|
Hi,
I am having the same trouble. I need to be able to find a bunch of gradients of variables too? Did you resolve this problem? |
|
May 14, 2018, 11:50 |
|
#5 |
Member
annan
Join Date: Nov 2016
Posts: 72
Rep Power: 10 |
Hi tejasvikrishna,
Have you tried writing a UDF where you define a UDS for each variable you want to calculate the gradient for, and then use C_UDSI_G or C_UDSI_RG of each defined UDS ? regards, Annan |
|
|
|