14 #include "libmesh/quadrature.h" 15 #include "metaphysicl/raw_type.h" 29 params.
addParam<
Real>(
"CFL", 0.5,
"The CFL number to use in computing time step size");
31 "Velocity material property name(s)");
33 "c_names",
"Sound speed material property name(s)");
40 params.
addClassDescription(
"Computes a time step size based on a user-specified CFL number");
48 _CFL(getParam<
Real>(
"CFL")),
49 _vel_names(getParam<
std::vector<MaterialPropertyName>>(
"vel_names")),
50 _c_names(getParam<
std::vector<MaterialPropertyName>>(
"c_names")),
51 _n_phases(_vel_names.size()),
55 mooseError(
"The number of elements in the parameters 'vel_names' and 'c_names' must be equal.");
59 _vel.push_back(&getGenericMaterialPropertyByName<Real, is_ad>(
_vel_names[
k]));
60 _c.push_back(&getGenericMaterialPropertyByName<Real, is_ad>(
_c_names[
k]));
69 _dt = std::numeric_limits<Real>::max();
92 _dt = std::min(_dt, pps.
_dt);
100 const Real h_min_element = _current_elem->hmin();
103 for (
unsigned int qp = 0; qp < _qrule->n_points(); qp++)
106 for (
unsigned int k = 0;
k < _n_phases; ++
k)
108 const Real dt_phase = _CFL * h_min_element /
111 _dt = std::min(_dt, dt_phase);
virtual void initialize() override
static InputParameters validParams()
const std::vector< double > y
const ExecFlagType EXEC_TIMESTEP_END
registerMooseObject("NavierStokesApp", CFLTimeStepSize)
auto max(const L &left, const R &right)
const std::vector< MaterialPropertyName > & _vel_names
Velocity material property name(s)
const std::vector< MaterialPropertyName > & _c_names
Sound speed material property name(s)
static InputParameters validParams()
CFLTimeStepSizeTempl(const InputParameters ¶meters)
virtual void threadJoin(const UserObject &y) override
Computes a time step size based on user-specified CFL number.
virtual Real getValue() const override
std::vector< const GenericMaterialProperty< Real, is_ad > * > _vel
Velocity material properties.
virtual void finalize() override
const unsigned int _n_phases
Number of phases.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void execute() override
void mooseError(Args &&... args) const
std::vector< const GenericMaterialProperty< Real, is_ad > * > _c
Sound speed material properties.
static const std::string k
const ExecFlagType EXEC_INITIAL