15#include "metaphysicl/parallel_numberarray.h"
16#include "metaphysicl/parallel_dualnumber.h"
17#include "metaphysicl/parallel_semidynamicsparsenumberarray.h"
18#include "libmesh/parallel_algebra.h"
22const 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")),
74 _dir(getMaterialProperty<RealVectorValue>(
"direction")),
76 _solutions(_n_connections),
78 _dof_indices(_n_connections,
std::vector<dof_id_type>(
THMVACE1D::N_FLUX_OUTPUTS, 0)),
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++)
178 const Real & n1_dot_d1 =
_normal[0];
195 U_flow1[i] *= A_flow /
A1;
196 U_flow2[i] *= A_flow /
A2;
217const std::vector<ADReal> &
220 Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
222 return _fluxes[connection_index];
registerMooseObject("ThermalHydraulicsApp", ADGateValve1PhaseUserObject)
DualNumber< Real, DNDerivativeType, true > ADReal
Provides common interfaces for flow junction user objects.
unsigned int getBoundaryIDIndex()
Gets the index of the currently executing boundary within the vector of boundary IDs given to this Si...
static InputParameters validParams()
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.
Gate valve user object for 1-phase flow.
std::vector< ADReal > _areas
Areas at each connection.
static const std::vector< std::pair< std::string, unsigned int > > _varname_eq_index_pairs
Pairs of variable names vs. their corresponding equation indices.
const ADMaterialProperty< Real > & _p
Pressure material property.
virtual void threadJoin(const UserObject &uo) override
std::vector< unsigned int > _connection_indices
Connection indices for this thread.
const ADVariableValue & _rhoA
rho*A of the connected flow channels
const std::string & _component_name
Name of the associated component.
std::vector< RealVectorValue > _directions
Directions at each connection.
const MaterialProperty< RealVectorValue > & _dir
Direction material property.
std::vector< std::vector< ADReal > > _solutions
Solution vectors for each connection.
std::vector< std::vector< dof_id_type > > _dof_indices
Degree of freedom indices; first index is connection, second is equation.
const Real & _f_open_min
Minimum open area fraction.
std::vector< std::vector< ADReal > > _fluxes
Flux vector.
const std::vector< ADReal > & getFlux(const unsigned int &connection_index) const override
Gets the flux vector for a connection.
ADGateValve1PhaseUserObject(const InputParameters ¶ms)
virtual void execute() override
const ADVariableValue & _A
Cross-sectional area of connected flow channels.
const Real & _f_open
Fraction of possible flow area that is open.
std::vector< unsigned int > _elem_ids
Element IDs for each connection.
virtual void initialize() override
std::vector< unsigned int > _local_side_ids
Local side IDs for each connection.
static InputParameters validParams()
const ADNumericalFlux3EqnBase & _numerical_flux
Numerical flux user object.
std::vector< ADReal > _stored_p
Stored pressure for each connection.
const ADVariableValue & _rhoEA
rho*E*A of the connected flow channels
virtual void finalize() override
const ADVariableValue & _rhouA
rho*u*A of the connected flow channels
Base class for computing numerical fluxes for FlowModelSinglePhase.
MooseVariable * getVar(const std::string &var_name, unsigned int comp)
void mooseError(Args &&... args) const
const std::vector< dof_id_type > & dofIndices() const final
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.
const unsigned int & _current_side
const Elem *const & _current_elem
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
const Parallel::Communicator & comm() const
static const unsigned int N_FLUX_OUTPUTS
Number of numerical flux function outputs for 1D.
static const unsigned int N_FLUX_INPUTS
Number of numerical flux function inputs for 1D.
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.