https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
13registerMooseObject("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
34void
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
51void
53 const FlowChannelBase & /*flow_channel*/)
54{
55}
registerMooseObject("ThermalHydraulicsApp", FunctorClosures)
Base class for closures implementations.
static InputParameters validParams()
Factory & _factory
Factory associated with the MooseApp.
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.
Creates arbitrary closures from functors.
virtual void addMooseObjectsFlowChannel(const FlowChannelBase &flow_channel) override
Adds MOOSE objects associated with a flow channel component.
static InputParameters validParams()
virtual void addMooseObjectsHeatTransfer(const HeatTransferBase &heat_transfer, const FlowChannelBase &flow_channel) override
Adds MOOSE objects associated with a heat transfer component.
FunctorClosures(const InputParameters &params)
Base class for heat transfer connections.
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
const std::string & name() const
void mooseError(Args &&... args) const
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.