MPI-AMRVAC  3.0
The MPI - Adaptive Mesh Refinement - Versatile Advection Code
mod_twofl_ppm.t
Go to the documentation of this file.
2 
3 #include "amrvac.h"
5 
6  implicit none
7  private
8 
9  public :: twofl_ppm_init
10 
11 contains
12 
13  subroutine twofl_ppm_init()
14  use mod_physics_ppm
17  end subroutine twofl_ppm_init
18 
19  subroutine twofl_ppm_flatcd(ixI^L,ixO^L,ixL^L,ixR^L,w,d2w,drho,dp)
21  integer, intent(in) :: ixI^L,ixO^L,ixL^L,ixR^L
22  double precision, intent(in) :: w(ixI^S,nw),d2w(ixI^S,1:nwflux)
23  double precision, intent(inout) :: drho(ixI^S),dp(ixI^S)
24 
25  if(twofl_eq_energy/=0) then
26  drho(ixo^s) =twofl_gamma*dabs(d2w(ixo^s,rho_c_))&
27  /min(w(ixl^s,rho_c_),w(ixr^s,rho_c_))
28  dp(ixo^s) = dabs(d2w(ixo^s,e_c_))/min(w(ixl^s,e_c_),w(ixr^s,e_c_))
29  else
30  call mpistop("PPM with flatcd=.true. can not be used without energy equation!")
31  end if
32  end subroutine twofl_ppm_flatcd
33 
34  ! based on Mignone and Miller and Collela 2002
35  ! PPM flattening at shocks: we use total pressure and not thermal pressure
36  subroutine twofl_ppm_flatsh(ixI^L,ixO^L,ixLL^L,ixL^L,ixR^L,ixRR^L,idims,w,drho,dp,dv)
38  use mod_geometry
39 
40  integer, intent(in) :: ixI^L,ixO^L,ixLL^L,ixL^L,ixR^L,ixRR^L
41  integer, intent(in) :: idims
42  double precision, intent(in) :: w(ixI^S,nw)
43  double precision, intent(inout) :: drho(ixI^S),dp(ixI^S),dv(ixI^S)
44  double precision :: ptot(ixI^S)
45 
46  if(twofl_eq_energy/=0) then
47  ! eq. B15, page 218, Mignone and Bodo 2005, ApJS (beta1)
48  ptot(ixo^s)=w(ixo^s,e_c_)+half*sum(w(ixo^s,mag(:))**2,dim=ndim+1)
49  where (dabs(ptot(ixrr^s)-ptot(ixll^s))>smalldouble)
50  drho(ixo^s) = dabs((ptot(ixr^s)-ptot(ixl^s))&
51  /(ptot(ixrr^s)-ptot(ixll^s)))
52  elsewhere
53  drho(ixo^s) = zero
54  end where
55 
56  ! eq. B76, page 48, Miller and Collela 2002, JCP 183, 26
57  ! use "dp" to save squared sound speed, assume primitive in w
58  dp(ixo^s)=(twofl_gamma*w(ixo^s,e_c_)/w(ixo^s,rho_c_))
59 
60  dp(ixo^s) = dabs(ptot(ixr^s)-ptot(ixl^s))&
61  /(w(ixo^s,rho_c_)*dp(ixo^s))
62  ! recycle ptot to store v
63  ptot(ixi^s)= w(ixi^s,mom_c(idims))
64  call gradient(ptot,ixi^l,ixo^l,idims,dv)
65  else
66  call mpistop("PPM with flatsh=.true. can not be used without energy equation!")
67  end if
68 
69  end subroutine twofl_ppm_flatsh
70 
71 end module mod_twofl_ppm
subroutine mpistop(message)
Exit MPI-AMRVAC with an error message.
Definition: comm_lib.t:194
Module with geometry-related routines (e.g., divergence, curl)
Definition: mod_geometry.t:2
subroutine gradient(q, ixIL, ixOL, idir, gradq)
Calculate gradient of a scalar q within ixL in direction idir.
Definition: mod_geometry.t:320
This module contains definitions of global parameters and variables and some generic functions/subrou...
integer, parameter ndim
Number of spatial dimensions for grid variables.
procedure(sub_ppm_flatcd), pointer phys_ppm_flatcd
procedure(sub_ppm_flatsh), pointer phys_ppm_flatsh
Magneto-hydrodynamics module.
Definition: mod_twofl_phys.t:2
integer, public e_c_
Index of the energy density (-1 if not present)
integer, dimension(:), allocatable, public mom_c
Indices of the momentum density.
integer, dimension(:), allocatable, public mag
Indices of the magnetic field.
integer, public rho_c_
Index of the density (in the w array)
integer, public, protected twofl_eq_energy
double precision, public twofl_gamma
The adiabatic index.
subroutine twofl_ppm_flatsh(ixIL, ixOL, ixLLL, ixLL, ixRL, ixRRL, idims, w, drho, dp, dv)
Definition: mod_twofl_ppm.t:37
subroutine twofl_ppm_flatcd(ixIL, ixOL, ixLL, ixRL, w, d2w, drho, dp)
Definition: mod_twofl_ppm.t:20
subroutine, public twofl_ppm_init()
Definition: mod_twofl_ppm.t:14