CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

SimpleFoam crashes after restarting simulation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 26, 2016, 12:12
Default SimpleFoam crashes after restarting simulation
  #1
Member
 
Federico Zabaleta
Join Date: May 2016
Posts: 47
Rep Power: 9
fedez91 is on a distinguished road
Hello everyone, I'm having problems when restarting a SimpleFoam simulation.

I'm modelling the spiral case of a Kaplan Turbine with laminar simpleFoam. I stopped the simulation after 800 iterations to check the partial results, but when I restarted it, after a few iterations, it crashes. No matter from when I restart it (iteration number 500, 600 or 800), it crashes.

I don't know what's happening, it doesn't make sense to me. Why can I simulate from 0 to 800 but can't from 700 to 800?

I copy a the output from the restarted simulation.

Thanks

Time = 10

smoothSolver: Solving for Ux, Initial residual = 0.962422, Final residual = 0.048133, No Iterations 1
smoothSolver: Solving for Uy, Initial residual = 0.915385, Final residual = 0.0453896, No Iterations 1
smoothSolver: Solving for Uz, Initial residual = 0.710173, Final residual = 0.0365221, No Iterations 1
GAMG: Solving for p, Initial residual = 0.968003, Final residual = 0.00640378, No Iterations 1
time step continuity errors : sum local = 2.83562, global = -0.0113787, cumulative = -0.0488717
ExecutionTime = 79.84 s ClockTime = 88 s

Time = 11

smoothSolver: Solving for Ux, Initial residual = 0.979397, Final residual = 0.0588178, No Iterations 1
smoothSolver: Solving for Uy, Initial residual = 0.98346, Final residual = 0.0547121, No Iterations 1
smoothSolver: Solving for Uz, Initial residual = 0.68809, Final residual = 0.028108, No Iterations 2
GAMG: Solving for p, Initial residual = 0.993474, Final residual = 0.0123613, No Iterations 1
time step continuity errors : sum local = 653.325, global = 1.09582, cumulative = 1.04695
ExecutionTime = 85.94 s ClockTime = 95 s

Time = 12

smoothSolver: Solving for Ux, Initial residual = 0.15849, Final residual = 0.00511335, No Iterations 1
smoothSolver: Solving for Uy, Initial residual = 0.31582, Final residual = 0.0102091, No Iterations 1
smoothSolver: Solving for Uz, Initial residual = 0.160476, Final residual = 0.00346714, No Iterations 1
GAMG: Solving for p, Initial residual = 0.999085, Final residual = 0.000542365, No Iterations 1
time step continuity errors : sum local = 16443.1, global = 2.23306, cumulative = 3.28001
ExecutionTime = 92.54 s ClockTime = 102 s

Time = 13

smoothSolver: Solving for Ux, Initial residual = 0.992432, Final residual = 0.0123749, No Iterations 6
smoothSolver: Solving for Uy, Initial residual = 0.981876, Final residual = 0.0226122, No Iterations 2
smoothSolver: Solving for Uz, Initial residual = 0.99753, Final residual = 0.0208188, No Iterations 6
GAMG: Solving for p, Initial residual = 0.999839, Final residual = 0.0847474, No Iterations 2
time step continuity errors : sum local = 7.33678e+11, global = -1.08603e+09, cumulative = -1.08603e+09
ExecutionTime = 101.25 s ClockTime = 111 s

Time = 14

smoothSolver: Solving for Ux, Initial residual = 0.249819, Final residual = 0.010744, No Iterations 9
smoothSolver: Solving for Uy, Initial residual = 0.322246, Final residual = 0.0300892, No Iterations 9
smoothSolver: Solving for Uz, Initial residual = 0.262044, Final residual = 0.00209802, No Iterations 9
[2] #0 Foam::error:rintStack(Foam::Ostream&) at ??:?
fedez91 is offline   Reply With Quote

Old   August 29, 2016, 07:23
Default
  #2
Senior Member
 
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 182
Rep Power: 17
matejfor is on a distinguished road
Hi,

your continuity errors are way to high.
Can you post last 3 iterations log from the first run - so close to those 600 or whatever?

Are there any error or warning messages in the log file at the restart?

To help you, we need more information
matejfor is offline   Reply With Quote

Old   August 30, 2016, 02:35
Default
  #3
Member
 
Giovanni Caramia
Join Date: Mar 2009
Location: Bari, ITALY
Posts: 58
Rep Power: 17
karamiag is on a distinguished road
I think this post could help, even if I do not understand why other software (i.e. fluent) do not have this problem.

Quote:
Originally Posted by arjun View Post
The issue is that there are two component to flux.
One due to velocitz and density. Second due to rhie and chow.

First part could be constructed from given data, second part however requires you to know Ap of velocity and pressure gradient. This part is mainly omitted in many solvers because in theory in a converged case goes to 0.

In practice it is not zero but small.

My suggestion would be to run first very few iterations with very small pressure urf. Say 0.01 or so.

(Dont touch momentum urf , keep as it is).

If it is a transient case, increase number of inner iterations and use very small pressure urf.

This should give solver time to recover and make fluxes better.




Some cases recover and very few can not. I think it depends on how strongly pressure affects the solution.
karamiag is offline   Reply With Quote

Old   August 30, 2016, 07:46
Default
  #4
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by karamiag View Post
I think this post could help, even if I do not understand why other software (i.e. fluent) do not have this problem.

In my solver I took care of this by testing and restoring case and testing the flux construction. I save all the relevant data that is needed for flux computation. I also did lots of testing around it.

In ccm, Milovan Peric commented that fluxes are saved. (I cant confirm but quite possible). I guess fluent also does that.
arjun is offline   Reply With Quote

Old   August 31, 2016, 05:33
Default
  #5
Member
 
Giovanni Caramia
Join Date: Mar 2009
Location: Bari, ITALY
Posts: 58
Rep Power: 17
karamiag is on a distinguished road
Can you detail how you saved all the relevant data needed for flux computation?
karamiag is offline   Reply With Quote

Old   August 31, 2016, 08:29
Default
  #6
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by karamiag View Post
Can you detail how you saved all the relevant data needed for flux computation?
My solver is not fluent but personally developed solver. I cant do anything about openFoam. I have never used openfoam.
arjun is offline   Reply With Quote

Old   August 31, 2016, 08:37
Default
  #7
Senior Member
 
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 182
Rep Power: 17
matejfor is on a distinguished road
fluxes are stored in OpenFOAM automatically into a file called phi and it is saved every time the results (variable fields) are written, based on your settings in controlDict.
matejfor is offline   Reply With Quote

Old   September 1, 2016, 17:42
Default
  #8
Member
 
Federico Zabaleta
Join Date: May 2016
Posts: 47
Rep Power: 9
fedez91 is on a distinguished road
Thank you everyone for your replies.

OF saves U, p, phi, k, omega, nut, and information about the time (I'm also trying to simulate with k-omega sst and still having the same problems).

Here i post the the last 3 iterations of the 1st simulation.

Time = 818

smoothSolver: Solving for Ux, Initial residual = 0.000320485, Final residual = 1.05181e-05, No Iterations 1
smoothSolver: Solving for Uy, Initial residual = 0.000564055, Final residual = 1.81788e-05, No Iterations 1
smoothSolver: Solving for Uz, Initial residual = 0.000376765, Final residual = 1.23029e-05, No Iterations 1
GAMG: Solving for p, Initial residual = 0.0115165, Final residual = 0.00101956, No Iterations 1
time step continuity errors : sum local = 0.000211661, global = 4.46972e-06, cumulative = -0.00551074
ExecutionTime = 5382.01 s ClockTime = 5780 s

Time = 819

smoothSolver: Solving for Ux, Initial residual = 0.000320814, Final residual = 1.0521e-05, No Iterations 1
smoothSolver: Solving for Uy, Initial residual = 0.000564596, Final residual = 1.81531e-05, No Iterations 1
smoothSolver: Solving for Uz, Initial residual = 0.00037613, Final residual = 1.22764e-05, No Iterations 1
GAMG: Solving for p, Initial residual = 0.0115504, Final residual = 0.00101698, No Iterations 1
time step continuity errors : sum local = 0.000211067, global = 3.58251e-06, cumulative = -0.00550716
ExecutionTime = 5388.67 s ClockTime = 5787 s

Time = 820

smoothSolver: Solving for Ux, Initial residual = 0.000321059, Final residual = 1.05238e-05, No Iterations 1
smoothSolver: Solving for Uy, Initial residual = 0.000564844, Final residual = 1.81341e-05, No Iterations 1
smoothSolver: Solving for Uz, Initial residual = 0.000375526, Final residual = 1.2257e-05, No Iterations 1
GAMG: Solving for p, Initial residual = 0.0115567, Final residual = 0.00100844, No Iterations 1
time step continuity errors : sum local = 0.000209301, global = 2.91079e-06, cumulative = -0.00550425
ExecutionTime = 5395.31 s ClockTime = 5794 s

End

Finalising parallel run


As you can see, after 820 simulations everything goes ok, until I restart it from there, and then it crashes.



This is what I get after restarting it

Reading field p

Reading field U

Reading/calculating face flux field phi

Selecting incompressible transport model Newtonian
Selecting turbulence model type RAS
Selecting RAS turbulence model kOmegaSST
Selecting patchDistMethod meshWave
kOmegaSSTCoeffs
{
alphaK1 0.85;
alphaK2 1;
alphaOmega1 0.5;
alphaOmega2 0.856;
gamma1 0.555556;
gamma2 0.44;
beta1 0.075;
beta2 0.0828;
betaStar 0.09;
a1 0.31;
b1 1;
c1 10;
F3 false;
}

No MRF models present

No finite volume options present


Starting time loop

Time = 801

smoothSolver: Solving for Ux, Initial residual = 0.000790055, Final residual = 2.05318e-05, No Iterations 1
smoothSolver: Solving for Uy, Initial residual = 0.000984961, Final residual = 2.61955e-05, No Iterations 1
smoothSolver: Solving for Uz, Initial residual = 0.000884717, Final residual = 2.30055e-05, No Iterations 1
GAMG: Solving for p, Initial residual = 0.0698154, Final residual = 0.00365017, No Iterations 1
time step continuity errors : sum local = 0.000832692, global = 1.91372e-05, cumulative = 1.91372e-05
ExecutionTime = 12.81 s ClockTime = 19 s

Time = 802

smoothSolver: Solving for Ux, Initial residual = 0.000688422, Final residual = 1.86906e-05, No Iterations 1
smoothSolver: Solving for Uy, Initial residual = 0.000882222, Final residual = 2.441e-05, No Iterations 1
smoothSolver: Solving for Uz, Initial residual = 0.000765998, Final residual = 2.07898e-05, No Iterations 1
GAMG: Solving for p, Initial residual = 0.07493, Final residual = 0.00453133, No Iterations 1
time step continuity errors : sum local = 0.00102426, global = 2.26965e-05, cumulative = 4.18337e-05
ExecutionTime = 18.52 s ClockTime = 26 s

Time = 803

smoothSolver: Solving for Ux, Initial residual = 0.000705414, Final residual = 1.83616e-05, No Iterations 1
smoothSolver: Solving for Uy, Initial residual = 0.000825338, Final residual = 2.39412e-05, No Iterations 1
smoothSolver: Solving for Uz, Initial residual = 0.000720684, Final residual = 1.99926e-05, No Iterations 1
GAMG: Solving for p, Initial residual = 0.0739444, Final residual = 0.00479078, No Iterations 1
time step continuity errors : sum local = 0.00108424, global = 2.5133e-05, cumulative = 6.69667e-05
ExecutionTime = 25.15 s ClockTime = 33 s

....
....
....


Time = 808

smoothSolver: Solving for Ux, Initial residual = 0.345719, Final residual = 0.00366349, No Iterations 2
smoothSolver: Solving for Uy, Initial residual = 0.305441, Final residual = 0.00244467, No Iterations 2
smoothSolver: Solving for Uz, Initial residual = 0.20039, Final residual = 0.00564311, No Iterations 2
GAMG: Solving for p, Initial residual = 0.966631, Final residual = 0.00113559, No Iterations 1
time step continuity errors : sum local = 0.204525, global = 0.000103407, cumulative = 0.000276406
ExecutionTime = 57.07 s ClockTime = 69 s

Time = 809

smoothSolver: Solving for Ux, Initial residual = 0.382023, Final residual = 0.034568, No Iterations 1
smoothSolver: Solving for Uy, Initial residual = 0.649371, Final residual = 0.00312891, No Iterations 3
smoothSolver: Solving for Uz, Initial residual = 0.181243, Final residual = 0.00775396, No Iterations 1
GAMG: Solving for p, Initial residual = 0.993609, Final residual = 0.0498776, No Iterations 1
time step continuity errors : sum local = 31.2167, global = -0.0310831, cumulative = -0.0308067
ExecutionTime = 63.88 s ClockTime = 76 s

Time = 810

smoothSolver: Solving for Ux, Initial residual = 0.21656, Final residual = 0.00203398, No Iterations 4
smoothSolver: Solving for Uy, Initial residual = 0.194797, Final residual = 0.000722102, No Iterations 4
smoothSolver: Solving for Uz, Initial residual = 0.209902, Final residual = 0.00722279, No Iterations 4
GAMG: Solving for p, Initial residual = 0.980103, Final residual = 0.0850555, No Iterations 1
time step continuity errors : sum local = 262749, global = -6.0681, cumulative = -6.0989
ExecutionTime = 71.64 s ClockTime = 84 s

...

And then it crashes.

Any idea OF experts?

Thanks
fedez91 is offline   Reply With Quote

Old   September 1, 2016, 17:59
Default
  #9
Senior Member
 
matej forman
Join Date: Mar 2009
Location: Brno, Czech Republic
Posts: 182
Rep Power: 17
matejfor is on a distinguished road
Now the first think I can see is that you are solving the flow with the k-omega model, it is in the log file written, but the lines for omega and k are not in the output from the solver so it looks like output from laminar flow solution.

Otherwise, the residuals look really nice ofter the first run. How are the values? Reasonable flow-field? It is very hard to judge with these info. I never met behaviour like this.

Just out of interest, what version of OF are you using? Do you have any probes or other monitoring with function objects to get more information?
matejfor is offline   Reply With Quote

Old   September 1, 2016, 21:25
Default
  #10
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by matejfor View Post

Otherwise, the residuals look really nice ofter the first run. How are the values? Reasonable flow-field? It is very hard to judge with these info. I never met behaviour like this.
Residuals dont look nice to me, momentum residuls are twice as large while continuity are 5 times.

If we assume that fluxes are stored and retrieved then the turbulent viscosity is second suspect. Other than that there is nothing in momentum equation that should make residual go up as everything else is computed during iteration.
arjun is offline   Reply With Quote

Old   September 2, 2016, 05:22
Default
  #11
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
This calculation is saved after 100 iterations and restarted then to convergence.

This is how residuals should look upon restart if things are properly restored.

There are two plots, one with laminar and one with k omega model.

In the second case Omega shows a bit of jump in residuals but rest are okay. Omega residuals only jumps a bit and not 2 or 3 times.

NOTE: This is not openFOAM
Attached Images
File Type: png ResidualsTest.png (28.4 KB, 35 views)
File Type: png KwResiduals.png (50.8 KB, 42 views)
arjun is offline   Reply With Quote

Old   September 2, 2016, 09:52
Default
  #12
Member
 
Federico Zabaleta
Join Date: May 2016
Posts: 47
Rep Power: 9
fedez91 is on a distinguished road
Dear Matej, OF (3.0) isn't calculating k and omega because I turned turbulence off in constant/turbulenceProperties. The simulation has a reasonable result, moreover, if I let it run without stopping it, it converges with residuals smaller than e-4.

This behavior is quite annoying, because when I use a finer mesh and want to use mapFields, it works like it's starting from an older simulation and diverges.

Also never happened to me before with other solvers.
fedez91 is offline   Reply With Quote

Old   September 2, 2016, 10:56
Default
  #13
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by fedez91 View Post
Dear Matej, OF (3.0) isn't calculating k and omega because I turned turbulence off in constant/turbulenceProperties. The simulation has a reasonable result, moreover, if I let it run without stopping it, it converges with residuals smaller than e-4.

This behavior is quite annoying, because when I use a finer mesh and want to use mapFields, it works like it's starting from an older simulation and diverges.

Also never happened to me before with other solvers.

The best way to handle this situation where a simulation is started from mapped field is that an intialization iteration should take place. In this only pressure is corrected and velocities are made divergence free.
Then on this pressure field and velocity field other variables should go through 1 iteration that adjust their values for given velocity and pressure field.

After this iterations should start. I feel in openFOAM initialization is not given enough time in both development and testing. Initialization is quite important aspect. It can make or break an simulation.
arjun is offline   Reply With Quote

Old   September 2, 2016, 14:44
Default
  #14
Member
 
Federico Zabaleta
Join Date: May 2016
Posts: 47
Rep Power: 9
fedez91 is on a distinguished road
Quote:
Originally Posted by arjun View Post
The best way to handle this situation where a simulation is started from mapped field is that an intialization iteration should take place. In this only pressure is corrected and velocities are made divergence free.
Then on this pressure field and velocity field other variables should go through 1 iteration that adjust their values for given velocity and pressure field.

After this iterations should start. I feel in openFOAM initialization is not given enough time in both development and testing. Initialization is quite important aspect. It can make or break an simulation.
Dear Arjun,

I've never heard about this technique before. How do you do that? Setting tolerance of U,k and omega to 1 in fvSolution and doing 1 iteration, and then setting tolerance of p to 1 and doing another iteration?

Thank you
fedez91 is offline   Reply With Quote

Old   September 2, 2016, 21:03
Default
  #15
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by fedez91 View Post
Dear Arjun,

I've never heard about this technique before. How do you do that? Setting tolerance of U,k and omega to 1 in fvSolution and doing 1 iteration, and then setting tolerance of p to 1 and doing another iteration?

Thank you
I was talking about how this should be handled, where you map the solution from one simulation to other.

In starccm+ there is something called continuity initialization that is an example of this what I wrote.

In openFOAM, if your calculation starting from very first iteration then try very very small momentum under-relaxation for first 1 or 2 iterations. That would make sure that velocities are not changed due to momentum solve and continuity solve only touches them.
arjun is offline   Reply With Quote

Old   September 3, 2016, 09:26
Default
  #16
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
Have you tried using the binary file format for storing the results? This might help.
jherb is offline   Reply With Quote

Old   September 3, 2016, 10:34
Default
  #17
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by jherb View Post
Have you tried using the binary file format for storing the results? This might help.
Is it not binary? This could affect a lot.
arjun is offline   Reply With Quote

Old   September 4, 2016, 08:02
Default
  #18
Senior Member
 
Joachim Herb
Join Date: Sep 2010
Posts: 650
Rep Power: 21
jherb is on a distinguished road
It is set in controlDict:
http://cfd.direct/openfoam/user-guide/controldict/
writeFormat Specifies the format of the data files.
  • ascii (default): ASCII format, written to writePrecision significant figures.
  • binary: binary format.
jherb is offline   Reply With Quote

Old   September 4, 2016, 08:59
Default
  #19
Senior Member
 
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,272
Rep Power: 34
arjun will become famous soon enougharjun will become famous soon enough
Quote:
Originally Posted by jherb View Post
It is set in controlDict:
http://cfd.direct/openfoam/user-guide/controldict/
writeFormat Specifies the format of the data files.
  • ascii (default): ASCII format, written to writePrecision significant figures.
  • binary: binary format.

writePrecision 6;

is too low. It would be interesting to see how binary behaves.
arjun is offline   Reply With Quote

Reply

Tags
restart, simplefoam


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
simpleFoam crashes (CFDSupport port of OpenFOAM for Windows) mqsim OpenFOAM Running, Solving & CFD 5 June 30, 2016 02:31
Simulation of Radial Fan with simpleFoam MRF nash OpenFOAM Running, Solving & CFD 2 November 5, 2015 10:12
Simulation seems to converge but crashes suddenly xxxx OpenFOAM 16 September 12, 2014 08:07
Temperature linearly rising after restarting a simulation Gennaro OpenFOAM Programming & Development 2 September 2, 2014 07:58
Problem restarting a simulation from an intermediate point. sergiorbrett CFX 2 April 21, 2010 17:11


All times are GMT -4. The time now is 01:10.