4#include "Numeric/Stencil.H"
34 pp.
forbid(
"pressure.P",
"use chamber.pressure instead");
36 pp.
forbid(
"geometry.x_len",
"This is specified by geometry.prob_lo/hi");
37 pp.
forbid(
"geometry.y_len",
"This is specified by geometry.prob_lo/hi");
38 pp.
forbid(
"amr.ghost_cells",
"This should not be adjustable ");
40 pp.
forbid(
"pf.gamma",
"implemented in regression rate law objects now");
42 pp.
forbid(
"pressure.r_ap",
"use regression.powerlaw.r_ap");
43 pp.
forbid(
"pressure.r_htpb",
"use regression.powerlaw.r_htpb");
44 pp.
forbid(
"pressure.r_comb",
"use regression.powerlaw.r_comb");
45 pp.
forbid(
"pressure.n_ap",
"use regression.powerlaw.n_ap");
46 pp.
forbid(
"pressure.n_htpb",
"use regression.powerlaw.n_htpb");
47 pp.
forbid(
"pressure.n_comb",
"use regression.powerlaw.n_comb");
49 pp.
forbid(
"thermal.bound",
"use thermal.Tref");
50 pp.
forbid(
"thermal.T_fluid",
"use thermal.Tfluid (or nothing)");
51 pp.
forbid(
"thermal.m_ap",
"use regression.arrhenius.m_ap");
52 pp.
forbid(
"thermal.m_htpb",
"use regression.arrhenius.m_htpb");
53 pp.
forbid(
"thermal.E_ap",
"use regression.arrhenius.E_ap");
54 pp.
forbid(
"thermal.E_htpb",
"use regression.arrhenius.E_htpb");
55 pp.
forbid(
"thermal.modeling_ap",
"Old debug variable. Should equal 1 ");
56 pp.
forbid(
"thermal.modeling_htpb",
"Old debug variable. Should equal 1");
58 pp.
forbid(
"pressure.a1",
"use propellant.mesoscale.a1 instead");
59 pp.
forbid(
"pressure.a2",
"use propellant.mesoscale.a2 instead");
60 pp.
forbid(
"pressure.a3",
"use propellant.mesoscale.a3 instead");
61 pp.
forbid(
"pressure.b1",
"use propellant.mesoscale.b1 instead");
62 pp.
forbid(
"pressure.b2",
"use propellant.mesoscale.b2 instead");
63 pp.
forbid(
"pressure.b3",
"use propellant.mesoscale.b3 instead");
64 pp.
forbid(
"pressure.c1",
"use propellant.mesoscale.c1 instead");
65 pp.
forbid(
"pressure.mob_ap",
"no longer used");
66 pp.
forbid(
"pressure.dependency",
"use propellant.mesoscale.arrhenius_dependency");
67 pp.
forbid(
"pressure.h1",
"use propellant.mesoscale.h1 instead");
68 pp.
forbid(
"pressure.h2",
"use propellant.mesoscale.h2 instead");
69 pp.
forbid(
"thermal.mlocal_ap",
"use propellant.mesoscale.mlocal_ap");
70 pp.
forbid(
"thermal.mlocal_comb",
"use propellant.mesoscale.mlocal_comb");
71 pp.
forbid(
"thermal.mlocal_htpb",
"this actually did **nothing** - it was overridden by a hard code using massfraction.");
73 pp.
forbid(
"thermal.disperssion1",
"use propellant.mesoscale.dispersion1");
74 pp.
forbid(
"thermal.disperssion2",
"use propellant.mesoscale.dispersion2");
75 pp.
forbid(
"thermal.disperssion3",
"use propellant.mesoscale.dispersion3");
77 pp.
forbid(
"thermal.rho_ap",
"use propellant.XX.rho_ap ");
78 pp.
forbid(
"thermal.rho_htpb",
"use propellant.XX.rho_htpb ");
79 pp.
forbid(
"thermal.k_ap",
"use propellant.XX.k_ap ");
80 pp.
forbid(
"thermal.k_htpb",
"use propellant.XX.k_htpb ");
81 pp.
forbid(
"thermal.cp_ap",
"use propellant.XX.cp_ap ");
82 pp.
forbid(
"thermal.cp_htpb",
"use propellant.XX.cp_htpb ");
90 BL_PROFILE(
"Integrator::Flame::Flame()");
189 (
"phi.ic",value.
ic_phi,value.geom);
204 if (value.
m_type != Type::Disable)
233 BL_PROFILE(
"Integrator::Flame::Initialize");
242 rhs_mf[lev]->setVal(Set::Vector::Zero());
270 for (
int lev = 0; lev <= finest_level; ++lev)
272 amrex::Box domain = this->geom[lev].Domain();
273 domain.convert(amrex::IntVect::TheNodeVector());
276 phi_mf[lev]->FillBoundary();
277 eta_mf[lev]->FillBoundary();
280 for (MFIter mfi(*
model_mf[lev],
false); mfi.isValid(); ++mfi)
282 amrex::Box smallbox = mfi.nodaltilebox();
283 amrex::Box bx = mfi.grownnodaltilebox() & domain;
292 amrex::ParallelFor(smallbox, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
295 rhs(i, j, k) =
elastic.traction * grad_eta;
297 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
315 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
334 BL_PROFILE(
"Integrator::Flame::TimeStepBegin");
337 for (
int lev = 0; lev <= finest_level; ++lev)
344 BL_PROFILE(
"Integrator::Flame::TimeStepComplete");
356 BL_PROFILE(
"Integrador::Flame::Advance");
370 else if (
chamber.pressure <= 0.99) {
382 -5.0 *
pf.w1 + 16.0 *
pf.w12 - 11.0 *
pf.w0,
383 14.0 *
pf.w1 - 32.0 *
pf.w12 + 18.0 *
pf.w0,
384 -8.0 *
pf.w1 + 16.0 *
pf.w12 - 8.0 *
pf.w0);
389 for (amrex::MFIter mfi(*
eta_mf[lev],
true); mfi.isValid(); ++mfi)
391 const amrex::Box& bx = mfi.tilebox();
405 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
429 Set::Scalar df_deta = ((
pf.lambda /
pf.eps) * dw(eta(i, j, k)) -
pf.eps *
pf.kappa * eta_lap);
430 etanew(i, j, k) = eta(i, j, k) - L *
dt * df_deta;
431 if (etanew(i, j, k) <=
small) etanew(i, j, k) =
small;
439 alpha(i, j, k) = K /
rho / cp;
445 mdot(i, j, k) =
rho * fabs(eta(i, j, k) - etanew(i, j, k)) /
dt;
452 heatflux(i,j,k) = (
thermal.hc*q0 + laser(i,j,k) ) / K;
468 for (amrex::MFIter mfi(*
eta_mf[lev],
true); mfi.isValid(); ++mfi)
470 const amrex::Box& bx = mfi.tilebox();
485 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
494 dTdt += grad_eta.dot(grad_temp * alpha(i, j, k));
495 dTdt += grad_alpha.dot(eta(i, j, k) * grad_temp);
496 dTdt += eta(i, j, k) * alpha(i, j, k) * lap_temp;
497 dTdt += alpha(i, j, k) * heatflux(i, j, k) * grad_eta_mag;
499 Set::Scalar Tsolid = dTdt + temps(i, j, k) * (etanew(i, j, k) - eta(i, j, k)) /
dt;
500 temps(i, j, k) = temps(i, j, k) +
dt * Tsolid;
501 tempnew(i, j, k) = etanew(i, j, k) * temps(i, j, k) + (1.0 - etanew(i, j, k)) *
thermal.Tfluid;
511 BL_PROFILE(
"Integrator::Flame::TagCellsForRefinement");
515 Set::Scalar dr = sqrt(AMREX_D_TERM(DX[0] * DX[0], +DX[1] * DX[1], +DX[2] * DX[2]));
518 for (amrex::MFIter mfi(*
eta_mf[lev],
true); mfi.isValid(); ++mfi)
520 const amrex::Box& bx = mfi.tilebox();
521 amrex::Array4<char>
const& tags = a_tags.array(mfi);
524 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
528 tags(i, j, k) = amrex::TagBox::SET;
534 for (amrex::MFIter mfi(*
eta_mf[lev],
true); mfi.isValid(); ++mfi)
536 const amrex::Box& bx = mfi.tilebox();
537 amrex::Array4<char>
const& tags = a_tags.array(mfi);
540 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
544 tags(i, j, k) = amrex::TagBox::SET;
552 for (amrex::MFIter mfi(*
temp_mf[lev],
true); mfi.isValid(); ++mfi)
554 const amrex::Box& bx = mfi.tilebox();
555 amrex::Array4<char>
const& tags = a_tags.array(mfi);
558 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
562 tags(i, j, k) = amrex::TagBox::SET;
570 BL_PROFILE(
"Integrator::Flame::Regrid");
578 const amrex::MFIter& mfi,
const amrex::Box& box)
580 BL_PROFILE(
"Flame::Integrate");
582 Set::Scalar dv = AMREX_D_TERM(DX[0], *DX[1], *DX[2]);
586 amrex::ParallelFor(
box, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
588 chamber.volume += eta(i, j, k, 0) * dv;
602 amrex::ParallelFor(
box, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
604 chamber.volume += eta(i, j, k, 0) * dv;
#define pp_query_default(...)
#define pp_queryclass(...)
void Initialize(const int &a_lev, Set::Field< T > &a_field, Set::Scalar a_time=0.0)
Initialize Laminates in a matrix.
void forbid(std::string name, std::string explanation, std::string file="", std::string func="", int line=-1)
int AnyUnusedInputs(bool inscopeonly=true, bool verbose=false)
void queryclass(std::string name, T *value, std::string file="", std::string func="", int line=-1)
void select(std::string name, PTRTYPE *&ic_eta, Args &&... args)
void select_default(std::string name, PTRTYPE *&ic_eta, Args &&... args)
int query_default(std::string name, T &value, T defaultvalue, std::string="", std::string="", int=-1)
static int AllUnusedInputs()
virtual void TimeStepBegin(Set::Scalar a_time, int a_step) override
void Initialize(int lev) override
Use the #ic object to initialize::Temp.
void Advance(int lev, Set::Scalar time, Set::Scalar dt) override
Solver::Nonlocal::Newton< MODEL > solver
void TagCellsForRefinement(int lev, amrex::TagBoxArray &a_tags, Set::Scalar, int) override
Set::Field< Set::Vector > rhs_mf
Set::Field< Model::Solid::Finite::NeoHookeanPredeformed > model_mf
Model::Propellant::Propellant< Model::Propellant::PowerLaw, Model::Propellant::FullFeedback, Model::Propellant::Homogenize > propellant
IC::IC< Set::Scalar > * ic_eta
Set::Field< Set::Scalar > laser_mf
Set::Field< Set::Scalar > alpha_mf
struct Integrator::Flame::@3 elastic
BC::BC< Set::Scalar > * bc_temp
void UpdateModel(int a_step, Set::Scalar a_time) override
Set::Field< Set::Scalar > phi_mf
Set::Field< Set::Scalar > temp_old_mf
IC::IC< Set::Scalar > * ic_temp
void Regrid(int lev, Set::Scalar time) override
void TimeStepComplete(Set::Scalar a_time, int a_iter) override
static void Forbids(IO::ParmParse &pp)
struct Integrator::Flame::@2 thermal
Set::Field< Set::Scalar > eta_mf
Set::Scalar phi_refinement_criterion
void TimeStepBegin(Set::Scalar a_time, int a_iter) override
static void Parse(Flame &value, IO::ParmParse &pp)
void Initialize(int lev) override
struct Integrator::Flame::@1 pf
Set::Field< Set::Scalar > temps_mf
void Advance(int lev, Set::Scalar time, Set::Scalar dt) override
Set::Scalar t_refinement_restriction
struct Integrator::Flame::@4 chamber
Set::Scalar t_refinement_criterion
Set::Field< Set::Scalar > eta_old_mf
Set::Scalar m_refinement_criterion
void Integrate(int amrlev, Set::Scalar time, int step, const amrex::MFIter &mfi, const amrex::Box &box) override
BC::BC< Set::Scalar > * bc_eta
IC::IC< Set::Scalar > * ic_laser
void TagCellsForRefinement(int lev, amrex::TagBoxArray &tags, amrex::Real, int) override
Set::Field< Set::Scalar > temp_mf
Set::Field< Set::Scalar > heatflux_mf
Set::Field< Set::Scalar > mdot_mf
IC::IC< Set::Scalar > * ic_phi
void RegisterNodalFab(Set::Field< Set::Scalar > &new_fab, int ncomp, int nghost, std::string name, bool writeout, bool evolving=true, std::vector< std::string > suffix={})
Add a new node-based scalar field.
void RegisterNewFab(Set::Field< Set::Scalar > &new_fab, BC::BC< Set::Scalar > *new_bc, int ncomp, int nghost, std::string name, bool writeout, bool evolving=true, std::vector< std::string > suffix={})
Add a new cell-based scalar field.
std::vector< amrex::Box > box
amrex::Vector< amrex::Real > dt
Timesteps for each level of refinement.
void RegisterIntegratedVariable(Set::Scalar *integrated_variable, std::string name, bool extensive=true)
Register a variable to be integrated over the spatial domain using the Integrate function.
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE Set::Scalar get_cp(const Set::Scalar phi)
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE Set::Scalar get_qdot(const Set::Scalar mdot, const Set::Scalar phi)
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE void set_pressure(Set::Scalar P)
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE Set::Scalar get_L(const Set::Scalar phi, const Set::Scalar T)
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE Set::Scalar get_rho(const Set::Scalar phi)
AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE Set::Scalar get_K(const Set::Scalar phi)
amrex::Array4< Set::Scalar > Patch(const int lev, const amrex::MFIter &mfi) const &
amrex::Array4< T > Patch(int lev, amrex::MFIter &mfi) const &
void setPsi(Set::Field< Set::Scalar > &a_psi)
Collection of numerical integrator objects.
AMREX_FORCE_INLINE Set::Scalar Laplacian(const amrex::Array4< const Set::Scalar > &f, const int &i, const int &j, const int &k, const int &m, const Set::Scalar dx[AMREX_SPACEDIM], std::array< StencilType, AMREX_SPACEDIM > &stencil=DefaultType)
static AMREX_FORCE_INLINE std::array< StencilType, AMREX_SPACEDIM > GetStencil(const int i, const int j, const int k, const amrex::Box domain)
AMREX_FORCE_INLINE Set::Vector CellGradientOnNode(const amrex::Array4< const Set::Scalar > &f, const int &i, const int &j, const int &k, const int &m, const Set::Scalar dx[AMREX_SPACEDIM])
AMREX_FORCE_INLINE Set::Vector Gradient(const amrex::Array4< const Set::Scalar > &f, const int &i, const int &j, const int &k, const int &m, const Set::Scalar dx[AMREX_SPACEDIM], std::array< StencilType, AMREX_SPACEDIM > stencil=DefaultType)
Eigen::Matrix< amrex::Real, AMREX_SPACEDIM, 1 > Vector
AMREX_FORCE_INLINE void RealFillBoundary(amrex::FabArray< amrex::BaseFab< T > > &a_mf, const amrex::Geometry &)
void Warning(std::string file, std::string func, int line, Args const &... args)
void Message(std::string file, std::string func, int line, Args const &... args)
void Exception(std::string file, std::string func, int line, Args const &... args)
static AMREX_FORCE_INLINE T NodeToCellAverage(const amrex::Array4< const T > &f, const int &i, const int &j, const int &k, const int &m)
static AMREX_FORCE_INLINE T CellToNodeAverage(const amrex::Array4< const T > &f, const int &i, const int &j, const int &k, const int &m, std::array< StencilType, AMREX_SPACEDIM > stencil=DefaultType)