Skip to content

Commit

Permalink
Removed deprecated Closures enumerations
Browse files Browse the repository at this point in the history
Closes #19913
  • Loading branch information
joshuahansel committed Dec 20, 2024
1 parent 7d4ab78 commit 6954109
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 101 deletions.
24 changes: 0 additions & 24 deletions modules/thermal_hydraulics/include/base/ThermalHydraulicsApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,6 @@ class ThermalHydraulicsApp : public MooseApp
ThermalHydraulicsApp(InputParameters parameters);
virtual ~ThermalHydraulicsApp();

/**
* Registers a closures option
*
* @param[in] closures_option Closures option string to register
* @param[in] closures_name Closures class name
* @param[in] flow_model_id Flow model ID
*/
static void registerClosuresOption(const std::string & closures_option,
const std::string & class_name,
const THM::FlowModelID & flow_model_id);

/**
* Gets the class name of the closures corresponding to the flow model and user option
*
* @param[in] closures_option Closures option
* @param[in] flow_model_id Flow model ID
*/
static const std::string & getClosuresClassName(const std::string & closures_option,
const THM::FlowModelID & flow_model_id);

static void registerApps();
static void registerAll(Factory & f, ActionFactory & af, Syntax & s);

Expand All @@ -94,8 +74,4 @@ class ThermalHydraulicsApp : public MooseApp
static std::map<THM::FlowModelID, std::string> _flow_model_map;

static InputParameters validParams();

protected:
/// Map from flow model ID to map of closures option to its class
static std::map<THM::FlowModelID, std::map<std::string, std::string>> _closures_class_names_map;
};
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,6 @@ class FlowChannelBase : public Component1D, public GravityInterface
virtual void initSecondary() override;
virtual void check() const override;

virtual std::shared_ptr<ClosuresBase> buildClosures();

/**
* Adds objects which are common for single- and two-phase flow
*/
Expand Down
45 changes: 0 additions & 45 deletions modules/thermal_hydraulics/src/base/ThermalHydraulicsApp.C
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@

std::map<THM::FlowModelID, std::string> ThermalHydraulicsApp::_flow_model_map;

std::map<THM::FlowModelID, std::map<std::string, std::string>>
ThermalHydraulicsApp::_closures_class_names_map;

namespace THM
{

Expand Down Expand Up @@ -102,9 +99,6 @@ ThermalHydraulicsApp::registerAll(Factory & f, ActionFactory & af, Syntax & s)
THM::associateSyntax(s);
THM::registerActions(s);

registerClosuresOption("simple", "Closures1PhaseSimple", THM::FM_SINGLE_PHASE);
registerClosuresOption("none", "Closures1PhaseNone", THM::FM_SINGLE_PHASE);

// flow models
registerFlowModel(THM::FM_SINGLE_PHASE, FlowModelSinglePhase);

Expand Down Expand Up @@ -148,45 +142,6 @@ ThermalHydraulicsApp::registerApps()
MiscApp::registerApps();
}

const std::string &
ThermalHydraulicsApp::getClosuresClassName(const std::string & closures_option,
const THM::FlowModelID & flow_model_id)
{
const std::string closures_option_lc = MooseUtils::toLower(closures_option);

if (_closures_class_names_map.find(flow_model_id) != _closures_class_names_map.end())
{
const auto & map_for_flow_model = _closures_class_names_map.at(flow_model_id);
if (map_for_flow_model.find(closures_option_lc) != map_for_flow_model.end())
{
const std::string & closures_class = map_for_flow_model.at(closures_option_lc);
mooseDeprecated("The closures system now uses objects created in the input file instead of "
"enumerated options.\n",
"To remove this warning, add the following block to your input file "
"(replacing 'my_closures' as you choose):\n",
" [Closures]\n [my_closures]\n type = ",
closures_class,
"\n []\n []\n",
"Then, set the 'closures' parameter in your flow channel to this name:\n",
" closures = my_closures");
return closures_class;
}
else
mooseError("The closures option '" + closures_option_lc + "' is not registered.");
}
else
mooseError("The closures option '" + closures_option_lc + "' is not registered.");
}

void
ThermalHydraulicsApp::registerClosuresOption(const std::string & closures_option,
const std::string & class_name,
const THM::FlowModelID & flow_model_id)
{
const std::string closures_option_lc = MooseUtils::toLower(closures_option);
_closures_class_names_map[flow_model_id][closures_option_lc] = class_name;
}

//
// Dynamic Library Entry Points - DO NOT MODIFY
//
Expand Down
14 changes: 0 additions & 14 deletions modules/thermal_hydraulics/src/components/FlowChannelBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -167,23 +167,9 @@ FlowChannelBase::init()

if (getTHMProblem().hasClosures(_closures_name))
_closures = getTHMProblem().getClosures(_closures_name);
else
_closures = buildClosures();
}
}

std::shared_ptr<ClosuresBase>
FlowChannelBase::buildClosures()
{
const std::string class_name =
ThermalHydraulicsApp::getClosuresClassName(_closures_name, getFlowModelID());
InputParameters params = _factory.getValidParams(class_name);
params.set<THMProblem *>("_thm_problem") = &getTHMProblem();
params.set<Logger *>("_logger") = &getTHMProblem().log();
return _factory.create<ClosuresBase>(
class_name, genName(name(), "closure", _closures_name), params);
}

void
FlowChannelBase::initSecondary()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,4 @@
exodiff = 'phy.test_out.e'
requirement = 'The system shall be able to define a closure object that does not define closures, so they can be defined directly in the input file.'
[]
[enumeration_option]
type = RunException
input = 'phy.test.i'
cli_args = "GlobalParams/closures=none"
allow_deprecated = False
expect_err = 'The closures system now uses objects created in the input file'
requirement = 'The system shall report an error with a useful message if the user attempts the former way of not specifying closures.'
[]
[]
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,4 @@
expect_err = "pipe: When using simple closures, the parameter 'f' must be provided."
requirement = 'The system shall report an error if the friction parameter is missing in the simple closures object.'
[]
[enumeration_option]
type = RunException
input = 'err.missing_f_1phase.i'
cli_args = "GlobalParams/closures=simple Components/pipe/f=0"
allow_deprecated = False
expect_err = 'The closures system now uses objects created in the input file'
requirement = 'The system shall report an error if the user attempts passing closure parameters directly to components.'
[]
[]

0 comments on commit 6954109

Please sign in to comment.