Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ the time variable $t$ in these functions (and the space variables are
discarded); therefore, the user is actually specifying the functions
$\tau(\omega)$ and $I(\omega)$, not $\tau(t,x,y,z)$ and $I(t,x,y,z)$.

If dependence on time is desired, the [ControlLogic/index.md] can be used. To
do this, supply an arbitrary constant value instead of a function name. Then
use a [TimeFunctionComponentControl.md]. See the `motor` component in
If dependence on time is desired, [ControlLogic](ControlLogic/index.md) can be used. To
do this, supply the name of a [ConstantFunction.md] and then control that function
using the value of the time function ([GetFunctionValueControl.md] followed by [SetRealValueControl.md]).
See the `motor` component in
[open_brayton_cycle.i](test/tests/problems/brayton_cycle/open_brayton_cycle.i)
for an example.

Expand Down
36 changes: 26 additions & 10 deletions modules/thermal_hydraulics/include/components/Component.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,18 +148,34 @@ class Component : public THMObject,
bool hasComponentByName(const std::string & cname) const;

/**
* Connect with control logic
* Connects a controllable parameter of the component to a controllable parameter of
* a constituent object.
*
* This version assumes that the component and object have the same control parameter name.
*
* @param[in] obj_params Constituent object input parameters object
* @param[in] obj_name Constituent object name
* @param[in] param Controllable parameter name (same in both component and constituent
* object)
*/
void connectObject(const InputParameters & params,
const std::string & mooseName,
const std::string & name) const;
void connectObject(const InputParameters & obj_params,
const std::string & obj_name,
const std::string & param) const;
/**
* Connect with control logic
*/
void connectObject(const InputParameters & params,
const std::string & mooseName,
const std::string & name,
const std::string & par_name) const;
* Connects a controllable parameter of the component to a controllable parameter of
* a constituent object.
*
* This is achieved by creating a "controllable parameter alias".
*
* @param[in] obj_params Constituent object input parameters object
* @param[in] obj_name Constituent object name
* @param[in] comp_param Controllable component parameter
* @param[in] obj_param Constituent object parameter
*/
void connectObject(const InputParameters & obj_params,
const std::string & obj_name,
const std::string & comp_param,
const std::string & obj_param) const;

/**
* Makes a function controllable if it is constant
Expand Down
2 changes: 0 additions & 2 deletions modules/thermal_hydraulics/src/base/FlowModel.C
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ FlowModel::addCommonInitialConditions()
const Function & fn = _sim.getFunction(area_function);
_sim.addConstantIC(AREA, fn.value(0, Point()), block);
_sim.addConstantIC(AREA_LINEAR, fn.value(0, Point()), block);

_flow_channel.makeFunctionControllableIfConstant(area_function, "Area", "value");
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ void
Closures1PhaseBase::addWallFrictionFunctionMaterial(const FlowChannel1Phase & flow_channel) const
{
const FunctionName & f_D_fn_name = flow_channel.getParam<FunctionName>("f");
flow_channel.makeFunctionControllableIfConstant(f_D_fn_name, "f");

const std::string class_name = "ADWallFrictionFunctionMaterial";
InputParameters params = _factory.getValidParams(class_name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ Closures1PhaseSimple::addMooseObjectsHeatTransfer(const HeatTransferBase & heat_
_sim.addMaterial(
class_name, genName(heat_transfer.name(), "Hw_material", flow_channel.name()), params);
}

heat_transfer.makeFunctionControllableIfConstant(Hw_fn_name, "Hw");
}

void
Expand Down
26 changes: 15 additions & 11 deletions modules/thermal_hydraulics/src/components/Component.C
Original file line number Diff line number Diff line change
Expand Up @@ -95,22 +95,22 @@ Component::executeSetupMesh()
}

void
Component::connectObject(const InputParameters & params,
const std::string & mooseName,
const std::string & name) const
Component::connectObject(const InputParameters & obj_params,
const std::string & obj_name,
const std::string & param) const
{
connectObject(params, mooseName, name, name);
connectObject(obj_params, obj_name, param, param);
}

void
Component::connectObject(const InputParameters & params,
const std::string & mooseName,
const std::string & name,
const std::string & par_name) const
Component::connectObject(const InputParameters & obj_params,
const std::string & obj_name,
const std::string & comp_param,
const std::string & obj_param) const
{
MooseObjectParameterName alias("component", this->name(), name, "::");
MooseObjectParameterName par_value(params.getBase(), mooseName, par_name);
_app.getInputParameterWarehouse().addControllableParameterAlias(alias, par_value);
MooseObjectParameterName alias("component", this->name(), comp_param, "::");
MooseObjectParameterName obj_controlled_param(obj_params.getBase(), obj_name, obj_param);
_app.getInputParameterWarehouse().addControllableParameterAlias(alias, obj_controlled_param);
}

void
Expand Down Expand Up @@ -142,6 +142,10 @@ Component::makeFunctionControllableIfConstant(const FunctionName & fn_name,
const std::string & control_name,
const std::string & param) const
{
mooseDeprecated("Component::makeFunctionControllableIfConstant is deprecated due to the issue "
"identified in https://github.com/idaholab/moose/issues/31869. Please use an "
"alternative parameter control strategy such as those identified in the issue.");

const Function & fn = _sim.getFunction(fn_name);
if (dynamic_cast<const ConstantFunction *>(&fn) != nullptr)
connectObject(fn.parameters(), fn_name, control_name, param);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ FlowChannel1PhaseBase::validParams()
SlopeReconstruction1DInterface<true>::getSlopeReconstructionMooseEnum("None"),
"Slope reconstruction type for rDG spatial discretization");

params.declareControllable("initial_p initial_T initial_vel D_h");
params.declareControllable("initial_p initial_T initial_vel");
params.addParamNamesToGroup("initial_p initial_T initial_vel", "Variable initialization");
params.addParamNamesToGroup("rdg_slope_reconstruction", "Numerical scheme");

Expand Down Expand Up @@ -118,8 +118,6 @@ FlowChannel1PhaseBase::addHydraulicDiameterMaterial()
params.set<std::vector<std::string>>("prop_names") = {THM::HYDRAULIC_DIAMETER};
params.set<std::vector<FunctionName>>("prop_values") = {D_h_fn_name};
getTHMProblem().addMaterial(class_name, mat_name, params);

makeFunctionControllableIfConstant(D_h_fn_name, "D_h");
}
else
{
Expand Down
3 changes: 0 additions & 3 deletions modules/thermal_hydraulics/src/components/FlowChannelBase.C
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ FlowChannelBase::validParams()
"curved flow channels, it is the (tangent) direction at the start position.");

params.addPrivateParam<std::string>("component_type", "pipe");
params.declareControllable("A f");

return params;
}
Expand Down Expand Up @@ -259,7 +258,6 @@ FlowChannelBase::addCommonObjects()
params.set<ExecFlagEnum>("execute_on") = ts_execute_on;
const std::string aux_kernel_name = genName(name(), "area_linear_aux");
getTHMProblem().addAuxKernel(class_name, aux_kernel_name, params);
makeFunctionControllableIfConstant(_area_function, "Area");
}
{
const std::string class_name = "ProjectionAux";
Expand All @@ -270,7 +268,6 @@ FlowChannelBase::addCommonObjects()
params.set<ExecFlagEnum>("execute_on") = ts_execute_on;
const std::string aux_kernel_name = genName(name(), "area_aux");
getTHMProblem().addAuxKernel(class_name, aux_kernel_name, params);
makeFunctionControllableIfConstant(_area_function, "Area");
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ HSBoundarySpecifiedTemperature::validParams()

params.addRequiredParam<FunctionName>("T", "Prescribed temperature [K]");

params.declareControllable("T");

params.addClassDescription("Applies Dirichlet boundary conditions on a heat structure");

return params;
Expand All @@ -43,6 +41,5 @@ HSBoundarySpecifiedTemperature::addMooseObjects()
pars.set<std::vector<BoundaryName>>("boundary") = _boundary;
pars.set<FunctionName>("function") = _T_func;
getTHMProblem().addBoundaryCondition(class_name, genName(name(), "bc"), pars);
makeFunctionControllableIfConstant(_T_func, "T");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ HeatTransfer1PhaseBase::validParams()
{
InputParameters params = HeatTransferBase::validParams();
params.addParam<FunctionName>("Hw", "Convective heat transfer coefficient [W/(m^2-K)]");
params.declareControllable("Hw");
return params;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ HeatTransferBase::validParams()
params.addParam<bool>(
"P_hf_transferred", false, "Is heat flux perimeter transferred from an external source?");
params.addParam<FunctionName>("P_hf", "Heat flux perimeter [m]");
params.declareControllable("P_hf");
return params;
}

Expand Down Expand Up @@ -135,8 +134,6 @@ HeatTransferBase::addHeatedPerimeter()
InputParameters params = _factory.getValidParams(class_name);
params.set<FunctionName>("area_function") = _A_fn_name;
getTHMProblem().addFunction(class_name, _P_hf_fn_name, params);

makeFunctionControllableIfConstant(_P_hf_fn_name, "P_hf");
}

if (!_app.isRestarting())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ HeatTransferFromSpecifiedTemperature1Phase::validParams()
{
InputParameters params = HeatTransferFromTemperature1Phase::validParams();
params.addRequiredParam<FunctionName>("T_wall", "Specified wall temperature [K]");
params.declareControllable("T_wall");
params.addClassDescription(
"Heat transfer connection from a fixed temperature function for 1-phase flow");
return params;
Expand All @@ -35,8 +34,6 @@ HeatTransferFromSpecifiedTemperature1Phase::addVariables()

if (!_app.isRestarting())
getTHMProblem().addFunctionIC(_T_wall_name, _T_wall_fn_name, _flow_channel_subdomains);

makeFunctionControllableIfConstant(_T_wall_fn_name, "T_wall");
}

void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ ShaftConnectedMotor::validParams()
params.addRequiredParam<FunctionName>("torque", "Driving torque supplied by the motor [kg-m^2]");
params.addRequiredParam<FunctionName>("inertia", "Moment of inertia from the motor [N-m]");
params.addParam<bool>("ad", true, "Use AD version or not");
params.declareControllable("torque inertia");
params.addClassDescription("Motor to drive a shaft component");
return params;
}
Expand All @@ -47,9 +46,6 @@ ShaftConnectedMotor::addVariables()
void
ShaftConnectedMotor::addMooseObjects()
{
makeFunctionControllableIfConstant(_torque_fn_name, "torque");
makeFunctionControllableIfConstant(_inertia_fn_name, "inertia");

const Shaft & shaft = getComponentByName<Shaft>(_shaft_name);
const VariableName shaft_speed_var_name = shaft.getOmegaVariableName();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
type = HeatTransferFromSpecifiedTemperature1Phase
flow_channel = pipe1
T_wall = 310
Hw = 0
Hw = Hw_fn
[]

[inlet1]
Expand Down Expand Up @@ -95,19 +95,10 @@
[]
[]

[ControlLogic]
[pipe_Hw_ctrl]
type = TimeFunctionComponentControl
component = ht_pipe1
parameter = Hw
function = Hw_fn
[]
[]

[Postprocessors]
[Hw]
type = RealComponentParameterValuePostprocessor
component = ht_pipe1
parameter = Hw
type = ADElementAverageMaterialProperty
block = 'pipe1'
mat_prop = Hw
[]
[]
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
[ht_pipe1]
type = HeatTransferFromSpecifiedTemperature1Phase
flow_channel = pipe1
T_wall = 300
T_wall = T_wall_fn
Hw = 0
[]

Expand Down Expand Up @@ -97,19 +97,10 @@
[]
[]

[ControlLogic]
[pipe_T_wall_ctrl]
type = TimeFunctionComponentControl
component = ht_pipe1
parameter = T_wall
function = T_wall_fn
[]
[]

[Postprocessors]
[T_wall]
type = RealComponentParameterValuePostprocessor
component = ht_pipe1
parameter = T_wall
type = ElementAverageValue
block = 'pipe1'
variable = T_wall
[]
[]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
0 2
1 3'
[]

[inertia_fn]
type = PiecewiseLinear
xy_data = '
Expand All @@ -26,8 +25,8 @@
[Components]
[motor]
type = ShaftConnectedMotor
inertia = 1
torque = 2
inertia = inertia_fn
torque = torque_fn
[]

[shaft]
Expand All @@ -53,17 +52,17 @@
[]
[]

[ControlLogic]
[motor_ctrl]
type = TimeFunctionComponentControl
component = motor
[]
[]

[Postprocessors]
[test]
type = RealComponentParameterValuePostprocessor
component = motor
[inertia]
type = ShaftConnectedComponentPostprocessor
shaft_connected_component_uo = motor:shaftconnected_uo
quantity = inertia
execute_on = 'initial timestep_end'
[]
[torque]
type = ShaftConnectedComponentPostprocessor
shaft_connected_component_uo = motor:shaftconnected_uo
quantity = torque
execute_on = 'initial timestep_end'
[]
[]
Expand Down Expand Up @@ -97,5 +96,5 @@

[Outputs]
csv = true
show = 'test'
show = 'torque inertia'
[]

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
time,inertia,torque
0,1,2
0.2,1.3483314773575,2.3483314773575
0.4,1.67726958067,2.67726958067
0.6,1.9873402934767,2.9873402934767
0.8,2,3
1,2,3
Loading