4#include "Numeric/Stencil.H"
35 pp.
forbid(
"pressure.P",
"use chamber.pressure instead");
37 pp.
forbid(
"geometry.x_len",
"This is specified by geometry.prob_lo/hi");
38 pp.
forbid(
"geometry.y_len",
"This is specified by geometry.prob_lo/hi");
39 pp.
forbid(
"amr.ghost_cells",
"This should not be adjustable ");
41 pp.
forbid(
"pf.gamma",
"use propellant.powerlaw.gamma");
43 pp.
forbid(
"pressure.r_ap",
"use propellant.powerlaw.r_ap");
44 pp.
forbid(
"pressure.r_htpb",
"use propellant.powerlaw.r_htpb");
45 pp.
forbid(
"pressure.r_comb",
"use propellant.powerlaw.r_comb");
46 pp.
forbid(
"pressure.n_ap",
"use propellant.powerlaw.n_ap");
47 pp.
forbid(
"pressure.n_htpb",
"use propellant.powerlaw.n_htpb");
48 pp.
forbid(
"pressure.n_comb",
"use propellant.powerlaw.n_comb");
50 pp.
forbid(
"thermal.bound",
"use thermal.Tref");
51 pp.
forbid(
"thermal.T_fluid",
"use thermal.Tfluid (or nothing)");
52 pp.
forbid(
"thermal.m_ap",
"use propellant.fullfeedback.m_ap");
53 pp.
forbid(
"thermal.m_htpb",
"use propellant.fullfeedback.m_htpb");
54 pp.
forbid(
"thermal.E_ap",
"use propellant.fullfeedback.E_ap");
55 pp.
forbid(
"thermal.E_htpb",
"use propellant.fullfeedback.E_htpb");
56 pp.
forbid(
"thermal.modeling_ap",
"Old debug variable. Should equal 1 ");
57 pp.
forbid(
"thermal.modeling_htpb",
"Old debug variable. Should equal 1");
59 pp.
forbid(
"pressure.a1",
"use propellant.fullfeedback.a1 instead");
60 pp.
forbid(
"pressure.a2",
"use propellant.fullfeedback.a2 instead");
61 pp.
forbid(
"pressure.a3",
"use propellant.fullfeedback.a3 instead");
62 pp.
forbid(
"pressure.b1",
"use propellant.fullfeedback.b1 instead");
63 pp.
forbid(
"pressure.b2",
"use propellant.fullfeedback.b2 instead");
64 pp.
forbid(
"pressure.b3",
"use propellant.fullfeedback.b3 instead");
65 pp.
forbid(
"pressure.c1",
"use propellant.fullfeedback.c1 instead");
66 pp.
forbid(
"pressure.mob_ap",
"no longer used");
67 pp.
forbid(
"pressure.dependency",
"use propellant.fullfeedback.pressure_dependency");
68 pp.
forbid(
"pressure.h1",
"use propellant.homogenize.h1 instead");
69 pp.
forbid(
"pressure.h2",
"use propellant.homogenize.h2 instead");
70 pp.
forbid(
"thermal.mlocal_ap",
"use propellant.homogenize.mlocal_ap");
71 pp.
forbid(
"thermal.mlocal_comb",
"use propellant.homogenize.mlocal_comb");
72 pp.
forbid(
"thermal.mlocal_htpb",
"this actually did **nothing** - it was overridden by a hard code using massfraction.");
74 pp.
forbid(
"thermal.disperssion1",
"use propellant.homogenize.dispersion1");
75 pp.
forbid(
"thermal.disperssion2",
"use propellant.homogenize.dispersion2");
76 pp.
forbid(
"thermal.disperssion3",
"use propellant.homogenize.dispersion3");
78 pp.
forbid(
"thermal.rho_ap",
"use propellant.fullfeedback/homogenize.rho_ap ");
79 pp.
forbid(
"thermal.rho_htpb",
"use propellant.fullfeedback/homogenize.rho_htpb ");
80 pp.
forbid(
"thermal.k_ap",
"use propellant.fullfeedback/homogenize.k_ap ");
81 pp.
forbid(
"thermal.k_htpb",
"use propellant.fullfeedback/homogenize.k_htpb ");
82 pp.
forbid(
"thermal.cp_ap",
"use propellant.fullfeedback/homogenize.cp_ap ");
83 pp.
forbid(
"thermal.cp_htpb",
"use propellant.fullfeedback/homogenize.cp_htpb ");
91 BL_PROFILE(
"Integrator::Flame::Flame()");
221 (
"phi.ic",value.
ic_phi,value.geom);
236 if (value.
m_type != Type::Disable)
272 BL_PROFILE(
"Integrator::Flame::Initialize");
281 rhs_mf[lev]->setVal(Set::Vector::Zero());
308 for (
int lev = 0; lev <= finest_level; ++lev)
310 amrex::Box domain = this->geom[lev].Domain();
311 domain.convert(amrex::IntVect::TheNodeVector());
314 phi_mf[lev]->FillBoundary();
315 eta_mf[lev]->FillBoundary();
318 for (MFIter mfi(*
model_mf[lev],
false); mfi.isValid(); ++mfi)
320 amrex::Box smallbox = mfi.nodaltilebox();
321 amrex::Box bx = mfi.grownnodaltilebox() & domain;
331 amrex::ParallelFor(smallbox, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
338 rhs(i, j, k) = (
elastic.traction) * grad_eta -
chamber.pressure*grad_eta;
343 rhs(i, j, k) = (
elastic.traction) * grad_eta;
347 rhs(i, j, k) = 0.0 * grad_eta;
351 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
369 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
388 BL_PROFILE(
"Integrator::Flame::TimeStepBegin");
391 for (
int lev = 0; lev <= finest_level; ++lev)
395 if (a_time >
thermal.end_initial_refine_time)
398 for (
int lev = 0; lev <= finest_level; ++lev)
410 BL_PROFILE(
"Integrator::Flame::TimeStepComplete");
422 BL_PROFILE(
"Integrador::Flame::Advance");
436 else if (
chamber.pressure <= 0.99) {
448 -5.0 *
pf.w1 + 16.0 *
pf.w12 - 11.0 *
pf.w0,
449 14.0 *
pf.w1 - 32.0 *
pf.w12 + 18.0 *
pf.w0,
450 -8.0 *
pf.w1 + 16.0 *
pf.w12 - 8.0 *
pf.w0);
455 for (amrex::MFIter mfi(*
eta_mf[lev],
true); mfi.isValid(); ++mfi)
457 const amrex::Box& bx = mfi.tilebox();
474 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
498 Set::Scalar df_deta = ((
pf.lambda /
pf.eps) * dw(eta(i, j, k)) -
pf.eps *
pf.kappa * eta_lap);
509 etanew(i, j, k) = eta(i, j, k) - L *
dt * df_deta;
511 if (etanew(i, j, k) <=
small) etanew(i, j, k) =
small;
519 alpha(i, j, k) = K /
rho / cp;
525 mdot(i, j, k) =
rho * fabs(eta(i, j, k) - etanew(i, j, k)) /
dt;
532 heatflux(i,j,k) = (
thermal.hc*q0 + laser(i,j,k) ) / K;
536 exceeded_Tcutoff(i,j,k) = 1;
553 for (amrex::MFIter mfi(*
eta_mf[lev],
true); mfi.isValid(); ++mfi)
555 const amrex::Box& bx = mfi.tilebox();
570 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
579 dTdt += grad_eta.dot(grad_temp * alpha(i, j, k));
580 dTdt += grad_alpha.dot(eta(i, j, k) * grad_temp);
581 dTdt += eta(i, j, k) * alpha(i, j, k) * lap_temp;
582 dTdt += alpha(i, j, k) * heatflux(i, j, k) * grad_eta_mag;
584 Set::Scalar Tsolid = dTdt + temps(i, j, k) * (etanew(i, j, k) - eta(i, j, k)) /
dt;
585 temps(i, j, k) = temps(i, j, k) +
dt * Tsolid;
586 tempnew(i, j, k) = etanew(i, j, k) * temps(i, j, k) + (1.0 - etanew(i, j, k)) *
thermal.Tfluid;
596 BL_PROFILE(
"Integrator::Flame::TagCellsForRefinement");
600 Set::Scalar dr = sqrt(AMREX_D_TERM(DX[0] * DX[0], +DX[1] * DX[1], +DX[2] * DX[2]));
603 for (amrex::MFIter mfi(*
eta_mf[lev],
true); mfi.isValid(); ++mfi)
605 const amrex::Box& bx = mfi.tilebox();
606 amrex::Array4<char>
const& tags = a_tags.array(mfi);
611 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
615 tags(i, j, k) = amrex::TagBox::SET;
619 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
623 tags(i, j, k) = amrex::TagBox::SET;
630 for (amrex::MFIter mfi(*
eta_mf[lev],
true); mfi.isValid(); ++mfi)
632 const amrex::Box& bx = mfi.tilebox();
633 amrex::Array4<char>
const& tags = a_tags.array(mfi);
636 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
640 tags(i, j, k) = amrex::TagBox::SET;
648 for (amrex::MFIter mfi(*
temp_mf[lev],
true); mfi.isValid(); ++mfi)
650 const amrex::Box& bx = mfi.tilebox();
651 amrex::Array4<char>
const& tags = a_tags.array(mfi);
654 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
658 tags(i, j, k) = amrex::TagBox::SET;
664 for (amrex::MFIter mfi(*
eta_mf[lev],
true); mfi.isValid(); ++mfi)
666 const amrex::Box& bx = mfi.tilebox();
667 amrex::Array4<char>
const& tags = a_tags.array(mfi);
671 amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
676 tags(i, j, k) = amrex::TagBox::SET;
683 BL_PROFILE(
"Integrator::Flame::Regrid");
696 for (amrex::MFIter mfi(*
eta_mf[lev],
true); mfi.isValid(); ++mfi)
698 const amrex::Box &bx = mfi.tilebox();
706 amrex::BoxList boxes_to_update;
708 boxes_to_update = amrex::complementIn(bx,
prev_finest_ba).boxList();
710 boxes_to_update.push_back(bx);
712 for (
const amrex::Box &
box : boxes_to_update)
713 amrex::ParallelFor(
box, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
716 if (!exceeded_Tcutoff(i,j,k) && temp(i,j,k) <
Tcutoff)
718 eta(i, j, k) = eta_0(i, j, k);
723 if (lev == finest_level)
732 const amrex::MFIter& mfi,
const amrex::Box& box)
734 BL_PROFILE(
"Flame::Integrate");
739 Set::Scalar dv = AMREX_D_TERM(DX[0], *DX[1], *DX[2]);
743 amrex::ParallelFor(
box, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
745 chamber.volume += eta(i, j, k, 0) * dv;
759 amrex::ParallelFor(
box, [=] AMREX_GPU_DEVICE(
int i,
int j,
int k)
761 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)
int AnyUnusedInputs(bool inscopeonly=true, bool verbose=false)
void select(std::string name, PTRTYPE *&ic_eta, Args &&... args)
void queryclass(std::string name, T *value)
void select_default(std::string name, PTRTYPE *&ic_eta, Args &&... args)
static int AllUnusedInputs()
int query_default(std::string name, T &value, T defaultvalue)
virtual void TimeStepBegin(Set::Scalar a_time, int a_step) override
void Integrate(int amrlev, Set::Scalar, int, const amrex::MFIter &mfi, const amrex::Box &a_box) 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
amrex::BoxArray prev_finest_ba
BC::BC< Set::Scalar > * bc_temp
void UpdateModel(int a_step, Set::Scalar a_time) override
Set::Scalar phi_refinement_criterion_inital
Set::Field< Set::Scalar > eta_0_mf
Set::Field< Set::Scalar > phi_mf
Set::Field< Set::Scalar > temp_old_mf
struct Integrator::Flame::@2 pf
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)
Set::Field< Set::Scalar > eta_mf
Set::Scalar phi_refinement_criterion
void TimeStepBegin(Set::Scalar a_time, int a_iter) override
struct Integrator::Flame::@5 chamber
static void Parse(Flame &value, IO::ParmParse &pp)
void Initialize(int lev) override
Set::Scalar end_initial_refine_time
Set::Field< Set::Scalar > temps_mf
void Advance(int lev, Set::Scalar time, Set::Scalar dt) override
Set::Scalar t_refinement_restriction
Set::Scalar t_refinement_criterion
struct Integrator::Flame::@3 thermal
Set::Field< Set::Scalar > eta_old_mf
Set::Scalar m_refinement_criterion
Set::Scalar apply_chamber_pressure
Set::Field< Set::Scalar > has_exceeded_Tcutoff
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
struct Integrator::Flame::@4 elastic
Set::Field< Set::Scalar > temp_mf
Set::Field< Set::Scalar > heatflux_mf
Set::Field< Set::Scalar > mdot_mf
IC::IC< Set::Scalar > * ic_phi
amrex::Real timestep
Timestep for the base level of refinement.
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
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)
AMREX_FORCE_INLINE void RealFillBoundary(amrex::FabArray< amrex::BaseFab< T > > &a_mf, const amrex::Geometry &, const int nghost=2)
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)
static Unit Temperature()