|
[Sponsors] |
May 3, 2020, 13:29 |
questions about C_R(c,t) in fluent udf
|
#1 |
New Member
Mo Wenhai
Join Date: Mar 2019
Posts: 7
Rep Power: 7 |
Hi, guys. I am a little confused about C_R(c,t) in fluent udf when programming.
The manual says it returns the Density. But, i am confused that what it means in vof model. I want to simulate linear wave in fluent, and I program the wave aborption part as follows: Code:
if ((x[0]>=FL-2*L && x[0]<=FL)) { //coeff= 10*(x[0]-(FL-2*L))/(2*L);// //coeff= sqrt(1-pow((x[0]-(FL-2*L))/(2*L),2));// //coeff= exp((pow(2,-(x[0]-(FL-2*L))/dx)-pow(2,-(2*L)/dx))log(10));// //coeff= exp(-0.15*(x[0]-(FL-2*L))/(2*L));// coeff= 2*PI/T*pow((x[0]-(FL-2*L))/(L),2); if((x[0]>=FL-L && x[0]<=FL)) { coeff= 2*PI/T; } //coeff= sin(PI*(x[0] - (FL - 2 * L)) /(2 * L))*8;// x_source=-C_U(c,t)*C_R(c,t)*coeff; dS[eqn] =-C_R(c, t)*coeff; } Code:
x_source=-C_U(c,t)*998.2*coeff; dS[eqn] =-998.2*coeff; for the other case, the density is fixed, no matter what phase it is. which one is correct? could someone explain it for me? Thanks, ! Last edited by Mwh-HEU; May 3, 2020 at 15:16. |
|
May 3, 2020, 16:49 |
C_R
|
#2 |
Senior Member
|
Your understanding is partially correct; C_R does not return the density of the phase but of the mixture in VoF and Mixture models. However, this is equivalent to assuming that C_R returns density of air phase while in air and of the water phase while in water, except at the interface. As far as your source term is concerned, formulation using C_R will apply smaller source in lighter fluid and larger value in denser, while the formulation with fixed value will return an almost 3 orders of magnitude higher source term in the lighter phase. Now, it is on user, which formulation he or she wants to use.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
May 4, 2020, 09:22 |
|
#3 |
New Member
Mo Wenhai
Join Date: Mar 2019
Posts: 7
Rep Power: 7 |
Thanks a lot, but I still a little puzzled about the situation that the formulation with fixed value. Take my second case for example, what the source term will return when in air phase, water phase and the interface?
|
|
May 4, 2020, 17:37 |
Source Term
|
#4 |
Senior Member
|
For the formulation with constant value, source term will be same in water phase but larger in air and interface region. In air, it will be about 1000 times larger while at the interface it will be 500 times larger. You can save this value in UDM and then plot a contour to observe it.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
May 8, 2020, 21:06 |
C_R too large
|
#5 |
New Member
Tarriq Purivatra
Join Date: Nov 2019
Posts: 2
Rep Power: 0 |
Hi there, in addition to the recent questions, I am also looking to use C_R for my multiphase VOF simulation. I am getting numbers ranging from -1639148109 to 2033200662. I am using oil and water so I am expecting a density between 850 and 998 kg/m3. Any chance I am using the variable incorrectly?
Here is my code below Code:
DEFINE_ADJUST(ad, domain){ Thread *t; cell_t c; thread_loop_c (t, domain){ begin_c_loop(c,t){ C_UDSI(c,t,ads)=139.7* (((WaterDENSITY-C_R(c,t))/(WaterDENSITY-OilDENSITY))*0.8274) /(1+170386.2* (((WaterDENSITY-C_R(c,t))/(WaterDENSITY-OilDENSITY))*0.8274)); printf("ads ;%d; ", C_UDSI(c,t,ads)); printf("CR ;%d; \n", C_R(c,t)); } end_c_loop(c,t) } Last edited by Tarriqpuri; May 8, 2020 at 21:09. Reason: formatting for code |
|
May 8, 2020, 22:27 |
|
#6 |
New Member
Mo Wenhai
Join Date: Mar 2019
Posts: 7
Rep Power: 7 |
Thank you so much for solving my problems!
|
|
May 9, 2020, 07:54 |
Error
|
#7 |
Senior Member
|
There is one syntactical and one logical bug. Syntactical bug is use of wrong format specifier, %d while it should be %f. That's the reason for wrong value reporting.
Logical bug is assigning values to UDS. Fluent solves conservation equation for UDS and user is not supposed to assign field values during the calculations. Instead, use UDM.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
May 13, 2020, 12:35 |
It worked
|
#8 | |
New Member
Tarriq Purivatra
Join Date: Nov 2019
Posts: 2
Rep Power: 0 |
Thank you, I took your advice for both errors and my simulation is working now! You saved me a lot of time, I appreciate it.
Quote:
|
||
Tags |
fluent, fluent - udf, fluent-19.0 |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A Problem of Fluent Interpreted UDF: parse error | knight | Fluent UDF and Scheme Programming | 25 | August 16, 2018 11:26 |
Running UDF with Supercomputer | roi247 | FLUENT | 4 | October 15, 2015 14:41 |
How does FLUENT process an UDF!!!!???? | Bharadwaj B S | Fluent UDF and Scheme Programming | 31 | March 9, 2015 07:32 |
fluent udf problem: write specific data for every iteration in a file. | nnvoro | Fluent UDF and Scheme Programming | 1 | May 27, 2013 16:26 |
UDF of Zimont model in fluent | Z | Main CFD Forum | 0 | February 17, 2005 04:07 |