CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > CFX

How to freeze additional variables fields for a number of solver iterations?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By ghorrocks

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 2, 2018, 07:07
Default How to freeze additional variables fields for a number of solver iterations?
  #1
Senior Member
 
Join Date: Feb 2011
Posts: 496
Rep Power: 18
Antanas is on a distinguished road
Hello guys!

As you all know CFX allows users to create additional variables and solve transport or algebraic equations for them. It does it on every single iteration just after solution of hydrodynamic system. I want to force solver to recalculate additional variables fields on every n-th iteration, i.e. I want to freeze their fields for a number of iterations, then recalculate and freeze again and so forth.
The problem is simple - I can't find a way to do so

Maybe someone knows solution or has an idea?
Antanas is offline   Reply With Quote

Old   March 2, 2018, 07:32
Default
  #2
Senior Member
 
Join Date: Jun 2009
Posts: 1,806
Rep Power: 32
Opaque will become famous soon enough
If you are willing to stop/start the software every n-th iteration, you can use the expert parameter "solve scalar = t/f" between iterations.

May I ask why you want to freeze the solution of the scalars? Are you looking to speed up the calculation, or to converge a highly non-linear interaction?
Opaque is offline   Reply With Quote

Old   March 2, 2018, 08:10
Default
  #3
Senior Member
 
Join Date: Feb 2011
Posts: 496
Rep Power: 18
Antanas is on a distinguished road
Quote:
Originally Posted by Opaque View Post
If you are willing to stop/start the software every n-th iteration, you can use the expert parameter "solve scalar = t/f" between iterations.
No, I'm not insane

Quote:
Originally Posted by Opaque View Post
Are you looking to speed up the calculation, or to converge a highly non-linear interaction?
The second.
Antanas is offline   Reply With Quote

Old   March 2, 2018, 09:00
Default
  #4
Senior Member
 
Join Date: Jun 2009
Posts: 1,806
Rep Power: 32
Opaque will become famous soon enough
Would you mind showing some of the non-linearities in your problems ?

Is the case steady-state? Perhaps under-relaxing the scalar changes, their influence propagates slower and you may obtain better robustness.
Opaque is offline   Reply With Quote

Old   March 2, 2018, 09:42
Default
  #5
Senior Member
 
Join Date: Feb 2011
Posts: 496
Rep Power: 18
Antanas is on a distinguished road
Quote:
Originally Posted by Opaque View Post
Would you mind showing some of the non-linearities in your problems ?

Is the case steady-state? Perhaps under-relaxing the scalar changes, their influence propagates slower and you may obtain better robustness.
Well... I simulate steady-state MHD flow with steady electromagnetic model (but in contrast with built-in model my potential equation contains additional term which depends on current density). Actially I think that maybe my problem is in something else, because I can get convergence for inviscid flow case (dynamic viscosity and thermal conductivity = 1e-20, laminar flow option, free slip adiabatic walls), but when I setup viscous flow the solution diverges. Maybe it due to cold thermal boundary layer in which electrical conductivity may become low and some crazy things happen.

Anyway I would like to try technique that I metioned if it feasible.

Last edited by Antanas; March 3, 2018 at 09:37.
Antanas is offline   Reply With Quote

Old   March 2, 2018, 19:16
Default
  #6
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,709
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
The more normal approach to deal with this is to reduce the under-relaxation parameter on the offending equation. But your last comment suggests it could be more on the fluid side than your additional variables.

I trust you have done all the normal things: smaller time steps, double precision numerics, better initial conditions, improved mesh quality
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   March 3, 2018, 09:35
Default
  #7
Senior Member
 
Join Date: Feb 2011
Posts: 496
Rep Power: 18
Antanas is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
The more normal approach to deal with this is to reduce the under-relaxation parameter on the offending equation. But your last comment suggests it could be more on the fluid side than your additional variables.
I'll try to play with URF.

Quote:
Originally Posted by ghorrocks View Post
I trust you have done all the normal things: smaller time steps, double precision numerics, better initial conditions, improved mesh quality
You're absolutely right.

Last edited by Antanas; March 7, 2018 at 16:27.
Antanas is offline   Reply With Quote

Old   March 7, 2018, 16:27
Default
  #8
Senior Member
 
Join Date: Feb 2011
Posts: 496
Rep Power: 18
Antanas is on a distinguished road
UPD. Ok, guys. URF did nothing for me. The problematic region is near the wall in a place where electromagnetic boundary conditions change from prescribed constant voltage to insulation. I think that in reality there is something like an electrical breakdown there. Therefore simulation gives some crazy values of currend density there and as a consequence of Lorenz force and Joule heating. Seems like CFX can't handle it. So I introduced limitation on this two quantities by truncating their values which 10 (number without justification) times higher than their volume averages in domain. Solution converged. Also solution converges without this limitations if I use Zero Equation turbulance model instead of k-e or SST.
Antanas is offline   Reply With Quote

Old   March 7, 2018, 16:35
Default
  #9
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,709
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
It is not uncommon to have to put artificial limiters in when you have very sharply resolved physics. A good thing to do to check you are not affecting accuracy is to do a sensitivity analysis on the limiting value. Check that a limiter of 10 and 100 makes no difference to the simulation result and you can have some confidence that your limiter is not artificially affecting the results.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   March 8, 2018, 04:44
Default
  #10
Senior Member
 
Join Date: Feb 2011
Posts: 496
Rep Power: 18
Antanas is on a distinguished road
Quote:
Originally Posted by ghorrocks View Post
It is not uncommon to have to put artificial limiters in when you have very sharply resolved physics. A good thing to do to check you are not affecting accuracy is to do a sensitivity analysis on the limiting value. Check that a limiter of 10 and 100 makes no difference to the simulation result and you can have some confidence that your limiter is not artificially affecting the results.
Yes, Glenn, this is exactly what I was going to do next.
Antanas is offline   Reply With Quote

Old   March 8, 2018, 05:27
Default
  #11
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,832
Rep Power: 27
Gert-Jan will become famous soon enough
I have a piece of Fortran that allows you to skip certain equations for a while in a transient calculation. Also it allows you to change the timestep when equations are skipped. So you can make it very large or very small, depending on your problem. I used it in a case where I skipped mass and momentum every 2 timesteps, while energy was solved using a large timestep. Interested? Send me a PM.

It is from 2006, not sure if it still works.......
Gert-Jan is offline   Reply With Quote

Old   April 20, 2023, 10:58
Default
  #12
New Member
 
Jianfeng
Join Date: Apr 2021
Posts: 11
Rep Power: 5
jennyjian is on a distinguished road
Hi Gert, could you please show me the Fortran code since I need to freeze one variable field to make the solver stable, thanks a lot!
jennyjian is offline   Reply With Quote

Old   April 20, 2023, 19:03
Default
  #13
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,709
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Don't forget that you can turn on and off equations with expert parameters. If that is what you want to do then that is much easier than fortran.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   April 25, 2023, 12:29
Default
  #14
Senior Member
 
Join Date: Jun 2009
Posts: 1,806
Rep Power: 32
Opaque will become famous soon enough
Quote:
Originally Posted by jennyjian View Post
Hi Gert, could you please show me the Fortran code since I need to freeze one variable field to make the solver stable, thanks a lot!
Would you mind explaining your model? and why do you think that freezing an equation is going to help?

There are plenty of ways to improve the robustness of the solution algorithm, and freezing the equations is very low on my list. In particular, if the equation has an indirect influence on the density
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
Opaque is offline   Reply With Quote

Old   April 25, 2023, 13:08
Default
  #15
New Member
 
Jianfeng
Join Date: Apr 2021
Posts: 11
Rep Power: 5
jennyjian is on a distinguished road
Hi Opaque:

I am working on a chain reaction simulation in CFX. The model is like a gas transfer from the membrane to the blood side process. Thinking that high concentration oxygen from the membrane side enter the blood plasma through diffusion and then convects. Later the plasma gas enter the red blood cells to combine with the hemoglobin by Henry's law. So there are two species : plasma oxygen and hemoglobin oxygen. The source terms of their transport equation are coupled. In simulation, two species concentrations are changing so the source term changes a lot. I want to use something like the segregated solver to freeze one field first to make the other field converge. Because the source terms are kind of large and CFX doesn't support implicit source treatment, so my case always diverged even using the upwind scheme.
jennyjian is offline   Reply With Quote

Old   April 25, 2023, 18:35
Default
  #16
Super Moderator
 
Glenn Horrocks
Join Date: Mar 2009
Location: Sydney, Australia
Posts: 17,709
Rep Power: 143
ghorrocks is just really niceghorrocks is just really niceghorrocks is just really niceghorrocks is just really nice
Freezing one variable is not a very effective way to get a coupled set of variables to converge.

The normal way of getting tricky things to converge is described in this FAQ: https://www.cfd-online.com/Wiki/Ansy...gence_criteria
Opaque likes this.
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
ghorrocks is offline   Reply With Quote

Old   April 26, 2023, 01:34
Default
  #17
Senior Member
 
Gert-Jan
Join Date: Oct 2012
Location: Europe
Posts: 1,832
Rep Power: 27
Gert-Jan will become famous soon enough
The provided fortran is to freeze fluids and to solve energy and/or scalars with a larger timestep, in a transient calculation. Just to reduce calculation time. This worked pretty well for specific situation after tedious comparison of results with and without Fortran.
In your case it won't work since you can only turn of and on groups of equations, and not specific concentrations/massfractions. But I already told you in our PM.
Better investigate if Fluent can help here of some other ANSYS tools for chemical reactions.
Gert-Jan is offline   Reply With Quote

Old   April 26, 2023, 03:06
Default
  #18
New Member
 
Jianfeng
Join Date: Apr 2021
Posts: 11
Rep Power: 5
jennyjian is on a distinguished road
Thank you all so much, I will check the posts. I tried to use the Fluent but the multiphase flow field results have large discrepancies compared to the experiment. But CFX results are fine. So maybe I will try to use CFX for a while to see if this problem can be solved. Actually, I saw a post saying that I can construct a numerical fiction source that as the results are closer to the equilibrium, it converges to zero. If I find a way to solve it, I will post again!
jennyjian is offline   Reply With Quote

Old   April 26, 2023, 11:29
Default
  #19
Senior Member
 
Join Date: Jun 2009
Posts: 1,806
Rep Power: 32
Opaque will become famous soon enough
For multi-component "reacting flow", the source terms are coupled as you have mentioned. Not certain if you have set up the problem using the Ansys CFX approach for reacting flows, or manually set the source/sink terms and linearized them yourself.

For your 2 species model, the source term linearization (Jacobian) contributions are represented by a 2x2 matrix block. Since the equations are solved in a segregated manner, the off-diagonal coefficients are being ignored and that could lead to some additional robustness issues that must be compensated elsewhere in the solution algorithm.

If you set up the case manually, you can increase the Source Coefficient of the sources to account for the missing linearization, and slow down the influence of the new source on the equations, i.e. implicit source relaxation.

If the sources are handled internally (using the Ansys CFX reacting flow approach), you can create a subdomain with a Source = 0, but a non-zero Source Coefficient to further linearized the species equation (that is what you referred previously)
__________________
Note: I do not answer CFD questions by PM. CFD questions should be posted on the forum.
Opaque 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
Free surface issues with interDyMFoam for hydroturbine oumnion OpenFOAM Running, Solving & CFD 0 October 6, 2017 14:05
should Courant number always be kept below 1? wc34071209 OpenFOAM Running, Solving & CFD 16 March 9, 2014 19:31
SLTS+rhoPisoFoam: what is rDeltaT??? nileshjrane OpenFOAM Running, Solving & CFD 4 February 25, 2013 04:13
pisoFoam with k-epsilon turb blows up - Some questions Heroic OpenFOAM Running, Solving & CFD 26 December 17, 2012 03:34
Orifice Plate with a fully developed flow - Problems with convergence jonmec OpenFOAM Running, Solving & CFD 3 July 28, 2011 05:24


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