Discussion Groups

Simulation CFD

Reply
*Expert Elite*
OmkarJ
Posts: 426
Registered: ‎10-02-2012

Remedies for divergence

473 Views, 16 Replies
10-26-2012 04:01 AM

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.

 

Please use plain text.
Product Support
apolo.vanderberg
Posts: 297
Registered: ‎08-31-2011

Re: Remedies for divergence

10-26-2012 11:30 AM 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

Please use plain text.
*Expert Elite*
OmkarJ
Posts: 426
Registered: ‎10-02-2012

Re: Remedies for divergence

10-27-2012 12:31 PM 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

 

 

Please use plain text.
Product Support
apolo.vanderberg
Posts: 297
Registered: ‎08-31-2011

Re: Remedies for divergence

10-29-2012 01:42 PM 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

Please use plain text.
*Expert Elite*
OmkarJ
Posts: 426
Registered: ‎10-02-2012

Re: Remedies for divergence

10-30-2012 02:15 AM 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.

 

Please use plain text.
Product Support
apolo.vanderberg
Posts: 297
Registered: ‎08-31-2011

Re: Remedies for divergence

10-30-2012 05:14 AM 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

Please use plain text.
*Expert Elite*
OmkarJ
Posts: 426
Registered: ‎10-02-2012

Re: Remedies for divergence

10-30-2012 05:19 AM 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

Please use plain text.
Product Support
apolo.vanderberg
Posts: 297
Registered: ‎08-31-2011

Re: Remedies for divergence

10-30-2012 05:22 AM 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

Please use plain text.
*Expert Elite*
OmkarJ
Posts: 426
Registered: ‎10-02-2012

Re: Remedies for divergence

10-30-2012 05:33 AM 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.

Please use plain text.
Product Support
apolo.vanderberg
Posts: 297
Registered: ‎08-31-2011

Re: Remedies for divergence

10-30-2012 05:36 AM 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

 

Please use plain text.