-
-
June 3, 2020 at 5:33 pm
johnam29
SubscriberBackground: Running water in co-axial channels into a 2-D domain with temperatures varying from sub- to super-critical using Fluent
Since water has a Cp spike for Super critical water ( as attached in the file).
I was looking at trying to model the spike using a UDF with temperature range from 300K to 1000K .I Took data points from the NIST website and generated piece-wise functions for multiple temperature ranges ( as depicted in the code).
While I believe the UDF gets loaded properly into fluent( using interpreted , it loads without showing any error), the residuals of continuity tend to blow up ( --> 1e+10 etc) while the energy residual (1e+0) and i get all sorts of temperature spots in the domain(As depicted in the picture).
CODE:
#include "udf.h"
DEFINE_SPECIFIC_HEAT(john_cp, T, Tref, h, yi)
{
real cp;
if (T >= 523 && T <=600)
cp = 6.84697E+04 + -2.41062E+02*T + 2.28273E-01*T*T;
else if (T>600 && T <= 630)
cp = 6.05982E+05 -2.00334E+03*T +1.67297E+00*T*T;
else if (T>630 && T<= 650)
cp =8.91902E+06 -2.81935E+04*T+ 2.23004E+01*T*T;
else if (T>650 && T <= 658)
cp = 3.34752E+08 -1.02965E+06*T+ 7.91808E+02*T*T;
else if (T>658 && T <= 660)
cp = -1.01330E+08+ 3.22934E+05*T-2.56559E+02*T*T;
else if (T>660 && T <= 668)
cp =2.60837E+08 + -7.81911E+05*T+ 5.86025E+02*T*T;
else if (T>668 && T <= 700)
cp = 4.94026E+06 -1.41350E+04*T+ 1.01250E+01*T*T;
else if (T>700 && T <= 850)
cp = 1.18004E+06 -4.36540E+03*T+ 5.40459E+00*T*T -2.23261E-03*T*T*T;
else
cp = 3000;
*h = cp*(T-Tref);
return cp;
}
I was wondering if anyone has faced such an issue.
p.s: I tried to recreate the Cp plot using the functions in MATLab and it seems to recreate them pretty well.
I have also tried with coarse and fine mesh and it still gives me such plots.
Any help or suggestion would be greatly appreciated.
John MisquithÂ
-
June 3, 2020 at 10:57 pm
Karthik Remella
AdministratorCouple of quick questions:
- does your model run without any issues if you do not use a UDF (and prescribe a constant Cp)?Â
- what is your mesh quality (max skewness or min orthogonal quality)?
-
June 4, 2020 at 6:12 am
johnam29
SubscriberThank you for your reply!
Â
Currently Im using piece-wise polynomials to capture the peak and it works fine without generating any of those spots. Its just that Im not able to accurately capture the highest point and therefore, I want to switch to udfs. Therefore, to answer your qn to the point, Yes it does work well with constant Cp.
i believe my max skewness was around 0.65-0.7 ish. I tried this out with an even finer mesh and it was still giving an issue.Â
Today i ran the simulation by compiling the code instead of using the interpreter and im still getting those temperature spots.
Regards
John
-
June 4, 2020 at 11:57 am
Karthik Remella
AdministratorThis macro works best as a compiled UDF. So, going forward, please compile the code.
It almost seems like the temperature spots are observed because of the jumps in your Cp value. Are you seeing the correct Cp value based on your temperature range?
I have another idea. What if you were to use Fluent Expressions instead of the UDF? You should be able to write out conditional statements using expressions. Since all your Cps are analytical expressions, theoretically, you should be able to write out this expression?
Looking forward to hearing what you find.
Thanks.
Karthik
-
June 11, 2020 at 11:27 pm
johnam29
SubscriberSo with help from someone from CFDOnline, I was able to solve this problem
Â
1. Yes, i switched to using Complied method to get my code loaded into AnSYS fluent accurately.
2. Resolved the 'nmake error' by loading ANSYS fluent from VS Studio v19 terminal prompt
3. replaced the enthalpy formula h = Cp(t - Tref) with the integral of the Cp over the interval T to Tref. ( This was the major change which resulted in the temperature spots to vanish).
Â
RegardsÂ
John Misquith
-
- The topic ‘Divergence using UDF for specific Heat (Fluent)’ is closed to new replies.
- air flow in and out of computer case
- Varying Bond model parameters to mimic soil particle cohesion/stiction
- Eroded Mass due to Erosion of Soil Particles by Fluids
- Centrifugal Fan Analysis for Determination of Characteristic Curve
- Guidance needed for Conjugate Heat Transfer Analysis for a 3s3p Li-ion Battery
- I am doing a corona simulation. But particles are not spreading.
- Issue to compile a UDF in ANSYS Fluent
- JACOBI Convergence Issue in ANSYS AQWA
- affinity not set
- Resuming SAG Mill Simulation with New Particle Batch in Rocky
-
3862
-
1414
-
1220
-
1118
-
1015
© 2025 Copyright ANSYS, Inc. All rights reserved.