12 subroutine fd(qdt,dtfactor,ixI^L,ixO^L,idims^LIM,qtC,sCT,qt,snew,fC,fE,dxs,x)
19 double precision,
intent(in) :: qdt, dtfactor, qtc, qt, dxs(
ndim)
20 integer,
intent(in) :: ixi^
l, ixo^
l, idims^lim
21 double precision,
dimension(ixI^S,1:ndim),
intent(in) :: x
23 type(state) :: sct, snew
24 double precision,
dimension(ixI^S,1:nwflux,1:ndim),
intent(out) :: fc
25 double precision,
dimension(ixI^S,sdim:3) :: fe
27 double precision,
dimension(ixI^S,1:nwflux) :: fct
28 double precision,
dimension(ixI^S,1:nw) :: fm, fp, fmr, fpl, wprim
30 double precision,
dimension(ixI^S,1:nw) :: wlc, wrc
32 double precision,
dimension(ixI^S,1:nw) :: wlp, wrp
33 double precision,
dimension(ixI^S) :: cmaxc, cminc
34 double precision,
dimension(ixI^S) :: hspeed
35 double precision,
dimension(ixO^S) :: inv_volume
36 double precision,
dimension(1:ndim) :: dxinv
37 logical :: transport, active
38 integer :: idims, iw, ixc^
l, ix^
l, hxo^
l, kxc^
l, kxr^
l
39 type(ct_velocity) :: vcts
41 associate(wct=>sct%w,wnew=>snew%w)
56 hxo^
l=ixo^
l-
kr(idims,^
d);
62 kxcmin^
d=iximin^
d; kxcmax^
d=iximax^
d-
kr(idims,^
d);
63 kxr^
l=kxc^
l+
kr(idims,^
d);
68 wrp(kxc^s,1:nw)=wprim(kxr^s,1:nw)
69 wlp(kxc^s,1:nw)=wprim(kxc^s,1:nw)
72 ixcmax^
d=ixomax^
d; ixcmin^
d=hxomin^
d;
87 fc(ixc^s,iwstart:nwflux,idims) = fpl(ixc^s,iwstart:nwflux) + fmr(ixc^s,iwstart:nwflux)
91 call reconstruct_lr(ixi^
l,ixc^
l,ixc^
l,idims,wprim,wlc,wrc,wlp,wrp,x,dxs(idims))
95 call phys_get_cbounds(wlc,wrc,wlp,wrp,x,ixi^
l,ixc^
l,idims,hspeed,cmaxc,cminc)
107 hxo^
l=ixo^
l-
kr(idims,^
d);
110 fc(ixi^s,iw,idims) = -
block%dt(ixi^s)*dtfactor/dxs(idims) * fc(ixi^s,iw,idims)
111 wnew(ixo^s,iw)=wnew(ixo^s,iw)+(fc(ixo^s,iw,idims)-fc(hxo^s,iw,idims))
115 fc(ixi^s,iw,idims) = dxinv(idims) * fc(ixi^s,iw,idims)
116 wnew(ixo^s,iw)=wnew(ixo^s,iw)+(fc(ixo^s,iw,idims)-fc(hxo^s,iw,idims))
121 inv_volume=1.d0/
block%dvolume(ixo^s)
123 hxo^
l=ixo^
l-
kr(idims,^
d);
126 fc(ixi^s,iw,idims)=-
block%dt(ixi^s)*dtfactor*fc(ixi^s,iw,idims)*
block%surfaceC(ixi^s,idims)
127 wnew(ixo^s,iw)=wnew(ixo^s,iw)+ &
128 (fc(ixo^s,iw,idims)-fc(hxo^s,iw,idims))*inv_volume(ixo^s)
132 fc(ixi^s,iw,idims)=-qdt*fc(ixi^s,iw,idims)*
block%surfaceC(ixi^s,idims)
133 wnew(ixo^s,iw)=wnew(ixo^s,iw)+ &
134 (fc(ixo^s,iw,idims)-fc(hxo^s,iw,idims))*inv_volume(ixo^s)
150 dtfactor*dble(idimsmax-idimsmin+1)/dble(
ndim), &
151 ixi^
l,ixo^
l,1,nw,qtc,wct,wprim,qt,wnew,x,.false.,active)
163 integer,
intent(in) :: ixI^L, iL^L, idims
164 double precision,
intent(in) :: w(ixI^S,1:nw)
166 double precision,
intent(out) :: wLC(ixI^S,1:nw)
168 double precision :: ldw(ixI^S), dwC(ixI^S)
169 integer :: jxR^L, ixC^L, jxC^L, kxC^L, iw
170 double precision :: a2max
176 call weno5limiterl(ixi^l,il^l,idims,w,wlc,1)
178 call weno5nmlimiterl(ixi^l,il^l,idims,w,wlc,1)
180 call weno5limiterl(ixi^l,il^l,idims,w,wlc,2)
182 call weno5nmlimiterl(ixi^l,il^l,idims,w,wlc,2)
184 call weno5limiterl(ixi^l,il^l,idims,w,wlc,3)
186 call weno5nmlimiterl(ixi^l,il^l,idims,w,wlc,3)
189 kxcmin^
d=iximin^
d; kxcmax^
d=iximax^
d-
kr(idims,^
d);
191 wlc(kxc^s,iwstart:nwflux) = w(kxc^s,iwstart:nwflux)
193 jxr^l=il^l+
kr(idims,^
d);
195 ixcmax^
d=jxrmax^
d; ixcmin^
d=ilmin^
d-
kr(idims,^
d);
196 jxc^l=ixc^l+
kr(idims,^
d);
199 dwc(ixc^s)=w(jxc^s,iw)-w(ixc^s,iw)
216 call mpistop(
"idims is wrong in mod_limiter")
222 wlc(il^s,iw)=wlc(il^s,iw)+half*ldw(il^s)
234 integer,
intent(in) :: ixI^L, iL^L, idims
235 double precision,
intent(in) :: w(ixI^S,1:nw)
237 double precision,
intent(out) :: wRC(ixI^S,1:nw)
239 double precision :: rdw(ixI^S), dwC(ixI^S)
240 integer :: jxR^L, ixC^L, jxC^L, kxC^L, kxR^L, iw
241 double precision :: a2max
247 call weno5limiterr(ixi^l,il^l,idims,w,wrc,1)
249 call weno5nmlimiterr(ixi^l,il^l,idims,w,wrc,1)
251 call weno5limiterr(ixi^l,il^l,idims,w,wrc,2)
253 call weno5nmlimiterr(ixi^l,il^l,idims,w,wrc,2)
255 call weno5limiterr(ixi^l,il^l,idims,w,wrc,3)
257 call weno5nmlimiterr(ixi^l,il^l,idims,w,wrc,3)
260 kxcmin^
d=iximin^
d; kxcmax^
d=iximax^
d-
kr(idims,^
d);
261 kxr^l=kxc^l+
kr(idims,^
d);
263 wrc(kxc^s,iwstart:nwflux)=w(kxr^s,iwstart:nwflux)
265 jxr^l=il^l+
kr(idims,^
d);
266 ixcmax^
d=jxrmax^
d; ixcmin^
d=ilmin^
d-
kr(idims,^
d);
267 jxc^l=ixc^l+
kr(idims,^
d);
270 dwc(ixc^s)=w(jxc^s,iw)-w(ixc^s,iw)
287 call mpistop(
"idims is wrong in mod_limiter")
293 wrc(il^s,iw)=wrc(il^s,iw)-half*rdw(jxr^s)
299 subroutine centdiff(method,qdt,dtfactor,ixI^L,ixO^L,idims^LIM,qtC,sCT,qt,s,fC,fE,dxs,x)
314 integer,
intent(in) :: method
315 integer,
intent(in) :: ixi^
l, ixo^
l, idims^lim
316 double precision,
intent(in) :: qdt, dtfactor, qtc, qt, dxs(
ndim)
317 type(state) :: sct, s
318 double precision,
intent(in) :: x(ixi^s,1:
ndim)
320 double precision :: fe(ixi^s,
sdim:3)
322 double precision :: v(ixi^s,
ndim), f(ixi^s,
nwflux)
324 double precision,
dimension(ixI^S,1:nw) :: wprim, wlc, wrc
326 double precision,
dimension(ixI^S,1:nw) :: wlp, wrp
327 double precision,
dimension(ixI^S) :: vlc, cmaxlc, cmaxrc
328 double precision,
dimension(ixI^S,1:number_species) :: cmaxc
329 double precision,
dimension(ixI^S,1:number_species) :: cminc
330 double precision,
dimension(ixI^S) :: hspeed
331 double precision,
dimension(ixO^S) :: inv_volume
333 double precision :: dxinv(1:
ndim)
334 integer :: idims, iw, ix^
l, hxo^
l, ixc^
l, jxc^
l, hxc^
l, kxc^
l, kkxc^
l, kkxr^
l
335 type(ct_velocity) :: vcts
336 logical :: transport, new_cmax, patchw(ixi^s), active
338 associate(wct=>sct%w,w=>s%w)
342 ix^
l=ix^
l^ladd2*
kr(idims,^
d);
345 if (ixi^
l^ltix^
l|.or.|.or.)
then
346 call mpistop(
"Error in centdiff: Non-conforming input limits")
357 ix^
l=ixo^
l^ladd2*
kr(idims,^
d);
358 hxo^
l=ixo^
l-
kr(idims,^
d);
368 ixcmax^
d=ixomax^
d; ixcmin^
d=hxomin^
d;
370 hxc^
l=ixc^
l-
kr(idims,^
d);
371 jxc^
l=ixc^
l+
kr(idims,^
d);
372 kxc^
l=ixc^
l+2*
kr(idims,^
d);
374 kkxcmin^
d=iximin^
d; kkxcmax^
d=iximax^
d-
kr(idims,^
d);
375 kkxr^
l=kkxc^
l+
kr(idims,^
d);
380 call reconstruct_lr(ixi^
l,ixc^
l,ixc^
l,idims,wprim,wlc,wrc,wlp,wrp,x,dxs(idims))
386 call phys_get_cbounds(wlc,wrc,wlp,wrp,x,ixi^
l,ixc^
l,idims,hspeed,cmaxc,cminc)
394 vlc(ixc^s)=max(cmaxrc(ixc^s),cmaxlc(ixc^s))
399 if(method==
fs_cd)
then
408 fc(ixc^s,iw,idims)=fc(ixc^s,iw,idims)-
tvdlfeps*half*vlc(ixc^s) &
409 *(wrc(ixc^s,iw)-wlc(ixc^s,iw))
421 hxo^
l=ixo^
l-
kr(idims,^
d);
424 fc(ixi^s,iw,idims)=-
block%dt(ixi^s)*dtfactor/dxs(idims)*fc(ixi^s,iw,idims)
426 w(ixo^s,iw)=w(ixo^s,iw)+(fc(ixo^s,iw,idims)-fc(hxo^s,iw,idims))
430 fc(ixi^s,iw,idims)=dxinv(idims)*fc(ixi^s,iw,idims)
432 w(ixo^s,iw)=w(ixo^s,iw)+(fc(ixo^s,iw,idims)-fc(hxo^s,iw,idims))
437 inv_volume=1.d0/
block%dvolume
439 hxo^
l=ixo^
l-
kr(idims,^
d);
442 fc(ixi^s,iw,idims)=-
block%dt(ixi^s)*dtfactor*
block%surfaceC(ixi^s,idims)*fc(ixi^s,iw,idims)
443 w(ixo^s,iw)=w(ixo^s,iw)+ &
444 (fc(ixo^s,iw,idims)-fc(hxo^s,iw,idims))*inv_volume(ixo^s)
448 fc(ixi^s,iw,idims)=-qdt*
block%surfaceC(ixi^s,idims)*fc(ixi^s,iw,idims)
449 w(ixo^s,iw)=w(ixo^s,iw)+ &
450 (fc(ixo^s,iw,idims)-fc(hxo^s,iw,idims))*inv_volume(ixo^s)
466 dtfactor*dble(idimsmax-idimsmin+1)/dble(
ndim), &
467 ixi^
l,ixo^
l,1,
nw,qtc,wct,wprim,qt,w,x,.false.,active)
subroutine, public mpistop(message)
Exit MPI-AMRVAC with an error message.
Module with finite difference methods for fluxes.
subroutine, public centdiff(method, qdt, dtfactor, ixIL, ixOL, idimsLIM, qtC, sCT, qt, s, fC, fE, dxs, x)
subroutine reconstructr(ixIL, iLL, idims, w, wRC)
subroutine reconstructl(ixIL, iLL, idims, w, wLC)
subroutine, public fd(qdt, dtfactor, ixIL, ixOL, idimsLIM, qtC, sCT, qt, snew, fC, fE, dxs, x)
Module with finite volume methods for fluxes.
subroutine, public reconstruct_lr(ixIL, ixLL, ixRL, idims, w, wLC, wRC, wLp, wRp, x, dxdim)
Determine the upwinded wLC(ixL) and wRC(ixR) from w. the wCT is only used when PPM is exploited.
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.
logical h_correction
If true, do H-correction to fix the carbuncle problem at grid-aligned shocks.
double precision tvdlfeps
integer, dimension(3, 3) kr
Kronecker delta tensor.
integer, parameter ndim
Number of spatial dimensions for grid variables.
logical stagger_grid
True for using stagger grid.
double precision cmax_global
global fastest wave speed needed in fd scheme and glm method
integer b0i
background magnetic field location indicator
integer, dimension(:), allocatable, parameter d
logical local_timestep
each cell has its own timestep or not
logical need_global_a2max
global value for schmid scheme
logical slab
Cartesian geometry or not.
integer, dimension(:), allocatable type_limiter
Type of slope limiter used for reconstructing variables on cell edges.
integer nghostcells
Number of ghost cells surrounding a grid.
integer, parameter sdim
starting dimension for electric field
logical slab_uniform
uniform Cartesian geometry or not (stretched Cartesian)
double precision, dimension(ndim) a2max_global
global largest a2 for schmid scheme
Module with slope/flux limiters.
subroutine dwlimiter2(dwC, ixIL, ixCL, idims, typelim, ldw, rdw, a2max)
Limit the centered dwC differences within ixC for iw in direction idim. The limiter is chosen accordi...
integer, parameter limiter_wenozp5
integer, parameter limiter_weno5
integer, parameter limiter_wenoz5
integer, parameter limiter_wenoz5nm
integer, parameter limiter_wenozp5nm
integer, parameter limiter_mp5
integer, parameter limiter_weno5nm
Module containing the MP5 (fifth order) flux scheme.
subroutine, public mp5limiterr(ixIL, iLL, idims, w, wRC)
subroutine, public mp5limiterl(ixIL, iLL, idims, w, wLC)
This module defines the procedures of a physics module. It contains function pointers for the various...
procedure(sub_get_ct_velocity), pointer phys_get_ct_velocity
procedure(sub_convert), pointer phys_to_primitive
procedure(sub_small_values), pointer phys_handle_small_values
procedure(sub_get_flux), pointer phys_get_flux
procedure(sub_get_cbounds), pointer phys_get_cbounds
procedure(sub_add_source_geom), pointer phys_add_source_geom
procedure(sub_update_faces), pointer phys_update_faces
procedure(sub_face_to_center), pointer phys_face_to_center
procedure(sub_get_h_speed), pointer phys_get_h_speed
procedure(sub_get_cmax), pointer phys_get_cmax
Module for handling split source terms (split from the fluxes)
subroutine, public addsource2(qdt, dtfactor, ixIL, ixOL, iwLIM, qtC, wCT, wCTprim, qt, w, x, qsourcesplit, src_active)
Add source within ixO for iws: w=w+qdt*S[wCT].
Module with all the methods that users can customize in AMRVAC.
integer nw
Total number of variables.
integer nwflux
Number of flux variables.