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

How to call mixture properties in a UDF

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

Like Tree1Likes
  • 1 Post By Sun

Reply
 
LinkBack Thread Tools Display Modes
Old   November 6, 2017, 16:16
Default How to call mixture properties in a UDF
  #1
Member
 
Refik
Join Date: Dec 2014
Location: Turkey
Posts: 49
Rep Power: 5
rewol is on a distinguished road
Hello,

I have a simple question. I am writing an UDF to calculate MIXTURE viscosity. But i need to call the MIXTURE DENSITY data somehow. Does anyone know how to include MIXTURE PROPERTIES in a UDF as a macro ? ( such as mixture density, mixture specific heat etc. )

Or, perhaps, does C_R(c,t) do exactly that ?

Also is it possible to call species critical properties into an UDF to use in mixture rule combinations ?

Thanks in advance.

Alper
rewol is offline   Reply With Quote

Old   November 8, 2017, 09:48
Default
  #2
Sun
Senior Member
 
Sun's Avatar
 
Join Date: Nov 2010
Posts: 102
Rep Power: 10
Sun is on a distinguished road
Hi,

if you are using
Code:
DEFINE_ADJUST
you get the mixture domain from adjust macro then you need to get the mixture thread and then loop through the cells in the thread. Something like this:
Code:
DEFINE_ADJUST(my_adjust,mixture_domain)
{
cell_t cell;
Thread *m_t; /*mixture thread*/
begin_c_loop_all (cell,m_t)
		{
			C_R(cell,m_t) = your*expression*for*density*goes*here; /* density of mixture */
		}
		end_c_loop_all (cell,m_t)
}
cheers!
Sun is offline   Reply With Quote

Old   November 19, 2017, 11:50
Default
  #3
Member
 
Refik
Join Date: Dec 2014
Location: Turkey
Posts: 49
Rep Power: 5
rewol is on a distinguished road
Quote:
Originally Posted by Sun View Post
Hi,

if you are using
Code:
DEFINE_ADJUST
you get the mixture domain from adjust macro then you need to get the mixture thread and then loop through the cells in the thread. Something like this:
Code:
DEFINE_ADJUST(my_adjust,mixture_domain)
{
cell_t cell;
Thread *m_t; /*mixture thread*/
begin_c_loop_all (cell,m_t)
		{
			C_R(cell,m_t) = your*expression*for*density*goes*here; /* density of mixture */
		}
		end_c_loop_all (cell,m_t)
}
cheers!
Dear Sun,

I am using a real-gas model (not UDF, Redlich Kwong in FLUENT) for mixture density. Isn't there a way to simply call the cell mixture density ? Because with DEFINE_ADJUST, i would calculate a mixture property that is already calculated by FLUENT itself each time.

Am i wrong ?

Same thing also goes for mixture critical temperature, volume and constant volue specific heat too. There is no macro to call them from mixture domain to use directly ?

Best Regards.
rewol is offline   Reply With Quote

Old   November 20, 2017, 09:05
Default
  #4
Sun
Senior Member
 
Sun's Avatar
 
Join Date: Nov 2010
Posts: 102
Rep Power: 10
Sun is on a distinguished road
Hi,

If I understand the question, you can probably export the solution data into any file formats that you'd like. File>Export>Solution data...

Also, take a look at this page.

Cheers!
Sun is offline   Reply With Quote

Old   November 20, 2017, 11:09
Default
  #5
Member
 
Refik
Join Date: Dec 2014
Location: Turkey
Posts: 49
Rep Power: 5
rewol is on a distinguished road
No, exporting data once the solution is converged is not the problem. Problem is as follows :

* I am trying to simulate a real-gas reacting flow and trying to define a composition-dependent MIXTURE VISCOSITY via a UDF . (Chung et al. method)

* In order to do so, i need to obtain MIXTURE DENSITY somehow. Using DEFINE_ADJUST, as you suggested earlier, is an option but FLUENT already calculates the MIXTURE DENSITY by itself when i choose the real-gas model in mixture box.

I am simply trying to obtain the mixture density in each cell, that is calculated by FLUENT, to calculate the MIXTURE VISCOSITY. ( Mixture density is a parameter in the formulation )

I hope it is more clear now.

Can it be helped ?

Best Regards.
rewol is offline   Reply With Quote

Old   November 21, 2017, 04:26
Default
  #6
Sun
Senior Member
 
Sun's Avatar
 
Join Date: Nov 2010
Posts: 102
Rep Power: 10
Sun is on a distinguished road
Have you tried something simple like this:
Code:
DEFINE_PROPERTY(myViscosity,c,t)
{
    real viscosity;
    
    viscosity = 0.0001*C_R(c,t);
    
    return viscosity;		
}
The idea is to see what value you are getting from the C_R(c,t) macro. Isn't it already the mixture density?
soheil_r7 likes this.
Sun is offline   Reply With Quote

Old   December 7, 2017, 14:34
Default
  #7
Member
 
Refik
Join Date: Dec 2014
Location: Turkey
Posts: 49
Rep Power: 5
rewol is on a distinguished road
Hello Sun,

I used C_R(c,t) for mixture density and menage to compile the code successfully after spending a week for editing bugs. I think it will work fine because i double-checked the code with MATLAB to see if the values are in agreement with similar academic papers.

I will share the work once i validete it with an combustion case and share the results.

By the way, is there list for PROP_ values for mixture species ?

PROP_rho, PROP_mu, PROP_ktc and PROP_mwi are provided in the UDF Manual but i think critical properties for mixture species are accessible too.

Regards.
rewol is offline   Reply With Quote

Old   December 8, 2017, 04:09
Default
  #8
Sun
Senior Member
 
Sun's Avatar
 
Join Date: Nov 2010
Posts: 102
Rep Power: 10
Sun is on a distinguished road
Glad to hear that everything worked out fine.
I am not sure if there is list for that. I usually use UDF manual to find out what macro I need. Looking forward to see the results
good luck!
Sun is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
imposing material properties via UDF and JOURNAL files mazdak Fluent UDF and Scheme Programming 1 November 9, 2015 07:05
how to change particle properties using udf? ljp Fluent UDF and Scheme Programming 0 April 2, 2010 10:57
variable composition mixture properties Neser25 CFX 3 February 27, 2007 18:47
defining volume properties via UDF Ralf Schmidt FLUENT 0 July 17, 2006 11:30
2D CFD code using SIMPLE algorithm bfan Main CFD Forum 3 June 22, 2002 23:01


All times are GMT -4. The time now is 00:46.