20 #include "libmesh/fe.h" 21 #include "libmesh/vector_value.h" 22 #include "libmesh/string_to_enum.h" 35 params.
addClassDescription(
"This class allows us to have a section of the input file like the " 36 "following which automatically adds Kernels and AuxKernels for all " 37 "the required nonlinear and auxiliary variables.");
39 MooseEnum type(
"steady-state transient",
"steady-state");
42 params.
addParam<std::vector<SubdomainName>>(
43 "block", {},
"The list of block ids (SubdomainID) on which NS equation is defined on");
46 "The name of the user object for fluid properties");
48 params.
addParam<std::vector<BoundaryName>>(
49 "stagnation_boundary", std::vector<BoundaryName>(),
"Stagnation boundaries");
51 "stagnation_pressure", std::vector<Real>(),
"Pressure on stagnation boundaries");
53 "stagnation_temperature", std::vector<Real>(),
"Temperature on stagnation boundaries");
55 "stagnation_flow_direction", std::vector<Real>(),
"Flow directions on stagnation boundaries");
56 params.
addParam<std::vector<BoundaryName>>(
57 "no_penetration_boundary", std::vector<BoundaryName>(),
"No-penetration boundaries");
58 params.
addParam<std::vector<BoundaryName>>(
59 "static_pressure_boundary", std::vector<BoundaryName>(),
"Static pressure boundaries");
61 "static_pressure", std::vector<Real>(),
"Static pressure on boundaries");
66 "family", families,
"Specifies the family of FE shape functions to use for this variable");
69 "Specifies the order of the FE shape function to use " 70 "for this variable (additional orders not listed are " 72 params.
addParam<
Real>(
"density_scaling", 1,
"Scaling for the density variable");
74 "momentum_scaling",
RealVectorValue(1, 1, 1),
"Scaling for the momentum variables");
75 params.
addParam<
Real>(
"total_energy_density_scaling", 1,
"Scaling for the total-energy variable");
78 "The initial pressure, assumed constant everywhere");
80 "The initial temperature, assumed constant everywhere");
82 "The initial velocity, assumed constant everywhere");
86 "stagnation_boundary stagnation_pressure stagnation_temperature " 87 "stagnation_flow_direction no_penetration_boundary static_pressure_boundary static_pressure",
90 "family order density_scaling momentum_scaling total_energy_density_scaling",
"Variable");
91 params.
addParam<std::string>(
"pressure_variable_name",
92 "A name for the pressure variable. If this is not provided, a " 93 "sensible default will be used.");
99 _type(getParam<
MooseEnum>(
"equation_type")),
100 _fp_name(getParam<UserObjectName>(
"fluid_properties")),
101 _blocks(getParam<
std::vector<SubdomainName>>(
"block")),
102 _stagnation_boundary(getParam<
std::vector<BoundaryName>>(
"stagnation_boundary")),
103 _stagnation_pressure(getParam<
std::vector<
Real>>(
"stagnation_pressure")),
104 _stagnation_temperature(getParam<
std::vector<
Real>>(
"stagnation_temperature")),
105 _stagnation_direction(getParam<
std::vector<
Real>>(
"stagnation_flow_direction")),
106 _no_penetration_boundary(getParam<
std::vector<BoundaryName>>(
"no_penetration_boundary")),
107 _static_pressure_boundary(getParam<
std::vector<BoundaryName>>(
"static_pressure_boundary")),
108 _static_pressure(getParam<
std::vector<
Real>>(
"static_pressure")),
111 _initial_pressure(getParam<
Real>(
"initial_pressure")),
112 _initial_temperature(getParam<
Real>(
"initial_temperature")),
114 _pressure_variable_name(isParamValid(
"pressure_variable_name")
115 ? getParam<
std::string>(
"pressure_variable_name")
120 "Size is not the same as the number of boundaries in 'stagnation_boundary'");
123 "Size is not the same as the number of boundaries in 'stagnation_boundary'");
126 "Size is not the same as the number of boundaries in 'static_pressure_boundary'");
135 for (
const auto & subdomain_name :
_blocks)
142 "Size is not the same as the number of boundaries in 'stagnation_boundary' times " 143 "the mesh dimension");
148 auto base_params =
_factory.getValidParams(var_type);
153 base_params.set<std::vector<SubdomainName>>(
"block").push_back(
Moose::stringify(
id));
157 params.set<std::vector<Real>>(
"scaling") = {getParam<Real>(
"density_scaling")};
160 auto mscaling = getParam<RealVectorValue>(
"momentum_scaling");
161 params.set<std::vector<Real>>(
"scaling") = {mscaling(0)};
165 params.set<std::vector<Real>>(
"scaling") = {mscaling(1)};
170 params.set<std::vector<Real>>(
"scaling") = {mscaling(2)};
173 params.set<std::vector<Real>>(
"scaling") = {getParam<Real>(
"total_energy_density_scaling")};
196 if (
_type ==
"transient")
250 std::vector<VariableName>
vars;
261 params.
set<VariableName>(
"variable") =
name;
265 params.
set<UserObjectName>(
"fluid_properties") =
_fp_name;
266 _problem->addInitialCondition(
"NSInitialCondition",
name + std::string(
"_ic"), params);
270 std::vector<VariableName> auxs;
285 for (
const auto &
name : auxs)
288 params.
set<VariableName>(
"variable") =
name;
292 params.
set<UserObjectName>(
"fluid_properties") =
_fp_name;
295 _problem->addInitialCondition(
"NSInitialCondition",
name + std::string(
"_ic"), params);
303 const std::string kernel_type =
"TimeDerivative";
305 params.
set<std::vector<SubdomainName>>(
"block") =
_blocks;
330 const std::string kernel_type =
"NSSUPGMass";
339 _problem->addKernel(kernel_type,
"rho_supg", params);
347 const std::string kernel_type =
"NSSUPGMomentum";
349 params.
set<NonlinearVariableName>(
"variable") = momentums[
component];
359 _problem->addKernel(kernel_type, momentums[
component] + std::string(
"_supg"), params);
365 const std::string kernel_type =
"NSSUPGEnergy";
374 _problem->addKernel(kernel_type,
"rhoE_supg", params);
380 const std::string kernel_type =
"ParsedAux";
390 params.
set<std::string>(
"function") =
function;
392 _problem->addAuxKernel(kernel_type,
"specific_volume_auxkernel", params);
398 const std::string kernel_type =
"NSInternalEnergyAux";
410 _problem->addAuxKernel(kernel_type,
"specific_internal_energy_auxkernel", params);
416 const std::string kernel_type =
"NSMachAux";
428 params.
set<UserObjectName>(
"fluid_properties") =
_fp_name;
430 _problem->addAuxKernel(kernel_type,
"mach_auxkernel", params);
436 const std::string kernel_type =
"NSSpecificTotalEnthalpyAux";
446 _problem->addAuxKernel(kernel_type,
"specific_total_enthalpy_auxkernel", params);
452 const std::string kernel_type =
"NSVelocityAux";
457 params.
set<AuxVariableName>(
"variable") = velocities[
component];
462 params.
set<UserObjectName>(
"fluid_properties") =
_fp_name;
464 _problem->addAuxKernel(kernel_type, velocities[
component] +
"_auxkernel", params);
472 params.
set<AuxVariableName>(
"variable") = var_name;
479 _problem->addAuxKernel(kernel_type, var_name +
"_auxkernel", params);
485 const std::string kernel_type =
"NSMassInviscidFlux";
489 _problem->addKernel(kernel_type,
"rho_if", params);
496 const std::string kernel_type =
"NSMomentumInviscidFlux";
498 params.
set<NonlinearVariableName>(
"variable") = momentums[
component];
506 _problem->addKernel(kernel_type, momentums[
component] + std::string(
"if"), params);
512 const std::string kernel_type =
"NSEnergyInviscidFlux";
521 _problem->addKernel(kernel_type,
"rhoE_if", params);
527 const std::string kernel_type =
"NSMassWeakStagnationBC";
543 const std::string kernel_type =
"NSEnergyWeakStagnationBC";
551 kernel_type,
"weak_stagnation_energy_inflow_" +
Moose::stringify(i), params);
562 const std::string kernel_type =
"NSMomentumConvectiveWeakStagnationBC";
564 params.
set<NonlinearVariableName>(
"variable") = momentums[
component];
571 _problem->addBoundaryCondition(kernel_type,
572 std::string(
"weak_stagnation_") + momentums[
component] +
580 const std::string kernel_type =
"NSMomentumPressureWeakStagnationBC";
582 params.
set<NonlinearVariableName>(
"variable") = momentums[
component];
591 _problem->addBoundaryCondition(kernel_type,
592 std::string(
"weak_stagnation_") + momentums[
component] +
603 const std::string kernel_type =
"NSPressureNeumannBC";
605 params.
set<NonlinearVariableName>(
"variable") = momentums[
component];
614 kernel_type, momentums[
component] + std::string(
"_no_penetration"), params);
620 const std::string kernel_type =
"NSMassUnspecifiedNormalFlowBC";
636 const std::string kernel_type =
"NSMomentumInviscidSpecifiedPressureBC";
638 params.
set<NonlinearVariableName>(
"variable") = momentums[
component];
658 const std::string kernel_type =
"NSEnergyInviscidSpecifiedPressureBC";
669 kernel_type,
"rhoE_specified_pressure_outflow_" +
Moose::stringify(i), params);
676 params.
set<std::vector<SubdomainName>>(
"block") =
_blocks;
687 params.
set<UserObjectName>(
"fluid_properties") =
_fp_name;
702 params.
set<UserObjectName>(
"fluid_properties") =
_fp_name;
static const std::string total_energy_density
Real _initial_temperature
Initial value for temperature.
static const std::string momentum_x
std::vector< Real > _stagnation_direction
Flow directions on stagnation boundaries.
std::set< SubdomainID > _block_ids
Subdomain IDs.
void addPressureOrTemperatureAux(const std::string &kernel_type)
void setKernelCommonParams(InputParameters ¶ms)
libMesh::FEType _fe_type
FE type for various variables.
static const std::string mach_number
VectorValue< Real > RealVectorValue
std::vector< SubdomainName > _blocks
Subdomains Navier-Stokes equation is defined on.
std::vector< BoundaryName > _no_penetration_boundary
Boundaries no-penetration BC applies.
static const std::string component
void setStagnationBCCommonParams(InputParameters ¶ms, unsigned int i)
void addNSSUPGMomentum(unsigned int component)
static const std::string velocity_z
std::vector< BoundaryName > _static_pressure_boundary
Boundaries static pressure BC applies.
void addNSMassUnspecifiedNormalFlowBC()
static const std::string density
void addSpecificTotalEnthalpyAux()
void addNSInternalEnergyAux()
static const std::string velocity_x
static const std::string temperature
The following methods are specializations for using the Parallel::packed_range_* routines for a vecto...
void addNSVelocityAux(unsigned int component)
static const std::string specific_internal_energy
virtual const std::string & name() const
static MooseEnum getNonlinearVariableFamilies()
void addNSMassWeakStagnationBC()
MooseEnum _type
Equation type, transient or steady-state.
std::vector< Real > _static_pressure
Pressures on static pressure boundaries.
static InputParameters validParams()
unsigned int _dim
Mesh dimension.
static InputParameters validParams()
static MooseEnum getNonlinearVariableOrders()
UserObjectName _fp_name
Name of the FluidProperties object to pass on to Kernels.
void addNSMassInviscidFlux()
This class allows us to have a section of the input file like the following which automatically adds ...
T string_to_enum(const std::string &s)
static const std::string specific_volume
registerMooseAction("NavierStokesApp", CNSAction, "add_navier_stokes_variables")
const std::string & _current_task
static std::string variableType(const libMesh::FEType &fe_type, const bool is_fv=false, const bool is_array=false)
static const std::string velocity_y
void addNSMomentumWeakStagnationBC(unsigned int component)
void paramError(const std::string ¶m, Args... args) const
RealVectorValue _initial_velocity
Initial value for velocity.
void addNSEnergyInviscidFlux()
std::string stringify(const T &t)
const std::string _pressure_variable_name
pressure variable name
void addNoPenetrationBC(unsigned int component)
void addNSMomentumInviscidFlux(unsigned int component)
void addNSEnergyWeakStagnationBC()
static const std::string momentum_y
std::vector< BoundaryName > _stagnation_boundary
Boundaries stagnation BC applies.
virtual void act() override
std::shared_ptr< MooseMesh > & _mesh
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addNSEnergyInviscidSpecifiedPressureBC()
static const std::string specific_total_enthalpy
CNSAction(const InputParameters ¶meters)
std::vector< VariableName > CoupledName
std::vector< Real > _stagnation_pressure
Pressures on stagnation boundaries.
static const std::string pressure
void addSpecificVolumeComputation()
void addNSMomentumInviscidSpecifiedPressureBC(unsigned int component)
std::shared_ptr< FEProblemBase > & _problem
static const std::string momentum_z
std::vector< Real > _stagnation_temperature
Temperatures on stagnation boundaries.
void setBCCommonParams(InputParameters ¶ms)
void coupleMomentums(InputParameters ¶ms)
Real _initial_pressure
Initial value for pressure.
void coupleVelocities(InputParameters ¶ms)