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/)
-   -   Problem with using User Define Real Gas Model (UDRGM) (https://www.cfd-online.com/Forums/fluent-udf/233143-problem-using-user-define-real-gas-model-udrgm.html)

Amirreza_pro January 14, 2021 18:54

Problem with using User Define Real Gas Model (UDRGM)
 
2 Attachment(s)
Hi guys.
We are using our data for a simulation in Fluent.
Our Data are for:
1- Cp
2- Viscosity
3- Lambda
4- Density
As you know, The user-defined real gas model (UDRGM) has been developed to allow you to write your own custom real gas model to fit your particular modeling needs.
The point is that, when we use our data for
1- Cp
2- Viscosity
3- Lambda
and we use this formulation for density according to Redlich-Kwong Equation of State for Real Gas Modeling:

we do not have any problem and our solution will converge.
But when we use our data for density and use this:
double Air_density(cell_t cell, Thread *thread, cxboolean vapor_phase, double temp, double density, double press, double yi[])
{
real mix = 0;
return CalcGasAblation(&rhoA, &rhoB, &rhoC, &rhoD, &rhoMixPoints, &rhoPressPoints, &rhoTempPoints, rhoNumMixPoints, rhoNumPressPoints, rhoNumTempPoints, mix, Air_pressure(temp, density), temp, rhoEquidistant);

In this case we are using interpolation function for our data of density.
the solution would diverge as you see in this picture
[IMG]https://i.ibb.co/Ntj08Rf/Screenshot-306.png[/IMG]


That means we only can not use our data for density (our interpolation function for density).

In attachment you can find codes for converged and diverged codes.
our data for density you can download with this link:
https://we.tl/t-aSC30jrbtP

Can someone please help me and say where is the problem? I really stuck in this problem.
Thanks in advance

AlexanderZ January 15, 2021 01:33

so looks like problem is inside interpolation function
I think, you should check carefully values, which your interpolation function generates

also the difference between 2 codes are in value type you are applying for density
in convergence case it is double
non-convergence - real

however, real is double if you are running fluent in double precision regime.

check carefully, what could happen if your input values for interpolation function are out of borders, cause fluent may extrapolate there

Amirreza_pro January 15, 2021 02:22

Quote:

Originally Posted by AlexanderZ (Post 793374)
so looks like problem is inside interpolation function
I think, you should check carefully values, which your interpolation function generates

also the difference between 2 codes are in value type you are applying for density
in convergence case it is double
non-convergence - real

however, real is double if you are running fluent in double precision regime.

check carefully, what could happen if your input values for interpolation function are out of borders, cause fluent may extrapolate there

Thanks alot dear Alexander.
Yes i did not care about this real and double definition. I will correct it.
Just one more question, you said:
Mybe ''the input values for interpolation function are out of borders''
How can I check it? Can you explain it more.
Again thanks alot for your help.

AlexanderZ January 15, 2021 03:07

I didn't go deep into your code
it could be a case where you've defined density for temperature range from 300 to 3000K, but which value will be applied for 290, 250 K ?

that is what I was trying t say

Amirreza_pro January 15, 2021 03:40

Quote:

Originally Posted by AlexanderZ (Post 793379)
I didn't go deep into your code
it could be a case where you've defined density for temperature range from 300 to 3000K, but what value will be applied for 290, 250 K ?

that is what I was trying t say

OK, I got it.
Thanks alot.

根瘤囧 June 26, 2021 08:57

Your article about UDRGM was very helpful for me, but it is uneasy to understand via the table files are unknown. Therefore, I sinerely hope you can sent the table files to me. Thank you very much.
Address:384117102@qq.com

根瘤囧 July 1, 2021 21:57

I studied the UDRGM carefully these days and I found that the reason why your code for density did not work.
double Air_density(cell_t cell, Thread *thread, cxboolean vapor_phase, double temp, double density, double press, double yi[])
{
real mix = 0;
return CalcGasAblation(&rhoA, &rhoB, &rhoC, &rhoD, &rhoMixPoints, &rhoPressPoints, &rhoTempPoints, rhoNumMixPoints, rhoNumPressPoints, rhoNumTempPoints, mix, 101325, temp, rhoEquidistant);
}
I think you should get rid of the "double density" in parentheses.


All times are GMT -4. The time now is 05:17.