16 #include "metaphysicl/parallel_numberarray.h" 17 #include "metaphysicl/parallel_dualnumber.h" 18 #include "metaphysicl/parallel_semidynamicsparsenumberarray.h" 19 #include "libmesh/parallel_algebra.h" 23 const std::vector<std::pair<std::string, unsigned int>>
38 "A_elem",
"Piecewise constant cross-sectional area of connected flow channels");
40 "Piecewise linear cross-sectional area of connected flow channels");
46 "Name of fluid properties user object");
48 params.
addRequiredParam<UserObjectName>(
"numerical_flux",
"Numerical flux user object name");
50 params.
addRequiredParam<std::string>(
"junction_name",
"Name of the junction component");
53 "Computes flux between two subdomains for 1-phase one-to-one junction");
63 _A_linear(adCoupledValue(
"A_linear")),
65 _A_var(getVar(
"A_elem", 0)),
66 _rhoA_var(getVar(
"rhoA", 0)),
67 _rhouA_var(getVar(
"rhouA", 0)),
68 _rhoEA_var(getVar(
"rhoEA", 0)),
74 _junction_name(getParam<
std::string>(
"junction_name")),
78 _primitive_solutions(_n_connections),
79 _neighbor_primitive_solutions(_n_connections),
81 _fluxes(_n_connections),
84 _elem_ids(_n_connections),
85 _local_side_ids(_n_connections),
87 _areas_linear(_n_connections),
88 _directions(_n_connections),
89 _positions(_n_connections),
90 _neighbor_positions(_n_connections),
91 _delta_x(_n_connections),
92 _has_neighbor(_n_connections)
127 mooseAssert(dofs.size() == 1,
"There should be only one DoF index.");
141 std::vector<std::vector<GenericReal<true>>> W_neighbor;
142 std::vector<Point> x_neighbor;
144 if (W_neighbor.size() == 1)
170 for (
unsigned int i = 0; i < junction_uo._connection_indices.size(); i++)
172 const unsigned int c = junction_uo._connection_indices[i];
215 auto W0_ref = W0_avg;
216 auto W1_ref = W1_avg;
220 std::vector<std::vector<GenericReal<true>>> W_neighbor0;
221 std::vector<Point> x_neighbor0;
228 std::vector<std::vector<GenericReal<true>>> W_neighbor1;
229 std::vector<Point> x_neighbor1;
245 W0[m] = W0_avg[m] + slopes0[m] *
_delta_x[0];
246 W1[m] = W1_avg[m] + slopes1[m] *
_delta_x[1];
250 FlowModel1PhaseUtils::computeConservativeSolutionVector<true>(W0,
_areas_linear[0],
_fp);
252 FlowModel1PhaseUtils::computeConservativeSolutionVector<true>(W1,
_areas_linear[1],
_fp);
262 const std::vector<ADReal> &
265 Threads::spin_mutex::scoped_lock lock(
_spin_mutex);
267 return _fluxes[connection_index];
275 return FlowModel1PhaseUtils::computePrimitiveSolutionVector<true>(U,
_fp);
const ADVariableValue & _A_linear
Piecewise linear cross-sectional area of connected flow channels.
std::vector< RealVectorValue > _directions
Directions at each connection.
std::vector< Point > _positions
Positions at each connection.
virtual void getNeighborPrimitiveVariables(const Elem *elem, std::vector< std::vector< GenericReal< is_ad >>> &W_neighbor, std::vector< Point > &x_neighbor) const
Gets the primitive solution vector and position of neighbor(s)
const unsigned int & _current_side
virtual std::vector< ADReal > computeElementPrimitiveVariables(const Elem *elem) const override
Computes the cell-average primitive variable values for an element.
MooseVariable * _rhouA_var
MooseVariable * _rhoEA_var
unsigned int getBoundaryIDIndex()
Gets the index of the currently executing boundary within the vector of boundary IDs given to this Si...
std::vector< std::vector< dof_id_type > > _dof_indices
Degree of freedom indices; first index is connection, second is equation.
virtual void threadJoin(const UserObject &uo) override
const Parallel::Communicator & comm() const
const MooseArray< Point > & _q_point
MooseVariable * getVar(const std::string &var_name, unsigned int comp)
static InputParameters validParams()
std::vector< std::vector< ADReal > > _fluxes
Flux vector.
const unsigned int _n_connections
Number of connected flow channels.
virtual const std::vector< ADReal > & getFlux(const unsigned int iside, const dof_id_type ielem, bool res_side_is_left, const std::vector< ADReal > &UL_1d, const std::vector< ADReal > &UR_1d, Real nLR_dot_d) const
Gets the 1D flux vector for an element/side combination.
MooseVariable * _rhoA_var
std::vector< unsigned int > _elem_ids
Element IDs for each connection.
virtual void initialize() override
static const std::vector< std::pair< std::string, unsigned int > > _varname_eq_index_pairs
Pairs of variable names vs. their corresponding equation indices.
uint8_t processor_id_type
virtual void finalize() override
std::vector< bool > _has_neighbor
Flags for each connection having a neighbor.
std::vector< std::vector< ADReal > > _primitive_solutions
Primitive solution vectors for each connection.
const std::vector< dof_id_type > & dofIndices() const final
const std::vector< ADReal > & getFlux(const unsigned int &connection_index) const override
Gets the flux vector for a connection.
std::vector< unsigned int > _connection_indices
Connection indices for this thread.
virtual void execute() override
std::vector< ADReal > _areas_linear
Piecewise linear areas at each connection.
std::vector< GenericReal< is_ad > > getBoundaryElementSlopes(const std::vector< GenericReal< is_ad >> &W_elem, const Point &x_elem, const RealVectorValue &dir, std::vector< std::vector< GenericReal< is_ad >>> W_neighbor, std::vector< Point > x_neighbor, const std::vector< GenericReal< is_ad >> &W_boundary) const
Gets limited slopes for the primitive variables in the 1-D direction for boundary element...
Common class for single phase fluid properties.
Base class for computing numerical fluxes for FlowModelSinglePhase.
Computes flux between two subdomains for 1-phase one-to-one junction.
static const unsigned int N_FLUX_INPUTS
Number of numerical flux function inputs for 1D.
std::vector< unsigned int > _processor_ids
Owners of each side of the junction.
Provides common interfaces for flow junction user objects.
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
std::vector< MooseVariable * > _U_vars
Conservative solution variables.
static const unsigned int N_PRIM_VARS
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< std::vector< ADReal > > _neighbor_primitive_solutions
Primitive solution vectors for each connection's neighbor.
Interface class for 1-D slope reconstruction.
const SinglePhaseFluidProperties & _fp
fluid properties user object
std::vector< Real > _delta_x
Position changes for each connection.
const std::vector< Real > & _normal
Flow channel outward normals or junction inward normals.
const MaterialProperty< RealVectorValue > & _dir
Direction material property.
const Elem *const & _current_elem
const ADNumericalFlux3EqnBase & _numerical_flux
Numerical flux user object.
static InputParameters validParams()
registerMooseObject("ThermalHydraulicsApp", ADJunctionOneToOne1PhaseUserObject)
std::vector< Point > _neighbor_positions
Positions at each connection's neighbor.
std::vector< unsigned int > _local_side_ids
Local side IDs for each connection.
static InputParameters validParams()
ADJunctionOneToOne1PhaseUserObject(const InputParameters ¶ms)
static const unsigned int N_FLUX_OUTPUTS
Number of numerical flux function outputs for 3D.
static Threads::spin_mutex _spin_mutex
Thread lock.