17#include "metaphysicl/parallel_numberarray.h"
18#include "metaphysicl/parallel_dualnumber.h"
19#include "metaphysicl/parallel_semidynamicsparsenumberarray.h"
20#include "libmesh/parallel_algebra.h"
28 params.
addRequiredParam<std::string>(
"component_name",
"Name of the associated component");
29 params.
addRequiredParam<RealVectorValue>(
"dir_c0",
"Direction of the first connection");
31 params.
addClassDescription(
"Computes and caches flux and residual vectors for a 1-phase junction "
32 "that connects flow channels that are parallel");
41 _p(getADMaterialProperty<Real>(
"p")),
43 _dir_c0(getParam<RealVectorValue>(
"dir_c0")),
45 _stored_pA(_n_connections),
46 _areas(_n_connections),
47 _is_inlet(_n_connections),
49 _component_name(getParam<
std::string>(
"component_name"))
68 const Point di =
_dir[0];
69 const Point ni = di * din;
79 const ADReal rhouV2 = rhouV_vec * rhouV_vec;
80 const ADReal eJ = rhoEV / rhoV - 0.5 * rhouV2 / (rhoV * rhoV);
89 if (MooseUtils::absoluteFuzzyEqual(
_rhouA[0], 0))
100 ": Connected flow channels are not parallel, use VolumeJunction1Phase "
101 "component instead.");
116 for (
unsigned int i = 0; i < jpc_uo._connection_indices.size(); i++)
165 RealVectorValue d_wall;
167 if (Aout_total > Ain_total)
169 if (Aout_total > 1e-15)
171 p_wall = pAout_total / Aout_total;
178 A_wall = Aout_total - Ain_total;
183 if (Ain_total > 1e-15)
185 p_wall = pAin_total / Ain_total;
192 A_wall = Ain_total - Aout_total;
registerMooseObject("ThermalHydraulicsApp", ADJunctionParallelChannels1PhaseUserObject)
DualNumber< Real, DNDerivativeType, true > ADReal
std::vector< unsigned int > _processor_ids
Owners of each side of the junction.
const unsigned int _n_connections
Number of connected flow channels.
const std::vector< Real > & _normal
Flow channel outward normals or junction inward normals.
const MaterialProperty< RealVectorValue > & _dir
Direction of the element connected to the junction.
Computes and caches flux and residual vectors for a 1-phase junction that connects flow channels that...
static InputParameters validParams()
RealVectorValue _dir_c0
Channel direction for the first connection.
std::vector< unsigned int > _c_wall
Connection index for connections that contribute to the wall pressure.
std::vector< ADReal > _areas
Areas at each connection.
virtual void initialize() override
virtual void finalize() override
const std::string & _component_name
Name of the associated component.
RealVectorValue _d_flow
Flow direction for the first connection.
const ADMaterialProperty< Real > & _p
Pressure material property.
std::vector< ADReal > _stored_pA
virtual void threadJoin(const UserObject &uo) override
ADJunctionParallelChannels1PhaseUserObject(const InputParameters ¶ms)
std::vector< bool > _is_inlet
Check if the connection is an inlet.
virtual void computeFluxesAndResiduals(const unsigned int &c) override
Computes and stores the fluxes, the scalar residuals, and their Jacobians.
std::vector< unsigned int > _c_in
Connection index for inlet flow channel connections.
std::vector< unsigned int > _c_out
Connection index for outlet flow channel connections.
Computes and caches flux and residual vectors for a 1-phase volume junction.
const SinglePhaseFluidProperties & _fp
Single-phase fluid properties user object.
virtual void computeFluxesAndResiduals(const unsigned int &c) override
Computes and stores the fluxes, the scalar residuals, and their Jacobians.
const ADVariableValue & _rhouA
rho*u*A of the connected flow channels
static InputParameters validParams()
const ADVariableValue & _A
Cross-sectional area of connected flow channels.
std::vector< unsigned int > _connection_indices
Connection indices for this thread.
unsigned int _n_scalar_eq
Number of scalar residual components.
std::vector< ADReal > _residual
Cached scalar residual vector.
const Real & _volume
Volume of the junction.
std::vector< ADReal > _cached_junction_var_values
void mooseError(Args &&... args) const
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
virtual void initialize()=0
virtual void threadJoin(const UserObject &uo)=0
const Parallel::Communicator & comm() const
void v_from_rhoA_A(Real rhoA, Real A, Real &v, Real &dv_drhoA)
Computes specific volume and its derivatives from rho*A, and area.
bool isOutlet(Real vel, Real normal)
Determine if outlet boundary condition should be applied.
bool areParallelVectors(const RealVectorValue &a, const RealVectorValue &b, const Real &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
Tests if two real-valued vectors are parallel within some absolute tolerance.