https://mooseframework.inl.gov
ADVolumeJunctionBaseUserObject.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
13 
22 {
23 public:
34 
35  virtual void initialSetup() override;
36  virtual void initialize() override;
37  virtual void execute() override;
38  virtual void threadJoin(const UserObject & uo) override;
39 
43  const std::vector<ADReal> & getResidual() const;
44 
45  const std::vector<ADReal> & getFlux(const unsigned int & connection_index) const override;
46 
47 protected:
54  virtual void storeConnectionData();
55 
61  virtual void computeFluxesAndResiduals(const unsigned int & c) = 0;
62 
66  virtual std::vector<const MooseVariableBase *> getJunctionVariables() const;
67 
71  const MooseVariableBase * getJunctionVar(const std::string & var_name, unsigned int i = 0) const;
72 
76  const ADVariableValue & coupledJunctionValue(const std::string & var_name,
77  unsigned int i = 0) const;
78 
81 
84 
86  const Real & _volume;
87 
89  std::vector<std::string> _flow_variable_names;
91  std::vector<std::string> _scalar_variable_names;
92 
94  unsigned int _n_flux_eq;
96  unsigned int _n_scalar_eq;
97 
98  std::vector<const ADVariableValue *> _junction_var_values;
99  std::vector<ADReal> _cached_junction_var_values;
100 
102  const std::vector<UserObjectName> & _numerical_flux_names;
103 
105  std::vector<unsigned int> _connection_indices;
106 
108  std::vector<dof_id_type> _scalar_dofs;
110  std::vector<std::vector<dof_id_type>> _flow_channel_dofs;
111 
113  std::vector<std::vector<ADReal>> _flux;
114 
116  std::vector<ADReal> _residual;
117 
118 public:
119  static InputParameters validParams();
120 };
std::vector< std::vector< ADReal > > _flux
Cached flux vector for each connection.
std::vector< std::vector< dof_id_type > > _flow_channel_dofs
Degrees of freedom for flow channel variables, for each connection.
virtual void computeFluxesAndResiduals(const unsigned int &c)=0
Computes and stores the fluxes, the scalar residuals, and their Jacobians.
std::vector< std::string > _scalar_variable_names
Vector of coupled variable names for each scalar variable.
unsigned int _n_scalar_eq
Number of scalar residual components.
unsigned int _n_flux_eq
Number of flow channel flux components.
ADVolumeJunctionBaseUserObject(const InputParameters &params)
Constructor.
const std::vector< UserObjectName > & _numerical_flux_names
Names of numerical flux user objects for each connected flow channel.
std::vector< ADReal > _residual
Cached scalar residual vector.
const subdomain_id_type _junction_subdomain_id
Junction subdomain ID.
const Real & _volume
Volume of the junction.
virtual std::vector< const MooseVariableBase * > getJunctionVariables() const
Gets the junction variables.
std::vector< const ADVariableValue * > _junction_var_values
std::vector< unsigned int > _connection_indices
Connection indices for this thread.
std::vector< std::string > _flow_variable_names
Vector of coupled variable names for each flow variable.
const std::vector< ADReal > & getResidual() const
Returns the residual vector for the scalar variables.
virtual void threadJoin(const UserObject &uo) override
const std::vector< ADReal > & getFlux(const unsigned int &connection_index) const override
Gets the flux vector for a connection.
virtual void storeConnectionData()
Stores data (connection index, face shape functions, DoFs associated with flow channel variables) rel...
Base class for computing and caching flux and residual vectors for a volume junction.
Provides common interfaces for flow junction user objects.
std::vector< dof_id_type > _scalar_dofs
Degrees of freedom for scalar variables.
const bool _use_scalar_variables
True if the junction variables are scalar variables.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const ADVariableValue & coupledJunctionValue(const std::string &var_name, unsigned int i=0) const
Gets an AD junction variable value.
const MooseVariableBase * getJunctionVar(const std::string &var_name, unsigned int i=0) const
Gets a junction variable.