-
-
February 28, 2024 at 4:08 pmAnagh DaveSubscriber
Hi everyone ,Â
I am trying to tackle an issue with energy imbalance when I use the specific heat UDF as specified . There doesnt seem to be many issues when I have low eneough Re . However when I enter a region near 1000 inlet Re , the energy imbalance pops up and the continuity residual doesnt go below 1e-5 . I changed the properties of the material in the UDF , however nothing really worked .
I would very much appreciate any help I could get .Â
-
February 28, 2024 at 4:23 pmRobForum Moderator
There's nothing in the code snippet that's linked to the flow variables so what changes in the flow field in that area other than it's a bit more turbulent? I'm also assuming you've got the rest of the code in the UDF, ie the main macro etc.Â
-
February 28, 2024 at 4:31 pm
-
February 28, 2024 at 4:45 pmRobForum Moderator
Is the problem that at higher flows you don't get convergence, or that in regions with higher turbulence you don't think energy is converged?Â
-
February 28, 2024 at 4:51 pmAnagh DaveSubscriber
Umm so just to elaborate, what I did was just apply a flow velocity at the inlet corresponding to Re range from 100 to 1000. Then I just checked to make sure at every velocity for the energy balance through the fluxes tab . The energy residual is always in 1e-7s. It's the continuity residual that does not go down or converge, it flattens out at 1e-5 or relatively earlier to energy.Â
-
February 28, 2024 at 5:01 pmRobForum Moderator
OK, continuity tends not so coverge as far, check the monitors tab for the default values of residual at convergence.Â
As flow increases you may find separation can occur on your turbulators, which may not help convergence. Have a look at the laminar/turbulent lectures in Learning.Â
-
February 28, 2024 at 5:13 pmAnagh DaveSubscriber
Ok , so over all there is turbulence even at lower Reynolds numbers, hence I am not too sure if the boundary layer seperation is the issue. Secondly , I have set everything to 1e-6Â
-
February 28, 2024 at 8:24 pmAnagh DaveSubscriber
I have tried changing the properties and it still is an issue. Could anyone help me around ? I think it may be the format of the Specific heat file?Â
-
February 29, 2024 at 11:34 amRobForum Moderator
You can get laminar separation too. If you manually calculate the various values for cp & h* what do you see? By all means use a UDF to alter properties, but why make the solver calculate the value for every cell when it's a constant?Â
-
February 29, 2024 at 12:27 pmAnagh DaveSubscriber
So the specific heat varies with temperature and it increases up to some higher amount for a small range of temperature which I am interested in seeing . The change occurs as a complex function of temperature (which varies with distance across the channel).
-
February 29, 2024 at 12:57 pmRobForum Moderator
Except in your case it has 3 values based on three temperature ranges. How sudden a jump in value is there?
-
February 29, 2024 at 1:00 pmAnagh DaveSubscriber
It's a large change , and it's gradual . Historically even in literature or research papers , authors have used a UDF to initiate this transition or program the transition of the specific heatÂ
-
February 29, 2024 at 2:54 pmRobForum Moderator
That's not gradual, you have three fixed constant values for three temperature ranges.Â
T
T = constant cp
T>Tl = constant cp
As none of the terms in the cp equations are variables.Â
Â
-
February 29, 2024 at 2:57 pmAnagh DaveSubscriber
Actually the CP value changes with temperature or as a sine curve . The CP is not constant in the middle rangeÂ
-
February 29, 2024 at 3:48 pmRobForum Moderator
That's not what is set in your UDF.Â
-
February 29, 2024 at 3:49 pmRobForum Moderator
Actually, I was wrong, you only have one cp value set using the UDF.Â
-
February 29, 2024 at 3:57 pmAnagh DaveSubscriber
cp = (1-phi)*cp_w + phi*(cp_p + (M_PI/2*(lambda/Mr-cp_p))*sin(M_PI*((T-Ts)/Mr)));
*h= Â (phi*(cp_p)+ (1-phi)*(cp_w))*(Ts-Tref)+(1-phi)*cp_w*(T-Ts) +phi*cp_p*(T-Ts) +phi*(M_PI/2*(lambda/Mr-cp_p))*(Mr/M_PI)*(-(cos(M_PI*((T-Ts)/Mr)) - 1));Â
As you can see , in this part of the UDF , The cp value changes with T , every other part of it is constant .
-
February 29, 2024 at 4:23 pmRobForum Moderator
Where is T defined?
-
February 29, 2024 at 4:27 pmAnagh DaveSubscriber
T is the Temperature taken from the simulation right? T is the varying temperature inside the channel .
-
February 29, 2024 at 4:31 pmRobForum Moderator
Sorry, yes, it's usually pulled from C_T(c,t) rather than passed to the macro.Â
-
February 29, 2024 at 4:33 pmAnagh DaveSubscriber
#include "udf.h"
DEFINE_SPECIFIC_HEAT(my_user_cp, T, Tref, h, yi)
{ Âdouble cp;
double cp_p = 3260;
double cp_w = 4182;
double phi=0.147096431;
double Ts=305;
double Tl=308;
double lambda=251000;
double Mr=Tl-Ts;if (T<=Ts)
{
cp = phi*(cp_p)+ (1-phi)*(cp_w);*h = cp*(T-Tref);
}else if (T>=Tl)
{cp = phi*(cp_p)+ (1-phi)*(cp_w);
*h=(phi*(cp_p)+ (1-phi)*(cp_w))*(Ts-Tref)+(1-phi)*cp_w*(Tl-Ts) +phi*cp_p*(Tl-Ts) +phi*(M_PI/2*(lambda/Mr-cp_p))*(Mr/M_PI)*(-(cos(M_PI*((Tl-Ts)/Mr)) - 1)) + (phi*(cp_p)+ (1-phi)*(cp_w))*(T-Tl);}
elseÂ
{
cp = (1-phi)*cp_w + phi*(cp_p + (M_PI/2*(lambda/Mr-cp_p))*sin(M_PI*((T-Ts)/Mr)));*h= Â (phi*(cp_p)+ (1-phi)*(cp_w))*(Ts-Tref)+(1-phi)*cp_w*(T-Ts) +phi*cp_p*(T-Ts) +phi*(M_PI/2*(lambda/Mr-cp_p))*(Mr/M_PI)*(-(cos(M_PI*((T-Ts)/Mr)) - 1));
}Â
Â
Â
return cp;
ÂThis is how I have defined my UDFÂ
-
February 29, 2024 at 4:43 pmRobForum Moderator
And if you plot contours of cp, do the values look smooth and do they agree with what you're expecting?Â
-
February 29, 2024 at 4:58 pmAnagh DaveSubscriber
They agree to the specified UDFÂ
-
February 29, 2024 at 5:09 pmRobForum Moderator
And values are smooth with well refined gradients? How is the flow over the turbulators?Â
-
February 29, 2024 at 5:18 pmAnagh DaveSubscriber
Temperature and Velocity gradients seem smooth (turbulence wise) . The cp varies as followed, it spikes up at a given distance as the the temperature increases and then decreases gradually. However for higher velocities , it spikes up and remains at that specific heat all the way to the outlet.Â
-
February 29, 2024 at 5:28 pm
-
March 1, 2024 at 9:45 amRobForum Moderator
Does the higher velocity cause separation on the turbulators? Zoom in and look at the velocity vectors.Â
-
March 3, 2024 at 4:19 amAnagh DaveSubscriber
So the continuity residual does not converge. There is a large turbulence in the system, with vortices spreading longitudinally. I believe this energy imbalance behavior may be related to the increased Cp. However I have noticed that this occurs only for higher velocities . However, the flow behavior doesn't seem so different from lower velocitiesÂ
-
March 4, 2024 at 9:20 amRobForum Moderator
Plot the full range of cp out using the equations in the UDF. Now look at the temperature field in your model. If you're seeing separation, are you getting hot spots on the lee of the fins?Â
-
March 8, 2024 at 7:55 pm
-
March 8, 2024 at 8:35 pmAnagh DaveSubscriber
As you can see , there is still an imbalanceÂ
-
March 11, 2024 at 9:59 amRobForum Moderator
2%, so not too bad. How are the near wall mesh, convergence and overall monitor behaviour?Â
-
March 16, 2024 at 5:17 amAnagh DaveSubscriber
I think it is a mesh issue. Currently, I have no inflation layers or any ways to resolve boundary layers. I have tried to including inflation layers, but I haven't been able to do that without reducing the quality of the meshÂ
-
March 18, 2024 at 9:54 amRobForum Moderator
Inflation onto ribs won't be that straightforward. Don't forget to refine in the streamwise direction around the fins too: high aspect ratio cells and separation are not a good combination.Â
-
March 18, 2024 at 2:58 pmAnagh DaveSubscriber
The residuals just flatten out before it reach a good enough convergence of 1e-6 for continuity if I use refinement .
-
March 18, 2024 at 3:14 pmRobForum Moderator
That should be sufficient, general guidance is 1e-6 for energy, 1e-5 for species and 1e-3 for the rest; that should be covered in the training in Learning.Â
-
March 26, 2024 at 7:07 pmAnagh DaveSubscriber
Would it be possible to automate this UDF? i.e make the phi as a variable
-
April 2, 2024 at 9:25 amRobForum Moderator
As in change phi from the GUI? Possible yes; easy, not so much. You're needing to promote values as parameters into Fluent or using Scheme & GUI coding; the former is in the UDF manual, the latter is in the other half of the customisation manual: I don't recommend either unless you're experienced and doing a lot of runs.Â
-
April 2, 2024 at 1:57 pmAnagh DaveSubscriber
Yeah , I do need to do multiple runs in which I change the parameter and also some geometric parametersÂ
-
April 5, 2024 at 3:19 pm
-
April 5, 2024 at 3:35 pmRobForum Moderator
Possibly, and you'll also need to resolve along the wall too.Â
-
April 5, 2024 at 3:40 pm
-
April 5, 2024 at 3:42 pm
-
April 5, 2024 at 3:45 pmAnagh DaveSubscriber
I tried to bias the edges of the ridges or the channel edges , but none of those options worked to form a clean boundary layer meshÂ
-
April 5, 2024 at 3:46 pmRobForum Moderator
There's a pale blue triangle on the clip plane panel, that shows the full cell rather than slicing through it. If you zoom in on 2-3 fins it'll be easier to see too.Â
-
April 5, 2024 at 3:52 pm
-
April 5, 2024 at 4:24 pmAnagh DaveSubscriber
I would like some kind of hexahedral mesh or a controllable tetrahedral mesh for the free mesh in the domain ideally.
-
April 8, 2024 at 8:32 amRobForum Moderator
Yes, and now press the blue triangle icon. A hex mesh may be better (note, may, as opposed to will) and have a look at boundary adaption as that may be a more efficient way to resolve the near wall mesh.Â
-
April 17, 2024 at 7:05 pmAnagh DaveSubscriber
Â
Â
Hi , I think I have solved the mesh issue now . However ,I just had a question about running the mass fraction parameter.  So I executed the commands as specified in the document  and it runs perfectly if I have the fluent window open and just change the parameter value in the workbench. However , it fails to initialise while running in automation unsupervised. Right when it switches to the next design points and undergoes setup changes . I get the error in the solution monitor as ‘ unable to find rpvar’. I have been looking at some solutions however , I havent found one suitable. To expand on this , the simulation will run once I initialise it and if I need to run it again , it fails with the same error . All I have done is parameterise the mass fraction using rp var define command and use the lambda script procedure to assign the value . I have only followed the steps given here https://www.computationalfluiddynamics.com.au/how-can-i-drive-fluent-udf-parameters-directly-from-ansys-workbench/Â
Â
Â
-
April 18, 2024 at 10:30 amRobForum Moderator
LEAP are always very good at publishing solutions - good find.Â
-
April 18, 2024 at 11:26 amAnagh DaveSubscriber
Yes , but it didn't work as you can see. I was wondering if you could provide some insight on thisÂ
-
April 18, 2024 at 1:21 pmRobForum Moderator
Messing with rpvar's isn't generally supported. As mentioned you may want to review setting up models and running sequentially and not use parameters.Â
-
April 18, 2024 at 2:37 pmAnagh DaveSubscriber
Â
That would actually take up a lot of time , for the number of simulations I need to conduct . Would it be possible to use some other technique to help the process?Â
Â
-
April 18, 2024 at 3:18 pmRobForum Moderator
How many of what changes are needed? Your other option is potentially Optislang but that's not something I know much about.Â
-
April 18, 2024 at 3:34 pmAnagh DaveSubscriber
Â
Well I have four parameters sampled through Latin Hypercube Sampling(about 50 data runs). These parameters include geometrical (which are followed by some mesh parameters for example no. of divisions ) , velocity and the mass fraction variableÂ
Â
-
April 18, 2024 at 4:20 pmRobForum Moderator
You may want to look at sets where the UDF is set. That also allows you to run some sets simulataneously. Otherwise Optislang may be your best option.Â
Replacing the UDF with an Expression looked vaguely possible but that seems limited to IF ELSE and not IF IF ELSE. Maybe in the future.Â
-
April 18, 2024 at 4:29 pmAnagh DaveSubscriber
Â
I am not sure if OptiSlang would be the best option , because I am changing the mesh according to the geometrical change . i.e to maintain some element quality and skewness. Therefore some mesh independence as well .
So just to cover the process . every single time I change the geometrical parameters , and initialise the fluent file , the variable fails to do so . However if I dont change anything outside the fluent workspace (i.e Geometry and Mesh) , it does not have a problem running and the variable value is changed seamlessly.
Â
-
April 19, 2024 at 12:27 pmRobForum Moderator
Then you'll need to set the cell sizing based on the geometry. It can be done, but generally isn't because it's not usually necessary.Â
Everything can be done, and can be automated. It's just that in many cases it's excessively complicated and may take longer than doing it manually. I could journal all of my Fluent model set up, but I don't because the GUI makes it easy. I do journal things that might take me a long time or are very repetitive.Â
-
April 19, 2024 at 12:39 pmAnagh DaveSubscriber
I was indeed thinking about using a journal file too for this . However , I don't have any experience in it's implementation.I will explore and try to understand it if there is no other alternative.
-
- The topic ‘Specific heat UDF energy imbalance’ is closed to new replies.
- How do I get my hands on Ansys Rocky DEM
- Non-Intersected faces found for matching interface periodic-walls
- Unburnt Hydrocarbons contour in ANSYS FORTE for sector mesh
- Help: About the expression of turbulent viscosity in Realizable k-e model
- Mass Conservation Issue in Methane Pyrolysis Shock Tube Simulation
- Facing trouble regarding setting up boundary conditions for SOEC Modeling
- Script Error
- convergence issue for transonic flow
- RIBBON WINDOW DISAPPEARED
- Running ANSYS Fluent on a HPC Cluster
-
1762
-
635
-
599
-
591
-
366
© 2025 Copyright ANSYS, Inc. All rights reserved.