JuliaGeodynamics / LaMEM.jl

Julia interface to LaMEM (Lithosphere and Mantle Evolution Model)
GNU General Public License v3.0
30 stars 13 forks source link

run_lamem(model, 1, "-mode restart") doesn't work well #50

Closed thichasse closed 5 months ago

thichasse commented 5 months ago

Dear all,

I am using LaMEM with the julia interface to perform simulations. What I want to do is to use the last timestep of a simulation as the initial condition for a new run.

I tried to add the "nstep_rdb" parameter (equal to 100) in the Time section when I create the model, and run LaMEM using run_lamem(model, 1, "-mode restart"), however, it does not work since I get an error and no folder .rdb is created.

The error is the following : [0]PETSC ERROR: --------------------- Error Message -------------------------------------------------------------- [0]PETSC ERROR: No restart database available (check -mode option)

Here is the julia file (to rename in .jl) that I compiled a first time using run_lamem(model, 1) and it works, then a second time with run_lamem(model, 1, "-mode restart") where I got the error message. test_bug.txt

My output.dat file is the following, renamed in .txt. output.txt

I am running LaMEM on Windows 10 pro, without WSL, on one core.

Please, if you have any idea, let me know.

thichasse commented 5 months ago

I forgot to mention that the nstep_rdb parameter does not figure in the output.dat file in the Time section.

boriskaus commented 5 months ago

Thanks for bringing this to my attention. If it was not specified, the restarting was indeed not set by default. I have now changed that, which will be part of the next release of LaMEM.jl.

If you indicate nstep_rdb in the Time structure, it works as expected:

using LaMEM, GeophysicalModelGenerator

model  = Model(Grid(nel=(16,16,16), x=[-1,1], y=[-1,1], z=[-1,1]), 
                 Time(nstep_max=20, dt_min=1e-3, dt=1, dt_max=10, time_end=100, nstep_rdb=10), 
                 Solver(SolverType="multigrid", MGLevels=2),
                 Output(out_dir="example_1"))

rm_phase!(model);
matrix = Phase(ID=0,Name="matrix",eta=1e20,rho=3000);
sphere = Phase(ID=1,Name="sphere",eta=1e23,rho=3200);
add_phase!(model, sphere, matrix);

add_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, ));

run_lamem(model,1)

where the LaMEM output gives:

--------------------------------------------------------------------------
Time stepping parameters:
   Simulation end time          : 100. [Myr] 
   Maximum number of steps      : 20 
   Time step                    : 1. [Myr] 
   Minimum time step            : 0.001 [Myr] 
   Maximum time step            : 10. [Myr] 
   Time step increase factor    : 0.1 
   CFL criterion                : 0.5 
   CFLMAX (fixed time steps)    : 0.8 
   Output every [n] steps       : 1 
   Output [n] initial steps     : 1 
   Save restart every [n] steps : 10 

If you restart this with restarting active it works as expected:

julia> run_lamem(model,1,"-mode restart")
Saved file: Model3D.vts
Writing LaMEM marker file -> ./markers/mdb.00000000.dat
-------------------------------------------------------------------------- 
                   Lithosphere and Mantle Evolution Model                   
     Compiled: Date: Jan  1 1970 - Time: 00:00:00           
     Version : 2.1.3 
-------------------------------------------------------------------------- 
        STAGGERED-GRID FINITE DIFFERENCE CANONICAL IMPLEMENTATION           
-------------------------------------------------------------------------- 
Loading restart database ... done (0.014317 sec)
--------------------------------------------------------------------------
Preconditioner parameters: 
   Matrix type                   : monolithic
   Preconditioner type           : coupled Galerkin geometric multigrid
   Global coarse grid [nx,ny,nz] : [8, 8, 8]
   Local coarse grid  [nx,ny,nz] : [8, 8, 8]
   Number of multigrid levels    :  2
--------------------------------------------------------------------------
Solver parameters specified: 
   Outermost Krylov solver       : gmres 
   Solver type                   : multigrid 
   Multigrid smoother levels KSP : chebyshev 
   Multigrid smoother levels PC  : sor 
   Number of smoothening steps   : 10 
   Coarse level KSP              : preonly 
   Coarse level PC               : lu 
   Coarse level solver package   : (null) 
--------------------------------------------------------------------------
Saving output ... done (0.000802 sec)
--------------------------------------------------------------------------
=========================== SOLUTION IS DONE! ============================
--------------------------------------------------------------------------
Total solution time : 0.020664 (sec) 
--------------------------------------------------------------------------
thichasse commented 5 months ago

Thanks, I changed the nstep_rdb parameter from 100 to 10, it seems to work now.