https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Static Private Member Functions | Private Attributes | List of all members
FunctorClosures Class Reference

Creates arbitrary closures from functors. More...

#include <FunctorClosures.h>

Inheritance diagram for FunctorClosures:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 FunctorClosures (const InputParameters &params)
 
virtual void addMooseObjectsFlowChannel (const FlowChannelBase &flow_channel) override
 Adds MOOSE objects associated with a flow channel component.
 
virtual void addMooseObjectsHeatTransfer (const HeatTransferBase &heat_transfer, const FlowChannelBase &flow_channel) override
 Adds MOOSE objects associated with a heat transfer component.
 
virtual void checkFlowChannel (const FlowChannelBase &) const
 Checks for errors associated with a flow channel component.
 
virtual void checkHeatTransfer (const HeatTransferBase &, const FlowChannelBase &) const
 Checks for errors associated with a heat transfer component.
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
bool isKokkosObject () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
const std::string & name () const
 
std::string typeAndName () const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
MooseObjectName uniqueName () const
 
const InputParametersparameters () const
 
const hit::Node * getHitNode () const
 
bool hasBase () const
 
const std::string & getBase () const
 
const TgetParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const TqueryParam (const std::string &name) const
 
const TgetRenamedParam (const std::string &old_name, const std::string &new_name) const
 
T getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &name) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
std::string messagePrefix (const bool hit_prefix=true) const
 
std::string errorPrefix (const std::string &) const
 
void mooseError (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecatedNoTrace (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
void callMooseError (std::string msg, const bool with_prefix, const hit::Node *node=nullptr, const bool show_trace=true) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 
template<typename... Args>
void logError (Args &&... args) const
 Logs an error.
 
template<typename... Args>
void logComponentError (const std::string &component_name, Args &&... args) const
 Logs an error for a component.
 
template<typename... Args>
void logWarning (Args &&... args) const
 Logs a warning.
 
template<typename... Args>
void logComponentWarning (const std::string &component_name, Args &&... args) const
 Logs a warning for a component.
 
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.
 
std::string genName (const std::string &prefix, unsigned int i, unsigned int j, const std::string &suffix="") const
 Build a name from a prefix, 2 numbers and possible suffix.
 
std::string genName (const std::string &prefix, const std::string &name, unsigned int i) const
 Build a name from 2 strings and a number.
 
std::string genName (const std::string &prefix, const std::string &middle, const std::string &suffix="") const
 Build a name from strings.
 
std::string genSafeName (const std::string &prefix, const std::string &middle, const std::string &suffix="") const
 Build a name from strings that is safe to use in input files (i.e.
 

Static Public Member Functions

static InputParameters validParams ()
 
static void callMooseError (MooseApp *const app, const InputParameters &params, std::string msg, const bool with_prefix, const hit::Node *node, const bool show_trace=true)
 

Public Attributes

 usingCombinedWarningSolutionWarnings
 
const ConsoleStream _console
 

Static Public Attributes

static const std::string type_param
 
static const std::string name_param
 
static const std::string unique_name_param
 
static const std::string app_param
 
static const std::string moose_base_param
 
static const std::string kokkos_object_param
 

Protected Member Functions

void addZeroMaterial (const FlowChannelBase &flow_channel, const std::string &property_name) const
 Adds an arbitrary zero-value material.
 
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.
 
void addWallTemperatureFromAuxMaterial (const FlowChannelBase &flow_channel, unsigned int i=0) const
 Adds a material for wall temperature from an aux variable.
 
void flagInvalidSolutionInternal (const InvalidSolutionID invalid_solution_id) const
 
InvalidSolutionID registerInvalidSolutionInternal (const std::string &message, const bool warning) const
 

Protected Attributes

THMProblem_sim
 Simulation.
 
Factory_factory
 Factory associated with the MooseApp.
 
const bool & _enabled
 
MooseApp_app
 
ActionFactory_action_factory
 
const std::string & _type
 
const std::string & _name
 
const InputParameters_pars
 
const Parallel::Communicator & _communicator
 
Logger_log
 

Static Private Member Functions

static const hit::Node * getHitNode (const InputParameters &params)
 
static std::string messagePrefix (const InputParameters &params, const bool hit_prefix)
 

Private Attributes

const ParallelParamObject_parent
 
const MooseBase_si_moose_base
 
const FEProblemBase_si_problem
 

Detailed Description

Creates arbitrary closures from functors.

Definition at line 17 of file FunctorClosures.h.

Constructor & Destructor Documentation

◆ FunctorClosures()

FunctorClosures::FunctorClosures ( const InputParameters params)

Definition at line 32 of file FunctorClosures.C.

32: ClosuresBase(params) {}
Base class for closures implementations.

Member Function Documentation

◆ addMooseObjectsFlowChannel()

void FunctorClosures::addMooseObjectsFlowChannel ( const FlowChannelBase flow_channel)
overridevirtual

Adds MOOSE objects associated with a flow channel component.

Parameters
[in]flow_channelFlow channel component

Implements ClosuresBase.

Definition at line 35 of file FunctorClosures.C.

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}
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
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.

◆ addMooseObjectsHeatTransfer()

void FunctorClosures::addMooseObjectsHeatTransfer ( const HeatTransferBase heat_transfer,
const FlowChannelBase flow_channel 
)
overridevirtual

Adds MOOSE objects associated with a heat transfer component.

Parameters
[in]heat_transferHeat transfer component
[in]flow_channelFlow channel component

Implements ClosuresBase.

Definition at line 52 of file FunctorClosures.C.

54{
55}

◆ addWallTemperatureFromAuxMaterial()

void ClosuresBase::addWallTemperatureFromAuxMaterial ( const FlowChannelBase flow_channel,
unsigned int  i = 0 
) const
protectedinherited

Adds a material for wall temperature from an aux variable.

Parameters
[in]flow_channelFlow channel component
[in]iindex of the heat transfer

Definition at line 64 of file ClosuresBase.C.

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::vector< VariableName > getWallTemperatureNames() const
Gets wall temperature names for connected heat transfers.

Referenced by Closures1PhaseSimple::addMooseObjectsFlowChannel(), Closures1PhaseTHM::addMooseObjectsFlowChannel(), and WallTemperature1PhaseClosures::addMooseObjectsFlowChannel().

◆ addWeightedAverageMaterial()

void ClosuresBase::addWeightedAverageMaterial ( const FlowChannelBase flow_channel,
const std::vector< MaterialPropertyName > &  values,
const std::vector< VariableName > &  weights,
const MaterialPropertyName &  property_name 
) const
protectedinherited

Adds a weighted average material.

Parameters
[in]flow_channelFlow channel component
[in]valuesValues to average
[in]weightsWeights for each value
[in]property_nameName of material property to create

Definition at line 49 of file ClosuresBase.C.

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}

Referenced by Closures1PhaseSimple::addMooseObjectsFlowChannel().

◆ addZeroMaterial()

void ClosuresBase::addZeroMaterial ( const FlowChannelBase flow_channel,
const std::string &  property_name 
) const
protectedinherited

Adds an arbitrary zero-value material.

Parameters
[in]flow_channelFlow channel component
[in]property_nameName of the material property to create

Definition at line 37 of file ClosuresBase.C.

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}
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ checkFlowChannel()

virtual void ClosuresBase::checkFlowChannel ( const FlowChannelBase ) const
inlinevirtualinherited

Checks for errors associated with a flow channel component.

Parameters
[in]flow_channelFlow channel component

Reimplemented in Closures1PhaseSimple, Closures1PhaseTHM, and WallTemperature1PhaseClosures.

Definition at line 38 of file ClosuresBase.h.

38{}

◆ checkHeatTransfer()

virtual void ClosuresBase::checkHeatTransfer ( const HeatTransferBase ,
const FlowChannelBase  
) const
inlinevirtualinherited

Checks for errors associated with a heat transfer component.

Parameters
[in]heat_transferHeat transfer component
[in]flow_channelFlow channel component

Reimplemented in Closures1PhaseSimple, Closures1PhaseTHM, and WallTemperature1PhaseClosures.

Definition at line 46 of file ClosuresBase.h.

48 {
49 }

◆ genName() [1/4]

std::string NamingInterface::genName ( const std::string &  prefix,
const std::string &  middle,
const std::string &  suffix = "" 
) const
inlineinherited

Build a name from strings.

Definition at line 66 of file NamingInterface.h.

69 {
70 std::stringstream ss;
71 ss << prefix << ":" << middle;
72 if (!suffix.empty())
73 ss << ":" << suffix;
74 return ss.str();
75 }

◆ genName() [2/4]

std::string NamingInterface::genName ( const std::string &  prefix,
const std::string &  name,
unsigned int  i 
) const
inlineinherited

Build a name from 2 strings and a number.

Definition at line 56 of file NamingInterface.h.

57 {
58 std::stringstream ss;
59 ss << prefix << ":" << name << ":" << i;
60 return ss.str();
61 }
const std::string name
Definition Setup.h:21

◆ genName() [3/4]

std::string NamingInterface::genName ( const std::string &  prefix,
unsigned int  i,
unsigned int  j,
const std::string &  suffix = "" 
) const
inlineinherited

Build a name from a prefix, 2 numbers and possible suffix.

Definition at line 41 of file NamingInterface.h.

45 {
46 std::stringstream ss;
47 ss << prefix << ":" << i << ":" << j;
48 if (!suffix.empty())
49 ss << ":" << suffix;
50 return ss.str();
51 }

◆ genName() [4/4]

std::string NamingInterface::genName ( const std::string &  prefix,
unsigned int  id,
const std::string &  suffix = "" 
) const
inlineinherited

Build a name from a prefix, number and possible suffix.

Definition at line 29 of file NamingInterface.h.

30 {
31 std::stringstream ss;
32 ss << prefix << ":" << id;
33 if (!suffix.empty())
34 ss << ":" << suffix;
35 return ss.str();
36 }

Referenced by Closures1PhaseBase::addAverageWallTemperatureMaterial(), FlowModel::addCommonInitialConditions(), FlowModel::addCommonMooseObjects(), FlowChannelBase::addCommonObjects(), Simulation::addComponentScalarIC(), HeatStructureBase::addConstantDensitySolidPropertiesMaterial(), Simulation::addConstantIC(), Simulation::addConstantScalarIC(), FlowModel1PhaseBase::addDensityAux(), FlowModelGasMix::addDensityIC(), FlowModelSinglePhase::addDensityIC(), FlowModel1PhaseBase::addEnergyGravityKernel(), FlowChannel1Phase::addFlowChannel1PhaseFunctorMaterial(), FlowModelGasMix::addFluidPropertiesMaterials(), FlowModelSinglePhase::addFluidPropertiesMaterials(), VolumeJunctionCoupledFlux1Phase::addFluxTransfer(), FlowModel1PhaseBase::addFunctionIC(), Simulation::addFunctionIC(), FlowModel1PhaseBase::addHeatConductionDGKernel(), HeatTransferBase::addHeatedPerimeter(), HeatConductionModel::addHeatEquationRZ(), HeatConductionModel::addHeatEquationXYZ(), HeatTransferFromTemperature1Phase::addHeatTransferKernels(), FlowChannel1PhaseBase::addHydraulicDiameterMaterial(), FlowModelGasMix::addMassDiffusionEnergyDGKernel(), FlowModelGasMix::addMassDiffusionSpeciesDGKernel(), FlowModelGasMix::addMassFractionAux(), FlowModel1PhaseBase::addMomentumAreaGradientKernel(), FlowModel1PhaseBase::addMomentumFrictionKernel(), FlowModel1PhaseBase::addMomentumGravityKernel(), FlowChannel1Phase::addMooseObjects(), FlowChannelBase::addMooseObjects(), FormLoss1PhaseBase::addMooseObjects(), FormLossFromExternalApp1Phase::addMooseObjects(), FormLossFromFunction1Phase::addMooseObjects(), GateValve1Phase::addMooseObjects(), HeatSourceFromPowerDensity::addMooseObjects(), HeatSourceFromTotalPower::addMooseObjects(), HeatSourceVolumetric1Phase::addMooseObjects(), HeatStructure2DCoupler::addMooseObjects(), HeatStructure2DRadiationCouplerRZ::addMooseObjects(), HeatTransferBase::addMooseObjects(), HeatTransferFromExternalAppHeatFlux1Phase::addMooseObjects(), HeatTransferFromHeatFlux1Phase::addMooseObjects(), HeatTransferFromHeatStructure1Phase::addMooseObjects(), HeatTransferFromHeatStructure3D1Phase::addMooseObjects(), HeatTransferFromSpecifiedTemperature1Phase::addMooseObjects(), HSBoundaryAmbientConvection::addMooseObjects(), HSBoundaryExternalAppConvection::addMooseObjects(), HSBoundaryExternalAppHeatFlux::addMooseObjects(), HSBoundaryExternalAppTemperature::addMooseObjects(), HSBoundaryHeatFlux::addMooseObjects(), HSBoundaryRadiation::addMooseObjects(), HSBoundarySpecifiedTemperature::addMooseObjects(), HSCoupler2D2DRadiation::addMooseObjects(), HSCoupler2D3D::addMooseObjects(), InletVelocityTemperature1Phase::addMooseObjects(), JunctionOneToOne1Phase::addMooseObjects(), Shaft::addMooseObjects(), ShaftConnectedCompressor1Phase::addMooseObjects(), ShaftConnectedPump1Phase::addMooseObjects(), ShaftConnectedTurbine1Phase::addMooseObjects(), SimpleTurbine1Phase::addMooseObjects(), TotalPower::addMooseObjects(), VolumeJunction1Phase::addMooseObjects(), addMooseObjectsFlowChannel(), Closures1PhaseSimple::addMooseObjectsHeatTransfer(), Component::addNonlinearStepFunctorMaterial(), FlowChannel1Phase::addNormalized1PhaseResidualNorm(), FlowModelSinglePhase::addPassiveTransportIC(), FlowModelGasMix::addPressureAux(), FlowModelSinglePhase::addPressureAux(), VolumeJunctionCoupledFlux1Phase::addPropertyTransfer(), FlowModelGasMix::addRDGAdvectionDGKernels(), FlowModelSinglePhase::addRDGAdvectionDGKernels(), FlowModel1PhaseBase::addRhoAIC(), FlowModelGasMix::addRhoEAIC(), FlowModelSinglePhase::addRhoEAIC(), FlowModel1PhaseBase::addRhoUAIC(), FlowModelGasMix::addSlopeReconstructionMaterial(), FlowModelSinglePhase::addSlopeReconstructionMaterial(), FlowModel1PhaseBase::addSpecificInternalEnergyAux(), FlowModel1PhaseBase::addSpecificInternalEnergyIC(), FlowModel1PhaseBase::addSpecificTotalEnthalpyAux(), FlowModel1PhaseBase::addSpecificTotalEnthalpyIC(), FlowModel1PhaseBase::addSpecificVolumeAux(), FlowModel1PhaseBase::addSpecificVolumeIC(), FlowModelGasMix::addTemperatureAux(), FlowModelSinglePhase::addTemperatureAux(), FlowModel1PhaseBase::addTimeDerivativeKernelIfTransient(), FlowChannelBase::addVariables(), FlowModel1PhaseBase::addVelocityAux(), FlowModel1PhaseBase::addVelocityIC(), VolumeJunction1Phase::addVolumeJunctionIC(), VolumeJunctionCoupledFlux1Phase::addVolumeJunctionKernel(), Closures1PhaseTHM::addWallFFMaterial(), Closures1PhaseBase::addWallFrictionFunctionMaterial(), Closures1PhaseTHM::addWallHTCMaterial(), ClosuresBase::addWallTemperatureFromAuxMaterial(), Closures1PhaseSimple::addWallTemperatureFromHeatFluxMaterial(), FlowBoundary1Phase::addWeakBCs(), FlowBoundaryGasMix::addWeakBCs(), ClosuresBase::addWeightedAverageMaterial(), FlowModelGasMix::addXiRhoAIC(), ClosuresBase::addZeroMaterial(), FileMeshComponent::buildMesh(), Component1D::buildMesh(), Component2D::buildMesh(), HeatSourceBase::HeatSourceBase(), Component::nonlinearConvergenceName(), and Simulation::setupInitialConditionsFromFile().

◆ genSafeName()

std::string NamingInterface::genSafeName ( const std::string &  prefix,
const std::string &  middle,
const std::string &  suffix = "" 
) const
inlineinherited

Build a name from strings that is safe to use in input files (i.e.

can be exposed to users)

Definition at line 80 of file NamingInterface.h.

83 {
84 std::stringstream ss;
85 ss << prefix << "_" << middle;
86 if (!suffix.empty())
87 ss << "_" << suffix;
88 return ss.str();
89 }

Referenced by HSBoundaryAmbientConvection::addMooseObjects(), HSBoundaryExternalAppConvection::addMooseObjects(), HSBoundaryExternalAppHeatFlux::addMooseObjects(), HSBoundaryHeatFlux::addMooseObjects(), and HSBoundaryRadiation::addMooseObjects().

◆ logComponentError()

template<typename... Args>
void LoggingInterface::logComponentError ( const std::string &  component_name,
Args &&...  args 
) const
inlineinherited

Logs an error for a component.

Parameters
[in]component_nameName of the component

Definition at line 47 of file LoggingInterface.h.

48 {
49 _log.add(Logger::ERROR, component_name, ": ", std::forward<Args>(args)...);
50 }
void add(EMessageType type, Args &&... args)
Add a message to the log.
Definition Logger.h:35
@ ERROR
Definition Logger.h:25

Referenced by Closures1PhaseSimple::checkFlowChannel(), Closures1PhaseSimple::checkHeatTransfer(), and Component::logError().

◆ logComponentWarning()

template<typename... Args>
void LoggingInterface::logComponentWarning ( const std::string &  component_name,
Args &&...  args 
) const
inlineinherited

Logs a warning for a component.

Parameters
[in]component_nameName of the component

Definition at line 67 of file LoggingInterface.h.

68 {
69 _log.add(Logger::WARNING, component_name, ": ", std::forward<Args>(args)...);
70 }
@ WARNING
Definition Logger.h:26

Referenced by Component::logWarning().

◆ logError()

template<typename... Args>
void LoggingInterface::logError ( Args &&...  args) const
inlineinherited

◆ logWarning()

template<typename... Args>
void LoggingInterface::logWarning ( Args &&...  args) const
inlineinherited

Logs a warning.

Definition at line 56 of file LoggingInterface.h.

57 {
58 _log.add(Logger::WARNING, std::forward<Args>(args)...);
59 }

◆ validParams()

InputParameters FunctorClosures::validParams ( )
static

Definition at line 16 of file FunctorClosures.C.

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}
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _factory

Factory& ClosuresBase::_factory
protectedinherited

◆ _log

Logger& LoggingInterface::_log
protectedinherited

◆ _sim

THMProblem& ClosuresBase::_sim
protectedinherited

The documentation for this class was generated from the following files: