mod_finite_volume_srhd Module

Module with finite volume methods for fluxes


Uses

  • module~~mod_finite_volume_srhd~~UsesGraph module~mod_finite_volume_srhd mod_finite_volume_srhd mod_physics_vars mod_physics_vars module~mod_finite_volume_srhd->mod_physics_vars module~mod_global_parameters mod_global_parameters module~mod_finite_volume_srhd->module~mod_global_parameters module~mod_physicaldata mod_physicaldata module~mod_finite_volume_srhd->module~mod_physicaldata module~mod_variables mod_variables module~mod_finite_volume_srhd->module~mod_variables module~mod_global_parameters->module~mod_physicaldata module~mod_global_parameters->module~mod_variables module~mod_basic_types mod_basic_types module~mod_global_parameters->module~mod_basic_types module~mod_connectivity mod_connectivity module~mod_global_parameters->module~mod_connectivity module~mod_constants mod_constants module~mod_global_parameters->module~mod_constants mpi mpi module~mod_global_parameters->mpi module~mod_variables->module~mod_basic_types

Functions

private pure function get_cmax(u, x, flux_dim) result(wC)

Returns maximum local signal speed from primitive state u in direction flux_dim; used in LLF/TVDLF flux estimation.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: u(nw_phys)
real(kind=dp), intent(in) :: x(1:ndim)
integer, intent(in) :: flux_dim

Return Value real(kind=dp)

private pure function koren(a, b)

Modified implementation of Koren limiter, to avoid division and the min/max functions, which can be problematic / expensive. In most literature, you have r = a / b (ratio of gradients). Then the limiter phi(r) is multiplied with b. With this implementation, you get phi(r) * b

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: a

Density gradient (numerator)

real(kind=dp), intent(in) :: b

Density gradient (denominator)

Return Value real(kind=dp)

private pure function mcbeta(a, b) result(phi)

Monotonised central-difference limiter with tunable beta (AMRVAC's mcbeta; beta=2 recovers the classic MC limiter, van Leer 1979)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: a
real(kind=dp), intent(in) :: b

Return Value real(kind=dp)

private pure function minmod(a, b)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: a
real(kind=dp), intent(in) :: b

Return Value real(kind=dp)

private pure function vanleer(a, b) result(phi)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: a
real(kind=dp), intent(in) :: b

Return Value real(kind=dp)


Subroutines

public subroutine finite_volume_local(qdt, dtfactor, ixImin1, ixImin2, ixImin3, ixImax1, ixImax2, ixImax3, ixOmin1, ixOmin2, ixOmin3, ixOmax1, ixOmax2, ixOmax3, idimsmin, idimsmax, qtC, bga, qt, bgb)

Arguments

Type IntentOptional Attributes Name
double precision, intent(in) :: qdt
double precision, intent(in) :: dtfactor
integer, intent(in) :: ixImin1
integer, intent(in) :: ixImin2
integer, intent(in) :: ixImin3
integer, intent(in) :: ixImax1
integer, intent(in) :: ixImax2
integer, intent(in) :: ixImax3
integer, intent(in) :: ixOmin1
integer, intent(in) :: ixOmin2
integer, intent(in) :: ixOmin3
integer, intent(in) :: ixOmax1
integer, intent(in) :: ixOmax2
integer, intent(in) :: ixOmax3
integer, intent(in) :: idimsmin
integer, intent(in) :: idimsmax
double precision, intent(in) :: qtC
type(block_grid_t) :: bga
double precision, intent(in) :: qt
type(block_grid_t) :: bgb

private subroutine addsource_compact(qdt, dtfactor, qtC, wCTprim1, wCTprim2, wCTprim3, qt, wnew, x, dx, qsourcesplit)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: qdt
real(kind=dp), intent(in) :: dtfactor
real(kind=dp), intent(in) :: qtC
real(kind=dp), intent(in) :: wCTprim1(nw_phys,3)
real(kind=dp), intent(in) :: wCTprim2(nw_phys,3)
real(kind=dp), intent(in) :: wCTprim3(nw_phys,3)
real(kind=dp), intent(in) :: qt
real(kind=dp), intent(inout) :: wnew(nw_phys)
real(kind=dp), intent(in) :: x(1:ndim)
real(kind=dp), intent(in) :: dx(1:ndim)
logical, intent(in) :: qsourcesplit

private subroutine addsource_local(qdt, dtfactor, qtC, wCT, wCTprim, qt, wnew, x, dr, qsourcesplit)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: qdt
real(kind=dp), intent(in) :: dtfactor
real(kind=dp), intent(in) :: qtC
real(kind=dp), intent(in) :: wCT(nw_phys)
real(kind=dp), intent(in) :: wCTprim(nw_phys)
real(kind=dp), intent(in) :: qt
real(kind=dp), intent(inout) :: wnew(nw_phys)
real(kind=dp), intent(in) :: x(1:ndim)
real(kind=dp), intent(in) :: dr(ndim)
logical, intent(in) :: qsourcesplit

private subroutine addsource_nonlocal(qdt, dtfactor, qtC, wCTprim, qt, wnew, x, dx, idir, qsourcesplit)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: qdt
real(kind=dp), intent(in) :: dtfactor
real(kind=dp), intent(in) :: qtC
real(kind=dp), intent(in) :: wCTprim(nw_phys,5)
real(kind=dp), intent(in) :: qt
real(kind=dp), intent(inout) :: wnew(nw_phys)
real(kind=dp), intent(in) :: x(1:ndim)
real(kind=dp), intent(in) :: dx(1:ndim)
integer, intent(in) :: idir
logical, intent(in) :: qsourcesplit

private subroutine estimate_speeds_minmax(uL, uR, xC, flux_dim, wL, wR)

Davis (1988) min/max wave speed estimates for HLL, in their relativistic form: wL = min(lambda^-), wR = max(lambda^+) over the left and right states.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: uL(nw_phys)
real(kind=dp), intent(in) :: uR(nw_phys)
real(kind=dp), intent(in) :: xC(ndim)
integer, intent(in) :: flux_dim
real(kind=dp), intent(out) :: wL
real(kind=dp), intent(out) :: wR

private subroutine estimate_speeds_toro_pvrs(uL, uR, xC, flux_dim, sL, sR)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: uL(nw_phys)
real(kind=dp), intent(in) :: uR(nw_phys)
real(kind=dp), intent(in) :: xC(ndim)
integer, intent(in) :: flux_dim
real(kind=dp), intent(out) :: sL
real(kind=dp), intent(out) :: sR

private subroutine finite_volume_local_muscl_hll(qdt, dtfactor, ixImin1, ixImin2, ixImin3, ixImax1, ixImax2, ixImax3, ixOmin1, ixOmin2, ixOmin3, ixOmax1, ixOmax2, ixOmax3, idimsmin, idimsmax, qtC, bga, qt, bgb)

Arguments

Type IntentOptional Attributes Name
double precision, intent(in) :: qdt
double precision, intent(in) :: dtfactor
integer, intent(in) :: ixImin1
integer, intent(in) :: ixImin2
integer, intent(in) :: ixImin3
integer, intent(in) :: ixImax1
integer, intent(in) :: ixImax2
integer, intent(in) :: ixImax3
integer, intent(in) :: ixOmin1
integer, intent(in) :: ixOmin2
integer, intent(in) :: ixOmin3
integer, intent(in) :: ixOmax1
integer, intent(in) :: ixOmax2
integer, intent(in) :: ixOmax3
integer, intent(in) :: idimsmin
integer, intent(in) :: idimsmax
double precision, intent(in) :: qtC
type(block_grid_t) :: bga
double precision, intent(in) :: qt
type(block_grid_t) :: bgb

private subroutine finite_volume_local_muscl_hllc(qdt, dtfactor, ixImin1, ixImin2, ixImin3, ixImax1, ixImax2, ixImax3, ixOmin1, ixOmin2, ixOmin3, ixOmax1, ixOmax2, ixOmax3, idimsmin, idimsmax, qtC, bga, qt, bgb)

Arguments

Type IntentOptional Attributes Name
double precision, intent(in) :: qdt
double precision, intent(in) :: dtfactor
integer, intent(in) :: ixImin1
integer, intent(in) :: ixImin2
integer, intent(in) :: ixImin3
integer, intent(in) :: ixImax1
integer, intent(in) :: ixImax2
integer, intent(in) :: ixImax3
integer, intent(in) :: ixOmin1
integer, intent(in) :: ixOmin2
integer, intent(in) :: ixOmin3
integer, intent(in) :: ixOmax1
integer, intent(in) :: ixOmax2
integer, intent(in) :: ixOmax3
integer, intent(in) :: idimsmin
integer, intent(in) :: idimsmax
double precision, intent(in) :: qtC
type(block_grid_t) :: bga
double precision, intent(in) :: qt
type(block_grid_t) :: bgb

private subroutine finite_volume_local_muscl_llf(qdt, dtfactor, ixImin1, ixImin2, ixImin3, ixImax1, ixImax2, ixImax3, ixOmin1, ixOmin2, ixOmin3, ixOmax1, ixOmax2, ixOmax3, idimsmin, idimsmax, qtC, bga, qt, bgb)

Arguments

Type IntentOptional Attributes Name
double precision, intent(in) :: qdt
double precision, intent(in) :: dtfactor
integer, intent(in) :: ixImin1
integer, intent(in) :: ixImin2
integer, intent(in) :: ixImin3
integer, intent(in) :: ixImax1
integer, intent(in) :: ixImax2
integer, intent(in) :: ixImax3
integer, intent(in) :: ixOmin1
integer, intent(in) :: ixOmin2
integer, intent(in) :: ixOmin3
integer, intent(in) :: ixOmax1
integer, intent(in) :: ixOmax2
integer, intent(in) :: ixOmax3
integer, intent(in) :: idimsmin
integer, intent(in) :: idimsmax
double precision, intent(in) :: qtC
type(block_grid_t) :: bga
double precision, intent(in) :: qt
type(block_grid_t) :: bgb

private pure subroutine fix_prim_state(u)

Make a reconstructed primitive face state admissible before it is handed to the Riemann solver.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: u(nw_phys)

private subroutine get_flux(u, xC, flux_dim, flux)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: u(nw_phys)
real(kind=dp), intent(in) :: xC(1:ndim)
integer, intent(in) :: flux_dim
real(kind=dp), intent(out) :: flux(nw_flux)

private pure subroutine muscl_reconstruct_prim(u, typelim, uL, uR)

MUSCL reconstruction in primitive variables for two faces using a 5-point stencil. Returns uL(:,iface), uR(:,iface) for iface=1 (between cells 2-3) and iface=2 (between 3-4).

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: u(nw_phys,5)
integer, intent(in) :: typelim
real(kind=dp), intent(out) :: uL(nw_phys,2)
real(kind=dp), intent(out) :: uR(nw_phys,2)

private subroutine reconflux_muscl_hll_prim(u, xlocC, flux_dim, flux, typelim)

MUSCL (primitive-variable) reconstruction with slope limiter; HLL two-wave approximate Riemann flux at faces. Uses estimated left/right signal speeds (Davis (1988)) for less diffusion than LLF, no contact resolution.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: u(nw_phys,5)
real(kind=dp), intent(in) :: xlocC(1:ndim,2)
integer, intent(in) :: flux_dim
real(kind=dp), intent(out) :: flux(nw_flux,2)
integer, intent(in) :: typelim

private subroutine reconflux_muscl_hllc_prim(u, xlocC, flux_dim, flux, typelim)

MUSCL (primitive-variable) reconstruction with slope limiter; HLLC approximate Riemann flux at faces. Restores the contact wave (and shear in Euler/HD), typically sharper than HLL for similar cost.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: u(nw_phys,5)
real(kind=dp), intent(in) :: xlocC(1:ndim,2)
integer, intent(in) :: flux_dim
real(kind=dp), intent(out) :: flux(nw_flux,2)
integer, intent(in) :: typelim

private subroutine reconflux_muscl_llf_prim(u, xlocC, flux_dim, flux, typelim)

MUSCL (primitive-variable) reconstruction with slope limiter; LLF/Rusanov numerical flux at faces. Robust and diffusive; uses local max wavespeed for upwinding. Adaptive diffusion (Rempel et al. 2009) is compiled in only when FLUX_AD is defined.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(in) :: u(nw_phys,5)
real(kind=dp), intent(in) :: xlocC(1:ndim,2)
integer, intent(in) :: flux_dim
real(kind=dp), intent(out) :: flux(nw_flux,2)
integer, intent(in) :: typelim

private subroutine riemann_hll_prim(uL, uR, xC, flux_dim, F)

One-face HLL numerical flux from primitive L/R states. takes flux_type(flux_dim,nw_flux) into account (fallback to LLF for selected variables)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: uL(nw_phys)
real(kind=dp), intent(inout) :: uR(nw_phys)
real(kind=dp), intent(in) :: xC(ndim)
integer, intent(in) :: flux_dim
real(kind=dp), intent(out) :: F(nw_flux)

private subroutine riemann_hllc_prim(uL, uR, xC, flux_dim, F)

One-face HLLC numerical flux from primitive L/R states (HD only). Uses scalar pressure assumption; not valid for MHD (use HLLD instead). Reference: Toro (2010), chapter 10 (Variant 2) does not yet take flux_type(flux_dim,nw_flux) into account

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: uL(nw_phys)
real(kind=dp), intent(inout) :: uR(nw_phys)
real(kind=dp), intent(in) :: xC(ndim)
integer, intent(in) :: flux_dim
real(kind=dp), intent(out) :: F(nw_flux)

private subroutine riemann_llf_prim(uL, uR, xC, flux_dim, F, phi)

One-face LLF/Rusanov numerical flux from primitive L/R states. phi(nw_flux) is the adaptive-diffusion reduction factor; only present when FLUX_AD is defined.

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: uL(nw_phys)
real(kind=dp), intent(inout) :: uR(nw_phys)
real(kind=dp), intent(in) :: xC(ndim)
integer, intent(in) :: flux_dim
real(kind=dp), intent(out) :: F(nw_flux)
real(kind=dp), intent(in) :: phi(nw_flux)

private pure subroutine to_conservative(u)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: u(nw_phys)

private pure subroutine to_primitive(u)

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: u(nw_phys)