CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Gas Model Change (Hypersonic)

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 30, 2020, 16:14
Default Gas Model Change (Hypersonic)
  #1
Member
 
Cpt. Convergence
Join Date: Feb 2020
Posts: 98
Rep Power: 8
Captain Convergence is on a distinguished road
Hi all! Iīm having issues right with switching the gas-model. I have attached 3 screenshots so you can observe the problem. The first one is my "initialization" which is the ideal-gas solution.

As soon as I switch the gas model, the residuals jump sudently and the simulation does not diverge because I have set pressure and temperature limits based on the ideal-gas solution (assuming that the flow field will not change dramatically with the real gas model), and the residuals keep almost constant through the iterations, they donīt converge. The Mach number contour after 1 single iteration looks very scattered, I had to clip the contour for Mach number between 0 and 10 because at the inlet the Mach number increased up to Mach 630. I have been trying many solver configurations to continue the calculations from the ideal-gas solution (i.e. explicit/implicit modes, multigrid levels, low Courant and Under-relaxation factors...) but none of them seem to work properly. Does anyone know any efficient way to perform this sudden gas-model change?
Attached Images
File Type: jpg InitialSolution.jpg (43.3 KB, 16 views)
File Type: jpg MachNumberContours.jpg (71.0 KB, 15 views)
File Type: png Residuals.PNG (24.3 KB, 9 views)
Captain Convergence is offline   Reply With Quote

Old   March 31, 2020, 15:21
Default Density Difference
  #2
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Did you observe density difference when changed from Ideal to Real? If this is significant, use a very very low, around 0.01, URF for density.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 1, 2020, 05:03
Default
  #3
Member
 
Cpt. Convergence
Join Date: Feb 2020
Posts: 98
Rep Power: 8
Captain Convergence is on a distinguished road
Hello Vinerm
Captain Convergence is offline   Reply With Quote

Old   April 1, 2020, 05:06
Default
  #4
Member
 
Cpt. Convergence
Join Date: Feb 2020
Posts: 98
Rep Power: 8
Captain Convergence is on a distinguished road
Hello Vinerm

I am having the same issue with the UDRGM with ideal-gas formulation available at ANSYS Fluent help guide (https://ansyshelp.ansys.com/account/...ned%20real-gas), so there shouldnīt be any significant changes in density (I have attached the ideal UDRGM so you donīt have to look for it). Therefore I believe that there is an issue when I switch the gas formulation that I donīt know how to solve.

I have attached a screenshot of my resiuduals and the final contour with this ideal gas formulation. When I switch the formulation, the residuals jump and they remain constant through all the iterations.
Attached Images
File Type: png Residuals_Ideal.PNG (29.2 KB, 3 views)
File Type: jpg Contour_Ideal.jpg (55.6 KB, 4 views)
Attached Files
File Type: c UDRGM_IDEAL.c (5.0 KB, 3 views)
Captain Convergence is offline   Reply With Quote

Old   April 1, 2020, 05:20
Default Udrgm
  #5
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
If ideal gas is replicated truly by this UDRGM, then you should be able to start from initialization and get convergence. Is that doable?
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 1, 2020, 06:10
Default
  #6
Member
 
Cpt. Convergence
Join Date: Feb 2020
Posts: 98
Rep Power: 8
Captain Convergence is on a distinguished road
I tried to perform a FMG initialization with the Ideal UDRGM but I had the error that I have attached as screenshot. If I am using the same density function as Fluent's ideal gas funtion (rho = press / (RGAS * Temp)) I cannot understand why the user-defined ideal-gas model is giving me these issues. I will try to create UDF for density and see what happens.

Another thing that worries me, why is Fluent working so slow with such simple UDRGM? Almost all the fields are constant but it takes ages to iterate.
Attached Images
File Type: png initialization_error.PNG (25.4 KB, 3 views)
Captain Convergence is offline   Reply With Quote

Old   April 1, 2020, 06:20
Default Initialization
  #7
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Do not use FMG initialization with UDRGM. Use standard or hybrid. UDRGM is slow because it has to calculate a lot of UDFs for each cell in the domain.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 4, 2020, 06:30
Default
  #8
Member
 
Cpt. Convergence
Join Date: Feb 2020
Posts: 98
Rep Power: 8
Captain Convergence is on a distinguished road
My intention is to reach an ideal-gas solution using fmg-initialization and then switch to real-gas model and continue iterating.

These days I have been trying different things and I think that I found the source of the problem. I tried to simulate a simple flow channel (see the attached image) with velocity inlet at 0.1 m/s and 300 Kelvin simulated at ambient pressure (101325 Pa). So no flow issues should arise due to the flow condition.

I simulated the case with 1) fluent ideal-gas formulation, with 2) FLUENT UDRGM Example: Ideal Gas Equation of State (https://ansyshelp.ansys.com/account/...ned%20real-gas) and with 3) my own UDRGM. When using a UDRGM my solver becomes completely unstable and this leads me to think that I might be having compiling issues or truncation errors. I tried to use "double" and "real" variables format but they didnīt seem to work properly. For compiling my UDRGM I am using Visual Studio Community Version 2019 and I am calling Fluent through "Cross Tools Command Prompt for VS 2019".

The aforementioned try was with a density-based solver but when I try a pressure-based solver, it directly diverges and I get the "floating point exception" which means that there is an impossible calculation attempt (i.e. dividing by zero). This reinforces even more my theory that there is something wrong with passing information between my UDRGM and the Fluent solver.

Is there any preferred UDF compiler for Fluent?
Attached Images
File Type: jpg Simple_LowSpeed_Case.jpg (59.9 KB, 3 views)
Attached Files
File Type: c UDRGM_IDEAL.c (5.0 KB, 3 views)

Last edited by Captain Convergence; April 4, 2020 at 12:44.
Captain Convergence is offline   Reply With Quote

Old   April 6, 2020, 04:47
Default Setup
  #9
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
There must be something wrong with your case setup. I used the same UDF and simulated a case with standard initialization. It works as expected. Mach number was slightly more than 4 for this case. Domain, pressure, and density contours are attached.
Attached Images
File Type: png cyl2d.png (32.7 KB, 4 views)
File Type: png pre.png (10.3 KB, 5 views)
File Type: png den.png (10.6 KB, 4 views)
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 6, 2020, 06:42
Default
  #10
Member
 
Cpt. Convergence
Join Date: Feb 2020
Posts: 98
Rep Power: 8
Captain Convergence is on a distinguished road
Hello Vinern,

Are you using Visual Studio for compiling the UDRGM? Or have you integrated a C compiler in Fluent?

I will try to do the case again from scratch and see if something was wrong in my set up, I really doubt it since I have checked everything a thousand times.

Thank you again!
Captain Convergence is offline   Reply With Quote

Old   April 6, 2020, 06:47
Default Compiler
  #11
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Yes, I used VS.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 6, 2020, 10:35
Default
  #12
Member
 
Cpt. Convergence
Join Date: Feb 2020
Posts: 98
Rep Power: 8
Captain Convergence is on a distinguished road
So I did again my case and depending on which gas model (ideal or ideal UDRGM) I use for the simulation the solution looks completely different. Does Fluent change the way the flow variables (like temperature and pressure) are calculated in a density-based loop when using a UDRGM?

I am pointing this because I set a total temperature of 922 K (which at Mach 9.6 it should lead to a static temperature of 47 Kelvin assuming ideal gas) but the solution tends to 808 Kelvin in the flow field and a Mach of less than 1.5. Both models provide the same density, Cp and enthalpy values but they donīt seem to work in the same way with the same boundary conditions.
Captain Convergence is offline   Reply With Quote

Old   April 6, 2020, 10:37
Default Boundary Condition
  #13
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Which boundary condition are you using?
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 6, 2020, 10:57
Default
  #14
Member
 
Cpt. Convergence
Join Date: Feb 2020
Posts: 98
Rep Power: 8
Captain Convergence is on a distinguished road
I have attached a scheme with my computational domain and BCs

Pressure-intlet, Total Pressure = 4,10E+06 Pa, Supersonic/Initial Gauge Pressure = 127 (the same as the outlet static pressure) and Total Temperature = 922 Kelvin.
Pressure-outlet, Gauge Pressure/Static Pressure = 127 Pa and Total Temperature = 922 Kelvin.
Operating Pressure, 0 Pa.

When I apply them with the ideal-gas density formulation available in Fluent I get the inviscid ideal-gas solution that I want (see the attached images). However It doesnīt seem to work in the same way when using a UDRGM
Attached Images
File Type: png BCs_Scheme.PNG (44.3 KB, 4 views)
File Type: jpeg TOP.jpeg (41.7 KB, 3 views)
File Type: jpeg SIDE.jpeg (38.4 KB, 3 views)
Captain Convergence is offline   Reply With Quote

Old   April 6, 2020, 11:02
Default Udrgm
  #15
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
What do you get with UDRGM?
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   April 6, 2020, 12:37
Default
  #16
Member
 
Cpt. Convergence
Join Date: Feb 2020
Posts: 98
Rep Power: 8
Captain Convergence is on a distinguished road
For that case I didnīt make it with the UDRGM.

For testing my gas models I am simulating an empty channel with the same BCs. I can make the Fluent ideal-gas model (see "Fluent_air_model.PNG") and the ideal UDRGM work when I initialize the case with standard initialization (it diverges when I use the hybrid initialization because it predicts a too low initial velocity), the final solution looks as image "ideal-gas-channel.jpg" for both models. However for my UDRGM that takes into account ionization and dissociation, the calculation of properties within the solver loop is unstable because unphysical values appear (see image "Limits.PNG ") and they cause the solver to stall after 1 single iteration. I guess that this unphysical values appear because the properties are obtained through interpolation so if the solver goes out of the range, the resulting value has a terrific error, I will try to set limits within the UDRGM because it seems that the limits declared in solution controls are not working inside the UDRGM.
Attached Images
File Type: png Fluent_air_model.PNG (22.5 KB, 3 views)
File Type: jpg ideal-gas-channel.jpg (39.6 KB, 5 views)
File Type: png Limits.PNG (16.7 KB, 5 views)
Captain Convergence 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
Setting the height of the stream in the free channel kevinmccartin CFX 12 October 13, 2022 21:43
Transient Phase Change Model: Explodes at low vapor quality evcelica CFX 0 August 28, 2018 10:55
How to run perfect gas model for r134a from refprop NozzleNoobie FLUENT 1 October 12, 2017 02:16
Wrong flow in ratating domain problem Sanyo CFX 17 August 15, 2015 06:20
Ideal vs constant gas model chris12345 STAR-CCM+ 1 January 2, 2013 06:49


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