https://mooseframework.inl.gov
Loading...
Searching...
No Matches
THMActionComponent.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 "THMActionComponent.h"
11#include "Control.h"
12
19
21
22void
24{
25 if (_current_task == "THM:add_component")
27 if (_current_task == "THM:add_closures")
29 if (_current_task == "THM:add_control_logic")
31}
32
35{
36 THMProblem * thm_problem = dynamic_cast<THMProblem *>(_problem.get());
37 if (thm_problem)
38 return *thm_problem;
39 else
40 mooseError("The Problem must derive from THMProblem to use THMActionComponents. Please include "
41 "a [Components] block in your input file, even if empty.");
42}
43
44void
45THMActionComponent::addTHMComponent(const std::string & class_name,
46 const std::string & obj_name,
47 InputParameters & params)
48{
49 auto & thm_problem = getTHMProblem();
50 params.set<THMProblem *>("_thm_problem") = &thm_problem;
51 thm_problem.addComponent(class_name, obj_name, params);
52}
53
54void
55THMActionComponent::addClosuresObject(const std::string & class_name,
56 const std::string & obj_name,
57 InputParameters & params)
58{
59 auto & thm_problem = getTHMProblem();
60 params.set<THMProblem *>("_thm_problem") = &thm_problem;
61 params.set<Logger *>("_logger") = &(thm_problem.log());
62 thm_problem.addClosures(class_name, obj_name, params);
63}
64
65void
66THMActionComponent::addControlLogicObject(const std::string & class_name,
67 const std::string & obj_name,
68 InputParameters & params)
69{
70 auto & thm_problem = getTHMProblem();
71 params.set<FEProblemBase *>("_fe_problem_base") = _problem.get();
72 params.set<THMProblem *>("_thm_problem") = &thm_problem;
73 std::shared_ptr<Control> control = _factory.create<Control>(class_name, obj_name, params);
74 thm_problem.getControlWarehouse().addObject(control);
75}
static InputParameters validParams()
std::shared_ptr< FEProblemBase > & _problem
const std::string & _current_task
std::shared_ptr< MooseObject > create(const std::string &obj_name, const std::string &name, const InputParameters &parameters, THREAD_ID tid=0, bool print_deprecated=true)
T & set(const std::string &name, bool quiet_mode=false)
Keeps the error and warning messages.
Definition Logger.h:18
void mooseError(Args &&... args) const
Factory & _factory
virtual void addComponent(const std::string &type, const std::string &name, InputParameters params)
Add a component into this simulation.
Definition Simulation.C:991
virtual void addControlLogic()
THMActionComponent(const InputParameters &params)
static InputParameters validParams()
void addClosuresObject(const std::string &class_name, const std::string &obj_name, InputParameters &params)
Adds a Closures object.
void addControlLogicObject(const std::string &class_name, const std::string &obj_name, InputParameters &params)
Adds a ControlLogic object.
void addTHMComponent(const std::string &class_name, const std::string &obj_name, InputParameters &params)
Adds a THM component.
virtual void actOnAdditionalTasks() override
virtual void addTHMComponents()
virtual void addClosures()
THMProblem & getTHMProblem()
Gets the THM problem.
Specialization of FEProblem to run with component subsystem.
Definition THMProblem.h:19