MPI-AMRVAC 3.2
The MPI - Adaptive Mesh Refinement - Versatile Advection Code (development version)
Loading...
Searching...
No Matches
mod_eos_shared_functions.t
Go to the documentation of this file.
1!=============================================================================
2!> Shared EoS accessors (EoS-type-agnostic) for the eos% family.
3!>
4!> Carved out of mod_eos.t (the per-type split). These operate on `eos` and the
5!> conserved/primitive state without committing to FI / LTE / PI, so they are
6!> the common dependency that mod_eos_FI / mod_eos_LTE / mod_eos_PI and the
7!> orchestrating mod_eos all draw on -- keeping the type-specific modules free
8!> of any back-dependency on mod_eos (no circular use). mod_eos re-exports the
9!> public names so existing `use mod_eos` callers are unaffected.
10!=============================================================================
14
15 implicit none
16 private
17
18 public :: get_rho, get_nh, get_ne_nh
20 public :: eos_get_log_t_floor
21
22contains
23
24 !> Mass density (code units).
25 subroutine get_rho(w,x,ixI^L,ixO^L,rho)
26 integer, intent(in) :: ixi^l, ixo^l
27 double precision, intent(in) :: w(ixi^s,1:nw)
28 double precision, intent(in) :: x(ixi^s,1:ndim)
29 double precision, intent(out) :: rho(ixi^s)
30
31 rho(ixo^s) = w(ixo^s,iw_rho)
32
33 end subroutine get_rho
34
35 !> Hydrogen number density: nH = rho / nH2rhoFactor.
36 subroutine get_nh(w,x,ixI^L,ixO^L,nH)
37 integer, intent(in) :: ixi^l, ixo^l
38 double precision, intent(in) :: w(ixi^s,1:nw)
39 double precision, intent(in) :: x(ixi^s,1:ndim)
40 double precision, intent(out) :: nh(ixi^s)
41
42 nh(ixo^s) = w(ixo^s,iw_rho) / eos%nH2rhoFactor
43
44 end subroutine get_nh
45
46 !> Return electron and hydrogen number densities in code units.
47 !> For LTE (iw_ne allocated): ne from Saha EoS, nH from rho/nH2rhoFactor.
48 !> For FI (iw_ne not allocated): ne = nH * neOnH_FI (full ionisation).
49 subroutine get_ne_nh(ixI^L, ixO^L, w, ne, nH)
50 integer, intent(in) :: ixi^l, ixo^l
51 double precision, intent(in) :: w(ixi^s, 1:nw)
52 double precision, intent(out) :: ne(ixi^s), nh(ixi^s)
53
54 nh(ixo^s) = w(ixo^s, iw_rho) / eos%nH2rhoFactor
55 if (iw_ne > 0) then
56 ne(ixo^s) = w(ixo^s, iw_ne)
57 else
58 ne(ixo^s) = nh(ixo^s) * eos%neOnH_FI
59 end if
60 end subroutine get_ne_nh
61
62 !> Temperature from the TOTAL energy: strip kinetic (+magnetic) energy via
63 !> phys_e_to_ei, then delegate to the type-specific eos%get_temperature_from_eint.
64 subroutine get_temperature_from_etot(w, x, ixI^L, ixO^L, res)
65 use mod_physics
66 integer, intent(in) :: ixi^l,ixo^l
67 double precision, intent(in) :: x(ixi^s,1:ndim)
68 double precision, intent(in) :: w(ixi^s,1:nw)
69 double precision, intent(out) :: res(ixi^s)
70 double precision :: wlocal(ixi^s,1:nw)
71
72 !> No timing here: get_temperature_from_eint is already timed.
73 !> The array copy and e_to_ei subtraction are trivial.
74 wlocal(ixi^s,1:nw)=w(ixi^s,1:nw)
75 call phys_e_to_ei(ixi^l, ixo^l, wlocal, x)
76 call eos%get_temperature_from_eint(wlocal, x, ixi^l, ixo^l, res)
77
78 end subroutine get_temperature_from_etot
79
80 !> Lower log10(T) bound for the (rho,T) inverse table; FI (no tables) floors
81 !> at log10(smalldouble). Used by the TC fluid-port log_T_floor.
82 double precision function eos_get_log_t_floor() result(log_T_min)
83 if (eos%method_id == eos_entropy .and. allocated(eos%eintT%table)) then
84 log_t_min = eos%eintT%var2_min
85 else if (allocated(eos%eint_from_T%table)) then
86 log_t_min = eos%eint_from_T%var2_min
87 else
88 log_t_min = dlog10(smalldouble)
89 end if
90 end function eos_get_log_t_floor
91
EoS state container – the single thermodynamic authority for AMRVAC.
integer, parameter, public eos_entropy
type(eos_container), allocatable, public eos
The single EoS state object, allocated in eos_init and shared (read-mostly) across all EoS sub-module...
Shared EoS accessors (EoS-type-agnostic) for the eos% family.
subroutine, public get_ne_nh(ixil, ixol, w, ne, nh)
Return electron and hydrogen number densities in code units. For LTE (iw_ne allocated): ne from Saha ...
double precision function, public eos_get_log_t_floor()
Lower log10(T) bound for the (rho,T) inverse table; FI (no tables) floors at log10(smalldouble)....
subroutine, public get_nh(w, x, ixil, ixol, nh)
Hydrogen number density: nH = rho / nH2rhoFactor.
subroutine, public get_temperature_from_etot(w, x, ixil, ixol, res)
Temperature from the TOTAL energy: strip kinetic (+magnetic) energy via phys_e_to_ei,...
subroutine, public get_rho(w, x, ixil, ixol, rho)
Mass density (code units).
This module contains definitions of global parameters and variables and some generic functions/subrou...
integer, parameter ndim
Number of spatial dimensions for grid variables.
This module defines the procedures of a physics module. It contains function pointers for the various...
Definition mod_physics.t:4
procedure(sub_e_to_ei), pointer phys_e_to_ei
Definition mod_physics.t:66