https://mooseframework.inl.gov
FunctorClosures.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 "FunctorClosures.h"
11 #include "FlowChannelBase.h"
12 
13 registerMooseObject("ThermalHydraulicsApp", FunctorClosures);
14 
17 {
19 
20  params.addRequiredParam<std::vector<MooseFunctorName>>(
21  "functors",
22  "The functors defining each material property. Each entry is paired with the corresponding "
23  "entry in 'properties'.");
24  params.addRequiredParam<std::vector<MaterialPropertyName>>("properties",
25  "The material properties to create");
26 
27  params.addClassDescription("Creates arbitrary closures from functors.");
28 
29  return params;
30 }
31 
33 
34 void
36 {
37  const auto & functor_names = getParam<std::vector<MooseFunctorName>>("functors");
38  const auto & property_names = getParam<std::vector<MaterialPropertyName>>("properties");
39 
40  if (functor_names.size() != property_names.size())
41  mooseError("The parameters 'functors' and 'properties' must have the same size.");
42 
43  const std::string class_name = "MaterialFunctorConverter";
44  InputParameters params = _factory.getValidParams(class_name);
45  params.set<std::vector<SubdomainName>>("block") = flow_channel.getSubdomainNames();
46  params.set<std::vector<MooseFunctorName>>("functors_in") = functor_names;
47  params.set<std::vector<MaterialPropertyName>>("ad_props_out") = property_names;
48  _sim.addMaterial(class_name, genName(flow_channel.name(), name()), params);
49 }
50 
51 void
53  const FlowChannelBase & /*flow_channel*/)
54 {
55 }
FunctorClosures(const InputParameters &params)
THMProblem & _sim
Simulation.
Definition: ClosuresBase.h:100
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.
virtual void addMaterial(const std::string &material_name, const std::string &name, InputParameters &parameters)
virtual void addMooseObjectsFlowChannel(const FlowChannelBase &flow_channel) override
Adds MOOSE objects associated with a flow channel component.
T & set(const std::string &name, bool quiet_mode=false)
InputParameters getValidParams(const std::string &name) const
A base class for flow channels.
static InputParameters validParams()
static InputParameters validParams()
Definition: ClosuresBase.C:14
virtual const std::string & name() const
void addRequiredParam(const std::string &name, const std::string &doc_string)
Creates arbitrary closures from functors.
Base class for closures implementations.
Definition: ClosuresBase.h:28
Base class for heat transfer connections.
virtual void addMooseObjectsHeatTransfer(const HeatTransferBase &heat_transfer, const FlowChannelBase &flow_channel) override
Adds MOOSE objects associated with a heat transfer component.
Factory & _factory
Factory associated with the MooseApp.
Definition: ClosuresBase.h:103
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
virtual const std::vector< SubdomainName > & getSubdomainNames() const
Gets the subdomain names for this component.
Definition: Component.C:307
registerMooseObject("ThermalHydraulicsApp", FunctorClosures)