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()),
52 _dt(
std::numeric_limits<Real>::max())
55 mooseError(
"The number of elements in the parameters 'vel_names' and 'c_names' must be equal.");
57 for (
unsigned int k = 0; k <
_n_phases; ++k)
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);
registerMooseObject("NavierStokesApp", CFLTimeStepSize)
const std::vector< double > y
const ExecFlagType EXEC_TIMESTEP_END
const ExecFlagType EXEC_INITIAL
Computes a time step size based on user-specified CFL number.
std::vector< const GenericMaterialProperty< Real, is_ad > * > _c
Sound speed material properties.
virtual void finalize() override
const std::vector< MaterialPropertyName > & _vel_names
Velocity material property name(s)
CFLTimeStepSizeTempl(const InputParameters ¶meters)
std::vector< const GenericMaterialProperty< Real, is_ad > * > _vel
Velocity material properties.
virtual void threadJoin(const UserObject &y) override
virtual Real getValue() const override
const unsigned int _n_phases
Number of phases.
const std::vector< MaterialPropertyName > & _c_names
Sound speed material property name(s)
static InputParameters validParams()
virtual void initialize() override
virtual void execute() override
static InputParameters validParams()
void mooseError(Args &&... args) const