Skip to content

Commit f5e9bac

Browse files
committed
Added passive transport capability for volume junctions
Refs #31847
1 parent 8c713c9 commit f5e9bac

21 files changed

Lines changed: 372 additions & 35 deletions

modules/thermal_hydraulics/doc/content/source/components/VolumeJunction1Phase.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ are taken from the *first* connection.
3030

3131
!template load file=volume_junction_1phase_usage.md.template name=VolumeJunction1Phase
3232

33+
If connected flow channels include passive transport variables (see [FlowChannel1Phase.md]), then [!param](/Components/VolumeJunction1Phase/initial_passives) must be specified to give the initial value for each passive $y$; [!param](/Components/VolumeJunction1Phase/scaling_factor_passives_times_V) may be specified to use non-unity values for the scaling factors for each corresponding junction variable $y V$.
34+
3335
!alert tip title=Visualizing junction solutions
3436
Since junction variables are located on the mesh, they can visualized alongside the other field variables, such as from pipes. In Paraview, the junction can be made more visible using the "point size" parameter.
3537

modules/thermal_hydraulics/include/components/JunctionParallelChannels1Phase.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ class JunctionParallelChannels1Phase : public VolumeJunction1Phase
2020
JunctionParallelChannels1Phase(const InputParameters & params);
2121

2222
protected:
23-
/**
24-
* Builds user object for computing and storing the fluxes
25-
*/
23+
virtual bool supportsPassiveTransport() const override { return false; }
2624
virtual void buildVolumeJunctionUserObject() override;
2725

2826
public:

modules/thermal_hydraulics/include/components/Pump1Phase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Pump1Phase : public VolumeJunction1Phase
2020
Pump1Phase(const InputParameters & params);
2121

2222
protected:
23+
virtual bool supportsPassiveTransport() const override { return false; }
2324
virtual void buildVolumeJunctionUserObject() override;
2425

2526
/// Pump head [m]

modules/thermal_hydraulics/include/components/ShaftConnectedCompressor1Phase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class ShaftConnectedCompressor1Phase : public VolumeJunction1Phase, public Shaft
2929

3030
protected:
3131
virtual void check() const override;
32+
virtual bool supportsPassiveTransport() const override { return false; }
3233
virtual void buildVolumeJunctionUserObject() override;
3334

3435
/// Compressor inlet

modules/thermal_hydraulics/include/components/ShaftConnectedPump1Phase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class ShaftConnectedPump1Phase : public VolumeJunction1Phase, public ShaftConnec
2929

3030
protected:
3131
virtual void check() const override;
32+
virtual bool supportsPassiveTransport() const override { return false; }
3233
virtual void buildVolumeJunctionUserObject() override;
3334

3435
/// Pump inlet

modules/thermal_hydraulics/include/components/ShaftConnectedTurbine1Phase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class ShaftConnectedTurbine1Phase : public VolumeJunction1Phase, public ShaftCon
2929

3030
protected:
3131
virtual void check() const override;
32+
virtual bool supportsPassiveTransport() const override { return false; }
3233
virtual void buildVolumeJunctionUserObject() override;
3334

3435
/// Turbine inlet

modules/thermal_hydraulics/include/components/VolumeJunction1Phase.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ class VolumeJunction1Phase : public FlowJunction1Phase
3939

4040
protected:
4141
virtual void setupMesh() override;
42+
virtual void init() override;
4243
virtual void check() const override;
44+
virtual bool supportsPassiveTransport() const override { return true; }
4345

4446
/**
4547
* Builds user object for computing and storing the fluxes
@@ -78,6 +80,9 @@ class VolumeJunction1Phase : public FlowJunction1Phase
7880
*/
7981
void addVolumeJunctionIC(const VariableName & var, const std::string & quantity);
8082

83+
/// Adds initial conditions for a passive transport variable
84+
void addPassiveTransportIC(const VariableName & var, const FunctionName & function_name);
85+
8186
/// Volume of the junction
8287
const Real _volume;
8388

@@ -117,6 +122,9 @@ class VolumeJunction1Phase : public FlowJunction1Phase
117122
/// Reference area
118123
const Real & _A_ref;
119124

125+
/// Names of the passive transport solution variables, if any
126+
std::vector<VariableName> _passives_times_V;
127+
120128
public:
121129
static InputParameters validParams();
122130
};

modules/thermal_hydraulics/include/userobjects/ADVolumeJunction1PhaseUserObject.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ class ADVolumeJunction1PhaseUserObject : public ADVolumeJunctionBaseUserObject
4949
const ADVariableValue & _rhouA;
5050
/// rho*E*A of the connected flow channels
5151
const ADVariableValue & _rhoEA;
52+
/// Passives transport variables of the connected flow channels
53+
std::vector<const ADVariableValue *> _passives_times_area;
54+
55+
/// Number of passive transport variables
56+
const unsigned int _n_passives;
5257

5358
/// Form loss coefficient
5459
const Real & _K;

modules/thermal_hydraulics/src/bcs/ADVolumeJunction1PhaseBC.C

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ ADVolumeJunction1PhaseBC::validParams()
2727
params.addRequiredCoupledVar("rhoA", "Flow channel variable: rho*A");
2828
params.addRequiredCoupledVar("rhouA", "Flow channel variable: rho*u*A");
2929
params.addRequiredCoupledVar("rhoEA", "Flow channel variable: rho*E*A");
30+
params.addRequiredCoupledVar("passives_times_area", "Passive transport solution variables");
3031

3132
params.addClassDescription(
3233
"Adds boundary fluxes for flow channels connected to a 1-phase volume junction");
@@ -69,6 +70,10 @@ ADVolumeJunction1PhaseBC::getFlowChannelIndexMapping() const
6970
jvar_map.insert(std::pair<unsigned int, unsigned int>(_rhoA_jvar, THMVACE1D::MASS));
7071
jvar_map.insert(std::pair<unsigned int, unsigned int>(_rhouA_jvar, THMVACE1D::MOMENTUM));
7172
jvar_map.insert(std::pair<unsigned int, unsigned int>(_rhoEA_jvar, THMVACE1D::ENERGY));
73+
const auto n_passives = coupledComponents("passives_times_area");
74+
for (const auto i : make_range(n_passives))
75+
jvar_map.insert(std::pair<unsigned int, unsigned int>(coupled("passives_times_area", i),
76+
THMVACE1D::N_FLUX_OUTPUTS + i));
7277

7378
return jvar_map;
7479
}

modules/thermal_hydraulics/src/components/JunctionParallelChannels1Phase.C

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ JunctionParallelChannels1Phase::buildVolumeJunctionUserObject()
4848
params.set<std::vector<VariableName>>("rhoA") = {FlowModelSinglePhase::RHOA};
4949
params.set<std::vector<VariableName>>("rhouA") = {FlowModelSinglePhase::RHOUA};
5050
params.set<std::vector<VariableName>>("rhoEA") = {FlowModelSinglePhase::RHOEA};
51+
auto flow_model_1phase = dynamic_cast<const FlowModelSinglePhase *>(_flow_model.get());
52+
params.set<std::vector<VariableName>>("passives_times_area") =
53+
flow_model_1phase->passiveTransportSolutionVariableNames();
5154
params.set<std::vector<VariableName>>("rhoV") = {_rhoV_var_name};
5255
params.set<std::vector<VariableName>>("rhouV") = {_rhouV_var_name};
5356
params.set<std::vector<VariableName>>("rhovV") = {_rhovV_var_name};
5457
params.set<std::vector<VariableName>>("rhowV") = {_rhowV_var_name};
5558
params.set<std::vector<VariableName>>("rhoEV") = {_rhoEV_var_name};
59+
params.set<std::vector<VariableName>>("passives_times_V") = _passives_times_V;
5660
params.set<RealVectorValue>("dir_c0") = _directions[0];
5761
params.set<Real>("K") = _K;
5862
params.set<Real>("A_ref") = _A_ref;

0 commit comments

Comments
 (0)