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

questions about C_R(c,t) in fluent udf

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 3, 2020, 13:29
Exclamation questions about C_R(c,t) in fluent udf
  #1
New Member
 
Mo Wenhai
Join Date: Mar 2019
Posts: 7
Rep Power: 7
Mwh-HEU is on a distinguished road
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;
}
Supposed that the density of the liquid phase is 998.2kg/m^3, what is difference if I set
Code:
x_source=-C_U(c,t)*998.2*coeff;
dS[eqn] =-998.2*coeff;
for the first case, when in air phase, C_R(c,t) returns air density. when in liquid phase, it returns liquid density, right?
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.
Mwh-HEU is offline   Reply With Quote

Old   May 3, 2020, 16:49
Default C_R
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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.
vinerm is offline   Reply With Quote

Old   May 4, 2020, 09:22
Default
  #3
New Member
 
Mo Wenhai
Join Date: Mar 2019
Posts: 7
Rep Power: 7
Mwh-HEU is on a distinguished road
Quote:
Originally Posted by vinerm View Post
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.
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?
Mwh-HEU is offline   Reply With Quote

Old   May 4, 2020, 17:37
Default Source Term
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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.
vinerm is offline   Reply With Quote

Old   May 8, 2020, 21:06
Unhappy C_R too large
  #5
New Member
 
Tarriq Purivatra
Join Date: Nov 2019
Posts: 2
Rep Power: 0
Tarriqpuri is on a distinguished road
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
Tarriqpuri is offline   Reply With Quote

Old   May 8, 2020, 22:27
Default
  #6
New Member
 
Mo Wenhai
Join Date: Mar 2019
Posts: 7
Rep Power: 7
Mwh-HEU is on a distinguished road
Thank you so much for solving my problems!
Mwh-HEU is offline   Reply With Quote

Old   May 9, 2020, 07:54
Default Error
  #7
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 36
vinerm will become famous soon enough
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.
vinerm is offline   Reply With Quote

Old   May 13, 2020, 12:35
Default It worked
  #8
New Member
 
Tarriq Purivatra
Join Date: Nov 2019
Posts: 2
Rep Power: 0
Tarriqpuri is on a distinguished road
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:
Originally Posted by vinerm View Post
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.
Tarriqpuri is offline   Reply With Quote

Reply

Tags
fluent, fluent - udf, fluent-19.0


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


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


All times are GMT -4. The time now is 20:13.