MPI-AMRVAC 3.2
The MPI - Adaptive Mesh Refinement - Versatile Advection Code (development version)
Loading...
Searching...
No Matches
amrvac.t
Go to the documentation of this file.
1!> AMRVAC solves a set of hyperbolic equations
2!> \f$\vec{u}_t + \nabla_x \cdot \vec{f}(\vec{u}) = \vec{s}\f$
3!> using adaptive mesh refinement.
4program amrvac
5
10 use mod_usr
17 use mod_advance, only: process
19 use mod_convert, only: init_convert
20 use mod_physics
28
29
30 double precision :: time0, time_in
31 logical,save :: part_file_exists=.false.
32
33
34 call comm_start()
35
36 time0 = mpi_wtime()
37 time_advance = .false.
38 time_bc = zero
39
40 ! read command line arguments first
41 call read_arguments()
42
43 ! init_convert is called before usr_init as user might associate a convert method
44 call init_convert()
45 !> eos_init is called prior to physics module
46 call eos_init()
47 ! the user_init routine should load a physics module
48 call usr_init()
49
50 call eos_finalise() !> finalise the EoS dispatch (tables, pointers) for the loaded physics
51
52 !> The EoS dispatch is now complete. Wire it into the two lower-level modules
53 !> that must call the EoS but cannot depend on mod_eos (hence these pointers).
54 !> Both are set only when there is real work to do and guarded at the call site:
55 !> - the ghost-cell update refreshes Te/ne on boundary cells, which only the
56 !> LTE EoS needs (FI's update_eos is a no-op);
57 !> - the physics layer binds the EoS into its source terms (thermal
58 !> conduction / cooling / radiation fluid objects), set only by physics
59 !> modules that have an EoS hook.
60 if (eos%eos_type == 'LTE') update_eos_4_bc => eos%update_eos
62
63 call initialize_amrvac() !> Grid bounds are set up here (ixG^D_ etc)
64
65 if (restart_from_file /= undefined) then
66 ! restart from previous file or dat file conversion
67 ! get input data from previous AMRVAC run
68
69 ! read in dat file
70 call read_snapshot()
71
72 ! rewrite it=0 snapshot when restart from it=0 state
73 if(it==0.and.itsave(1,2)==0) snapshotnext=snapshotnext-1
74
75 if (reset_time) then
76 ! reset it and global time to original value
77 it = it_init
79 ! reset snapshot number
81 end if
82
83 if (reset_it) then
84 ! reset it to original value
85 it = it_init
86 end if
87
88 ! allow user to read extra data before filling boundary condition
89 if (associated(usr_process_grid) .or. &
90 associated(usr_process_global)) then
92 end if
93
94 ! modify initial condition
95 if (firstprocess) then
96 ! update ghost cells for all need-boundary variables before modification
97 call getbc(global_time,0.d0,ps,iwstart,nwgc)
98 call modify_ic
99 end if
100
101 ! select active grids
102 call selectgrids
103
104 ! update ghost cells for all need-boundary variables
105 call getbc(global_time,0.d0,ps,iwstart,nwgc)
106
107 ! reset AMR grid
108 if (reset_grid) then
109 call settree
110 else
111 ! set up boundary flux conservation arrays
112 if (levmax>levmin) call allocatebflux
113 end if
114
115 ! all blocks refined to the same level for output
116 if(convert .and. level_io>0 .or. level_io_min.ne.1 .or. level_io_max.ne.nlevelshi) &
118
119 {^nooned
120 ! improve initial condition after restart and modification
122 }
123
125
126 if(use_particles) then
127 call read_particles_snapshot(part_file_exists)
128 call init_gridvars()
129 if (.not. part_file_exists) call particles_create()
130 if(convert) then
131 call handle_particles()
132 call finish_gridvars()
133 call time_spent_on_particles()
134 call comm_finalize
135 stop
136 end if
137 end if
138
139 if(convert) then
140 if (npe/=1.and.(.not.(index(convert_type,'mpi')>=1)) &
141 .and. convert_type .ne. 'user' &
142 .and. convert_type .ne. 'magnetic_helicity' &
143 .and. convert_type .ne. 'magnetic_topology') &
144 call mpistop("non-mpi conversion only uses 1 cpu")
145 if(mype==0.and.level_io>0) write(unitterm,*)'reset tree to fixed level=',level_io
146
147 !here requires -1 snapshot
149
150 if(associated(phys_special_advance)) then
151 ! e.g. calculate MF velocity from magnetic field
153 end if
154
156 call comm_finalize
157 stop
158 end if
159
160 else
161
162 ! form and initialize all grids at level one
163 call initlevelone
164
165 ! set up and initialize finer level grids, if needed
166 call settree
167
169
170 ! improve initial condition
172
173 ! select active grids
174 call selectgrids
175
176 if (use_particles) then
177 call init_gridvars()
178 call particles_create()
179 end if
180
181 end if
182
183 ! initialize something base on tree information
185
186 ! Populate the additional w state eos variables (if needed)
188
189 if (mype==0) then
190 print*,'-------------------------------------------------------------------------------'
191 write(*,'(a,f17.3,a)')' Startup phase took : ',mpi_wtime()-time0,' sec'
192 print*,'-------------------------------------------------------------------------------'
193 end if
194
195 ! an interface to allow user to do special things before the main loop
196 if (associated(usr_before_main_loop)) &
198
199 ! do time integration of all grids on all levels
200 call timeintegration()
201
202 if (mype==0) then
203 time0=mpi_wtime()-time0
204 print*,'-------------------------------------------------------------------------------'
205 write(*,'(a,f17.3,a,f17.3,a)')' Finished AMRVAC in : ',time0,' sec', dble(npe)*time0/3.6d3,' core hour'
206 print*,'-------------------------------------------------------------------------------'
207 end if
208
209 call comm_finalize
210
211contains
212
213 subroutine timeintegration()
214 use mod_timing
215 use mod_source, only: time_sts_total
217 use mod_forest, only: nleafs_active
222 use mod_dt, only: setdt
223
224
225 double precision :: time_last_print, time_write0, time_write, time_before_advance, dt_loop
226 integer(kind=8) ncells_update
227 integer :: level, ifile, ncells_block, igrid, iigrid
228 logical :: crashall
229
230 time_in=mpi_wtime()
231 time_last_print = -bigdouble
232
234
235 do ifile=nfile,1,-1
236 if(resume_previous_run) then
237 tsavelast(ifile)=aint((global_time+smalldouble)/dtsave(ifile))*dtsave(ifile)
238 itsavelast(ifile)=it/ditsave(ifile)*ditsave(ifile)
239 else
241 itsavelast(ifile)=it
242 end if
243 end do
244
245 ! the next two are used to keep track of the performance during runtime:
247 timelast=mpi_wtime()
248
249 ! ------ start of integration loop. ------------------
250 if (mype==0) then
251 write(*, '(A,ES9.2,A)') ' Start integrating, print status every ', &
252 time_between_print, ' seconds'
253 write(*, '(A4,A10,A12,A12,A12,A14)') ' #', 'it', 'time', 'dt', 'wc-time(s)', 'active_grids'
254 end if
255
256 timeloop0=mpi_wtime()
257 time_bc=0.d0
258 time_write=0.d0
259 ncells_block={(ixghi^d-2*nghostcells)*}
260 ncells_update=0
261 dt_loop=0.d0
262
263 time_advance=.true.
264
265 ! Pre-compute column mass before first advance so escape probability
266 ! is active from the very first timestep (avoids IC transient)
268
269 ! Open timing breakdown log if requested via savelist
270 if (write_timing_log .and. .not. timing_log_opened .and. mype==0) then
271 if (global_time > 1.0d-10) then
272 open(timing_unit,file=trim(base_filename)//'timing.log', &
273 status='unknown',position='append',action='write')
274 write(timing_unit,'(a,es12.5)') '# --- restart at t = ', global_time
275 else
276 open(timing_unit,file=trim(base_filename)//'timing.log', &
277 status='replace',action='write')
278 write(timing_unit,'(a)') '# MAIN: it t nleafs setdt advance tc' &
279 //' eos_hydro eos_tc regrid save process adv-tc'
280 end if
281 timing_log_opened = .true.
282 end if
283
284 time_evol : do
285
286 time_before_advance=mpi_wtime()
287 ! set time step
288 tw_setdt=mpi_wtime()
289 call setdt()
290 tw_setdt=mpi_wtime()-tw_setdt
291
292 ! Optionally call a user method that can modify the grid variables at the
293 ! beginning of a time step (this is where the SC radiative transfer solve runs)
294 tw_process=0.d0
295 if (associated(usr_process_grid) .or. &
296 associated(usr_process_global)) then
297 tw_process=mpi_wtime()
299 tw_process=mpi_wtime()-tw_process
300 end if
301
302 ! Check if output needs to be written
303 do ifile=nfile,1,-1
304 save_file(ifile) = timetosave(ifile)
305 end do
306
307 timeio0=mpi_wtime()
308
309 if (timeio0 - time_last_print > time_between_print) then
310 time_last_print = timeio0
311 if (mype == 0) then
312 write(*, '(A4,I10,ES12.4,ES12.4,ES12.4,I14)') " #", &
314 end if
315 end if
316
317 ! output data
318 if (any(save_file)) then
319 if(associated(usr_modify_output)) then
320 ! Users can modify or set variables before output is written
321 do iigrid=1,igridstail; igrid=igrids(iigrid);
322 ^d&dxlevel(^d)=rnode(rpdx^d_,igrid);
323 block=>ps(igrid)
324 call usr_modify_output(ixg^ll,ixm^ll,global_time,ps(igrid)%w,ps(igrid)%x)
325 end do
326 end if
327 time_write=0.d0
328 do ifile=nfile,1,-1
329 if (save_file(ifile)) then
330 time_write0=mpi_wtime()
331 call saveamrfile(ifile)
332 time_write=time_write+mpi_wtime()-time_write0
333 end if
334 end do
335 end if
336
337 ! output a snapshot when user write a file named 'savenow' in the same
338 ! folder as the executable amrvac
339 if (mype==0) inquire(file='savenow',exist=save_now)
340 if (npe>1) call mpi_bcast(save_now,1,mpi_logical,0,icomm,ierrmpi)
341
342 if (save_now) then
343 if(mype==0) write(*,'(a,i7,a,i7,a,es12.4)') ' save a snapshot No.',&
344 snapshotnext,' at it=',it,' global_time=',global_time
345 call saveamrfile(1)
346 call saveamrfile(2)
347 call mpi_file_delete('savenow',mpi_info_null,ierrmpi)
348 end if
349 timeio_tot=timeio_tot+mpi_wtime()-timeio0
350
351 pass_wall_time=mpi_wtime()-time0+dt_loop+4.d0*time_write >=wall_time_max
352
353 ! exit time loop if time is up
354 if (it>=it_max .or. global_time>=time_max .or. pass_wall_time .or. final_dt_exit) exit time_evol
355
356 ! Pre-compute column mass for escape probability cooling modification
358
359 ! solving equations
360 tw_tmp=mpi_wtime()
361 call advance(it)
362 tw_advance=mpi_wtime()-tw_tmp
363
364 ! if met unphysical values, output the last good status and stop the run
365 call mpi_allreduce(crash,crashall,1,mpi_logical,mpi_lor,icomm,ierrmpi)
366 if (crashall) then
367 call saveamrfile(1)
368 call saveamrfile(2)
369 if(mype==0) write(*,*) "Error: small value encountered, run crash."
370 call mpi_abort(icomm, iigrid, ierrmpi)
371 end if
372
373 ! Optionally call a user method that can modify the grid variables at the
374 ! end of a time step: this is for two-way coupling to PIC, e.g.
375 if (associated(usr_process_adv_grid) .or. &
376 associated(usr_process_adv_global)) then
378 end if
379
380 ! update time variables
381 it = it + 1
383
384 ! update AMR mesh and tree (upstream-style: mod-based regrid)
385 timegr0=mpi_wtime()
386 if (mod(it,ditregrid)==0 .and. refine_max_level>1 .and. .not.(fixgrid())) call resettree
387 ! Static-grid cost rebalance: regrid never fires when refine_max_level==1, so the cost-weighted
388 ! load_balance has no trigger. Fire it every lb_interval cycles (the previously-unused knob).
389 ! (AMR grids get the costed rebalance inside resettree already, so this is static-grid only.)
390 if (lb_automatic .and. refine_max_level==1 .and. it>it_init .and. mod(it,lb_interval)==0) &
391 call amr_rebalance
392 tw_regrid=mpi_wtime()-timegr0
394
395 ! write main-loop timing to user timing log
403 if (mype==0 .and. timing_log_opened .and. &
404 mod(it, timing_log_interval)==0) then
405 write(timing_unit,'(a,i8,1x,es12.5,1x,i6,1x,9(f10.4,1x))') &
406 ' MAIN ', it, global_time, nleafs_active, &
409 call flush(timing_unit)
410 end if
411
412 if(it>9000000)then
414 itsavelast(:)=0
415 end if
416
417 ! count updated cells
418 ncells_update=ncells_update+ncells_block*nleafs_active
419
420 ! time lapses in one loop
421 dt_loop=mpi_wtime()-time_before_advance
422 end do time_evol
423
424 if(use_particles) then
425 call write_particle_output()
426 call finish_gridvars()
427 end if
428
429 time_advance=.false.
430
431 timeloop=mpi_wtime()-timeloop0
432
433 if (mype==0) then
434 write(*,'(a,f12.3,a)')' Total timeloop took : ',timeloop,' sec'
435 write(*,'(a,f12.3,a)')' Time spent on AMR : ',timegr_tot,' sec'
436 write(*,'(a,f12.2,a)')' Percentage: ',100.0*timegr_tot/timeloop,' %'
437 write(*,'(a,f12.3,a)')' Time spent on IO in loop : ',timeio_tot,' sec'
438 write(*,'(a,f12.2,a)')' Percentage: ',100.0*timeio_tot/timeloop,' %'
439 write(*,'(a,f12.3,a)')' Time spent on ghost cells : ',time_bc,' sec'
440 write(*,'(a,f12.2,a)')' Percentage: ',100.0*time_bc/timeloop,' %'
442 write(*,'(a,f12.3,a)')' Time spent on eos : ',timeeos_tot,' sec'
443 write(*,'(a,f12.2,a)')' Percentage: ',100.0*timeeos_tot/timeloop,' %'
444 write(*,'(a,f12.3,a)')' - update_eos : ',timeeos_update,' sec'
445 write(*,'(a,f12.3,a)')' - T_from_eint (TC) : ',timeeos_tfromei,' sec'
446 write(*,'(a,f12.3,a)')' - csound2 : ',timeeos_csound,' sec'
447 write(*,'(a,f12.3,a)')' - cons/prim conversion : ',timeeos_conv,' sec'
448 write(*,'(a,f12.3,a)')' - get_pthermal : ',timeeos_pthermal,' sec'
449 write(*,'(a,f12.3,a)')' Time spent on WB transform : ',time_wb_transform,' sec'
450 write(*,'(a,f12.3,a)')' Time spent on WB inverse+C : ',time_wb_inverse,' sec'
451 write(*,'(a,f12.3,a)')' Time spent on reconstruction:',time_wb_recon,' sec'
452 write(*,'(a,f12.3,a)')' Time spent on computing : ',timeloop-timeio_tot-timeeos_tot-timegr_tot-time_bc,' sec'
453 write(*,'(a,f12.2,a)')' Percentage: ',100.0*(timeloop-timeio_tot-timeeos_tot-timegr_tot-time_bc)/timeloop,' %'
454 write(*,'(a,es12.3 )')' Cells updated / proc / sec : ',dble(ncells_update)*dble(nstep)/dble(npe)/timeloop
455 end if
456
457 ! output end state
458 timeio0=mpi_wtime()
459 do ifile=nfile,1,-1
460 if(itsavelast(ifile)<it) call saveamrfile(ifile)
461 end do
462 if (mype==0) call mpi_file_close(log_fh,ierrmpi)
463 timeio_tot=timeio_tot+(mpi_wtime()-timeio0)
464
465 if (mype==0) then
466 write(*,'(a,f12.3,a)')' Total time spent on IO : ',timeio_tot,' sec'
467 write(*,'(a,f12.3,a)')' Total timeintegration took : ',mpi_wtime()-time_in,' sec'
468 write(*, '(A4,I10,ES12.3,ES12.3,ES12.3)') " #", &
470 end if
471
472 {#IFDEF RAY
473 call time_spent_on_rays
474 }
475
476 if(use_particles) call time_spent_on_particles
477
478 if (use_multigrid) call mg_timers_show(mg)
479 end subroutine timeintegration
480
481 !> Save times are defined by either tsave(isavet(ifile),ifile) or
482 !> itsave(isaveit(ifile),ifile) or dtsave(ifile) or ditsave(ifile)
483 !> tsavestart(ifile) determines first start time. This only affects
484 !> read out times determined by dtsave(ifiles).
485 !> Other conditions may be included.
486 logical function timetosave(ifile)
488
489 integer:: ifile
490 logical:: oksave
491
492 oksave=.false.
493 if (it==itsave(isaveit(ifile),ifile)) then
494 oksave=.true.
495 isaveit(ifile)=isaveit(ifile)+1
496 end if
497 if (it==itsavelast(ifile)+ditsave(ifile)) oksave=.true.
498
499 if (global_time>=tsave(isavet(ifile),ifile).and.global_time-dt<tsave(isavet(ifile),ifile)) then
500 oksave=.true.
501 isavet(ifile)=isavet(ifile)+1
502 end if
503
504 if(global_time>=tsavestart(ifile)-smalldouble)then
505 if (global_time>=tsavelast(ifile)+dtsave(ifile)-smalldouble)then
506 oksave=.true.
507 n_saves(ifile) = n_saves(ifile) + 1
508 endif
509 endif
510
511 if (oksave) then
512 tsavelast(ifile) =global_time
513 itsavelast(ifile)=it
514 end if
515 timetosave=oksave
516
517 return
518 end function timetosave
519
520 !> Return true if the AMR grid should not be adapted any more. This is
521 !> controlled by tfixgrid or itfixgrid. Other conditions may be included.
522 logical function fixgrid()
524
525 fixgrid= (global_time>=tfixgrid .or. it>=itfixgrid)
526 end function fixgrid
527
528end program amrvac
program amrvac
AMRVAC solves a set of hyperbolic equations using adaptive mesh refinement.
Definition amrvac.t:4
subroutine timeintegration()
eos_init is called prior to physics module
Definition amrvac.t:214
Module containing all the time stepping schemes.
Definition mod_advance.t:2
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.
Definition mod_advance.t:23
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.
Module to coarsen and refine grids for AMR.
subroutine, public amr_rebalance
Cost-weighted rebalance without refine/coarsen. For static/uniform grids (refine_max_level=1) amr_coa...
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()
Definition mod_convert.t:32
Definition mod_dt.t:1
subroutine, public setdt()
setdt - set dt for all levels between levmin and levmax. dtpar>0 --> use fixed dtpar for all level dt...
Definition mod_dt.t:11
Equation of state for AMRVAC, handled through a single eos_container object.
Definition mod_eos.t:30
subroutine, public eos_init()
Phase 'create' (before units are known): allocate the EoS object, read its &eos_list parameters,...
Definition mod_eos.t:235
subroutine, public eos_finalise()
Phase 'commit' (after units are known): finalise the dispatch for the loaded physics – wire the metho...
Definition mod_eos.t:265
subroutine, public prepare_eos_w_fields()
Definition mod_eos.t:283
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.
Definition mod_forest.t:2
integer nleafs_active
Definition mod_forest.t:78
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.
logical lb_automatic
Cost-weighted automatic load balancer toggle (off by default). When .true., the SFC partitioner cuts ...
double precision, dimension(nfile) dtsave
Repeatedly save output of type N when dtsave(N) simulation time has passed.
integer lb_interval
Rebalance every lb_interval cycles when lb_automatic is on.
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.
logical save_now
whether a manually inserted snapshot is saved
Module for reading input and writing output.
subroutine saveamrfile(ifile)
subroutine read_arguments()
Read the command line arguments passed to amrvac.
subroutine read_snapshot
Routine to read in snapshots (.dat files). When it cannot recognize the file version,...
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...
Definition mod_physics.t:4
procedure(sub_check_params), pointer phys_bind_eos_to_source
Definition mod_physics.t:53
procedure(sub_special_advance), pointer phys_special_advance
Definition mod_physics.t:75
subroutine, public selectgrids
Module for handling split source terms (split from the fluxes)
Definition mod_source.t:2
double precision, save, public time_sts_total
Definition mod_source.t:14
double precision tw_eos_hydro_prev
Definition mod_timing.t:25
double precision time_wb_inverse
Definition mod_timing.t:16
double precision tw_process
Definition mod_timing.t:23
double precision tw_advance
Definition mod_timing.t:21
double precision tw_regrid
Definition mod_timing.t:22
integer timing_log_interval
Write timing log every N iterations (default 10)
Definition mod_timing.t:34
integer ittimelast
Definition mod_timing.t:28
double precision timegr_tot
Definition mod_timing.t:9
double precision time_htc_total
Definition mod_timing.t:27
double precision tw_save
Definition mod_timing.t:22
double precision timeio_tot
Definition mod_timing.t:8
double precision time_in
Definition mod_timing.t:8
double precision tw_eos_tc
Definition mod_timing.t:26
double precision tw_eos_hydro
Definition mod_timing.t:25
double precision tw_tmp
Definition mod_timing.t:24
double precision time_wb_recon
Definition mod_timing.t:17
double precision timelast
Definition mod_timing.t:20
double precision timeeos_update
Definition mod_timing.t:11
integer, parameter timing_unit
Definition mod_timing.t:29
double precision tw_setdt
Definition mod_timing.t:21
logical write_timing_log
Enable writing of detailed timing breakdown log (set via savelist)
Definition mod_timing.t:32
double precision timeeos_pthermal
Definition mod_timing.t:14
double precision timeio0
Definition mod_timing.t:8
double precision timeloop
Definition mod_timing.t:9
double precision timeloop0
Definition mod_timing.t:9
double precision tw_tc_total
Definition mod_timing.t:23
double precision tw_tc_prev
Definition mod_timing.t:24
double precision timeeos_tot
Definition mod_timing.t:10
double precision timeeos_conv
Definition mod_timing.t:13
double precision time_wb_transform
Definition mod_timing.t:16
double precision timeeos_csound
Definition mod_timing.t:12
double precision tw_eos_tc_prev
Definition mod_timing.t:26
logical timing_log_opened
Definition mod_timing.t:30
double precision timeeos_tfromei
Definition mod_timing.t:15
double precision timegr0
Definition mod_timing.t:9
subroutine, public initialize_trac_after_settree
Definition mod_trac.t:873
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.