cons2prim

Module

Description

Subroutines to swap between primitive variables needed on RHS of fluid equations (density,velocity,internal energy) and conserved/evolved variables on the LHS of the fluid equations (rho*,momentum,entropy)

This is complicated in the GR code but also useful to structure things this way in the non-GR code, e.g. B/rho is the evolved variable while B is the “primitive” variable for magnetic field. Similarly sqrt(rho_d) is the evolved variable for dust species but the primitive variable is the dust mass fraction.

References:

Liptai & Price (2019), MNRAS 485, 819-842 Ballabio et al. (2018), MNRAS 477, 2766-2771

Owner:

Daniel Price

Runtime parameters:

None

Dependencies:

cons2primsolver, dim, eos, io, nicil, options, part, radiation_utils, shock_capturing, utils_gr

Quick access

Routines:

cons2prim_everything(), cons2primall(), cons2primall_sink(), prim2consall(), prim2consi()

Variables

Subroutines and functions

subroutine  cons2prim/prim2consall(npart, xyzh, metrics, vxyzu, pxyzu[, use_dens[, dens[, use_sink]]])
Parameters:
  • npart [integer,in]

  • xyzh (,) [real,in] :: save smoothing length, h

  • metrics (,,*,*) [real,in]

  • vxyzu (,) [real,in]

  • pxyzu (,) [real,out]

  • use_dens [logical,in,]

  • dens (*) [real,inout,]

  • use_sink [logical,in,]

Use :

part (isdead_or_accreted(), ien_type(), eos_vars(), igasp(), igamma(), itemp(), igas(), aprmassoftype(), apr_level(), massoftype()), eos (gamma(), ieos()), dim (use_apr())

Call to:

prim2consi()

subroutine  cons2prim/prim2consi(pmassi, xyzhi, metrici, vxyzui, pri, tempi, pxyzui, ien_type[, use_dens[, use_sink[, dens_i]]])
Parameters:
  • pmassi [real,in]

  • xyzhi (4) [real,in]

  • metrici (,,*) [real,in]

  • vxyzui (4) [real,in]

  • pri [real,inout]

  • tempi [real,inout]

  • pxyzui (4) [real,out]

  • ien_type [integer,in]

  • use_dens [logical,in,]

  • use_sink [logical,in,]

  • dens_i [real,inout,] :: Feed the newly computed dens back out of the routine

Use :

cons2primsolver (primitive2conservative()), utils_gr (h2dens()), eos (equationofstate(), ieos())

Called from:

prim2consall()

Call to:

primitive2conservative()

subroutine  cons2prim/cons2primall(npart, xyzh, metrics, pxyzu, vxyzu, dens, eos_vars)
Parameters:
  • npart [integer,in]

  • xyzh (,) [real,in]

  • metrics (,,*,*) [real,in]

  • pxyzu (,) [real,in]

  • vxyzu (,) [real,inout]

  • dens (*) [real,inout]

  • eos_vars (,) [real,out]

Use :

cons2primsolver (conservative2primitive()), part (isdead_or_accreted(), massoftype(), igas(), rhoh(), igasp(), ics(), ien_type(), itemp(), igamma(), aprmassoftype(), apr_level()), io (fatal()), eos (ieos(), done_init_eos(), init_eos(), get_spsound()), dim (use_apr())

Call to:

conservative2primitive()

subroutine  cons2prim/cons2primall_sink(nptmass, xyzmh_ptmass, metrics_ptmass, pxyzu_ptmass, vxyz_ptmass)
Parameters:
  • nptmass [integer,in]

  • xyzmh_ptmass (,) [real,in]

  • metrics_ptmass (,,*,*) [real,in]

  • pxyzu_ptmass (,) [real,in]

  • vxyz_ptmass (,) [real,inout]

Use :

cons2primsolver (conservative2primitive()), io (fatal()), part (ien_type())

Call to:

conservative2primitive()

subroutine  cons2prim/cons2prim_everything(npart, xyzh, vxyzu, dvdx, rad, eos_vars, radprop, bevol, bxyz, dustevol, dustfrac, alphaind)
Parameters:
  • npart [integer,in]

  • xyzh (,) [real,in]

  • vxyzu (,) [real,inout]

  • dvdx (,) [real,in]

  • rad (,) [real,in]

  • eos_vars (,) [real,out] :: needed for initial guess for idealplusrad

  • radprop (,) [real,out] :: arbitrary, but should give zero for u when u=cv*T

  • bevol (,) [real,in]

  • bxyz (,) [real,out]

  • dustevol (,) [real,in]

  • dustfrac (,) [real,out]

  • alphaind (,) [real,inout]

Use :

part (nucleation(), igamma()), eos (equationofstate(), ieos(), eos_outputs_mu(), done_init_eos(), init_eos(), gmw(), x_in(), z_in(), gamma()), radiation_utils (radiation_equation_of_state(), get_opacity()), dim (mhd(), maxvxyzu(), maxphase(), maxp(), use_dustgrowth(), do_radiation(), nalpha(), mhd_nonideal(), do_nucleation(), use_krome(), update_mugamma(), use_apr()), nicil (nicil_update_nimhd(), nicil_translate_error(), n_warn()), io (fatal(), real4(), warning()), shock_capturing (get_alphaloc(), xi_limiter()), options (alpha(), alphamax(), use_dustfrac(), iopacity_type(), use_var_comp(), implicit_radiation())