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 Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Sun
  • 1 Post By rewol

Reply
 
LinkBack Thread Tools Search this Thread 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: 58
Rep Power: 11
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: 103
Rep Power: 16
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: 58
Rep Power: 11
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: 103
Rep Power: 16
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: 58
Rep Power: 11
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: 103
Rep Power: 16
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: 58
Rep Power: 11
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.
ashkan0065 likes this.
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: 103
Rep Power: 16
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

Old   May 6, 2021, 04:49
Default same problem
  #9
New Member
 
ashkan
Join Date: Oct 2020
Posts: 17
Rep Power: 6
ashkan0065 is on a distinguished road
Quote:
Originally Posted by rewol View Post
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.


Hello dear Refik
I have the same problem and i cant find pure and mixture density function for UDF. would you please help me?
thank you so much
ashkan0065 is offline   Reply With Quote

Old   May 6, 2021, 05:52
Default
  #10
Member
 
Refik
Join Date: Dec 2014
Location: Turkey
Posts: 58
Rep Power: 11
rewol is on a distinguished road
Quote:
Originally Posted by ashkan0065 View Post
Hello dear Refik
I have the same problem and i cant find pure and mixture density function for UDF. would you please help me?
thank you so much

Well C_R indeed returns the mixture density as explained earlier.

I assume by "pure" you mean species-density, for which you'll have to formulate a UDF.
But i reckon you have very little use for species-density if you are working with turbulent flow.
rewol is offline   Reply With Quote

Old   May 6, 2021, 09:29
Default Udf
  #11
New Member
 
ashkan
Join Date: Oct 2020
Posts: 17
Rep Power: 6
ashkan0065 is on a distinguished road
Quote:
Originally Posted by rewol View Post
Well C_R indeed returns the mixture density as explained earlier.

I assume by "pure" you mean species-density, for which you'll have to formulate a UDF.
But i reckon you have very little use for species-density if you are working with turbulent flow.
Thanks so much.
Would you please let me see your UDF ? Because i want to calculate mixture gas viscosity like you.
Best regards
ashkan0065 is offline   Reply With Quote

Reply


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
variable composition mixture properties Neser25 CFX 6 August 17, 2020 15:19
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
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 18:29.