MPI-AMRVAC  2.2
The MPI - Adaptive Mesh Refinement - Versatile Advection Code
Data Types | Modules | Functions/Subroutines | Variables
mod_mhd_phys.t File Reference

Go to the source code of this file.

Modules

module  mod_mhd_phys
 Magneto-hydrodynamics module.
 

Functions/Subroutines

subroutine mod_mhd_phys::mhd_write_info (fh)
 Write this module's parameters to a snapsoht. More...
 
subroutine mod_mhd_phys::mhd_angmomfix (fC, x, wnew, ixIL, ixOL, idim)
 
subroutine, public mod_mhd_phys::mhd_phys_init ()
 
subroutine mod_mhd_phys::mhd_check_params
 
subroutine mod_mhd_phys::mhd_physical_units ()
 
subroutine mod_mhd_phys::mhd_check_w (primitive, ixIL, ixOL, w, flag)
 
subroutine, public mod_mhd_phys::mhd_to_conserved (ixIL, ixOL, w, x)
 Transform primitive variables into conservative ones. More...
 
subroutine, public mod_mhd_phys::mhd_to_primitive (ixIL, ixOL, w, x)
 Transform conservative variables into primitive ones. More...
 
subroutine mod_mhd_phys::mhd_ei_to_e (ixIL, ixOL, w, x)
 Transform internal energy to total energy. More...
 
subroutine mod_mhd_phys::mhd_e_to_ei (ixIL, ixOL, w, x)
 Transform total energy to internal energy. More...
 
subroutine mod_mhd_phys::mhd_energy_synchro (qdt, ixIL, ixOL, wCT, w, x)
 
subroutine mod_mhd_phys::mhd_handle_small_values (primitive, w, x, ixIL, ixOL, subname)
 
subroutine mod_mhd_phys::e_to_rhos (ixIL, ixOL, w, x)
 Convert energy to entropy. More...
 
subroutine mod_mhd_phys::rhos_to_e (ixIL, ixOL, w, x)
 Convert entropy to energy. More...
 
subroutine, public mod_mhd_phys::mhd_get_v (w, x, ixIL, ixOL, v)
 Calculate v vector. More...
 
subroutine, public mod_mhd_phys::mhd_get_v_idim (w, x, ixIL, ixOL, idim, v)
 Calculate v component. More...
 
subroutine mod_mhd_phys::mhd_get_cmax (w, x, ixIL, ixOL, idim, cmax)
 Calculate cmax_idim=csound+abs(v_idim) within ixO^L. More...
 
subroutine mod_mhd_phys::mhd_get_a2max (w, x, ixIL, ixOL, a2max)
 
subroutine mod_mhd_phys::mhd_get_tcutoff (ixIL, ixOL, w, x, tco_local, Tmax_local)
 get adaptive cutoff temperature for TRAC (Johnston 2019 ApJL, 873, L22) More...
 
subroutine mod_mhd_phys::mhd_get_cbounds (wLC, wRC, wLp, wRp, x, ixIL, ixOL, idim, cmax, cmin)
 Estimating bounds for the minimum and maximum signal velocities. More...
 
subroutine mod_mhd_phys::mhd_get_csound (w, x, ixIL, ixOL, idim, csound)
 Calculate fast magnetosonic wave speed. More...
 
subroutine mod_mhd_phys::mhd_get_csound_prim (w, x, ixIL, ixOL, idim, csound)
 Calculate fast magnetosonic wave speed. More...
 
subroutine, public mod_mhd_phys::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 mod_mhd_phys::mhd_get_temperature_from_eint (w, x, ixIL, ixOL, res)
 Calculate temperature=p/rho when in e_ the internal energy is stored. More...
 
subroutine mod_mhd_phys::mhd_get_temperature_from_etot (w, x, ixIL, ixOL, res)
 Calculate temperature=p/rho when in e_ the total energy is stored this does not check the values of mhd_energy and mhd_internal_e, mhd_energy = .true. and mhd_internal_e = .false. also check small_values is avoided. More...
 
subroutine mod_mhd_phys::mhd_ei_to_e1 (ixIL, ixOL, w, x)
 Transform internal energy to total energy. More...
 
subroutine mod_mhd_phys::mhd_e_to_ei1 (ixIL, ixOL, w, x)
 Transform total energy to internal energy. More...
 
subroutine, public mod_mhd_phys::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 mod_mhd_phys::mhd_get_p_total (w, x, ixIL, ixOL, p)
 Calculate total pressure within ixO^L including magnetic pressure. More...
 
subroutine mod_mhd_phys::mhd_get_flux (wC, w, x, ixIL, ixOL, idim, f)
 Calculate fluxes within ixO^L. More...
 
subroutine mod_mhd_phys::add_source_ambipolar_internal_energy (qdt, ixIL, ixOL, wCT, w, x, ie)
 Source terms J.E in internal energy. For the ambipolar term E = ambiCoef * JxBxB=ambiCoef * B^2(-J_perpB) More...
 
subroutine mod_mhd_phys::mhd_get_jxbxb (w, x, ixIL, ixOL, res)
 
subroutine mod_mhd_phys::sts_set_source_ambipolar (ixIL, ixOL, w, x, wres, fix_conserve_at_step, my_dt, igrid, indexChangeStart, indexChangeN, indexChangeFixC)
 Sets the sources for the ambipolar this is used for the STS method. More...
 
double precision function mod_mhd_phys::get_ambipolar_dt (w, ixIL, ixOL, dxD, x)
 Calculates the explicit dt for the ambipokar term This function is used by both explicit scheme and STS method. More...
 
subroutine, public mod_mhd_phys::multiplyambicoef (ixIL, ixOL, res, w, x)
 multiply res by the ambipolar coefficient The ambipolar coefficient is calculated as -mhd_eta_ambi/rho^2 The user may mask its value in the user file by implemneting usr_mask_ambipolar subroutine More...
 
subroutine mod_mhd_phys::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 mod_mhd_phys::boris_add_source (qdt, ixIL, ixOL, wCT, w, x, qsourcesplit, active)
 
subroutine mod_mhd_phys::get_lorentz (ixIL, ixOL, w, JxB)
 Compute the Lorentz force (JxB) More...
 
subroutine mod_mhd_phys::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...
 
double precision function, dimension(ixo^s) mod_mhd_phys::mhd_gamma_alfven (w, ixIL, ixOL)
 Compute 1/sqrt(1+v_A^2/c^2) for Boris simplification, where v_A is the Alfven velocity. More...
 
subroutine mod_mhd_phys::internal_energy_add_source (qdt, ixIL, ixOL, wCT, w, x, ie)
 
subroutine mod_mhd_phys::mhd_handle_small_ei (w, x, ixIL, ixOL, ie, subname)
 handle small or negative internal energy More...
 
subroutine mod_mhd_phys::add_source_b0split (qdt, ixIL, ixOL, wCT, w, x)
 Source terms after split off time-independent magnetic field. More...
 
subroutine mod_mhd_phys::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 mod_mhd_phys::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 mod_mhd_phys::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 mod_mhd_phys::add_source_glm (qdt, ixIL, ixOL, wCT, w, x)
 
subroutine mod_mhd_phys::add_source_powel (qdt, ixIL, ixOL, wCT, w, x)
 Add divB related sources to w within ixO corresponding to Powel. More...
 
subroutine mod_mhd_phys::add_source_janhunen (qdt, ixIL, ixOL, wCT, w, x)
 
subroutine mod_mhd_phys::add_source_linde (qdt, ixIL, ixOL, wCT, w, x)
 
subroutine, public mod_mhd_phys::get_divb (w, ixIL, ixOL, divb, fourthorder)
 Calculate div B within ixO. More...
 
subroutine, public mod_mhd_phys::get_normalized_divb (w, ixIL, ixOL, divb)
 get dimensionless div B = |divB| * volume / area / |B| More...
 
subroutine, public mod_mhd_phys::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 mod_mhd_phys::mhd_get_dt (w, ixIL, ixOL, dtnew, dxD, x)
 If resistivity is not zero, check diffusion time limit for dt. More...
 
subroutine mod_mhd_phys::mhd_add_source_geom (qdt, ixIL, ixOL, wCT, w, x)
 
double precision function, dimension(ixo^s), public mod_mhd_phys::mhd_mag_en_all (w, ixIL, ixOL)
 Compute 2 times total magnetic energy. More...
 
double precision function, dimension(ixo^s) mod_mhd_phys::mhd_mag_i_all (w, ixIL, ixOL, idir)
 Compute full magnetic field by direction. More...
 
double precision function, dimension(ixo^s) mod_mhd_phys::mhd_mag_en (w, ixIL, ixOL)
 Compute evolving magnetic energy. More...
 
double precision function, dimension(ixo^s), public mod_mhd_phys::mhd_kin_en (w, ixIL, ixOL, inv_rho)
 compute kinetic energy More...
 
subroutine mod_mhd_phys::mhd_getv_hall (w, x, ixIL, ixOL, vHall)
 
subroutine mod_mhd_phys::mhd_get_jambi (w, x, ixIL, ixOL, res)
 
subroutine mod_mhd_phys::mhd_getdt_hall (w, x, ixIL, ixOL, dxD, dthall)
 
subroutine mod_mhd_phys::mhd_modify_wlr (ixIL, ixOL, qt, wLC, wRC, wLp, wRp, s, idir)
 
subroutine mod_mhd_phys::mhd_boundary_adjust
 
subroutine mod_mhd_phys::fixdivb_boundary (ixGL, ixOL, w, x, iB)
 
subroutine, public mod_mhd_phys::mhd_clean_divb_multigrid (qdt, qt, active)
 
subroutine mod_mhd_phys::mhd_update_faces (ixIL, ixOL, qt, qdt, wprim, fC, fE, sCT, s)
 
subroutine mod_mhd_phys::update_faces_average (ixIL, ixOL, qt, qdt, fC, fE, sCT, s)
 get electric field though averaging neighors to update faces in CT More...
 
subroutine mod_mhd_phys::update_faces_contact (ixIL, ixOL, qt, qdt, wp, fC, fE, sCT, s)
 update faces using UCT contact mode by Gardiner and Stone 2005 JCP 205, 509 More...
 
subroutine mod_mhd_phys::update_faces_hll (ixIL, ixOL, qt, qdt, fE, sCT, s)
 update faces More...
 
subroutine mod_mhd_phys::get_resistive_electric_field (ixIL, ixOL, sCT, s, jce)
 calculate eta J at cell edges More...
 
subroutine, public mod_mhd_phys::mhd_face_to_center (ixOL, s)
 calculate cell-center values from face-center values More...
 
subroutine, public mod_mhd_phys::b_from_vector_potential (ixIsL, ixIL, ixOL, ws, x)
 calculate magnetic field from vector potential More...
 

Variables

logical, public, protected mod_mhd_phys::mhd_energy = .true.
 Whether an energy equation is used. More...
 
logical, public, protected mod_mhd_phys::mhd_thermal_conduction = .false.
 Whether thermal conduction is used. More...
 
logical, public, protected mod_mhd_phys::use_new_mhd_tc = .false.
 Whether use new mod_tc. More...
 
logical, public, protected mod_mhd_phys::mhd_radiative_cooling = .false.
 Whether radiative cooling is added. More...
 
logical, public, protected mod_mhd_phys::mhd_viscosity = .false.
 Whether viscosity is added. More...
 
logical, public, protected mod_mhd_phys::mhd_gravity = .false.
 Whether gravity is added. More...
 
logical, public, protected mod_mhd_phys::mhd_hall = .false.
 Whether Hall-MHD is used. More...
 
logical, public, protected mod_mhd_phys::mhd_ambipolar = .false.
 Whether Ambipolar term is used. More...
 
logical, public, protected mod_mhd_phys::mhd_ambipolar_sts = .false.
 Whether Ambipolar term is implemented using supertimestepping. More...
 
logical, public, protected mod_mhd_phys::mhd_particles = .false.
 Whether particles module is added. More...
 
logical, public, protected mod_mhd_phys::mhd_magnetofriction = .false.
 Whether magnetofriction is added. More...
 
logical, public, protected mod_mhd_phys::mhd_glm = .false.
 Whether GLM-MHD is used. More...
 
logical, public, protected mod_mhd_phys::mhd_solve_eaux = .false.
 Whether auxiliary internal energy is solved. More...
 
logical, public, protected mod_mhd_phys::mhd_internal_e = .false.
 Whether internal energy is solved instead of total energy. More...
 
logical, public, protected mod_mhd_phys::source_split_divb = .false.
 Whether divB cleaning sources are added splitting from fluid solver. More...
 
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]. More...
 
logical, public, protected mod_mhd_phys::mhd_4th_order = .false.
 MHD fourth order. More...
 
integer, public, protected mod_mhd_phys::mhd_n_tracer = 0
 Number of tracer species. More...
 
integer, public, protected mod_mhd_phys::rho_
 Index of the density (in the w array) More...
 
integer, dimension(:), allocatable, public, protected mod_mhd_phys::mom
 Indices of the momentum density. More...
 
integer, public, protected mod_mhd_phys::e_
 Index of the energy density (-1 if not present) More...
 
integer, public, protected mod_mhd_phys::p_
 Index of the gas pressure (-1 if not present) should equal e_. More...
 
integer, dimension(:), allocatable, public, protected mod_mhd_phys::mag
 Indices of the magnetic field. More...
 
integer, public, protected mod_mhd_phys::psi_
 Indices of the GLM psi. More...
 
integer, public, protected mod_mhd_phys::eaux_
 Indices of auxiliary internal energy. More...
 
integer, public, protected mod_mhd_phys::paux_
 
integer, dimension(:), allocatable, public, protected mod_mhd_phys::tracer
 Indices of the tracers. More...
 
double precision, public mod_mhd_phys::mhd_gamma = 5.d0/3.0d0
 The adiabatic index. More...
 
double precision, public mod_mhd_phys::mhd_adiab = 1.0d0
 The adiabatic constant. More...
 
double precision, public mod_mhd_phys::mhd_eta = 0.0d0
 The MHD resistivity. More...
 
double precision, public mod_mhd_phys::mhd_eta_hyper = 0.0d0
 The MHD hyper-resistivity. More...
 
double precision, public mod_mhd_phys::mhd_etah = 0.0d0
 TODO: what is this? More...
 
double precision, public mod_mhd_phys::mhd_eta_ambi = 0.0d0
 The MHD ambipolar coefficient. More...
 
character(len=std_len), public, protected mod_mhd_phys::typedivbfix = 'linde'
 Method type to clean divergence of B. More...
 
character(len=std_len), public, protected mod_mhd_phys::type_ct = 'uct_contact'
 Method type of constrained transport. More...
 
logical, public, protected mod_mhd_phys::mhd_divb_4thorder = .false.
 Whether divB is computed with a fourth order approximation. More...
 
logical, public mod_mhd_phys::divbwave = .true.
 Add divB wave in Roe solver. More...
 
logical, public mod_mhd_phys::clean_initial_divb = .false.
 clean initial divB More...
 
double precision, public, protected mod_mhd_phys::he_abundance =0.1d0
 Helium abundance over Hydrogen. More...
 
logical, dimension(2 *^nd), public, protected mod_mhd_phys::boundary_divbfix =.true.
 To control divB=0 fix for boundary. More...
 
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. More...
 
logical, public, protected mod_mhd_phys::b0field_forcefree =.true.
 B0 field is force-free. More...
 
procedure(mask_subroutine), pointer, public mod_mhd_phys::usr_mask_ambipolar => null()