CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   How to call mixture properties in a UDF (https://www.cfd-online.com/Forums/fluent-udf/195411-how-call-mixture-properties-udf.html)

rewol November 6, 2017 15:16

How to call mixture properties in a UDF
 
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

Sun November 8, 2017 08:48

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!

rewol November 19, 2017 10:50

Quote:

Originally Posted by Sun (Post 670855)
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.

Sun November 20, 2017 08:05

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!

rewol November 20, 2017 10:09

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.

Sun November 21, 2017 03:26

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?

rewol December 7, 2017 13:34

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.

Sun December 8, 2017 03:09

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!

ashkan0065 May 6, 2021 03:49

same problem
 
Quote:

Originally Posted by rewol (Post 674403)
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

rewol May 6, 2021 04:52

Quote:

Originally Posted by ashkan0065 (Post 803245)
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.

ashkan0065 May 6, 2021 08:29

Udf
 
Quote:

Originally Posted by rewol (Post 803259)
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


All times are GMT -4. The time now is 11:08.