File Radiation.H

class Radiation
#include <Radiation.H>

Public Types

enum Solver_Type

Values:

enumerator InvalidSolver
enumerator SingleGroupSolver
enumerator SGFLDSolver
enumerator MGFLDSolver

Public Functions

Radiation(amrex::Amr *Parent, class Castro *castro, int restart = 0)
Parameters:
  • Parent

  • castro

  • restart

void regrid(int level, const amrex::BoxArray &grids, const amrex::DistributionMapping &dmap)
Parameters:
  • level

  • grids

  • dmap

void close(int level)
Parameters:

level

void restart(int level, const amrex::BoxArray &grids, const amrex::DistributionMapping &dmap, const std::string &dir, std::istream &is)
Parameters:
  • level

  • grids

  • dmap

  • dir

  • is

void checkPoint(int level, const std::string &dir, std::ostream &os, amrex::VisMF::How how)
Parameters:
  • level

  • dir

  • os

  • how

void set_current_group(int igroup)

access to group information

Parameters:

igroup

inline amrex::Real group_center(int i)
Parameters:

i

inline amrex::Real group_weight(int i)
Parameters:

i

inline amrex::Real deltaEnergyRatMax(int lev)

diagnostics for adjusting timestep

Parameters:

lev

inline amrex::Real deltaTRatMax(int lev)
Parameters:

lev

inline nodiscard amrex::Real deltaEnergyTol () const
inline nodiscard amrex::Real deltaTTol () const
inline amrex::FluxRegister *consRegister(int level)

access to conservation flux register for energy diagnostics

Parameters:

level

void post_init(int level)
Parameters:

level

void pre_timestep(int level)
Parameters:

level

void init_flux(int level, int ncycle)
Parameters:
  • level

  • ncycle

void deferred_sync_setup(int level)
Parameters:

level

void deferred_sync(int level, amrex::MultiFab &rhs, int indx)
Parameters:
  • level

  • rhs

  • indx

void single_group_update(int level, int iteration, int ncycle)
Parameters:
  • level

  • iteration

  • ncycle

void MGFLD_implicit_update(int level, int iteration, int ncycle)
Parameters:
  • level

  • iteration

  • ncycle

void write_groups(ostream &os)
Parameters:

os

void reflux(int level)
Parameters:

level

void compute_limiter(int level, const amrex::BoxArray &grids, const amrex::MultiFab &Sborder, const amrex::MultiFab &Erborder, amrex::MultiFab &lamborder)
Parameters:
  • level

  • grids

  • &Sborder

  • &Erborder

  • &lamborder

void estimate_gamrPr(const amrex::FArrayBox &state, const amrex::FArrayBox &Er, amrex::FArrayBox &gPr, const amrex::Real *dx, const amrex::Box &box)
Parameters:
  • state

  • Er

  • gPr

  • dx

  • box

void EstTimeStep(amrex::Real &estdt, int level)
Parameters:
  • estdt

  • level

void filter_prim(int level, amrex::MultiFab &State)
Parameters:
  • level

  • State

void compute_exchange(amrex::MultiFab &exch, amrex::MultiFab &Er, amrex::MultiFab &fkp, int igroup = -1)
Parameters:
  • exch

  • Er

  • fkp

  • igroup

void compute_eta(amrex::MultiFab &eta, amrex::MultiFab &etainv, amrex::MultiFab &state, amrex::MultiFab &temp, amrex::MultiFab &fkp, amrex::MultiFab &Er, amrex::Real delta_t, amrex::Real c, amrex::Real underrel, int lag_planck, int igroup = 0)
Parameters:
  • eta

  • etainv

  • state

  • temp

  • fkp

  • Er

  • delta_t

  • c

  • underrel

  • lag_planck

  • igroup

void internal_energy_update(amrex::Real &relative, amrex::Real &absolute, amrex::MultiFab &frhoes, amrex::MultiFab &frhoem, amrex::MultiFab &eta, amrex::MultiFab &etainv, amrex::MultiFab &dflux_old, amrex::MultiFab &dflux_new, amrex::MultiFab &exchange, amrex::Real delta_t)
Parameters:
  • relative

  • absolute

  • frhoes

  • frhoem

  • eta

  • etainv

  • dflux_old

  • dflux_new

  • exchange

  • delta_t

void internal_energy_update(amrex::Real &relative, amrex::Real &absolute, amrex::MultiFab &frhoes, amrex::MultiFab &frhoem, amrex::MultiFab &eta, amrex::MultiFab &etainv, amrex::MultiFab &dflux_old, amrex::MultiFab &dflux_new, amrex::MultiFab &exchange, amrex::MultiFab &Dterm, amrex::Real delta_t)
Parameters:
  • relative

  • absolute

  • frhoes

  • frhoem

  • eta

  • etainv

  • dflux_old

  • dflux_new

  • exchange

  • Dterm

  • delta_t

void nonconservative_energy_update(amrex::Real &relative, amrex::Real &absolute, amrex::MultiFab &frhoes, amrex::MultiFab &frhoem, amrex::MultiFab &eta, amrex::MultiFab &etainv, amrex::MultiFab &Er_new, amrex::MultiFab &dflux_old, amrex::MultiFab &dflux_new, amrex::MultiFab &temp, amrex::MultiFab &fkp, amrex::MultiFab &state, amrex::Real delta_t)
Parameters:
  • relative

  • absolute

  • frhoes

  • frhoem

  • eta

  • etainv

  • Er_new

  • dflux_old

  • dflux_new

  • temp

  • fkp

  • state

  • delta_t

void state_update(amrex::MultiFab &state, amrex::MultiFab &frhoes)
Parameters:
  • state

  • frhoes

void getBndryData(RadBndry &bd, amrex::MultiFab &Er, amrex::Real time, int level)
Parameters:
  • bd

  • Er

  • time

  • level

void getBndryDataMG(MGRadBndry &mgbd, amrex::MultiFab &Er, amrex::Real time, int level)

multigroup version

Parameters:
  • mgbd

  • Er

  • time

  • level

void getBndryDataMG_ga(MGRadBndry &mgbd, amrex::MultiFab &Er, int level)
Parameters:
  • mgbd

  • Er

  • level

void filBndry(amrex::BndryRegister &bdry, int level, amrex::Real time)
Parameters:
  • bdry

  • level

  • time

void scaledGradient(int level, amrex::Array<amrex::MultiFab, AMREX_SPACEDIM> &R, amrex::MultiFab &kappa_r, int kcomp, amrex::MultiFab &Er, int igroup, int nGrow_Er = 0, int Rcomp = 0)

Computes the scaled gradient for use in flux limiters & Eddington factors

Parameters:
  • level

  • amrex::Array<amrex::MultiFab

  • R

  • kappa_r

  • kcomp

  • Er

  • igroup

  • nGrow_Er

  • Rcomp

void fluxLimiter(int level, amrex::Array<amrex::MultiFab, AMREX_SPACEDIM> &lambda, int lamcomp = 0)

On input, lambda should contain scaled gradient. On output this will be overwritten with the flux limiter.

Parameters:
  • level

  • amrex::Array<amrex::MultiFab

  • lambda

  • lamcomp

void get_c_v(amrex::FArrayBox &c_v, amrex::FArrayBox &temp, amrex::FArrayBox &state, const amrex::Box &reg)

Fab versions of conversion functions.

Parameters:
  • c_v

  • temp

  • state

  • reg

void get_frhoe(amrex::MultiFab &frhoe, amrex::MultiFab &state)

MultiFab versions of conversion functions call Fab versions for eos data

Parameters:
  • frhoe

  • state

void get_planck_and_temp(amrex::MultiFab &fkp, amrex::MultiFab &temp, amrex::MultiFab &state, int igroup = 0, amrex::Real delta_t = 0.0)

Planck mean is only needed in the grid interiors, but must be computed separately for each fluid (fkp.nVar() == N fluids). temp contains frhoe on input

Parameters:
  • fkp

  • temp

  • state

  • igroup

  • delta_t

void get_rosseland(amrex::MultiFab &kappa_r, amrex::AmrLevel *hclaw, int igroup = 0)

Rosseland mean is needed on an extended region (nGrow == 1). Fills patches with state information on extended region

Parameters:
  • kappa_r

  • hclaw

  • igroup

void update_rosseland_from_temp(amrex::MultiFab &kappa_r, amrex::MultiFab &temp, amrex::MultiFab &state, const amrex::Geometry &geom, int igroup = 0)

For the interior opacities, temperature is assumed to be known (input)

Updates Rosseland mean in interior of level, leaves ghost values at physical or coarse-fine interfaces untouched

Parameters:
  • kappa_r

  • temp

  • state

  • geom

  • igroup

void get_rosseland_v_dcf(amrex::MultiFab &kappa_r, amrex::MultiFab &v, amrex::MultiFab &dcf, amrex::Real delta_t, amrex::Real c, amrex::AmrLevel *hclaw, int igroup = 0)

RadHydro

Parameters:
  • kappa_r

  • v

  • dcf

  • delta_t

  • c

  • hclaw

  • igroup

void get_groups(int verbose)

multigroup methods

Parameters:

verbose

void extrapolateBorders(amrex::MultiFab &f, int indx)
Parameters:
  • f

  • indx

void SGFLD_compute_rosseland(amrex::MultiFab &kappa_r, const amrex::MultiFab &state)
Parameters:
  • kappa_r

  • state

void SGFLD_compute_rosseland(amrex::FArrayBox &kappa_r, const amrex::FArrayBox &state)
Parameters:
  • kappa_r

  • state

void update_dcf(amrex::MultiFab &dcf, amrex::MultiFab &etainv, amrex::MultiFab &kp, amrex::MultiFab &kr, const amrex::Geometry &geom)
Parameters:
  • dcf

  • etainv

  • kp

  • kr

  • geom

void check_convergence_er(amrex::Real &relative_in, amrex::Real &absolute_in, amrex::Real &error_er, const amrex::MultiFab &Er_new, const amrex::MultiFab &Er_pi, const amrex::MultiFab &kappa_p, const amrex::MultiFab &etaTz, const amrex::MultiFab &temp_new, amrex::Real delta_t)

</ Shestakov-Bolstad>

Parameters:
  • relative_in

  • absolute_in

  • error_er

  • Er_new

  • Er_pi

  • kappa_p

  • etaTz

  • temp_new

  • delta_t

void check_convergence_matt(const amrex::MultiFab &rhoe_new, const amrex::MultiFab &rhoe_star, const amrex::MultiFab &rhoe_step, const amrex::MultiFab &Er_new, const amrex::MultiFab &temp_new, const amrex::MultiFab &temp_star, const amrex::MultiFab &rho, const amrex::MultiFab &kappa_p, const amrex::MultiFab &jg, const amrex::MultiFab &dedT, amrex::Real &rel_rhoe, amrex::Real &abs_rhoe, amrex::Real &rel_FT, amrex::Real &abs_FT, amrex::Real &rel_T, amrex::Real &abs_T, amrex::Real delta_t)
Parameters:
  • rhoe_new

  • rhoe_star

  • rhoe_step

  • Er_new

  • temp_new

  • temp_star

  • rho

  • kappa_p

  • jg

  • dedT

  • rel_rhoe

  • abs_rhoe

  • rel_FT

  • abs_FT

  • rel_T

  • abs_T

  • delta_t

void compute_coupling(amrex::MultiFab &coupT, const amrex::MultiFab &kappa_p, const amrex::MultiFab &Er_pi, const amrex::MultiFab &jg)
Parameters:
  • coupT

  • kappa_p

  • Er_pi

  • jg

void compute_etat(amrex::MultiFab &etaT, amrex::MultiFab &etaTz, amrex::MultiFab &eta1, amrex::MultiFab &djdT, const amrex::MultiFab &dkdT, const amrex::MultiFab &dedT, const amrex::MultiFab &Er_star, const amrex::MultiFab &rho, amrex::Real delta_t, amrex::Real ptc_tau)
Parameters:
  • etaT

  • etaTz

  • eta1

  • djdT

  • dkdT

  • dedT

  • Er_star

  • rho

  • delta_t

  • ptc_tau

void eos_opacity_emissivity(const amrex::MultiFab &S_new, const amrex::MultiFab &temp_new, const amrex::MultiFab &temp_star, amrex::MultiFab &kappa_p, amrex::MultiFab &kappa_r, amrex::MultiFab &jg, amrex::MultiFab &djdT, amrex::MultiFab &dkdT, amrex::MultiFab &dedT, int level, int it, int ngrow)
Parameters:
  • S_new

  • temp_new

  • temp_star

  • kappa_p

  • kappa_r

  • jg

  • djdT

  • dkdT

  • dedT

  • level

  • it

  • ngrow

void gray_accel(amrex::MultiFab &Er_new, amrex::MultiFab &Er_pi, amrex::MultiFab &kappa_p, amrex::MultiFab &kappa_r, amrex::MultiFab &etaT, amrex::MultiFab &eta1, amrex::MultiFab &mugT, amrex::Array<amrex::MultiFab, AMREX_SPACEDIM> &lambda, RadSolve *solver, MGRadBndry &mgbd, const amrex::BoxArray &grids, int level, amrex::Real time, amrex::Real delta_t, amrex::Real ptc_tau)
Parameters:
  • Er_new

  • Er_pi

  • kappa_p

  • kappa_r

  • etaT

  • eta1

  • mugT

  • lambda

  • solver

  • mgbd

  • grids

  • level

  • time

  • delta_t

  • ptc_tau

void local_accel(amrex::MultiFab &Er_new, const amrex::MultiFab &Er_pi, const amrex::MultiFab &kappa_p, const amrex::MultiFab &etaT, const amrex::MultiFab &mugT, amrex::Real delta_t, amrex::Real ptc_tau)
Parameters:
  • Er_new

  • Er_pi

  • kappa_p

  • etaT

  • mugT

  • delta_t

  • ptc_tau

void state_energy_update(amrex::MultiFab &state, const amrex::MultiFab &rhoe, const amrex::MultiFab &temp, const amrex::BoxArray &grids, amrex::Real &derat, amrex::Real &dT, int level)
Parameters:
  • state

  • rhoe

  • temp

  • grids

  • derat

  • dT

  • level

void update_matter(amrex::MultiFab &rhoe_new, amrex::MultiFab &temp_new, const amrex::MultiFab &Er_new, const amrex::MultiFab &Er_pi, const amrex::MultiFab &rhoe_star, const amrex::MultiFab &rhoe_step, const amrex::MultiFab &etaT, const amrex::MultiFab &etaTz, const amrex::MultiFab &eta1, const amrex::MultiFab &coupT, const amrex::MultiFab &kappa_p, const amrex::MultiFab &jg, const amrex::MultiFab &mugT, const amrex::MultiFab &S_new, int level, amrex::Real delta_t, amrex::Real ptc_tau, int it, bool conservative_update)
Parameters:
  • rhoe_new

  • temp_new

  • Er_new

  • Er_pi

  • rhoe_star

  • rhoe_step

  • etaT

  • etaTz

  • eta1

  • coupT

  • kappa_p

  • jg

  • mugT

  • S_new

  • level

  • delta_t

  • ptc_tau

  • it

  • conservative_update

void bisect_matter(amrex::MultiFab &rhoe_new, amrex::MultiFab &temp_new, const amrex::MultiFab &rhoe_star, const amrex::MultiFab &temp_star, const amrex::MultiFab &S_new, const amrex::BoxArray &grids, int level)
Parameters:
  • rhoe_new

  • temp_new

  • rhoe_star

  • temp_star

  • S_new

  • grids

  • level

void MGFLD_compute_rosseland(amrex::MultiFab &kappa_r, const amrex::MultiFab &state)

for the hyperbolic solver

Parameters:
  • kappa_r

  • state

void MGFLD_compute_rosseland(amrex::FArrayBox &kappa_r, const amrex::FArrayBox &state)
Parameters:
  • kappa_r

  • state

void MGFLD_compute_scattering(amrex::FArrayBox &kappa_s, const amrex::FArrayBox &state)
Parameters:
  • kappa_s

  • state

void rhstoEr(amrex::MultiFab &rhs, amrex::Real dt, int level)
Parameters:
  • rhs

  • dt

  • level

void save_lambda_in_plotvar(int level, const amrex::Array<amrex::MultiFab, AMREX_SPACEDIM> &lambda)

</ MGFLD>

Parameters:
  • level

  • amrex::Array<amrex::MultiFab

  • lambda

void save_lab_Er_in_plotvar(int level, const amrex::MultiFab &Snew, const amrex::MultiFab &Ecom, const amrex::MultiFab &F, int iflx)
Parameters:
  • level

  • Snew

  • Ecom

  • F

  • iflx

void save_flux_in_plotvar(int level, const amrex::MultiFab &Snew, const amrex::Array<amrex::MultiFab, AMREX_SPACEDIM> &lambda, const amrex::MultiFab &Er, const amrex::MultiFab &F, int iflx, const amrex::Real lab_factor = 1.0)
Parameters:
  • level

  • Snew

  • amrex::Array<amrex::MultiFab

  • lambda

  • Er

  • F

  • iflx

  • lab_factor

void save_com_flux_in_plotvar(int level, const amrex::MultiFab &Snew, const amrex::Array<amrex::MultiFab, AMREX_SPACEDIM> &lambda, const amrex::MultiFab &Er, const amrex::MultiFab &F, int iflx)
Parameters:
  • level

  • Snew

  • amrex::Array<amrex::MultiFab

  • lambda

  • Er

  • F

  • iflx

Public Members

int verbose
int maxiter

iteration limit for implicit update loop

int miniter
int convergence_check_type

0 (default): both 2 and 3, 1: rhoe, 2: residue of Eq. rhoe, 3: T

amrex::Real relInTol
amrex::Real absInTol

tolerance for inner iteration of J equation

int maxInIter

iteration limit for inner iteration of J equation

int minInIter
int skipAccelAllowed

Skip acceleration if it doesn’t help.

int matter_update_type

0: conservative 1: non-conservative 2: C and NC interwoven The last outer iteration is always conservative.

int n_bisect

Bisection after n_bisect iterations.

amrex::Real dedT_fac

Make dedT larger for safety in Newton iteration.

int inner_convergence_check
amrex::Real delta_e_rat_dt_tol

energy change tolerance for adjusting timestep

amrex::Real delta_T_rat_dt_tol

T change tolerance for adjusting timestep.

int update_planck

after this number of iterations, lag planck

int update_rosseland

after this number of iterations, lag rosseland

int update_opacity
int update_limiter

after this number of iterations, lag limiter

int inner_update_limiter

This is for MGFLD solver. Stop updating limiter after ? inner iterations 0 means lagging by one outer iteration

amrex::Real dT

temperature step for derivative estimate

amrex::Real underfac

factor controlling progressive underrelaxation

int do_sync

perform sync (if false zero out sync source)

int do_kappa_stm_emission
amrex::Vector<std::unique_ptr<amrex::MultiFab>> plotvar
int use_dkdT

<MGFLD>

int use_WiensLaw

<Shestakov-Bolstad>

amrex::Real Tf_Wien
amrex::Vector<amrex::Real> xnu
amrex::Vector<amrex::Real> nugroup
amrex::Vector<amrex::Real> dnugroup
amrex::Vector<amrex::Real> lognugroup
amrex::Vector<amrex::Real> dlognugroup

Public Static Functions

static void read_static_params()

Public Static Attributes

static Solver_Type SolverType
static amrex::Real radtoE
static amrex::Real Etorad
static amrex::Real radfluxtoF
static int do_multigroup
static int nGroups
static int rad_hydro_combined
static int Er_Lorentz_term
static int icomp_lambda
static int icomp_kp
static int icomp_kr
static int icomp_lab_Er
static int icomp_lab_Fr
static int icomp_com_Fr
static int nplotvar
static amrex::Vector<std::string> plotvar_names
static int filter_lambda_T
static int filter_lambda_S
static int filter_prim_int
static int filter_prim_T
static int filter_prim_S
static int accelerate

controls multigroup convergence acceleration

static amrex::Real convert_MeV_erg

Physical constants for use in multigroup, made static and public so that other modules such as RadSolve can get to them easily. Values are set in the Radiation constructor.

static amrex::Real clight
static amrex::Real hPlanck
static amrex::Real kBoltz
static amrex::Real Avogadro
static amrex::Real c

Values used internally for speed of light, Stefan-Boltzmann constant, radiation constant. (For contrived test problems, these may differ from the proper physical values, so be careful if you use them!)

static amrex::Real sigma
static amrex::Real aRad
static int current_group_number
static std::string current_group_name
static int pure_hydro

Protected Attributes

amrex::Amr *parent
amrex::BCRec rad_bc

types defined in LO_BCTYPES.H, not BCTYPES.H

amrex::Real reltol
amrex::Real abstol

tolerances for implicit update loop

amrex::Vector<amrex::Real> delta_e_rat_level
amrex::Vector<amrex::Real> delta_T_rat_level
amrex::Vector<std::unique_ptr<amrex::FluxRegister>> flux_cons

arrays of flux registers flux_cons(\level) is a amrex::FluxRegister, which contains fluxes for all groups

amrex::Vector<std::unique_ptr<amrex::FluxRegister>> flux_cons_old
amrex::Vector<std::unique_ptr<amrex::FluxRegister>> flux_trial
amrex::Vector<amrex::Real> delta_t_old

for deferred sync

amrex::Vector<std::unique_ptr<amrex::MultiFab>> dflux

divergence of flux

std::string group_units
amrex::Real group_print_factor
amrex::IntVect spot