MPI-AMRVAC  2.1
The MPI - Adaptive Mesh Refinement - Versatile Advection Code
Functions/Subroutines | Variables
mod_mhd_phys Module Reference

Magneto-hydrodynamics module. More...

Functions/Subroutines

subroutine mhd_write_info (fh)
 Write this module's parameters to a snapsoht. More...
 
subroutine mhd_angmomfix (fC, x, wnew, ixIL, ixOL, idim)
 
subroutine, public mhd_phys_init ()
 
subroutine mhd_check_params
 
subroutine mhd_physical_units ()
 
subroutine mhd_check_w (primitive, ixIL, ixOL, w, flag)
 
subroutine, public mhd_to_conserved (ixIL, ixOL, w, x)
 Transform primitive variables into conservative ones. More...
 
subroutine, public mhd_to_primitive (ixIL, ixOL, w, x)
 Transform conservative variables into primitive ones. More...
 
subroutine mhd_handle_small_values (primitive, w, x, ixIL, ixOL, subname)
 
subroutine e_to_rhos (ixIL, ixOL, w, x)
 Convert energy to entropy. More...
 
subroutine rhos_to_e (ixIL, ixOL, w, x)
 Convert entropy to energy. More...
 
subroutine, public mhd_get_v (w, x, ixIL, ixOL, v)
 Calculate v vector. More...
 
subroutine mhd_get_v_idim (w, x, ixIL, ixOL, idim, v)
 Calculate v component. More...
 
subroutine mhd_get_cmax (w, x, ixIL, ixOL, idim, cmax)
 Calculate cmax_idim=csound+abs(v_idim) within ixO^L. More...
 
subroutine mhd_get_cbounds (wLC, wRC, wLp, wRp, x, ixIL, ixOL, idim, cmax, cmin)
 Estimating bounds for the minimum and maximum signal velocities. More...
 
subroutine mhd_get_csound (w, x, ixIL, ixOL, idim, csound)
 Calculate fast magnetosonic wave speed. More...
 
subroutine mhd_get_csound_prim (w, x, ixIL, ixOL, idim, csound)
 Calculate fast magnetosonic wave speed. More...
 
subroutine, public mhd_get_pthermal (w, x, ixIL, ixOL, pth)
 Calculate thermal pressure=(gamma-1)*(e-0.5*m**2/rho-b**2/2) within ixO^L. More...
 
subroutine, public mhd_get_csound2 (w, x, ixIL, ixOL, csound2)
 Calculate the square of the thermal sound speed csound2 within ixO^L. csound2=gamma*p/rho. More...
 
subroutine mhd_get_p_total (w, x, ixIL, ixOL, p)
 Calculate total pressure within ixO^L including magnetic pressure. More...
 
subroutine mhd_get_flux (wC, w, x, ixIL, ixOL, idim, f)
 Calculate fluxes within ixO^L. More...
 
subroutine mhd_add_source (qdt, ixIL, ixOL, wCT, w, x, qsourcesplit, active)
 w[iws]=w[iws]+qdt*S[iws,wCT] where S is the source based on wCT within ixO More...
 
subroutine boris_add_source (qdt, ixIL, ixOL, wCT, w, x, qsourcesplit, active)
 
subroutine get_lorentz (ixIL, ixOL, w, JxB)
 Compute the Lorentz force (JxB) More...
 
subroutine mhd_gamma2_alfven (ixIL, ixOL, w, gamma_A2)
 Compute 1/(1+v_A^2/c^2) for Boris' approximation, where v_A is the Alfven velocity. More...
 
subroutine internal_energy_add_source (qdt, ixIL, ixOL, wCT, w, x)
 
subroutine add_source_b0split (qdt, ixIL, ixOL, wCT, w, x)
 Source terms after split off time-independent magnetic field. More...
 
subroutine add_source_res1 (qdt, ixIL, ixOL, wCT, w, x)
 Add resistive source to w within ixO Uses 3 point stencil (1 neighbour) in each direction, non-conservative. If the fourthorder precompiler flag is set, uses fourth order central difference for the laplacian. Then the stencil is 5 (2 neighbours). More...
 
subroutine add_source_res2 (qdt, ixIL, ixOL, wCT, w, x)
 Add resistive source to w within ixO Uses 5 point stencil (2 neighbours) in each direction, conservative. More...
 
subroutine add_source_hyperres (qdt, ixIL, ixOL, wCT, w, x)
 Add Hyper-resistive source to w within ixO Uses 9 point stencil (4 neighbours) in each direction. More...
 
subroutine add_source_glm1 (qdt, ixIL, ixOL, wCT, w, x)
 
subroutine add_source_glm2 (qdt, ixIL, ixOL, wCT, w, x)
 
subroutine add_source_powel (qdt, ixIL, ixOL, wCT, w, x)
 Add divB related sources to w within ixO corresponding to Powel. More...
 
subroutine add_source_janhunen (qdt, ixIL, ixOL, wCT, w, x)
 
subroutine add_source_linde (qdt, ixIL, ixOL, wCT, w, x)
 
subroutine, public get_divb (w, ixIL, ixOL, divb, fourthorder)
 Calculate div B within ixO. More...
 
subroutine, public get_normalized_divb (w, ixIL, ixOL, divb)
 get dimensionless div B = |divB| * volume / area / |B| More...
 
subroutine, public get_current (w, ixIL, ixOL, idirmin, current)
 Calculate idirmin and the idirmin:3 components of the common current array make sure that dxlevel(^D) is set correctly. More...
 
subroutine mhd_get_dt (w, ixIL, ixOL, dtnew, dxD, x)
 If resistivity is not zero, check diffusion time limit for dt. More...
 
subroutine mhd_add_source_geom (qdt, ixIL, ixOL, wCT, w, x)
 
double precision function, dimension(ixo^s), public mhd_mag_en_all (w, ixIL, ixOL)
 Compute 2 times total magnetic energy. More...
 
double precision function, dimension(ixo^s) mhd_mag_i_all (w, ixIL, ixOL, idir)
 Compute full magnetic field by direction. More...
 
double precision function, dimension(ixo^s) mhd_mag_en (w, ixIL, ixOL)
 Compute evolving magnetic energy. More...
 
double precision function, dimension(ixo^s), public mhd_kin_en (w, ixIL, ixOL, inv_rho)
 compute kinetic energy More...
 
subroutine mhd_getv_hall (w, x, ixIL, ixOL, vHall)
 
subroutine mhd_getdt_hall (w, x, ixIL, ixOL, dxD, dthall)
 
subroutine glmsolve (wLC, wRC, ixIL, ixOL, idir)
 This implements eq. (42) in Dedner et al. 2002 JcP 175 Gives the Riemann solution on the interface for the normal B component and Psi in the GLM-MHD system. 23/04/2013 Oliver Porth. More...
 
subroutine mhd_boundary_adjust
 
subroutine fixdivb_boundary (ixGL, ixOL, w, x, iB)
 
subroutine mhd_clean_divb_multigrid (qdt, qt, active)
 

Variables

logical, public, protected mhd_energy = .true.
 Whether an energy equation is used. More...
 
logical, public, protected mhd_thermal_conduction = .false.
 Whether thermal conduction is used. More...
 
logical, public, protected mhd_radiative_cooling = .false.
 Whether radiative cooling is added. More...
 
logical, public, protected mhd_viscosity = .false.
 Whether viscosity is added. More...
 
logical, public, protected mhd_gravity = .false.
 Whether gravity is added. More...
 
logical, public, protected mhd_hall = .false.
 Whether Hall-MHD is used. More...
 
logical, public, protected mhd_particles = .false.
 Whether particles module is added. More...
 
logical, public, protected mhd_magnetofriction = .false.
 Whether magnetofriction is added. More...
 
logical, public, protected mhd_glm = .false.
 Whether GLM-MHD is used. More...
 
logical, public, protected source_split_divb = .false.
 Whether divB cleaning sources are added splitting from fluid solver. More...
 
double precision, public mhd_glm_alpha = 0.5d0
 GLM-MHD parameter: ratio of the diffusive and advective time scales for div b taking values within [0, 1]. More...
 
logical, public, protected mhd_4th_order = .false.
 MHD fourth order. More...
 
integer, public, protected mhd_n_tracer = 0
 Number of tracer species. More...
 
integer, public, protected rho_
 Index of the density (in the w array) More...
 
integer, dimension(:), allocatable, public, protected mom
 Indices of the momentum density. More...
 
integer, public, protected e_
 Index of the energy density (-1 if not present) More...
 
integer, public, protected p_
 Index of the gas pressure (-1 if not present) should equal e_. More...
 
integer, dimension(:), allocatable, public, protected mag
 Indices of the magnetic field. More...
 
integer, public, protected psi_
 Indices of the GLM psi. More...
 
integer, dimension(:), allocatable, public, protected tracer
 Indices of the tracers. More...
 
double precision, public mhd_gamma = 5.d0/3.0d0
 The adiabatic index. More...
 
double precision, public mhd_adiab = 1.0d0
 The adiabatic constant. More...
 
double precision, public mhd_eta = 0.0d0
 The MHD resistivity. More...
 
double precision, public mhd_eta_hyper = 0.0d0
 The MHD hyper-resistivity. More...
 
double precision, public mhd_etah = 0.0d0
 TODO: what is this? More...
 
character(len=std_len), public, protected typedivbfix = 'linde'
 Method type to clean divergence of B. More...
 
logical, public, protected mhd_divb_4thorder = .false.
 Whether divB is computed with a fourth order approximation. More...
 
logical, public divbwave = .true.
 Add divB wave in Roe solver. More...
 
double precision, public, protected he_abundance =0.1d0
 Helium abundance over Hydrogen. More...
 
logical, dimension(2 *^nd), public, protected boundary_divbfix =.true.
 To control divB=0 fix for boundary. More...
 
integer, dimension(2 *^nd), public, protected boundary_divbfix_skip =0
 To skip * layer of ghost cells during divB=0 fix for boundary. More...
 
logical, public, protected b0field_forcefree =.true.
 B0 field is force-free. More...
 

Detailed Description

Magneto-hydrodynamics module.

Function/Subroutine Documentation

◆ add_source_b0split()

subroutine mod_mhd_phys::add_source_b0split ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(in)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Source terms after split off time-independent magnetic field.

Definition at line 1340 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ add_source_glm1()

subroutine mod_mhd_phys::add_source_glm1 ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(in)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Definition at line 1621 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ add_source_glm2()

subroutine mod_mhd_phys::add_source_glm2 ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(in)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Definition at line 1674 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ add_source_hyperres()

subroutine mod_mhd_phys::add_source_hyperres ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(in)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Add Hyper-resistive source to w within ixO Uses 9 point stencil (4 neighbours) in each direction.

Definition at line 1564 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ add_source_janhunen()

subroutine mod_mhd_phys::add_source_janhunen ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(in)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Definition at line 1770 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ add_source_linde()

subroutine mod_mhd_phys::add_source_linde ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(in)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Definition at line 1793 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ add_source_powel()

subroutine mod_mhd_phys::add_source_powel ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(in)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Add divB related sources to w within ixO corresponding to Powel.

Definition at line 1735 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ add_source_res1()

subroutine mod_mhd_phys::add_source_res1 ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(in)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Add resistive source to w within ixO Uses 3 point stencil (1 neighbour) in each direction, non-conservative. If the fourthorder precompiler flag is set, uses fourth order central difference for the laplacian. Then the stencil is 5 (2 neighbours).

Definition at line 1395 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ add_source_res2()

subroutine mod_mhd_phys::add_source_res2 ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(in)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Add resistive source to w within ixO Uses 5 point stencil (2 neighbours) in each direction, conservative.

Definition at line 1508 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ boris_add_source()

subroutine mod_mhd_phys::boris_add_source ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(in)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
logical, intent(in)  qsourcesplit,
logical, intent(inout)  active 
)

Definition at line 1249 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ e_to_rhos()

subroutine mod_mhd_phys::e_to_rhos ( integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Convert energy to entropy.

Definition at line 674 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ fixdivb_boundary()

subroutine mod_mhd_phys::fixdivb_boundary ( integer, intent(in)  ixG,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixg^s,1:nw), intent(inout)  w,
double precision, dimension(ixg^s,1:ndim), intent(in)  x,
integer, intent(in)  iB 
)

Definition at line 2313 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ get_current()

subroutine, public mod_mhd_phys::get_current ( double precision, dimension(ixi^s,1:nw)  w,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(out)  idirmin,
double precision, dimension(ixi^s,7-2*ndir:3)  current 
)

Calculate idirmin and the idirmin:3 components of the common current array make sure that dxlevel(^D) is set correctly.

Definition at line 1920 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ get_divb()

subroutine, public mod_mhd_phys::get_divb ( double precision, dimension(ixi^s,1:nw), intent(in)  w,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s), intent(inout)  divb,
logical, intent(in), optional  fourthorder 
)

Calculate div B within ixO.

Definition at line 1868 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ get_lorentz()

subroutine mod_mhd_phys::get_lorentz ( integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(in)  w,
double precision, dimension(ixi^s,3), intent(inout)  JxB 
)

Compute the Lorentz force (JxB)

Definition at line 1278 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ get_normalized_divb()

subroutine, public mod_mhd_phys::get_normalized_divb ( double precision, dimension(ixi^s,1:nw), intent(in)  w,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s)  divb 
)

get dimensionless div B = |divB| * volume / area / |B|

Definition at line 1891 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ glmsolve()

subroutine mod_mhd_phys::glmsolve ( double precision, dimension(ixi^s,1:nw), intent(inout)  wLC,
double precision, dimension(ixi^s,1:nw), intent(inout)  wRC,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idir 
)

This implements eq. (42) in Dedner et al. 2002 JcP 175 Gives the Riemann solution on the interface for the normal B component and Psi in the GLM-MHD system. 23/04/2013 Oliver Porth.

Definition at line 2250 of file mod_mhd_phys.t.

◆ internal_energy_add_source()

subroutine mod_mhd_phys::internal_energy_add_source ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(in)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Definition at line 1322 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_add_source()

subroutine mod_mhd_phys::mhd_add_source ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(in)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
logical, intent(in)  qsourcesplit,
logical, intent(inout)  active 
)

w[iws]=w[iws]+qdt*S[iws,wCT] where S is the source based on wCT within ixO

Definition at line 1110 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_add_source_geom()

subroutine mod_mhd_phys::mhd_add_source_geom ( double precision, intent(in)  qdt,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:nw), intent(inout)  wCT,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Definition at line 2005 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_angmomfix()

subroutine mod_mhd_phys::mhd_angmomfix ( double precision, dimension(ixi^s,1:nwflux,1:ndim), intent(inout)  fC,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
double precision, dimension(ixi^s,1:nw), intent(inout)  wnew,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idim 
)

Definition at line 207 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_boundary_adjust()

subroutine mod_mhd_phys::mhd_boundary_adjust ( )

Definition at line 2269 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_check_params()

subroutine mod_mhd_phys::mhd_check_params ( )

Definition at line 473 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_check_w()

subroutine mod_mhd_phys::mhd_check_w ( logical, intent(in)  primitive,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,nw), intent(in)  w,
integer, dimension(ixi^s), intent(inout)  flag 
)

Definition at line 525 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_clean_divb_multigrid()

subroutine mod_mhd_phys::mhd_clean_divb_multigrid ( double precision, intent(in)  qdt,
double precision, intent(in)  qt,
logical, intent(inout)  active 
)
Parameters
[in]qdtCurrent time step
[in]qtCurrent time
[in,out]activeOutput if the source is active

Definition at line 2690 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_gamma2_alfven()

subroutine mod_mhd_phys::mhd_gamma2_alfven ( integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s, nw), intent(in)  w,
double precision, dimension(ixo^s), intent(out)  gamma_A2 
)

Compute 1/(1+v_A^2/c^2) for Boris' approximation, where v_A is the Alfven velocity.

Definition at line 1306 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_get_cbounds()

subroutine mod_mhd_phys::mhd_get_cbounds ( double precision, dimension(ixi^s, nw), intent(in)  wLC,
double precision, dimension(ixi^s, nw), intent(in)  wRC,
double precision, dimension(ixi^s, nw), intent(in)  wLp,
double precision, dimension(ixi^s, nw), intent(in)  wRp,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idim,
double precision, dimension(ixi^s), intent(inout)  cmax,
double precision, dimension(ixi^s), intent(inout), optional  cmin 
)

Estimating bounds for the minimum and maximum signal velocities.

Definition at line 752 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_get_cmax()

subroutine mod_mhd_phys::mhd_get_cmax ( double precision, dimension(ixi^s, nw), intent(in)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idim,
double precision, dimension(ixi^s), intent(inout)  cmax 
)

Calculate cmax_idim=csound+abs(v_idim) within ixO^L.

Definition at line 738 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_get_csound()

subroutine mod_mhd_phys::mhd_get_csound ( double precision, dimension(ixi^s, nw), intent(in)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idim,
double precision, dimension(ixi^s), intent(out)  csound 
)

Calculate fast magnetosonic wave speed.

Definition at line 800 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_get_csound2()

subroutine, public mod_mhd_phys::mhd_get_csound2 ( double precision, dimension(ixi^s,nw), intent(in)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s), intent(out)  csound2 
)

Calculate the square of the thermal sound speed csound2 within ixO^L. csound2=gamma*p/rho.

Definition at line 919 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_get_csound_prim()

subroutine mod_mhd_phys::mhd_get_csound_prim ( double precision, dimension(ixi^s, nw), intent(in)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idim,
double precision, dimension(ixi^s), intent(out)  csound 
)

Calculate fast magnetosonic wave speed.

Definition at line 847 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_get_dt()

subroutine mod_mhd_phys::mhd_get_dt ( double precision, dimension(ixi^s,1:nw), intent(in)  w,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, intent(inout)  dtnew,
double precision, intent(in)  dx,
double precision, intent(in)  D,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

If resistivity is not zero, check diffusion time limit for dt.

Definition at line 1945 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_get_flux()

subroutine mod_mhd_phys::mhd_get_flux ( double precision, dimension(ixi^s,nw), intent(in)  wC,
double precision, dimension(ixi^s,nw), intent(in)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idim,
double precision, dimension(ixi^s,nwflux), intent(out)  f 
)

Calculate fluxes within ixO^L.

Definition at line 950 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_get_p_total()

subroutine mod_mhd_phys::mhd_get_p_total ( double precision, dimension(ixi^s,nw), intent(in)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s), intent(out)  p 
)

Calculate total pressure within ixO^L including magnetic pressure.

Definition at line 935 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_get_pthermal()

subroutine, public mod_mhd_phys::mhd_get_pthermal ( double precision, dimension(ixi^s,nw), intent(in)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s), intent(out)  pth 
)

Calculate thermal pressure=(gamma-1)*(e-0.5*m**2/rho-b**2/2) within ixO^L.

Definition at line 896 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_get_v()

subroutine, public mod_mhd_phys::mhd_get_v ( double precision, dimension(ixi^s,nw), intent(in)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,ndir), intent(out)  v 
)

Calculate v vector.

Definition at line 710 of file mod_mhd_phys.t.

◆ mhd_get_v_idim()

subroutine mod_mhd_phys::mhd_get_v_idim ( double precision, dimension(ixi^s,nw), intent(in)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idim,
double precision, dimension(ixi^s), intent(out)  v 
)

Calculate v component.

Definition at line 726 of file mod_mhd_phys.t.

◆ mhd_getdt_hall()

subroutine mod_mhd_phys::mhd_getdt_hall ( double precision, dimension(ixi^s,1:nw), intent(in)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, intent(in)  dx,
double precision, intent(in)  D,
double precision, intent(out)  dthall 
)

Definition at line 2214 of file mod_mhd_phys.t.

◆ mhd_getv_hall()

subroutine mod_mhd_phys::mhd_getv_hall ( double precision, dimension(ixi^s,nw), intent(in)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,1:3), intent(inout)  vHall 
)

Definition at line 2193 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_handle_small_values()

subroutine mod_mhd_phys::mhd_handle_small_values ( logical, intent(in)  primitive,
double precision, dimension(ixi^s,1:nw), intent(inout)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
character(len=*), intent(in)  subname 
)

Definition at line 623 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_kin_en()

double precision function, dimension(ixo^s), public mod_mhd_phys::mhd_kin_en ( double precision, dimension(ixi^s, nw), intent(in)  w,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixo^s), intent(in), optional  inv_rho 
)

compute kinetic energy

Definition at line 2179 of file mod_mhd_phys.t.

◆ mhd_mag_en()

double precision function, dimension(ixo^s) mod_mhd_phys::mhd_mag_en ( double precision, dimension(ixi^s, nw), intent(in)  w,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L 
)

Compute evolving magnetic energy.

Definition at line 2169 of file mod_mhd_phys.t.

◆ mhd_mag_en_all()

double precision function, dimension(ixo^s), public mod_mhd_phys::mhd_mag_en_all ( double precision, dimension(ixi^s, nw), intent(in)  w,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L 
)

Compute 2 times total magnetic energy.

Definition at line 2141 of file mod_mhd_phys.t.

◆ mhd_mag_i_all()

double precision function, dimension(ixo^s) mod_mhd_phys::mhd_mag_i_all ( double precision, dimension(ixi^s, nw), intent(in)  w,
integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
integer, intent(in)  idir 
)

Compute full magnetic field by direction.

Definition at line 2155 of file mod_mhd_phys.t.

◆ mhd_phys_init()

subroutine, public mod_mhd_phys::mhd_phys_init ( )

Definition at line 270 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_physical_units()

subroutine mod_mhd_phys::mhd_physical_units ( )

Definition at line 496 of file mod_mhd_phys.t.

◆ mhd_to_conserved()

subroutine, public mod_mhd_phys::mhd_to_conserved ( integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s, nw), intent(inout)  w,
double precision, dimension(ixi^s, 1:ndim), intent(in)  x 
)

Transform primitive variables into conservative ones.

Definition at line 556 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_to_primitive()

subroutine, public mod_mhd_phys::mhd_to_primitive ( integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s, nw), intent(inout)  w,
double precision, dimension(ixi^s, 1:ndim), intent(in)  x 
)

Transform conservative variables into primitive ones.

Definition at line 587 of file mod_mhd_phys.t.

Here is the call graph for this function:

◆ mhd_write_info()

subroutine mod_mhd_phys::mhd_write_info ( integer, intent(in)  fh)

Write this module's parameters to a snapsoht.

Definition at line 190 of file mod_mhd_phys.t.

◆ rhos_to_e()

subroutine mod_mhd_phys::rhos_to_e ( integer, intent(in)  ixI,
integer, intent(in)  L,
integer, intent(in)  ixO,
  L,
double precision, dimension(ixi^s,nw)  w,
double precision, dimension(ixi^s,1:ndim), intent(in)  x 
)

Convert entropy to energy.

Definition at line 692 of file mod_mhd_phys.t.

Here is the call graph for this function:

Variable Documentation

◆ b0field_forcefree

logical, public, protected mod_mhd_phys::b0field_forcefree =.true.

B0 field is force-free.

Definition at line 132 of file mod_mhd_phys.t.

◆ boundary_divbfix

logical, dimension(2*^nd), public, protected mod_mhd_phys::boundary_divbfix =.true.

To control divB=0 fix for boundary.

Definition at line 126 of file mod_mhd_phys.t.

◆ boundary_divbfix_skip

integer, dimension(2*^nd), public, protected mod_mhd_phys::boundary_divbfix_skip =0

To skip * layer of ghost cells during divB=0 fix for boundary.

Definition at line 129 of file mod_mhd_phys.t.

◆ divbwave

logical, public mod_mhd_phys::divbwave = .true.

Add divB wave in Roe solver.

Definition at line 120 of file mod_mhd_phys.t.

◆ e_

integer, public, protected mod_mhd_phys::e_

Index of the energy density (-1 if not present)

Definition at line 66 of file mod_mhd_phys.t.

◆ he_abundance

double precision, public, protected mod_mhd_phys::he_abundance =0.1d0

Helium abundance over Hydrogen.

Definition at line 123 of file mod_mhd_phys.t.

◆ mag

integer, dimension(:), allocatable, public, protected mod_mhd_phys::mag

Indices of the magnetic field.

Definition at line 72 of file mod_mhd_phys.t.

◆ mhd_4th_order

logical, public, protected mod_mhd_phys::mhd_4th_order = .false.

MHD fourth order.

Definition at line 54 of file mod_mhd_phys.t.

◆ mhd_adiab

double precision, public mod_mhd_phys::mhd_adiab = 1.0d0

The adiabatic constant.

Definition at line 84 of file mod_mhd_phys.t.

◆ mhd_divb_4thorder

logical, public, protected mod_mhd_phys::mhd_divb_4thorder = .false.

Whether divB is computed with a fourth order approximation.

Definition at line 105 of file mod_mhd_phys.t.

◆ mhd_energy

logical, public, protected mod_mhd_phys::mhd_energy = .true.

Whether an energy equation is used.

Definition at line 8 of file mod_mhd_phys.t.

◆ mhd_eta

double precision, public mod_mhd_phys::mhd_eta = 0.0d0

The MHD resistivity.

Definition at line 87 of file mod_mhd_phys.t.

◆ mhd_eta_hyper

double precision, public mod_mhd_phys::mhd_eta_hyper = 0.0d0

The MHD hyper-resistivity.

Definition at line 90 of file mod_mhd_phys.t.

◆ mhd_etah

double precision, public mod_mhd_phys::mhd_etah = 0.0d0

TODO: what is this?

Definition at line 93 of file mod_mhd_phys.t.

◆ mhd_gamma

double precision, public mod_mhd_phys::mhd_gamma = 5.d0/3.0d0

The adiabatic index.

Definition at line 81 of file mod_mhd_phys.t.

◆ mhd_glm

logical, public, protected mod_mhd_phys::mhd_glm = .false.

Whether GLM-MHD is used.

Definition at line 32 of file mod_mhd_phys.t.

◆ mhd_glm_alpha

double precision, public mod_mhd_phys::mhd_glm_alpha = 0.5d0

GLM-MHD parameter: ratio of the diffusive and advective time scales for div b taking values within [0, 1].

Definition at line 39 of file mod_mhd_phys.t.

◆ mhd_gravity

logical, public, protected mod_mhd_phys::mhd_gravity = .false.

Whether gravity is added.

Definition at line 20 of file mod_mhd_phys.t.

◆ mhd_hall

logical, public, protected mod_mhd_phys::mhd_hall = .false.

Whether Hall-MHD is used.

Definition at line 23 of file mod_mhd_phys.t.

◆ mhd_magnetofriction

logical, public, protected mod_mhd_phys::mhd_magnetofriction = .false.

Whether magnetofriction is added.

Definition at line 29 of file mod_mhd_phys.t.

◆ mhd_n_tracer

integer, public, protected mod_mhd_phys::mhd_n_tracer = 0

Number of tracer species.

Definition at line 57 of file mod_mhd_phys.t.

◆ mhd_particles

logical, public, protected mod_mhd_phys::mhd_particles = .false.

Whether particles module is added.

Definition at line 26 of file mod_mhd_phys.t.

◆ mhd_radiative_cooling

logical, public, protected mod_mhd_phys::mhd_radiative_cooling = .false.

Whether radiative cooling is added.

Definition at line 14 of file mod_mhd_phys.t.

◆ mhd_thermal_conduction

logical, public, protected mod_mhd_phys::mhd_thermal_conduction = .false.

Whether thermal conduction is used.

Definition at line 11 of file mod_mhd_phys.t.

◆ mhd_viscosity

logical, public, protected mod_mhd_phys::mhd_viscosity = .false.

Whether viscosity is added.

Definition at line 17 of file mod_mhd_phys.t.

◆ mom

integer, dimension(:), allocatable, public, protected mod_mhd_phys::mom

Indices of the momentum density.

Definition at line 63 of file mod_mhd_phys.t.

◆ p_

integer, public, protected mod_mhd_phys::p_

Index of the gas pressure (-1 if not present) should equal e_.

Definition at line 69 of file mod_mhd_phys.t.

◆ psi_

integer, public, protected mod_mhd_phys::psi_

Indices of the GLM psi.

Definition at line 75 of file mod_mhd_phys.t.

◆ rho_

integer, public, protected mod_mhd_phys::rho_

Index of the density (in the w array)

Definition at line 60 of file mod_mhd_phys.t.

◆ source_split_divb

logical, public, protected mod_mhd_phys::source_split_divb = .false.

Whether divB cleaning sources are added splitting from fluid solver.

Definition at line 35 of file mod_mhd_phys.t.

◆ tracer

integer, dimension(:), allocatable, public, protected mod_mhd_phys::tracer

Indices of the tracers.

Definition at line 78 of file mod_mhd_phys.t.

◆ typedivbfix

character(len=std_len), public, protected mod_mhd_phys::typedivbfix = 'linde'

Method type to clean divergence of B.

Definition at line 102 of file mod_mhd_phys.t.