8 logical :: fix_conserve_at_step = .true.
22 integer,
intent(in) :: iit
24 integer :: iigrid, igrid, idimsplit
28 do iigrid=1,igridstail; igrid=igrids(iigrid);
29 pso(igrid)%w=ps(igrid)%w
45 call advect(idimsplit,idimsplit)
50 do idimsplit=
ndim,1,-1
51 call advect(idimsplit,idimsplit)
74 integer,
intent(in) :: idim^LIM
75 integer :: iigrid, igrid
82 do iigrid=1,igridstail; igrid=igrids(iigrid);
83 ps1(igrid)%w=ps(igrid)%w
103 do iigrid=1,igridstail; igrid=igrids(iigrid);
104 ps1(igrid)%w=ps(igrid)%w
111 call mpistop(
"unkown onestep time_integrator in advect")
119 fix_conserve_at_step = .false.
129 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
130 ps(igrid)%w = ps(igrid)%w+
rk_b1*(ps1(igrid)%w-ps(igrid)%w)/
rk_a21
140 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
141 ps(igrid)%w = half*ps(igrid)%w+half*ps1(igrid)%w
142 if(
stagger_grid) ps(igrid)%ws = half*ps(igrid)%ws+half*ps1(igrid)%ws
149 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
150 ps2(igrid)%w = ps(igrid)%w
157 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
158 ps(igrid)%w = ps(igrid)%w+2.0d0*(ps2(igrid)%w-ps1(igrid)%w)
159 if(
stagger_grid) ps(igrid)%ws = ps(igrid)%ws+2.0d0*(ps2(igrid)%ws-ps1(igrid)%ws)
167 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
168 ps2(igrid)%w = half*(ps(igrid)%w+ps1(igrid)%w)
169 if(
stagger_grid) ps2(igrid)%ws = half*(ps(igrid)%ws+ps1(igrid)%ws)
174 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
175 ps1(igrid)%w = ps1(igrid)%w+half*
dt*ps(igrid)%w
176 if(
stagger_grid) ps1(igrid)%ws = ps1(igrid)%ws+half*
dt*ps(igrid)%ws
180 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
181 ps(igrid)%w = ps2(igrid)%w+half*
dt*ps(igrid)%w
182 if(
stagger_grid) ps(igrid)%ws = ps2(igrid)%ws+half*
dt*ps(igrid)%ws
188 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
189 ps(igrid)%w = ps(igrid)%w+ps2(igrid)%w-ps1(igrid)%w
190 if(
stagger_grid) ps(igrid)%ws = ps(igrid)%ws+ps2(igrid)%ws-ps1(igrid)%ws
204 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
205 ps2(igrid)%w = ps(igrid)%w
218 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
224 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
225 ps(igrid)%w = half*(ps(igrid)%w + ps1(igrid)%w + ps2(igrid)%w)
226 if(
stagger_grid) ps(igrid)%ws = half*(ps(igrid)%ws + ps1(igrid)%ws + ps2(igrid)%ws)
230 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
231 ps1(igrid)%w = ps1(igrid)%w + (1.0d0 - 2.0d0*
imex222_lambda)*ps2(igrid)%w
239 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
240 ps2(igrid)%w = 2.0d0*ps2(igrid)%w - ps1(igrid)%w -
imex222_lambda*ps2(igrid)%w
249 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
250 ps(igrid)%w = ps(igrid)%w + (ps2(igrid)%w - ps1(igrid)%w) / (2.0d0 *
imex222_lambda)
258 call mpistop(
"unkown twostep time_integrator in advect")
267 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
274 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
285 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
286 ps3(igrid)%w=(ps1(igrid)%w-ps(igrid)%w)/
rk3_a21
291 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
292 ps2(igrid)%w=ps(igrid)%w+
rk3_a31*ps3(igrid)%w
298 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
299 ps(igrid)%w=ps(igrid)%w+
rk3_b1*ps3(igrid)%w &
302 ps(igrid)%ws=ps(igrid)%ws+
rk3_b1*ps3(igrid)%ws &
313 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
314 ps4(igrid)%w=(ps1(igrid)%w-ps(igrid)%w)/
ars_gamma
320 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
321 ps1(igrid)%w=(ps2(igrid)%w-ps1(igrid)%w)/
ars_gamma
326 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
327 ps3(igrid)%w=ps(igrid)%w+(
ars_gamma-1.0d0)*ps4(igrid)%w+(1.0d0-2.0d0*
ars_gamma)*ps1(igrid)%w
329 ps3(igrid)%ws=ps(igrid)%ws+(
ars_gamma-1.0d0)*ps4(igrid)%ws+(1.0d0-2.0d0*
ars_gamma)*ps1(igrid)%ws
335 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
336 ps2(igrid)%w=ps1(igrid)%w+(ps3(igrid)%w-(ps(igrid)%w+ &
339 ps2(igrid)%ws=ps1(igrid)%ws+(ps3(igrid)%ws-(ps(igrid)%ws+ &
346 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
347 ps(igrid)%w=ps(igrid)%w+half*ps2(igrid)%w &
348 +half*(ps4(igrid)%w-ps3(igrid)%w)/
ars_gamma
350 ps(igrid)%ws=ps(igrid)%ws+half*ps2(igrid)%ws &
351 +half*(ps4(igrid)%ws-ps3(igrid)%ws)/
ars_gamma
361 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
362 ps4(igrid)%w=(ps1(igrid)%w-ps(igrid)%w)/
imex_a21
363 ps3(igrid)%w=ps(igrid)%w
365 ps4(igrid)%ws=(ps1(igrid)%ws-ps(igrid)%ws)/
imex_a21
366 ps3(igrid)%ws=ps(igrid)%ws
372 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
373 ps1(igrid)%w=ps1(igrid)%w+
imex_ha21*
dt*ps3(igrid)%w
380 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
381 ps(igrid)%w=ps(igrid)%w+
imex_a31*ps4(igrid)%w &
384 ps(igrid)%ws=ps(igrid)%ws+
imex_a31*ps4(igrid)%ws &
390 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
391 ps3(igrid)%w=ps1(igrid)%w-
imex_a21*ps4(igrid)%w &
394 ps3(igrid)%ws=ps1(igrid)%ws-
imex_a21*ps4(igrid)%ws &
401 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
405 ps2(igrid)%ws=(ps(igrid)%ws-ps3(igrid)%ws-
imex_a31*ps4(igrid)%ws)/
imex_a32 &
411 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
412 ps1(igrid)%w=ps3(igrid)%w+
imex_b1*ps4(igrid)%w+
imex_b2*ps2(igrid)%w
414 ps1(igrid)%ws=ps3(igrid)%ws+
imex_b1*ps4(igrid)%ws+
imex_b2*ps2(igrid)%ws
420 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
421 ps(igrid)%w=ps1(igrid)%w+ps2(igrid)%w-ps(igrid)%w
423 ps(igrid)%ws=ps1(igrid)%ws+ps2(igrid)%ws-ps(igrid)%ws
438 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
439 ps3(igrid)%w = ps(igrid)%w +
imex_a32/
imex_a22 * (ps2(igrid)%w - ps1(igrid)%w)
440 ps(igrid)%w = ps(igrid)%w +
imex_b2 /
imex_a22 * (ps2(igrid)%w - ps1(igrid)%w)
441 ps1(igrid)%w = ps3(igrid)%w
449 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
450 ps(igrid)%w = ps(igrid)%w +
imex_b2 /
imex_ha32 * (ps3(igrid)%w - ps1(igrid)%w)
455 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
456 ps(igrid)%w = ps(igrid)%w +
imex_b3 /
imex_a33 * (ps1(igrid)%w - ps3(igrid)%w)
463 call mpistop(
"unkown threestep time_integrator in advect")
476 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
483 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
490 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
500 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
501 ps2(igrid)%w=ps(igrid)%w
502 ps3(igrid)%w=ps(igrid)%w
504 ps2(igrid)%ws=ps(igrid)%ws
505 ps3(igrid)%ws=ps(igrid)%ws
513 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
514 ps(igrid)%w=(1.0d0/3.0d0)*(-ps(igrid)%w+ps1(igrid)%w+2.0d0*ps2(igrid)%w+ps3(igrid)%w)
516 *(-ps(igrid)%ws+ps1(igrid)%ws+2.0d0*ps2(igrid)%ws+ps3(igrid)%ws)
522 call mpistop(
"unkown fourstep time_integrator in advect")
532 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
539 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
546 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
552 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
559 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
560 ps(igrid)%w=ps3(igrid)%w+
rk_alfa55*ps2(igrid)%w &
563 ps(igrid)%ws=ps3(igrid)%ws+
rk_alfa55*ps2(igrid)%ws &
572 call mpistop(
"unkown fivestep time_integrator in advect")
576 call mpistop(
"unkown time_stepper in advect")
587 type(state),
target :: psa(max_blocks)
588 type(state),
target :: psb(max_blocks)
589 double precision,
intent(in) :: qdt
590 double precision,
intent(in) :: qtC
591 double precision,
intent(in) :: dtfactor
593 integer :: iigrid, igrid
597 do iigrid=1,igridstail; igrid=igrids(iigrid);
598 psa(igrid)%w = psb(igrid)%w
615 type(state),
target :: psa(max_blocks)
616 double precision,
intent(in) :: qtC
625 subroutine advect1(method,dtfactor,idim^LIM,qtC,psa,qt,psb)
631 integer,
intent(in) :: idim^LIM
632 type(state),
target :: psa(max_blocks)
633 type(state),
target :: psb(max_blocks)
634 double precision,
intent(in) :: dtfactor
635 double precision,
intent(in) :: qtC
636 double precision,
intent(in) :: qt
637 integer,
intent(in) :: method(nlevelshi)
639 double precision :: qdt
640 integer :: iigrid, igrid
651 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
656 psa(igrid),qt,psb(igrid),pso(igrid))
671 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
679 do iigrid=1,igridstail_active; igrid=igrids_active(iigrid);
696 integer,
intent(in) :: method
697 integer,
intent(in) :: igrid, ixI^L, idim^LIM
698 double precision,
intent(in) :: qdt, qtC, qt
699 type(state),
target :: sCT, s, sold
702 double precision :: fC(ixI^S,1:nwflux,1:ndim)
704 double precision :: fE(ixI^S,7-2*ndim:3)
706 call advect1_grid(method,qdt,ixi^l,idim^lim,qtc,sct,qt,s,sold,fc,fe,&
723 subroutine advect1_grid(method,qdt,ixI^L,idim^LIM,qtC,sCT,qt,s,sold,fC,fE,dxs,x)
732 integer,
intent(in) :: method
733 integer,
intent(in) :: ixI^L, idim^LIM
734 double precision,
intent(in) :: qdt, qtC, qt, dxs(ndim), x(ixI^S,1:ndim)
735 type(state),
target :: sCT, s, sold
736 double precision :: fC(ixI^S,1:nwflux,1:ndim)
737 double precision :: fE(ixI^S,7-2*ndim:3)
741 ixo^l=ixi^l^lsubnghostcells;
744 call finite_volume(method,qdt,ixi^l,ixo^l,idim^lim,qtc,sct,qt,s,sold,fc,fe,dxs,x)
746 call centdiff(method,qdt,ixi^l,ixo^l,idim^lim,qtc,sct,qt,s,fc,fe,dxs,x)
748 call hancock(qdt,ixi^l,ixo^l,idim^lim,qtc,sct,qt,s,dxs,x)
750 call fd(qdt,ixi^l,ixo^l,idim^lim,qtc,sct,qt,s,fc,fe,dxs,x)
752 call centdiff(
fs_cd,qdt,ixi^l,ixo^l,idim^lim,qtc,sct,qt,s,fc,fe,dxs,x)
753 call tvdlimit(method,qdt,ixi^l,ixo^l,idim^lim,sct,qt+qdt,s,fc,dxs,x)
755 call addsource2(qdt*dble(idimmax-idimmin+1)/dble(ndim),&
756 ixi^l,ixo^l,1,nw,qtc,sct%w,qt,s%w,x,.false.)
760 call mpistop(
"unknown flux scheme in advect1_grid")
774 integer,
intent(in) :: iit
775 double precision,
intent(in):: qt
777 integer:: iigrid, igrid
785 do iigrid=1,igridstail; igrid=igrids(iigrid);
790 qt,ps(igrid)%w,ps(igrid)%x)
808 integer,
intent(in) :: iit
809 double precision,
intent(in):: qt
811 integer:: iigrid, igrid
819 do iigrid=1,igridstail; igrid=igrids(iigrid);
825 qt,ps(igrid)%w,ps(igrid)%x)
subroutine mpistop(message)
Exit MPI-AMRVAC with an error message.
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 advect1(method, dtfactor, idimLIM, qtC, psa, qt, psb)
Integrate all grids by one partial step.
subroutine, public process(iit, qt)
process is a user entry in time loop, before output and advance allows to modify solution,...
subroutine evaluate_implicit(qtC, psa)
Evaluate Implicit part in place, i.e. psa==>F_im(psa)
subroutine global_implicit_update(dtfactor, qdt, qtC, psa, psb)
Implicit global update step within IMEX schemes, advance psa=psb+dtfactor*qdt*F_im(psa)
subroutine advect1_grid(method, qdt, ixIL, idimLIM, qtC, sCT, qt, s, sold, fC, fE, dxs, x)
Advance a single grid over one partial time step.
subroutine advect(idimLIM)
Advance all grids over one time step, but without taking dimensional splitting or split source terms ...
subroutine process1_grid(method, igrid, qdt, ixIL, idimLIM, qtC, sCT, qt, s, sold)
Prepare to advance a single grid over one partial time step.
Module with finite difference methods for fluxes.
subroutine, public fd(qdt, ixIL, ixOL, idimsLIM, qtC, sCT, qt, snew, fC, fE, dxs, x)
subroutine, public centdiff(method, qdt, ixIL, ixOL, idimsLIM, qtC, sCT, qt, s, fC, fE, dxs, x)
Module with finite volume methods for fluxes.
subroutine, public finite_volume(method, qdt, ixIL, ixOL, idimsLIM, qtC, sCT, qt, snew, sold, fC, fE, dxs, x)
finite volume method
subroutine, public hancock(qdt, ixIL, ixOL, idimsLIM, qtC, sCT, qt, snew, dxs, x)
The non-conservative Hancock predictor for TVDLF.
Module for flux conservation near refinement boundaries.
subroutine, public recvflux(idimLIM)
subroutine, public fix_edges(psuse, idimLIM)
subroutine, public sendflux(idimLIM)
subroutine, public fix_conserve(psb, idimLIM, nw0, nwfluxin)
subroutine, public store_edge(igrid, ixIL, fE, idimLIM)
subroutine, public init_comm_fix_conserve(idimLIM, nwfluxin)
subroutine, public store_flux(igrid, fC, idimLIM, nwfluxin)
update ghost cells of all blocks including physical boundaries
subroutine getbc(time, qdt, psb, nwstart, nwbc, req_diag)
do update ghost cells of all blocks including physical boundaries
This module contains definitions of global parameters and variables and some generic functions/subrou...
type(state), pointer block
Block pointer for using one block and its previous state.
integer, parameter ssprk4
integer, dimension(:), allocatable typepred1
The spatial discretization for the predictor step when using a two step PC method.
integer, parameter fs_tvdlf
double precision rk_alfa41
double precision imex_a32
integer, parameter fs_hlld
integer, parameter imex_euler
integer, parameter fs_tvd
double precision rk_beta55
double precision global_time
The global simulation time.
double precision rk_alfa22
integer istep
Index of the sub-step in a multi-step time integrator.
integer, parameter threestep
integer, parameter imex_232
double precision rk_alfa55
double precision rk_beta22
integer, parameter fivestep
double precision imex_ha32
double precision ars_gamma
IMEX_ARS3 parameter ars_gamma.
integer, parameter fs_hllcd
integer, parameter ndim
Number of spatial dimensions for grid variables.
integer, parameter ssprk5
logical stagger_grid
True for using stagger grid.
integer, parameter imex_ars3
logical use_particles
Use particles module or not.
integer, parameter fs_tvdmu
double precision rk_alfa54
integer, parameter imex_trapezoidal
integer, parameter plevel_
integer, dimension(:), allocatable, parameter d
double precision rk_alfa21
double precision imex222_lambda
IMEX-222(lambda) one-parameter family of schemes.
integer, dimension(:), allocatable flux_method
Which flux scheme of spatial discretization to use (per grid level)
integer, parameter fs_nul
double precision rk_beta54
integer, parameter rk2_alf
integer, parameter fs_hll
flux schemes
double precision rk_beta11
double precision, dimension(:,:), allocatable rnode
Corner coordinates.
double precision rk_alfa31
integer, parameter imex_sp
double precision rk_alfa44
double precision imex_ha22
double precision imex_a31
integer, parameter twostep
integer, parameter onestep
double precision rk_a21
RK2(alfa) method parameters from Butcher tableau.
integer, parameter predictor_corrector
integer, parameter forward_euler
logical fix_conserve_global
Whether to apply flux conservation at refinement boundaries.
character(len=std_len) typedimsplit
double precision rk_alfa53
double precision imex_ha21
integer, parameter ssprk3
integer t_stepper
time stepper type
integer, parameter fs_cd4
integer, parameter rk3_bt
integer, parameter fourstep
double precision imex_a21
integer, parameter rnodehi
grid location info (corner coordinates and grid spacing)
integer, parameter fs_hllc
double precision imex_a22
IMEX_CB3a extra parameters.
integer, parameter imex_cb3a
integer, parameter imex_222
double precision imex_a33
integer t_integrator
time integrator method
integer, parameter fs_hancock
integer, dimension(:,:), allocatable node
integer, parameter ssprk2
double precision rk_alfa33
integer, parameter fs_source
double precision, dimension(ndim) dxlevel
integer, parameter imex_midpoint
double precision rk_beta33
double precision rk_beta44
Module containing all the particle routines.
This module defines the procedures of a physics module. It contains function pointers for the various...
procedure(sub_evaluate_implicit), pointer phys_evaluate_implicit
logical phys_req_diagonal
Whether the physics routines require diagonal ghost cells, for example for computing a curl.
logical phys_solve_eaux
Solve internal energy and total energy equations.
procedure(sub_energy_synchro), pointer phys_energy_synchro
procedure(sub_implicit_update), pointer phys_implicit_update
procedure(sub_face_to_center), pointer phys_face_to_center
procedure(sub_special_advance), pointer phys_special_advance
Module for handling split source terms (split from the fluxes)
subroutine, public addsource2(qdt, ixIL, ixOL, iwLIM, qtC, wCT, qt, w, x, qsourcesplit, src_active, wCTprim)
Add source within ixO for iws: w=w+qdt*S[wCT].
subroutine, public add_split_source(prior)
Subroutines for TVD-MUSCL schemes.
subroutine, public tvdlimit(method, qdt, ixIL, ixOL, idimLIM, s, qt, snew, fC, dxs, x)
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(process_global), pointer usr_process_global
procedure(process_adv_global), pointer usr_process_adv_global