https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
36void
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
48void
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
63void
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}
std::array< Real, 2 > values
ClosuresBase(const InputParameters &params)
static InputParameters validParams()
void addZeroMaterial(const FlowChannelBase &flow_channel, const std::string &property_name) const
Adds an arbitrary zero-value material.
Factory & _factory
Factory associated with the MooseApp.
void addWallTemperatureFromAuxMaterial(const FlowChannelBase &flow_channel, unsigned int i=0) const
Adds a material for wall temperature from an aux variable.
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.
THMProblem & _sim
Simulation.
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
Definition Component.C:345
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters)
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.
void addPrivateParam(const std::string &name, const T &value)
void registerBase(const std::string &value)
T & set(const std::string &name, bool quiet_mode=false)
Keeps the error and warning messages.
Definition Logger.h:18
Interface class for logging errors and warnings.
const std::string & name() const
static InputParameters validParams()
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.
Specialization of FEProblem to run with component subsystem.
Definition THMProblem.h:19