MPI-AMRVAC  3.0
The MPI - Adaptive Mesh Refinement - Versatile Advection Code
mod_hd_ppm.t
Go to the documentation of this file.
1 !> Hydrodynamics PPM module
2 module mod_hd_ppm
3  use mod_hd_phys
4 
5  implicit none
6  private
7 
8  public :: hd_ppm_init
9 
10 contains
11 
12  subroutine hd_ppm_init()
13  use mod_physics_ppm
14 
17  end subroutine hd_ppm_init
18 
19  subroutine hd_ppm_flatcd(ixI^L,ixO^L,ixL^L,ixR^L,w,d2w,drho,dp)
21 
22  integer, intent(in) :: ixI^L, ixO^L, ixL^L, ixR^L
23  double precision, intent(in) :: w(ixI^S, nw), d2w(ixG^T, 1:nwflux)
24  double precision, intent(inout) :: drho(ixG^T), dp(ixG^T)
25 
26  if(hd_energy) then
27  drho(ixo^s) = hd_gamma*abs(d2w(ixo^s, rho_))&
28  /min(w(ixl^s, rho_), w(ixr^s, rho_))
29  dp(ixo^s) = abs(d2w(ixo^s, e_))/min(w(ixl^s, e_), w(ixr^s, e_))
30  else
31  call mpistop("PPM with flatcd=.true. can not be used with -eos = iso !")
32  end if
33  end subroutine hd_ppm_flatcd
34 
35  subroutine hd_ppm_flatsh(ixI^L,ixO^L,ixLL^L,ixL^L,ixR^L,ixRR^L,idims,w,drho,dp,dv)
37  use mod_geometry
38 
39  integer, intent(in) :: ixI^L, ixO^L, ixLL^L, ixL^L, ixR^L, ixRR^L
40  integer, intent(in) :: idims
41  double precision, intent(in) :: w(ixI^S, nw)
42  double precision, intent(inout) :: drho(ixG^T), dp(ixG^T), dv(ixG^T)
43  double precision :: v(ixG^T)
44 
45  if(hd_energy) then
46  ! eq. B15, page 218, Mignone and Bodo 2005, ApJS (beta1)
47  where (abs(w(ixrr^s, e_)-w(ixll^s, e_))>smalldouble)
48  drho(ixo^s) = abs((w(ixr^s, e_)-w(ixl^s, e_))&
49  /(w(ixrr^s, e_)-w(ixll^s, e_)))
50  else where
51  drho(ixo^s) = zero
52  end where
53 
54  ! eq. B76, page 48, Miller and Collela 2002, JCP 183, 26
55  ! use "dp" to save squared sound speed, assuming primitives
56  dp(ixo^s) =(hd_gamma*w(ixo^s, e_)/w(ixo^s, rho_))
57 
58  dp(ixo^s) = abs(w(ixr^s, e_)-w(ixl^s, e_))&
59  /(w(ixo^s, rho_)*dp(ixo^s))
60  v(ixi^s) = w(ixi^s, mom(idims))
61  call gradient(v, ixi^l, ixo^l, idims, dv)
62  else
63  call mpistop("PPM with flatsh=.true. can not be used with -eos = iso !")
64  end if
65  end subroutine hd_ppm_flatsh
66 
67 end module mod_hd_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...
Hydrodynamics physics module.
Definition: mod_hd_phys.t:2
logical, public, protected hd_energy
Whether an energy equation is used.
Definition: mod_hd_phys.t:10
integer, public, protected e_
Index of the energy density (-1 if not present)
Definition: mod_hd_phys.t:52
double precision, public hd_gamma
The adiabatic index.
Definition: mod_hd_phys.t:61
integer, dimension(:), allocatable, public, protected mom
Indices of the momentum density.
Definition: mod_hd_phys.t:46
integer, public, protected rho_
Index of the density (in the w array)
Definition: mod_hd_phys.t:43
Hydrodynamics PPM module.
Definition: mod_hd_ppm.t:2
subroutine hd_ppm_flatcd(ixIL, ixOL, ixLL, ixRL, w, d2w, drho, dp)
Definition: mod_hd_ppm.t:20
subroutine hd_ppm_flatsh(ixIL, ixOL, ixLLL, ixLL, ixRL, ixRRL, idims, w, drho, dp, dv)
Definition: mod_hd_ppm.t:36
subroutine, public hd_ppm_init()
Definition: mod_hd_ppm.t:13
procedure(sub_ppm_flatcd), pointer phys_ppm_flatcd
procedure(sub_ppm_flatsh), pointer phys_ppm_flatsh