29 double precision :: time0, time_in
30 logical,
save :: part_file_exists=.false.
126 call read_particles_snapshot(part_file_exists)
130 call handle_particles()
131 call finish_gridvars()
132 call time_spent_on_particles()
141 call mpistop(
"non-mpi conversion only uses 1 cpu")
187 print*,
'-------------------------------------------------------------------------------'
188 write(*,
'(a,f17.3,a)')
' Startup phase took : ',mpi_wtime()-time0,
' sec'
189 print*,
'-------------------------------------------------------------------------------'
200 time0=mpi_wtime()-time0
201 print*,
'-------------------------------------------------------------------------------'
202 write(*,
'(a,f17.3,a,f17.3,a)')
' Finished AMRVAC in : ',time0,
' sec', dble(
npe)*time0/3.6d3,
' core hour'
203 print*,
'-------------------------------------------------------------------------------'
222 double precision :: time_last_print, time_write0, time_write, time_before_advance, dt_loop
223 integer(kind=8) ncells_update
224 integer :: level, ifile, ncells_block, igrid, iigrid
228 time_last_print = -bigdouble
248 write(*,
'(A,ES9.2,A)')
' Start integrating, print status every ', &
250 write(*,
'(A4,A10,A12,A12,A12,A14)')
' #',
'it',
'time',
'dt',
'wc-time(s)',
'active_grids'
270 status=
'unknown',position=
'append',action=
'write')
274 status=
'replace',action=
'write')
275 write(
timing_unit,
'(a)')
'# MAIN: it t nleafs setdt advance tc' &
276 //
' eos_hydro eos_tc regrid save process adv-tc'
283 time_before_advance=mpi_wtime()
304 write(*,
'(A4,I10,ES12.4,ES12.4,ES12.4,I14)')
" #", &
313 do iigrid=1,igridstail; igrid=igrids(iigrid);
322 time_write0=mpi_wtime()
324 time_write=time_write+mpi_wtime()-time_write0
335 if(
mype==0)
write(*,
'(a,i7,a,i7,a,es12.4)')
' save a snapshot No.',&
339 call mpi_file_delete(
'savenow',mpi_info_null,
ierrmpi)
361 if(
mype==0)
write(*,*)
"Error: small value encountered, run crash."
392 write(
timing_unit,
'(a,i8,1x,es12.5,1x,i6,1x,9(f10.4,1x))') &
408 dt_loop=mpi_wtime()-time_before_advance
412 call write_particle_output()
413 call finish_gridvars()
421 write(*,
'(a,f12.3,a)')
' Total timeloop took : ',
timeloop,
' sec'
422 write(*,
'(a,f12.3,a)')
' Time spent on AMR : ',
timegr_tot,
' sec'
424 write(*,
'(a,f12.3,a)')
' Time spent on IO in loop : ',
timeio_tot,
' sec'
426 write(*,
'(a,f12.3,a)')
' Time spent on ghost cells : ',
time_bc,
' sec'
429 write(*,
'(a,f12.3,a)')
' Time spent on eos : ',
timeeos_tot,
' sec'
434 write(*,
'(a,f12.3,a)')
' - cons/prim conversion : ',
timeeos_conv,
' sec'
437 write(*,
'(a,f12.3,a)')
' Time spent on WB inverse+C : ',
time_wb_inverse,
' sec'
438 write(*,
'(a,f12.3,a)')
' Time spent on reconstruction:',
time_wb_recon,
' sec'
441 write(*,
'(a,es12.3 )')
' Cells updated / proc / sec : ',dble(ncells_update)*dble(
nstep)/dble(
npe)/
timeloop
453 write(*,
'(a,f12.3,a)')
' Total time spent on IO : ',
timeio_tot,
' sec'
454 write(*,
'(a,f12.3,a)')
' Total timeintegration took : ',mpi_wtime()-
time_in,
' sec'
455 write(*,
'(A4,I10,ES12.3,ES12.3,ES12.3)')
" #", &
460 call time_spent_on_rays
473 logical function timetosave(ifile)
505 end function timetosave
509 logical function fixgrid()
program amrvac
AMRVAC solves a set of hyperbolic equations using adaptive mesh refinement.
subroutine timeintegration()
eos_init is called prior to physics module
Module containing all the time stepping schemes.
subroutine, public process_advanced(iit, qt)
process_advanced is user entry in time loop, just after advance allows to modify solution,...
subroutine, public advance(iit)
Advance all the grids over one time step, including all sources.
subroutine, public process(iit, qt)
process is a user entry in time loop, before output and advance allows to modify solution,...
subroutine, public resettree
reset AMR and (de)allocate boundary flux storage at level changes
subroutine, public resettree_convert
Force the tree to desired level(s) from level_io(_min/_max) used for conversion to vtk output.
subroutine, public settree
Build up AMR.
subroutine, public comm_start
Initialize the MPI environment.
subroutine, public comm_finalize
Finalize (or shutdown) the MPI environment.
subroutine, public mpistop(message)
Exit MPI-AMRVAC with an error message.
subroutine generate_plotfile
subroutine init_convert()
subroutine, public setdt()
setdt - set dt for all levels between levmin and levmax. dtpar>0 --> use fixed dtpar for all level dt...
Equation of state for AMRVAC, handled through a single eos_container object.
subroutine, public eos_init()
Phase 'create' (before units are known): allocate the EoS object, read its &eos_list parameters,...
subroutine, public eos_finalise()
Phase 'commit' (after units are known): finalise the dispatch for the loaded physics – wire the metho...
subroutine, public prepare_eos_w_fields()
Module for escape probability radiative cooling modification.
subroutine, public escape_prob_compute_colmass()
Compute column mass from the corona toward the footpoints and scatter to wextra. Called once per time...
Module for flux conservation near refinement boundaries.
subroutine, public allocatebflux
Module with basic grid data structures.
update ghost cells of all blocks including physical boundaries
subroutine getbc(time, qdt, psb, nwstart, nwbc)
do update ghost cells of all blocks including physical boundaries
procedure(update_eos_bc_sub), pointer update_eos_4_bc
This module contains definitions of global parameters and variables and some generic functions/subrou...
double precision, dimension(nfile) tsavelast
type(state), pointer block
Block pointer for using one block and its previous state.
integer nstep
How many sub-steps the time integrator takes.
integer it_max
Stop the simulation after this many time steps have been taken.
logical reset_it
If true, reset iteration count to 0.
integer ixghi
Upper index of grid block arrays.
logical, dimension(nfile) save_file
whether or not to save an output file
logical resume_previous_run
If true, restart a previous run from the latest snapshot.
double precision global_time
The global simulation time.
integer, dimension(nsavehi, nfile) itsave
Save output of type N on iterations itsave(:, N)
double precision time_max
End time for the simulation.
double precision time_init
Start time for the simulation.
logical firstprocess
If true, call initonegrid_usr upon restarting.
integer snapshotini
Resume from the snapshot with this index.
integer it
Number of time steps taken.
integer it_init
initial iteration count
integer ditregrid
Reconstruct the AMR grid once every ditregrid iteration(s)
character(len=std_len) convert_type
Which format to use when converting.
integer itfixgrid
Fix the AMR grid after this many time steps.
integer, parameter nlevelshi
The maximum number of levels in the grid refinement.
logical phys_escape_prob
Use escape probability for radiative cooling modification.
logical use_particles
Use particles module or not.
integer icomm
The MPI communicator.
logical reset_time
If true, reset iteration count and global_time to original values, and start writing snapshots at ind...
integer mype
The rank of the current MPI task.
integer, dimension(1:nfile) n_saves
Number of saved files of each type.
double precision, dimension(nfile) tsavestart
Start of read out (not counting specified read outs)
integer, dimension(nfile) ditsave
Repeatedly save output of type N when ditsave(N) time steps have passed.
double precision dt
global time step
double precision wall_time_max
Ending wall time (in hours) for the simulation.
integer ierrmpi
A global MPI error return code.
logical autoconvert
If true, already convert to output format during the run.
double precision, dimension(:), allocatable, parameter d
integer slowsteps
If > 1, then in the first slowsteps-1 time steps dt is reduced by a factor .
integer snapshotnext
IO: snapshot and collapsed views output numbers/labels.
integer npe
The number of MPI tasks.
integer, dimension(nfile) itsavelast
double precision time_between_print
to monitor timeintegration loop at given wall-clock time intervals
integer, parameter unitterm
Unit for standard output.
double precision, dimension(nfile) dtsave
Repeatedly save output of type N when dtsave(N) simulation time has passed.
logical time_advance
do time evolving
character(len=std_len) restart_from_file
If not 'unavailable', resume from snapshot with this base file name.
double precision, dimension(:,:), allocatable rnode
Corner coordinates.
integer, parameter filelog_
Constant indicating log output.
integer, parameter fileout_
Constant indicating regular output.
double precision time_bc
accumulated wall-clock time spent on boundary conditions
double precision tfixgrid
Fix the AMR grid after this time.
integer nghostcells
Number of ghost cells surrounding a grid.
character(len= *), parameter undefined
double precision, dimension(nsavehi, nfile) tsave
Save output of type N on times tsave(:, N)
logical convert
If true and restart_from_file is given, convert snapshots to other file formats.
logical reset_grid
If true, rebuild the AMR grid upon restarting.
logical crash
Save a snapshot before crash a run met unphysical values.
double precision, dimension(^nd) dxlevel
store unstretched cell size of current level
logical use_multigrid
Use multigrid (only available in 2D and 3D)
character(len=std_len) base_filename
Base file name for simulation output, which will be followed by a number.
integer refine_max_level
Maximal number of AMR levels.
integer, parameter nfile
Number of output methods.
logical pass_wall_time
If true, wall time is up, modify snapshotnext for later overwrite.
logical final_dt_exit
Force timeloop exit when final dt < dtmin.
integer, dimension(nfile) isaveit
integer, dimension(nfile) isavet
integer log_fh
MPI file handle for logfile.
subroutine, public improve_initial_condition()
improve initial condition after initialization
subroutine, public initlevelone
Generate and initialize all grids at the coarsest level (level one)
subroutine, public modify_ic
modify initial condition
This module handles the initialization of various components of amrvac.
subroutine, public initialize_amrvac()
Initialize amrvac: read par files and initialize variables.
Module to couple the octree-mg library to AMRVAC. This file uses the VACPP preprocessor,...
type(mg_t) mg
Data structure containing the multigrid tree.
subroutine mg_setup_multigrid()
Setup multigrid for usage.
Module containing all the particle routines.
subroutine particles_create()
Create initial particles.
This module defines the procedures of a physics module. It contains function pointers for the various...
procedure(sub_check_params), pointer phys_bind_eos_to_source
procedure(sub_special_advance), pointer phys_special_advance
subroutine, public selectgrids
Module for handling split source terms (split from the fluxes)
double precision, save, public time_sts_total
double precision tw_eos_hydro_prev
double precision time_wb_inverse
double precision tw_process
double precision tw_advance
double precision tw_regrid
integer timing_log_interval
Write timing log every N iterations (default 10)
double precision timegr_tot
double precision time_htc_total
double precision timeio_tot
double precision tw_eos_tc
double precision tw_eos_hydro
double precision time_wb_recon
double precision timelast
double precision timeeos_update
integer, parameter timing_unit
double precision tw_setdt
logical write_timing_log
Enable writing of detailed timing breakdown log (set via savelist)
double precision timeeos_pthermal
double precision timeloop
double precision timeloop0
double precision tw_tc_total
double precision tw_tc_prev
double precision timeeos_tot
double precision timeeos_conv
double precision time_wb_transform
double precision timeeos_csound
double precision tw_eos_tc_prev
logical timing_log_opened
double precision timeeos_tfromei
subroutine, public initialize_trac_after_settree
Module with all the methods that users can customize in AMRVAC.
procedure(process_grid), pointer usr_process_grid
procedure(process_adv_grid), pointer usr_process_adv_grid
procedure(sub_modify_io), pointer usr_modify_output
procedure(p_no_args), pointer usr_before_main_loop
procedure(process_global), pointer usr_process_global
procedure(process_adv_global), pointer usr_process_adv_global
This is a template for a new user problem of mhd.
subroutine usr_init()
This routine should set user methods, and activate the physics module.