15 #include "metaphysicl/parallel_numberarray.h" 16 #include "metaphysicl/parallel_dualnumber.h" 17 #include "metaphysicl/parallel_semidynamicsparsenumberarray.h" 18 #include "libmesh/parallel_algebra.h" 22 const std::vector<std::pair<std::string, unsigned int>>
34 "Fraction of possible flow area that is open");
35 params.
addParam<
Real>(
"open_area_fraction_min", 1e-10,
"Minimum open area fraction");
42 params.
addRequiredParam<UserObjectName>(
"numerical_flux",
"Numerical flux user object name");
44 params.
addRequiredParam<std::string>(
"component_name",
"Name of the associated component");
56 _f_open(getParam<
Real>(
"open_area_fraction")),
57 _f_open_min(getParam<
Real>(
"open_area_fraction_min")),
59 _A(adCoupledValue(
"A")),
60 _rhoA(adCoupledValue(
"rhoA")),
61 _rhouA(adCoupledValue(
"rhouA")),
62 _rhoEA(adCoupledValue(
"rhoEA")),
64 _rhoA_jvar(coupled(
"rhoA")),
65 _rhouA_jvar(coupled(
"rhouA")),
66 _rhoEA_jvar(coupled(
"rhoEA")),
68 _p(getADMaterialProperty<
Real>(
"p")),
72 _component_name(getParam<
std::string>(
"component_name")),
76 _solutions(_n_connections),
80 _stored_p(_n_connections),
82 _elem_ids(_n_connections),
83 _local_side_ids(_n_connections),
85 _areas(_n_connections),
86 _directions(_n_connections)
117 mooseAssert(dofs.size() == 1,
"There should be only one DoF index.");
146 for (
unsigned int i = 0; i < junction_uo._connection_indices.size(); i++)
148 const unsigned int c = junction_uo._connection_indices[i];
195 U_flow1[i] *= A_flow /
A1;
196 U_flow2[i] *= A_flow /
A2;
217 const std::vector<ADReal> &
220 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
222 return _fluxes[connection_index];
std::vector< RealVectorValue > _directions
Directions at each connection.
Gate valve user object for 1-phase flow.
virtual void execute() override
const unsigned int & _current_side
virtual void initialize() override
unsigned int getBoundaryIDIndex()
Gets the index of the currently executing boundary within the vector of boundary IDs given to this Si...
static InputParameters validParams()
const Parallel::Communicator & comm() const
std::vector< unsigned int > _connection_indices
Connection indices for this thread.
MooseVariable * getVar(const std::string &var_name, unsigned int comp)
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.
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.
std::vector< unsigned int > _local_side_ids
Local side IDs for each connection.
virtual void finalize() override
const ADNumericalFlux3EqnBase & _numerical_flux
Numerical flux user object.
registerMooseObject("ThermalHydraulicsApp", ADGateValve1PhaseUserObject)
uint8_t processor_id_type
const std::vector< dof_id_type > & dofIndices() const final
const ADMaterialProperty< Real > & _p
Pressure material property.
static const std::vector< std::pair< std::string, unsigned int > > _varname_eq_index_pairs
Pairs of variable names vs. their corresponding equation indices.
std::vector< ADReal > _areas
Areas at each connection.
const ADVariableValue & _rhouA
rho*u*A of the connected flow channels
Base class for computing numerical fluxes for FlowModelSinglePhase.
ADGateValve1PhaseUserObject(const InputParameters ¶ms)
const MaterialProperty< RealVectorValue > & _dir
Direction material property.
const ADVariableValue & _rhoA
rho*A of the connected flow channels
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.
std::vector< unsigned int > _elem_ids
Element IDs for each connection.
const std::vector< ADReal > & getFlux(const unsigned int &connection_index) const override
Gets the flux vector for a connection.
Provides common interfaces for flow junction user objects.
const ADVariableValue & _A
Cross-sectional area of connected flow channels.
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
static const unsigned int N_FLUX_OUTPUTS
Number of numerical flux function outputs for 1D.
std::vector< std::vector< ADReal > > _solutions
Solution vectors for each connection.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< ADReal > _stored_p
Stored pressure for each connection.
void mooseError(Args &&... args) const
const std::vector< Real > & _normal
Flow channel outward normals or junction inward normals.
const Elem *const & _current_elem
const ADVariableValue & _rhoEA
rho*E*A of the connected flow channels
virtual void threadJoin(const UserObject &uo) override
const std::string & _component_name
Name of the associated component.
const Real & _f_open_min
Minimum open area fraction.
std::vector< std::vector< ADReal > > _fluxes
Flux vector.
std::vector< std::vector< dof_id_type > > _dof_indices
Degree of freedom indices; first index is connection, second is equation.
static InputParameters validParams()
const Real & _f_open
Fraction of possible flow area that is open.
static const unsigned int N_FLUX_OUTPUTS
Number of numerical flux function outputs for 3D.