24 "use_scalar_variables",
25 "True if the junction variables are scalar variables",
26 "Please remove this parameter; it no longer has any effect. The behavior corresponding to " 27 "'use_scalar_variables = false' is now the only option.");
30 params.
addRequiredParam<Point>(
"position",
"Spatial position of the center of the junction [m]");
32 params.
addParam<FunctionName>(
"initial_p",
"Initial pressure [Pa]");
33 params.
addParam<FunctionName>(
"initial_T",
"Initial temperature [K]");
34 params.
addParam<FunctionName>(
"initial_vel_x",
"Initial velocity in x-direction [m/s]");
35 params.
addParam<FunctionName>(
"initial_vel_y",
"Initial velocity in y-direction [m/s]");
36 params.
addParam<FunctionName>(
"initial_vel_z",
"Initial velocity in z-direction [m/s]");
38 params.
addParam<
Real>(
"scaling_factor_rhoV", 1.0,
"Scaling factor for rho*V [-]");
39 params.
addParam<
Real>(
"scaling_factor_rhouV", 1.0,
"Scaling factor for rho*u*V [-]");
40 params.
addParam<
Real>(
"scaling_factor_rhovV", 1.0,
"Scaling factor for rho*v*V [-]");
41 params.
addParam<
Real>(
"scaling_factor_rhowV", 1.0,
"Scaling factor for rho*w*V [-]");
42 params.
addParam<
Real>(
"scaling_factor_rhoEV", 1.0,
"Scaling factor for rho*E*V [-]");
47 params.
addParam<
bool>(
"apply_velocity_scaling",
49 "Set to true to apply the scaling to the normal velocity. See " 50 "documentation for more information.");
53 params.
addClassDescription(
"Junction between 1-phase flow channels that has a non-zero volume");
61 _volume(getParam<
Real>(
"volume")),
62 _position(getParam<Point>(
"position")),
64 _scaling_factor_rhoV(getParam<
Real>(
"scaling_factor_rhoV")),
65 _scaling_factor_rhouV(getParam<
Real>(
"scaling_factor_rhouV")),
66 _scaling_factor_rhovV(getParam<
Real>(
"scaling_factor_rhovV")),
67 _scaling_factor_rhowV(getParam<
Real>(
"scaling_factor_rhowV")),
68 _scaling_factor_rhoEV(getParam<
Real>(
"scaling_factor_rhoEV")),
70 _rhoV_var_name(junctionVariableName(
"rhoV")),
71 _rhouV_var_name(junctionVariableName(
"rhouV")),
72 _rhovV_var_name(junctionVariableName(
"rhovV")),
73 _rhowV_var_name(junctionVariableName(
"rhowV")),
74 _rhoEV_var_name(junctionVariableName(
"rhoEV")),
75 _pressure_var_name(junctionVariableName(
"p")),
76 _temperature_var_name(junctionVariableName(
"T")),
77 _velocity_var_name(junctionVariableName(
"vel")),
79 _K(getParam<
Real>(
"K")),
80 _A_ref(isParamValid(
"A_ref") ? getParam<
Real>(
"A_ref") : _zero)
85 logWarning(
"Parameter 'A_ref' is specified, but 'K' is not specified, so the junction will " 86 "behave as if there were no form loss.");
103 for (
unsigned int i = 0; i < elem_ids.size(); i++)
120 const std::vector<std::string> ic_params{
121 "initial_p",
"initial_T",
"initial_vel_x",
"initial_vel_y",
"initial_vel_z"};
122 std::ostringstream oss;
123 for (
const auto & ic_param : ic_params)
125 oss <<
" " << ic_param;
127 logError(
"The following initial condition parameters are missing:", oss.str());
135 "Using initial conditions from a file for VolumeJunction1Phase is " 136 "currently not tested for parallel threading.");
174 const std::string class_name =
"ADVolumeJunction1PhaseUserObject";
176 params.
set<
bool>(
"use_scalar_variables") =
false;
179 params.
set<std::vector<Real>>(
"normals") =
_normals;
195 params.
set<
bool>(
"apply_velocity_scaling") = getParam<bool>(
"apply_velocity_scaling");
210 const std::vector<NonlinearVariableName> var_names = {
212 for (std::size_t
j = 0;
j < var_names.size();
j++)
214 const std::string class_name =
"ADVolumeJunction1PhaseBC";
218 params.
set<NonlinearVariableName>(
"variable") = var_names[
j];
220 params.
set<
unsigned int>(
"connection_index") = i;
228 class_name,
genName(
name(), i, var_names[
j] +
":" + class_name), params);
233 std::vector<NonlinearVariableName> var_names(
N_EQ);
239 for (std::size_t i = 0; i <
N_EQ; i++)
242 const std::string class_name =
"ADTimeDerivative";
244 params.
set<NonlinearVariableName>(
"variable") = var_names[i];
245 const std::string obj_name =
genName(
name(), var_names[i],
"td");
250 const std::string class_name =
"ADVolumeJunctionAdvectionKernel";
252 params.
set<NonlinearVariableName>(
"variable") = var_names[i];
254 params.
set<
unsigned int>(
"equation_index") = i;
255 const std::string obj_name =
genName(
name(), var_names[i],
"vja_sk");
261 const std::vector<std::pair<std::string, VariableName>> quantities = {
265 for (
const auto & quantity_and_name : quantities)
267 const std::string class_name =
"VolumeJunction1PhaseAux";
269 params.
set<AuxVariableName>(
"variable") = quantity_and_name.second;
270 params.
set<
MooseEnum>(
"quantity") = quantity_and_name.first;
278 const std::string obj_name =
genName(
name(), quantity_and_name.first +
"_aux");
287 const std::string class_name =
"GenericConstantMaterial";
290 params.
set<std::vector<std::string>>(
"prop_names") = {};
291 params.
set<std::vector<Real>>(
"prop_values") = {};
304 const VariableName & var,
313 problem.addSimVariable(is_nonlinear, var, fe_type, subdomains, scaling_factor);
315 problem.addSimVariable(is_nonlinear, var, fe_type, subdomains);
327 const std::string class_name =
"VolumeJunction1PhaseIC";
330 params.
set<VariableName>(
"variable") = var;
340 params.
set<UserObjectName>(
"fluid_properties") =
_fp_name;
static const std::string AREA_LINEAR
virtual void addVariables() override
std::string genName(const std::string &prefix, unsigned int id, const std::string &suffix="") const
Build a name from a prefix, number and possible suffix.
const VariableName _rhoV_var_name
rho*V variable name for junction
const std::vector< processor_id_type > & getConnectedProcessorIDs()
Gets the processor IDs of the connected 1D components.
static InputParameters validParams()
static const std::string AREA
THMProblem & getTHMProblem() const
Gets the THM problem.
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters ¶meters)
const VariableName _rhovV_var_name
rho*v*V variable name for junction
InputParameters getValidParams(const std::string &name) const
void logWarning(Args &&... args) const
Logs a warning.
const VariableName _temperature_var_name
temperature variable name for junction
registerMooseObject("ThermalHydraulicsApp", VolumeJunction1Phase)
virtual void setupMesh() override
Performs mesh setup such as creating mesh or naming mesh sets.
virtual void addAuxKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
virtual void setSubdomainInfo(SubdomainID subdomain_id, const std::string &subdomain_name, const Moose::CoordinateSystemType &coord_system=Moose::COORD_XYZ)
Sets the next subdomain ID, name, and coordinate system.
virtual void addKernel(const std::string &kernel_name, const std::string &name, InputParameters ¶meters)
const VariableName _rhowV_var_name
rho*w*V variable name for junction
bool isRestarting() const
std::vector< BoundaryName > _boundary_names
Boundary names of connected components.
Node * addNode(const Point &pt)
virtual const std::string & name() const
virtual void addBoundaryCondition(const std::string &bc_name, const std::string &name, InputParameters ¶meters)
virtual void buildVolumeJunctionUserObject()
Builds user object for computing and storing the fluxes.
ExecFlagEnum getDefaultExecFlagEnum()
void logError(Args &&... args) const
Logs an error.
bool isParamValid(const std::string &name) const
const Real & _scaling_factor_rhovV
Scaling factor for rho*v*V.
Elem * addNodeElement(dof_id_type node)
void mooseDocumentedError(const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
static const unsigned int N_EQ
Number of equations for the junction.
processor_id_type n_processors() const
std::string junctionVariableName(const std::string &var_base) const
Returns the name of junction variable, depending on whether scalar.
void addJunctionIC(const VariableName &var, Real value)
Adds a junction IC to the problem, as a scalar or field variable.
const Real & _scaling_factor_rhoV
Scaling factor for rho*V.
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
const Real & _scaling_factor_rhouV
Scaling factor for rho*u*V.
const std::vector< dof_id_type > & getConnectedElementIDs()
Gets the element IDs of the connected 1D components.
const VariableName _velocity_var_name
velocity variable name for junction
static const std::string RHOUA
std::vector< UserObjectName > _numerical_flux_names
virtual void check() const override
Check the component integrity.
static const std::string RHOA
virtual void addMooseObjects() override
const Real & _scaling_factor_rhowV
Scaling factor for rho*w*V.
const VariableName _pressure_var_name
pressure variable name for junction
const Real _volume
Volume of the junction.
void addJunctionVariable(bool is_nonlinear, const VariableName &var, Real scaling_factor=1.0)
Adds a junction variable to the problem, as a scalar or field variable.
const ExecFlagType EXEC_LINEAR
Junction between 1-phase flow channels that has a non-zero volume.
virtual SubdomainID getNextSubdomainId()
Gets the next subdomain ID.
const Real & _A_ref
Reference area.
THMMesh & mesh()
Non-const reference to THM mesh, which can only be called before the end of mesh setup.
const ExecFlagType EXEC_NONLINEAR
void addSimInitialCondition(const std::string &type, const std::string &name, InputParameters params)
static InputParameters validParams()
virtual void check() const override
Check the component integrity.
const std::string _junction_uo_name
Name of junction user object name, if any.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Base class for 1-phase flow junctions.
Factory & _factory
The Factory associated with the MooseApp.
void connectObject(const InputParameters ¶ms, const std::string &mooseName, const std::string &name) const
Connect with control logic.
UserObjectName _fp_name
Fluid property user object name.
virtual std::vector< std::shared_ptr< UserObject > > addUserObject(const std::string &user_object_name, const std::string &name, InputParameters ¶meters)
void addVolumeJunctionIC(const VariableName &var, const std::string &quantity)
Adds a VolumeJunctionIC to the problem.
virtual void setupMesh() override
Performs mesh setup such as creating mesh or naming mesh sets.
const Real & _K
Form loss coefficient.
const bool & getImplicitTimeIntegrationFlag()
Gets the flag indicating whether an implicit time integration scheme is being used.
const InputParameters & parameters() const
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
static const std::string RHOEA
const VariableName _rhouV_var_name
rho*u*V variable name for junction
const Point & _position
Spatial position of center of the junction.
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
std::vector< Real > _normals
Outward normals associated with connected components.
void addConstantIC(const VariableName &var_name, Real value, const std::vector< SubdomainName > &block_names)
VolumeJunction1Phase(const InputParameters ¶ms)
const VariableName _rhoEV_var_name
rho*E*V variable name for junction
subdomain_id_type _junction_subdomain_id
Junction subdomain ID.
bool hasInitialConditionsFromFile() const
Are initial conditions specified from a file.
const Real & _scaling_factor_rhoEV
Scaling factor for rho*E*V.
virtual void augmentSparsity(const dof_id_type &elem_id1, const dof_id_type &elem_id2)
Hint how to augment sparsity pattern between two elements.
const ExecFlagType EXEC_INITIAL