18#include "libmesh/parallel_object.h"
102 template <
typename T>
111 template <
typename T>
141 std::shared_ptr<ClosuresBase>
getClosures(
const std::string &
name)
const;
152 const VariableName &
name,
154 Real scaling_factor = 1.0);
166 const VariableName &
name,
168 const std::vector<SubdomainName> & subdomain_names,
169 Real scaling_factor = 1.0);
180 const std::string & var_type,
181 const VariableName &
name,
191 const std::vector<SubdomainName> & block_names);
193 const std::string & func_name,
194 const std::vector<SubdomainName> & block_names);
199 const std::string &
name,
274 template <
typename T>
289 template <
typename T>
310 template <
typename T>
321 logError(
"Trying to declare '",
name,
"', but it was already declared.");
352 virtual void augmentSparsity(
const dof_id_type & elem_id1,
const dof_id_type & elem_id2);
412 std::map<VariableName, VariableInfo>
_vars;
424 std::map<std::string, ICInfo>
_ics;
497 return dynamic_cast<T *
>((it->second).get()) !=
nullptr;
508 return *
dynamic_cast<T *
>((it->second).get());
512 "' does not exist in the simulation. Use hasComponent or "
513 "checkComponnetByName before calling getComponent.");
void mooseError(Args &&... args)
Base class for closures implementations.
Base class for THM components.
bool getDeclared()
Get the declared state.
void setControl(THMControl *ctrl)
Set the pointer to the control object that declared this control data.
void setDeclared()
Mark the data as declared.
Concrete definition of a parameter value for a specified type.
Keeps the error and warning messages.
Interface class for logging errors and warnings.
void logError(Args &&... args) const
Logs an error.
Interface for handling names.
Main class for simulation (the driver of the simulation)
void printComponentLoops() const
Prints the component loops.
void addComponentScalarIC(const VariableName &var_name, const std::vector< Real > &value)
void addControl(const std::string &type, const std::string &name, InputParameters params)
Add a control.
THMMesh & _thm_mesh
THM mesh.
std::map< std::string, std::shared_ptr< Component > > _comp_by_name
Map of components by their names.
void setupCriticalHeatFluxTable()
Setup ctirical heat flux table user object.
void setVectorValuedVelocity(bool vector_velocity)
Set if velocity is being output as a vector-valued field.
const T & getComponentByName(const std::string &name) const
Get component by its name.
bool hasComponentOfType(const std::string &name) const
Find out if simulation has a component with the given name and specified type.
bool hasInitialConditionsFromFile() const
Are initial conditions specified from a file.
bool _output_vector_velocity
Flag indicating if velocity is output as vector-valued field.
std::map< VariableName, VariableInfo > _vars
variables for this simulation (name and info about the var)
std::map< std::string, ControlDataValue * > _control_data
Control data created in the control logic system.
void addConstantScalarIC(const VariableName &var_name, Real value)
const std::vector< std::shared_ptr< Component > > & getComponents() const
Return list of components available in the simulation.
FEProblemBase & _fe_problem
Pointer to FEProblem representing this simulation.
ThermalHydraulicsApp & _thm_app
The application this is associated with.
static std::map< VariableName, int > _component_variable_order_map
Component variable order map; see setComponentVariableOrder for more info.
ThermalHydraulicsApp & getApp()
Get the ThermalHydraulicsApp.
libMesh::FEType _flow_fe_type
finite element type for the flow in the simulation
std::vector< OutputName > _outputters_file
void addConstantIC(const VariableName &var_name, Real value, const std::vector< SubdomainName > &block_names)
virtual void integrityCheck() const
Check the integrity of the simulation.
virtual void advanceState()
Advance all of the state holding vectors / datastructures so that we can move to the next timestep.
virtual void addVariables()
Add variables involved in this simulation.
virtual void augmentSparsity(const dof_id_type &elem_id1, const dof_id_type &elem_id2)
Hint how to augment sparsity pattern between two elements.
const InputParameters & _thm_pars
"Global" of this simulation
void addFunctionIC(const VariableName &var_name, const std::string &func_name, const std::vector< SubdomainName > &block_names)
virtual void initComponents()
Initialize this simulation's components.
ControlData< T > * declareControlData(const std::string &name, THMControl *ctrl)
Declare control data of type T and name 'name', if it does not exist it will be created.
std::vector< OutputName > _outputters_all
void setupEquations()
Setup equations to be solved in this simulation.
std::map< std::string, std::string > _component_name_to_loop_name
Map of component name to component loop name.
virtual void couplingMatrixIntegrityCheck() const
Check integrity of coupling matrix used by the preconditioner.
virtual void addClosures(const std::string &type, const std::string &name, InputParameters params)
Add a closures object into this simulation.
void setCheckJacobian(bool state)
Enable Jacobian checking.
const bool & getImplicitTimeIntegrationFlag()
Gets the flag indicating whether an implicit time integration scheme is being used.
void addRelationshipManagers()
Add additional relationship managers to run the simulation.
virtual void setupMesh()
Perform mesh setup actions such as setting up the coordinate system(s) and creating ghosted elements.
std::vector< OutputName > _outputters_screen
void checkVariableNameLength(const std::string &name) const
Reports an error if the variable name is too long.
bool hasControlData(const std::string &name)
Query if control data with name 'name' exists.
const libMesh::FEType & getFlowFEType() const
Gets the FE type for the flow in this simulation.
bool hasComponent(const std::string &name) const
Find out if simulation has a component with the given name.
virtual void controlDataIntegrityCheck()
Check the integrity of the control data.
std::map< std::string, ICInfo > _ics
ControlData< T > * getControlData(const std::string &name)
Get control data of type T and name 'name', if it does not exist it will be created.
std::shared_ptr< ClosuresBase > getClosures(const std::string &name) const
Get a pointer to a closures object.
void identifyLoops()
Identifies the component loops.
virtual void initSimulation()
Initialize this simulation.
void addSimVariable(bool nl, const VariableName &name, libMesh::FEType fe_type, Real scaling_factor=1.0)
Queues a variable of type MooseVariableScalar to be added to the nonlinear or aux system.
static void setComponentVariableOrder(const VariableName &var, int index)
Sets a component variable order index.
virtual void addComponent(const std::string &type, const std::string &name, InputParameters params)
Add a component into this simulation.
bool hasClosures(const std::string &name) const
Return whether the simulation has a closures object.
std::map< std::string, std::shared_ptr< ClosuresBase > > _closures_by_name
Map of closures by their names.
virtual void addMooseObjects()
Add component MOOSE objects.
bool _implicit_time_integration
true if using implicit time integration scheme
virtual void buildMesh()
Create mesh for this simulation.
virtual void setupQuadrature()
Sets up quadrature rules.
Factory & _thm_factory
The Factory associated with the MooseApp.
std::vector< std::shared_ptr< Component > > _components
List of components in this simulation.
std::vector< VariableName > sortAddedComponentVariables() const
Returns a sorted list of the variables added by components.
void setupInitialConditionObjects()
void addFileOutputter(const std::string &name)
bool getVectorValuedVelocity()
Is velocity output as vector-valued field.
std::vector< OutputName > getOutputsVector(const std::string &key) const
Gets the vector of output names corresponding to a 1-word key string.
void setupCoordinateSystem()
Sets the coordinate system for each subdomain.
virtual void run()
Run the simulation.
void setupInitialConditionsFromFile()
Setup reading initial conditions from a specified file, see 'initial_from_file' and 'initial_from_fil...
std::map< std::string, THM::FlowModelID > _loop_name_to_model_id
Map of loop name to model type.
bool _check_jacobian
True if checking jacobian.
void addSimInitialCondition(const std::string &type, const std::string &name, InputParameters params)
std::map< dof_id_type, std::vector< dof_id_type > > _sparsity_elem_augmentation
Additional sparsity pattern that needs to be added into the Jacobian matrix.
void addScreenOutputter(const std::string &name)
Specialization of FEProblem to run with component subsystem.
ICInfo(const std::string &type, const InputParameters ¶ms)
bool _nl
True if the variable is a nonlinear (solution) variable; otherwise, aux.
InputParameters _params
Input parameters.
std::string _var_type
Type (class) of the variable.