Skip to content

Commit

Permalink
Allowed multiple Closures to be supplied
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuahansel committed Jan 2, 2025
1 parent a1f32e8 commit 361d444
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 20 deletions.
20 changes: 13 additions & 7 deletions modules/thermal_hydraulics/include/components/FlowChannelBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,19 @@ class FlowChannelBase : public Component1D, public GravityInterface
std::string getHeatTransferNamesSuffix(const std::string & ht_name) const;

/**
* Get the used closures object
* Get the used closures object(s)
*
* @return The closures object
* @return The closures object(s)
*/
std::shared_ptr<ClosuresBase> getClosures() const { return _closures; }
std::shared_ptr<ClosuresBase> getClosures() const
{
mooseDeprecated("getClosures() is deprecated. Use getClosuresObjects() instead.");
return _closures;
}
std::vector<std::shared_ptr<ClosuresBase>> getClosuresObjects() const
{
return _closures_objects;
}

protected:
virtual std::shared_ptr<FlowModel> buildFlowModel() = 0;
Expand Down Expand Up @@ -212,11 +220,9 @@ class FlowChannelBase : public Component1D, public GravityInterface
/// Function describing the flow channel area
FunctionName _area_function;

/// The name of used closures
const std::string & _closures_name;

/// Closures object
/// Closures object(s)
std::shared_ptr<ClosuresBase> _closures;
std::vector<std::shared_ptr<ClosuresBase>> _closures_objects;

const bool & _pipe_pars_transferred;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ class HeatTransferBase : public ConnectorBase
/// flag that the heated perimeter was specified via an input parameter
const bool _P_hf_provided;

/// Used closures
/// Used closures object(s)
std::shared_ptr<ClosuresBase> _closures;
std::vector<std::shared_ptr<ClosuresBase>> _closures_objects;

/// heated perimeter name
VariableName _P_hf_name;
Expand Down
23 changes: 16 additions & 7 deletions modules/thermal_hydraulics/src/components/FlowChannelBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ FlowChannelBase::validParams()
false,
"Set to true if Dh, P_hf and A are going to be transferred in from an external source");
params.addParam<bool>("lump_mass_matrix", false, "Lump the mass matrix");
params.addRequiredParam<std::string>("closures", "Closures type");
params.addParam<std::vector<std::string>>(
"closures",
{},
"Closures object(s). This is optional since closure relations can be supplied directly by "
"Materials as well.");
params.addParam<bool>("name_multiple_ht_by_index",
true,
"If true, when there are multiple heat transfer components connected to "
Expand Down Expand Up @@ -118,7 +122,6 @@ FlowChannelBase::FlowChannelBase(const InputParameters & params)
? 0.0
: std::acos(_dir * _gravity_vector / (_dir.norm() * _gravity_magnitude)) *
180 / M_PI),
_closures_name(getParam<std::string>("closures")),
_pipe_pars_transferred(getParam<bool>("pipe_pars_transferred")),
_roughness(getParam<Real>("roughness")),
_HT_geometry(getEnumParam<EConvHeatTransGeom>("heat_transfer_geom")),
Expand Down Expand Up @@ -165,8 +168,12 @@ FlowChannelBase::init()
{
_flow_model->init();

if (getTHMProblem().hasClosures(_closures_name))
_closures = getTHMProblem().getClosures(_closures_name);
const auto & closures_names = getParam<std::vector<std::string>>("closures");
for (const auto & closures_name : closures_names)
_closures_objects.push_back(getTHMProblem().getClosures(closures_name));
// _closures should be removed after transition:
if (_closures_objects.size() >= 1)
_closures = _closures_objects[0];
}
}

Expand Down Expand Up @@ -194,8 +201,8 @@ FlowChannelBase::check() const
{
Component1D::check();

if (_closures)
_closures->checkFlowChannel(*this);
for (const auto & closures : _closures_objects)
closures->checkFlowChannel(*this);

// check types of heat transfer for all sources; must be all of same type
if (_temperature_mode)
Expand Down Expand Up @@ -320,7 +327,9 @@ FlowChannelBase::addMooseObjects()
}

_flow_model->addMooseObjects();
_closures->addMooseObjectsFlowChannel(*this);

for (const auto & closures : _closures_objects)
closures->addMooseObjectsFlowChannel(*this);
}

void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,19 @@ HeatTransfer1PhaseBase::check() const
{
HeatTransferBase::check();

if (_closures != nullptr && hasComponentByName<FlowChannel1Phase>(_flow_channel_name))
_closures->checkHeatTransfer(*this, getComponentByName<FlowChannel1Phase>(_flow_channel_name));
for (const auto & closures : _closures_objects)
if (closures && hasComponentByName<FlowChannel1Phase>(_flow_channel_name))
closures->checkHeatTransfer(*this, getComponentByName<FlowChannel1Phase>(_flow_channel_name));
}

void
HeatTransfer1PhaseBase::addMooseObjects()
{
HeatTransferBase::addMooseObjects();

_closures->addMooseObjectsHeatTransfer(*this,
getComponentByName<FlowChannel1Phase>(_flow_channel_name));
for (const auto & closures : _closures_objects)
closures->addMooseObjectsHeatTransfer(
*this, getComponentByName<FlowChannel1Phase>(_flow_channel_name));
}

const MaterialPropertyName &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ HeatTransferBase::init()
_fp_name = flow_channel.getFluidPropertiesName();
_A_fn_name = flow_channel.getAreaFunctionName();
_closures = flow_channel.getClosures();
_closures_objects = flow_channel.getClosuresObjects();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ HeatTransferFromHeatStructure3D1Phase::init()
const auto subdomain_names = flow_channel.getSubdomainNames();
_flow_channel_subdomains.insert(
_flow_channel_subdomains.end(), subdomain_names.begin(), subdomain_names.end());
_flow_channel_closures.push_back(flow_channel.getClosures());

const auto & closures = flow_channel.getClosuresObjects();
_flow_channel_closures.insert(_flow_channel_closures.end(), closures.begin(), closures.end());

fch_num_elems.push_back(flow_channel.getNumElems());

Expand Down

0 comments on commit 361d444

Please sign in to comment.