Community
CFD Forum
Welcome to Autodesk’s CFD Forums. Share your knowledge, ask questions, and explore popular CFD topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Remedies for divergence

16 REPLIES 16
Reply
Message 1 of 17
OmkarJ
1186 Views, 16 Replies

Remedies for divergence

Hello

 

I generally use surface resistances in pipes and always prefer RNG turbulence model (accuracy) and Advection 5 discretization scheme (less diffusion, more accurate). I often create queues of simulations and submit them at once for running. But since the ADV5 and RNG are less stable, I often encounter divergence. Ideally, I would like to keep first 500 iterations using k-epsilon turbulence model (robust than RNG) and ADV1 (upwind with numerical diffusion to aid in convergence), and then automatically change to RNG and ADV5 till say 1500 iterations.

 

Questions are:

 

#1. Is there any way in SimCFD to run first few iterations using k-epsilon/ADV1 and then to change automatically to RNG/ADV5?

 

#2. How appropriate this approach would be, as compared to running simulations using RNG/ADV5 for all iterations?

 

Cheers

 

Omkar Joshi

Vee Bee Filtrations Ltd.

 

16 REPLIES 16
Message 2 of 17
apolo_vanderberg
in reply to: OmkarJ

Omkar,

    Staging an analysis k-e and then RNG is perfectly acceptable and at times beneficial (stability as you mentioned, and in some cases the k-e run will give you a good indication of where you're at before running the RNG segment for final iteration set).

 

For Automatically switching between them the only method would be to build a Python Script to do this.

When you run RNG/ADV5 what and how does the divergence come about?

 

If the instability is early in the analysis, you might be able to set the Automatic Startup (under Turbulence dialog) to Extend, and perhaps change the Turb/Lam ratio to a higher value (1000).

 

Apolo

Message 3 of 17
OmkarJ
in reply to: apolo_vanderberg

Hello Apollo, thanks for a quick response. You raised some interesting points.

 

With RNG/ADV5, I have a divergence rate of upto 50% in the simulations I am doing! Over that, sometimes the simulations get "corrupted."  I assume that going easy with eddy viscosity/k-e turbulence models  with ADV1 for initial iterations of solution should give robustness, hence this post.

 

I understand that Python scripting here is equivalent to C scripted journal files in Fluent or Perl scripts in CFX. I have some exposure to C and Fortran but never touched Python. Can you provide me some templates/scripts that will help me understand the syntax I need to use here? For now, I would use them just to automate the selection of turbulence models and discretization schemes.

 

Lastly, can you elaborate on how increasing turb/lam ratio to 1000 will be benefitial here? The flow doesn't seem to be dominated by turbulence/momentum here as it's potentially a porus resistance I am modelling.

 

Regards

OJ

 

 

Message 4 of 17
apolo_vanderberg
in reply to: OmkarJ

Omkar,

    First, as I mentioned, extending the startup for Turbulence can help out in some situations as we gradually ramp in the TKE and TED computations.

 

If the divergence is early in the analysis (during some of the ramp up stages for TKE and TED), the increased Turb/Lam ratio will help stabilize the solution until Turbulence is fully ramped in.

 

We typically dont change the value too much but stepping up from 100 to 1000 should be able to help in some situations.

 

Apolo

Message 5 of 17
OmkarJ
in reply to: apolo_vanderberg

Apollo,

 

I will try with "Extend" for the simulations that are diverging. Most of the divergence instances I have noticed occur long after TKE and TED step in the solution march, so I doubt Turb/Lam ratio of 1000 would be of much benefit, yet I will try that.

 

Extending my earlier point, I would like to have more control on how Solver handles the simulations, as this would let me use approaches that are suited for the type of simulations I work on. Would it be possible for you to suggest me a Python script that works as per the following process flow?

 

+-----------------------------------------------
For scenario 1
- Turbulence model : k-epsilon
- Advection scheme : ADV1
- Intelligence control: enable
- Start from iterations : 0
- Run upto iterations : 800
- Start solving
- Stop solving
- Change turbulence model to : RNG
- Change advection scheme to: ADV5
- Intelligence control : disable
- Factors under manual control for pressure, velocity, turbulence : 0.4
- Run from iterations : s800
- Run upto iterations : 1500
- Start solving
- Stop solving
 
For scenario 2
..
..
..
etc.
------------------------------------------------+

I have observed that k-e/ADV1 startup works well for my simulatiosns and perhaps would bring down divergence rate significantly if I choose above process-flow automated with a script.

 

Cheers

Omkar.

 

Message 6 of 17
apolo_vanderberg
in reply to: OmkarJ

Omkar,

   There are some sample items within the Help that can outline some of the Python commands, however we do not have a script that is set for doing as you requrie. That would be something that you would need to code yourself. If you look at some of the guidelines you can find pieces that you can put together that might get you close.

 

Considering you're already relaxing Velocity and Pressure, have you tried that from the beginning with ADV5/RNG

 

Note, when we turn off Solution Control to make modifications, once we adjust the sliders, we will turn ON Solution Control again. It will use the values set even though it goes greyed out.

 

Apolo

Message 7 of 17
OmkarJ
in reply to: apolo_vanderberg

Apollo

 

I tried with RNG/ADV5 from the beginning and the divergence rate is upto 40%. Hence all this fuss!

 

Meanwhile, I tried a Python script and is given below.

Can you let ne know if this is enough or I can add some more instructions to it to make it more robust?

 

+--------------------------------------------------------------------------------

#setup the scenario
from CFD import Setup
study = Setup.DesignStudy.Create()
scenario = study.getActiveScenario()

#setup the basic model
scenario.setProperty("solverComputer", "MyComputer")
scenario.setProperty("flow", "On")
scenario.setProperty("analysisMode", "Steady State")
scenario.setProperty("autoStartup", "Extend")
scenario.setProperty("turbulence", "On")
scenario.setProperty("autoStartup", "On")

#run with k-epsilon/ADV1
scenario.setProperty("intelligentSolutionControl", "On")
scenario.setProperty("turbModel", "k-epsilon")
scenario.setProperty("advectionScheme", "ADV 1")
scenario.setProperty("continueFrom", "0")
scenario.setProperty("iterations",20)
scenario.run()

#run with RNG/ADV5
scenario.setProperty("intelligentSolutionControl", "Off")
scenario.setProperty("turbModel", "RNG")
scenario.setProperty("advectionScheme", "ADV 5")
scenario.setProperty("iterations", 20)
scenario.run()

---------------------------------------------------------------------------------+

 

Let me know what you think.

 

Cheers

OJ

Message 8 of 17
apolo_vanderberg
in reply to: OmkarJ

Omkar,

    I ask as you mention in the previous post that you have Solution Control disabled.

Have you specifically run with ADV5/RNG, Velocity and Pressure set to ~0.4, and Solution Control turned ON?

 

Apolo

Message 9 of 17
OmkarJ
in reply to: apolo_vanderberg

Apollo,

 

Sorry for missing on that point.

 

Yes, I generally disable intelligent solution control and put pressure/velocity/turbulence under relaxation factors to 0.4. By experience, these settings seem to have worked for the simulations I handle. And values of 0.4 are always safer than 0.5 anyway.

 

But in my new approach, for initial iterations with ADV1/k-e, I would enable intelligence control so that the linesearch parameters are adjusted in seggregated solver during solution and there is more robustness.Then disable intelligent control and continue with 0.4 factors and RNG/ADV5. I don't want to go any lesser than that at the cost of time for running.

 

Hope that clarified.

 

Regards

Omkar.

Message 10 of 17
apolo_vanderberg
in reply to: OmkarJ

Omkar,

    I believe the point might be missed here.

 

When Solution Control is enabled, we do not adjust the value of the Velocity and Pressure relaxation. If it is set to a value we will use that value through out the entire analysis. There are many times with complex electronics models that we will reduce the Pressure slider to a value of ~0.25. However in ALL of these we will always go back and Re-enable (add the check) to turn on Solution Control. We very rarely run SteadyState models with Solution control disabled.

 

This is why I'm asking (as your last post still didnt answer) if you are leaving Solution Control disabled. If so, please try leaving it enabled with your value of 0.4 and run ADV5/RNG from the beginning.

Apolo

 

Message 11 of 17
OmkarJ
in reply to: apolo_vanderberg

Alright, apologies for some assumptions here! Let me jot down what I know. Feel free to take a dig at it so I can correct my approach 🙂

 

First of all, when I run full RNG/ADV5, I disable (unclick) the intelligent solution control. This is to avoid the timestep sizes being automatically set to too small values which aids in stability. I understand with this control enabled, the Solver runs pseudo-transiently using only one inner loop for every time step. Thus, logically, smaller time step values may result in longer convergence times (though Autodesk documentation contradicts this view).

 

I have a basic question here. If I keep values of 0.4 and enable the intelligent control, you say it will use these values though they are greyed. But won't these values keep changing for every iteration as the time-step changes? And if this is true, then what is the point in keeping it as 0.4 as it will eventually decrease? I would rather disable the intelligent control and force the Solver to use 0.4 (or any) value so the convergence proces is not unnecessarily longer.

 

Hope the post addresses your question?

 

Regards

Omkar

Message 12 of 17
OmkarJ
in reply to: OmkarJ

Correction to earlier post:

 

You mention the pressure/velocity values are not changed if intelligent control is enabled.

Then this only changes the time step values. So it doesnt this affect the time for convergence?

 

Regards

Omkar.

Message 13 of 17
OmkarJ
in reply to: apolo_vanderberg

Apollo,

 

Additionally, I would like to explain my motivation for switching the intelligent control off.

 

Generally, I use many monitor points in the flow domain. My definition of "convergence" is the flatness of these monitor point plots (for velocity/pressure/temperature etc.) and not only the flatness of global average values. I have observed that with intelligent control enabled, the convergence occurs even when these monitors are not flat and I don't want that.

 

Regards

Omkar.

Message 14 of 17
apolo_vanderberg
in reply to: OmkarJ

Omkar,

 

      Our steady state solver is a pseudo-transient. However, we do not run just 1 loop. You can see in the convergence monitor (on the right there is a drop down to look rather than AVG to Solv Iter), this is the solver iterations per global iteration.

 

While we do not typically recommend making wild adjustments within the Solution Control dialog, adjustments to Velocity and Pressure do not tend to make a very large impact on overall convergence time. As I mentioned in one of the previous notes, there are models (Data Centers, or complex electronics) where we might set Pressure to ~0.25, however we will run with Solution Control Enabled.

 

While Solution control can adjust the timestepping, typically it wil not impeded the solutions progress or time to convergence. If your goal is to allow for an extended run and not prematurely stopping due to Auto-Convergence assessment, you can go in to the Advanced dialog (next to the Enable check box) and set this to "Tight" to tighten the convergence assessment. We do this often for external aerodynamic models. If you like you can even disable our Convergence Assessment from that dialog while keeping Solution Control enabled for stability purposes.

 

I would suggest (in order to try first)
Run ADV5/RNG with Velocity/Pressure relaxation to 0.4 (or even 0.3) with Solution Control ON (and Convergence Assessment OFF)

If you still see some divergences in this, try the previous recommendation or Switching the Turbulence Startup to Extend

Or increase the Turb/Lam ratio to 1000

 

Apolo

 

Message 15 of 17
OmkarJ
in reply to: apolo_vanderberg

Thanks Apollo, that was an elaborate and comprehensive discussion.

 

I now understand that intelligent solution control doesn't stop the solution process with premature convergence, but the automatic convergence assessment does, which I can always turn off and judge conergence on my monitor plots! Nor does it change the under-relaxation factors too much to affect ETA for convergence.

 

Concludingly, I would like to ask one question:

 

Is there any side effect if I start with "Extend" setting and Turb/Lam ratio of 1000 every time to minimise any divergence risk? I generally run the simulations overnight on cluster and any diverged simulation affects my timeline. FYI, I typically run upto 1500 iterations for every simulation, which is more than minimum 400 iterations recommended for the "Extend."

 

Regards

Omkar.

 

 

Message 16 of 17
OmkarJ
in reply to: OmkarJ

Additionally, I would like to point out that generally, I observe that in the event of divergence, the unphysical results are seen at pressure outlet boundary. e.g. velocities as high as 5000 m/s while the general velocity is upto 40 m/s.

 

Any thoughts on why these unphysical results exist near outelt and any suggestions for mitigating the same?

 

Thanks
Omkar.

Message 17 of 17
apolo_vanderberg
in reply to: OmkarJ

No, there shouldn't be any negative impact running Extend on your models if you are running them out as you mention.

 

As far as the divergence, typically with a divergence you will get impractical / non-physical resutls.

As for the reason behind it, sometimes it can be mesh related. If a gradient develops that is steeper than the mesh can capture there is a potential for some of this. Otherwise, without looking at this through a Support case, I couldn't specifically mentioned why it would diverge.

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report