https://mooseframework.inl.gov
ClosuresBase.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "ClosuresBase.h"
11 #include "FlowChannelBase.h"
12 
15 {
17 
18  params.addPrivateParam<THMProblem *>("_thm_problem");
19  params.addPrivateParam<Logger *>("_logger");
20 
21  params.registerBase("Closures");
22 
23  return params;
24 }
25 
27  : MooseObject(params),
28  LoggingInterface(*params.getCheckedPointerParam<Logger *>("_logger")),
30 
31  _sim(*params.getCheckedPointerParam<THMProblem *>("_thm_problem")),
32  _factory(_app.getFactory())
33 {
34 }
35 
36 void
38  const std::string & property_name) const
39 {
40  const std::string class_name = "ADConstantMaterial";
41  InputParameters params = _factory.getValidParams(class_name);
42  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
43  params.set<std::string>("property_name") = property_name;
44  params.set<Real>("value") = 0;
45  _sim.addMaterial(class_name, genName(flow_channel.name(), "const_mat", property_name), params);
46 }
47 
48 void
50  const std::vector<MaterialPropertyName> & values,
51  const std::vector<VariableName> & weights,
52  const MaterialPropertyName & property_name) const
53 {
54  const std::string class_name = "ADWeightedAverageMaterial";
55  InputParameters params = _factory.getValidParams(class_name);
56  params.set<MaterialPropertyName>("prop_name") = property_name;
57  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
58  params.set<std::vector<MaterialPropertyName>>("values") = values;
59  params.set<std::vector<VariableName>>("weights") = weights;
60  _sim.addMaterial(class_name, genName(flow_channel.name(), "wavg_mat", property_name), params);
61 }
62 
63 void
65  unsigned int i) const
66 {
67  const std::string class_name = "ADCoupledVariableValueMaterial";
68  InputParameters params = _factory.getValidParams(class_name);
69  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
70  params.set<MaterialPropertyName>("prop_name") = {flow_channel.getWallTemperatureNames()[i]};
71  params.set<std::vector<VariableName>>("coupled_variable") = {
72  flow_channel.getWallTemperatureNames()[i]};
73  _sim.addMaterial(class_name, genName(flow_channel.name(), "coupled_var_mat", i), params);
74 }
Keeps the error and warning messages.
Definition: Logger.h:17
THMProblem & _sim
Simulation.
Definition: ClosuresBase.h:100
Specialization of FEProblem to run with component subsystem.
Definition: THMProblem.h:18
Interface for handling names.
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.
void addPrivateParam(const std::string &name, const T &value)
void addWeightedAverageMaterial(const FlowChannelBase &flow_channel, const std::vector< MaterialPropertyName > &values, const std::vector< VariableName > &weights, const MaterialPropertyName &property_name) const
Adds a weighted average material.
Definition: ClosuresBase.C:49
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters)
T & set(const std::string &name, bool quiet_mode=false)
InputParameters getValidParams(const std::string &name) const
A base class for flow channels.
std::vector< VariableName > getWallTemperatureNames() const
Gets wall temperature names for connected heat transfers.
static InputParameters validParams()
Definition: ClosuresBase.C:14
Interface class for logging errors and warnings.
virtual const std::string & name() const
void registerBase(const std::string &value)
void addWallTemperatureFromAuxMaterial(const FlowChannelBase &flow_channel, unsigned int i=0) const
Adds a material for wall temperature from an aux variable.
Definition: ClosuresBase.C:64
ClosuresBase(const InputParameters &params)
Definition: ClosuresBase.C:26
void addZeroMaterial(const FlowChannelBase &flow_channel, const std::string &property_name) const
Adds an arbitrary zero-value material.
Definition: ClosuresBase.C:37
Factory & _factory
Factory associated with the MooseApp.
Definition: ClosuresBase.h:103
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
Definition: Component.C:307
static InputParameters validParams()