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

Question about C_UDMI and F_UDMI and How to define the gradient of a UDM?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 19, 2015, 04:52
Default 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: 12
aestas is on a distinguished road
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?
aestas is offline   Reply With Quote

Old   May 22, 2015, 07:34
Default
  #2
Member
 
Jim
Join Date: May 2015
Posts: 47
Rep Power: 10
CFDYourself is on a distinguished road
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 ?
CFDYourself is offline   Reply With Quote

Old   May 22, 2015, 07:43
Default
  #3
Member
 
Peter Aestas
Join Date: Dec 2013
Posts: 64
Rep Power: 12
aestas is on a distinguished road
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:
Originally Posted by CFDYourself View Post
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 ?
aestas is offline   Reply With Quote

Old   May 11, 2018, 12:55
Default
  #4
New Member
 
Tejasvi Krishna
Join Date: Sep 2010
Location: College station,Tx, USA
Posts: 12
Rep Power: 15
tejasvikrishna is on a distinguished road
Send a message via Skype™ to tejasvikrishna
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?
tejasvikrishna is offline   Reply With Quote

Old   May 14, 2018, 11:50
Default
  #5
Member
 
annan
Join Date: Nov 2016
Posts: 72
Rep Power: 9
annan is on a distinguished road
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
annan is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 22:12.