www.mooseframework.org
Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Pressure Class Reference

#include <Pressure.h>

Inheritance diagram for Pressure:
[legend]

Static Public Member Functions

static InputParameters validParams ()
 

Protected Member Functions

virtual Real computeQpJacobian () override
 
virtual void precalculateQpJacobian () override
 
virtual Real computeQpOffDiagJacobian (const unsigned int jvar_num) override
 
virtual void precalculateQpOffDiagJacobian (const MooseVariableFEBase &jvar) override
 
Real computeStiffness (const unsigned int coupled_component)
 
Real computeFaceStiffness (const unsigned int local_j, const unsigned int coupled_component)
 
virtual void initialSetup () override
 
virtual GenericReal< is_ad > computeQpResidual () override
 
GenericReal< is_ad > computeFactor () const
 

Protected Attributes

unsigned int _component
 displacement component to apply the bc to More...
 
const unsigned int _ndisp
 Number of displacement variables. More...
 
const Real _alpha
 _alpha Parameter for HHT time integration scheme More...
 
std::vector< unsigned int_disp_var
 Variable numbers of coupled displacement variables. More...
 
const FEBase *const & _fe_side
 
const std::vector< RealGradient > * _q_dxi
 
const std::vector< RealGradient > * _q_deta
 
const std::vector< std::vector< Real > > * _phi_dxi
 
const std::vector< std::vector< Real > > * _phi_deta
 
const bool _use_displaced_mesh
 
std::vector< std::unique_ptr< FEBase > > _fe
 
std::map< unsigned int, unsigned int_node_map
 
Moose::CoordinateSystemType _coord_type
 Coordinate system type. More...
 
 usingTransientInterfaceMembers
 
const Real _factor
 Pressure value constant factor, function factor, and postprocessor factor. More...
 
const Function *const _function
 
const PostprocessorValue *const _postprocessor
 

Detailed Description

Definition at line 89 of file Pressure.h.

Member Function Documentation

◆ computeFaceStiffness()

Real Pressure::computeFaceStiffness ( const unsigned int  local_j,
const unsigned int  coupled_component 
)
protected

Definition at line 122 of file Pressure.C.

Referenced by computeStiffness().

123 {
124  //
125  // Note that this approach will break down for shell elements, i.e.,
126  // topologically 2D elements in 3D space with pressure loads on
127  // the faces.
128  //
129  const Real phi_dxi = (*_phi_dxi)[local_j][_qp];
130  const Real phi_deta = _phi_deta ? (*_phi_deta)[local_j][_qp] : 0;
131 
132  const RealGradient & dqdxi = (*_q_dxi)[_qp];
133  const RealGradient out_of_plane(0, 0, 1);
134  const RealGradient & dqdeta = _q_deta ? (*_q_deta)[_qp] : out_of_plane;
135  // Here, b is dqdxi (cross) dqdeta
136  // Then, normal is b/length(b)
137  RealGradient b(dqdxi(1) * dqdeta(2) - dqdxi(2) * dqdeta(1),
138  dqdxi(2) * dqdeta(0) - dqdxi(0) * dqdeta(2),
139  dqdxi(0) * dqdeta(1) - dqdxi(1) * dqdeta(0));
140  const Real inv_length = 1 / (b * _normals[_qp]);
141 
142  const unsigned int i = _component;
143  const unsigned int j = coupled_component;
144 
145  // const int posneg[3][3] = {{0, -1, 1}, {1, 0, -1}, {-1, 1, 0}};
146  const int posneg = 1 - (j + (2 - (i + 1) % 3)) % 3;
147 
148  // const unsigned int index[3][3] = {{0, 2, 1}, {2, 1, 0}, {1, 0, 2}};
149  const unsigned int index = 2 - (j + (i + 2) % 3) % 3;
150 
151  const Real variation_b = posneg * (phi_deta * dqdxi(index) - phi_dxi * dqdeta(index));
152 
153  Real rz_term = 0;
154  if (_coord_type == Moose::COORD_RZ && j == _subproblem.getAxisymmetricRadialCoord())
155  {
156  rz_term = _normals[_qp](i) * _phi[_j][_qp] / _q_point[_qp](0);
157  }
158 
159  return computeFactor() * _test[_i][_qp] * (inv_length * variation_b + rz_term);
160 }
const std::vector< std::vector< Real > > * _phi_deta
Definition: Pressure.h:64
const std::vector< RealGradient > * _q_deta
Definition: Pressure.h:62
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int _component
displacement component to apply the bc to
Definition: Pressure.h:43
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
Moose::CoordinateSystemType _coord_type
Coordinate system type.
Definition: Pressure.h:73
GenericReal< is_ad > computeFactor() const
Definition: Pressure.C:108

◆ computeFactor()

GenericReal< is_ad > PressureTempl< is_ad >::computeFactor ( ) const
protectedinherited

Definition at line 108 of file Pressure.C.

Referenced by computeFaceStiffness(), and computeStiffness().

109 {
110  GenericReal<is_ad> factor = _factor;
111 
112  if (_function)
113  factor *= _function->value(_t + _alpha * _dt, _q_point[_qp]);
114 
115  if (_postprocessor)
116  factor *= *_postprocessor;
117 
118  return factor;
119 }
const Function *const _function
Definition: Pressure.h:50
const Real _alpha
_alpha Parameter for HHT time integration scheme
Definition: Pressure.h:55
const Real _factor
Pressure value constant factor, function factor, and postprocessor factor.
Definition: Pressure.h:49
const PostprocessorValue *const _postprocessor
Definition: Pressure.h:51
typename Moose::GenericType< Real, is_ad > GenericReal
virtual Real value(Real t, const Point &p) const

◆ computeQpJacobian()

Real Pressure::computeQpJacobian ( )
overrideprotectedvirtual

Definition at line 190 of file Pressure.C.

191 {
194 
195  return 0;
196 }
const bool _use_displaced_mesh
Definition: Pressure.h:65
Real computeStiffness(const unsigned int coupled_component)
Definition: Pressure.C:163
unsigned int _component
displacement component to apply the bc to
Definition: Pressure.h:43

◆ computeQpOffDiagJacobian()

Real Pressure::computeQpOffDiagJacobian ( const unsigned int  jvar_num)
overrideprotectedvirtual

Definition at line 199 of file Pressure.C.

200 {
202  for (unsigned int j = 0; j < _ndisp; ++j)
203  if (jvar_num == _disp_var[j])
204  return computeStiffness(j);
205 
206  return 0;
207 }
const unsigned int _ndisp
Number of displacement variables.
Definition: Pressure.h:46
const bool _use_displaced_mesh
Definition: Pressure.h:65
std::vector< unsigned int > _disp_var
Variable numbers of coupled displacement variables.
Definition: Pressure.h:58
Real computeStiffness(const unsigned int coupled_component)
Definition: Pressure.C:163
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")

◆ computeQpResidual()

GenericReal< is_ad > PressureTempl< is_ad >::computeQpResidual ( )
overrideprotectedvirtualinherited

Definition at line 101 of file Pressure.C.

102 {
103  return computeFactor() * (_normals[_qp](_component) * _test[_i][_qp]);
104 }
unsigned int _component
displacement component to apply the bc to
Definition: Pressure.h:43
GenericReal< is_ad > computeFactor() const
Definition: Pressure.C:108

◆ computeStiffness()

Real Pressure::computeStiffness ( const unsigned int  coupled_component)
protected

Definition at line 163 of file Pressure.C.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

164 {
165  if (_ndisp > 1)
166  {
167  const std::map<unsigned int, unsigned int>::iterator j_it = _node_map.find(_j);
168  if (_test[_i][_qp] == 0 || j_it == _node_map.end())
169  return 0;
170 
171  return computeFaceStiffness(j_it->second, coupled_component);
172  }
173 
175  {
176  return computeFactor() * _normals[_qp](_component) * _test[_i][_qp] * _phi[_j][_qp] *
177  (2 / _q_point[_qp](0));
178  }
179 
181  {
182  return computeFactor() * _normals[_qp](_component) * _test[_i][_qp] * _phi[_j][_qp] /
183  _q_point[_qp](0);
184  }
185 
186  return 0;
187 }
Real computeFaceStiffness(const unsigned int local_j, const unsigned int coupled_component)
Definition: Pressure.C:122
std::map< unsigned int, unsigned int > _node_map
Definition: Pressure.h:70
const unsigned int _ndisp
Number of displacement variables.
Definition: Pressure.h:46
COORD_RSPHERICAL
unsigned int _component
displacement component to apply the bc to
Definition: Pressure.h:43
Moose::CoordinateSystemType _coord_type
Coordinate system type.
Definition: Pressure.h:73
GenericReal< is_ad > computeFactor() const
Definition: Pressure.C:108

◆ initialSetup()

void PressureTempl< is_ad >::initialSetup ( )
overrideprotectedvirtualinherited

Definition at line 81 of file Pressure.C.

82 {
83  auto boundary_ids = this->boundaryIDs();
84  std::set<SubdomainID> block_ids;
85  for (auto bndry_id : boundary_ids)
86  {
87  auto bids = _mesh.getBoundaryConnectedBlocks(bndry_id);
88  block_ids.insert(bids.begin(), bids.end());
89  }
90 
91  _coord_type = _fe_problem.getCoordSystem(*block_ids.begin());
92  for (auto blk_id : block_ids)
93  {
94  if (_coord_type != _fe_problem.getCoordSystem(blk_id))
95  mooseError("The Pressure BC requires subdomains to have the same coordinate system.");
96  }
97 }
void mooseError(Args &&... args)
Moose::CoordinateSystemType _coord_type
Coordinate system type.
Definition: Pressure.h:73

◆ precalculateQpJacobian()

void Pressure::precalculateQpJacobian ( )
overrideprotectedvirtual

Definition at line 210 of file Pressure.C.

Referenced by precalculateQpOffDiagJacobian().

211 {
212  if (_ndisp == 1)
213  return;
214 
215  if (_fe[_tid] == nullptr)
216  {
217  const unsigned int dim = _sys.mesh().dimension() - 1;
218  QBase * const & qrule = _assembly.writeableQRuleFace();
219  _fe[_tid] = FEBase::build(dim, _var.feType());
220  _fe[_tid]->attach_quadrature_rule(qrule);
221  }
222 
223  _q_dxi = &_fe[_tid]->get_dxyzdxi();
224  _phi_dxi = &_fe[_tid]->get_dphidxi();
226  {
227  _q_deta = &_fe[_tid]->get_dxyzdeta();
228  _phi_deta = &_fe[_tid]->get_dphideta();
229  }
230 
231  _fe[_tid]->reinit(_current_side_elem);
232 
234  {
235  if (_q_deta->empty())
236  _q_deta = nullptr;
237  if (_phi_deta->empty())
238  _phi_deta = nullptr;
239  }
240 
241  // Compute node map (given elem node, supply face node)
242  _node_map.clear();
243  const unsigned int num_node_elem = _current_elem->n_nodes();
244  const Node * const * elem_nodes = _current_elem->get_nodes();
245  const unsigned int num_node_face = _current_side_elem->n_nodes();
246  const Node * const * face_nodes = _current_side_elem->get_nodes();
247  unsigned int num_found = 0;
248  for (unsigned i = 0; i < num_node_elem; ++i)
249  {
250  for (unsigned j = 0; j < num_node_face; ++j)
251  if (**(elem_nodes + i) == **(face_nodes + j))
252  {
253  _node_map[i] = j;
254  ++num_found;
255  break;
256  }
257  if (num_found == num_node_face)
258  break;
259  }
260 }
std::map< unsigned int, unsigned int > _node_map
Definition: Pressure.h:70
unsigned int dim
const unsigned int _ndisp
Number of displacement variables.
Definition: Pressure.h:46
std::vector< std::unique_ptr< FEBase > > _fe
Definition: Pressure.h:68
const std::vector< RealGradient > * _q_dxi
Definition: Pressure.h:61
const std::vector< std::vector< Real > > * _phi_deta
Definition: Pressure.h:64
const std::vector< RealGradient > * _q_deta
Definition: Pressure.h:62
const std::vector< std::vector< Real > > * _phi_dxi
Definition: Pressure.h:63
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
Moose::CoordinateSystemType _coord_type
Coordinate system type.
Definition: Pressure.h:73

◆ precalculateQpOffDiagJacobian()

void Pressure::precalculateQpOffDiagJacobian ( const MooseVariableFEBase jvar)
overrideprotectedvirtual

Definition at line 263 of file Pressure.C.

264 {
266 }
virtual void precalculateQpJacobian() override
Definition: Pressure.C:210

◆ validParams()

InputParameters PressureTempl< is_ad >::validParams ( )
staticinherited

Definition at line 21 of file Pressure.C.

22 {
24  params.addClassDescription("Applies a pressure on a given boundary in a given direction");
25  params.addDeprecatedParam<unsigned int>(
26  "component", "The component for the pressure", "This parameter is no longer necessary");
27  params.addRequiredCoupledVar("displacements",
28  "The string of displacements suitable for the problem statement");
29  params.addDeprecatedParam<Real>("constant",
30  "The magnitude to use in computing the pressure",
31  "Use 'factor' in place of 'constant'");
32  params.addParam<Real>("factor", 1.0, "The magnitude to use in computing the pressure");
33  params.addParam<FunctionName>("function", "The function that describes the pressure");
34  params.addParam<PostprocessorName>("postprocessor",
35  "Postprocessor that will supply the pressure value");
36  params.addParam<Real>("alpha", 0.0, "alpha parameter required for HHT time integration scheme");
37  params.set<bool>("use_displaced_mesh") = true;
38  return params;
39 }
void addDeprecatedParam(const std::string &name, const T &value, const std::string &doc_string, const std::string &deprecation_message)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
InputParameters validParams()
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _alpha

const Real PressureTempl< is_ad >::_alpha
protectedinherited

_alpha Parameter for HHT time integration scheme

Definition at line 55 of file Pressure.h.

◆ _component

unsigned int PressureTempl< is_ad >::_component
protectedinherited

displacement component to apply the bc to

Definition at line 43 of file Pressure.h.

Referenced by computeFaceStiffness(), computeQpJacobian(), and computeStiffness().

◆ _coord_type

Moose::CoordinateSystemType PressureTempl< is_ad >::_coord_type
protectedinherited

Coordinate system type.

Definition at line 73 of file Pressure.h.

Referenced by computeFaceStiffness(), computeStiffness(), and precalculateQpJacobian().

◆ _disp_var

std::vector<unsigned int> PressureTempl< is_ad >::_disp_var
protectedinherited

Variable numbers of coupled displacement variables.

Definition at line 58 of file Pressure.h.

Referenced by computeQpOffDiagJacobian().

◆ _factor

const Real PressureTempl< is_ad >::_factor
protectedinherited

Pressure value constant factor, function factor, and postprocessor factor.

Definition at line 49 of file Pressure.h.

◆ _fe

std::vector<std::unique_ptr<FEBase> > PressureTempl< is_ad >::_fe
protectedinherited

Definition at line 68 of file Pressure.h.

Referenced by precalculateQpJacobian().

◆ _fe_side

const FEBase* const& PressureTempl< is_ad >::_fe_side
protectedinherited

Definition at line 60 of file Pressure.h.

◆ _function

const Function* const PressureTempl< is_ad >::_function
protectedinherited

Definition at line 50 of file Pressure.h.

◆ _ndisp

const unsigned int PressureTempl< is_ad >::_ndisp
protectedinherited

Number of displacement variables.

Definition at line 46 of file Pressure.h.

Referenced by computeQpOffDiagJacobian(), computeStiffness(), and precalculateQpJacobian().

◆ _node_map

std::map<unsigned int, unsigned int> PressureTempl< is_ad >::_node_map
protectedinherited

Definition at line 70 of file Pressure.h.

Referenced by computeStiffness(), and precalculateQpJacobian().

◆ _phi_deta

const std::vector<std::vector<Real> >* PressureTempl< is_ad >::_phi_deta
protectedinherited

Definition at line 64 of file Pressure.h.

Referenced by computeFaceStiffness(), and precalculateQpJacobian().

◆ _phi_dxi

const std::vector<std::vector<Real> >* PressureTempl< is_ad >::_phi_dxi
protectedinherited

Definition at line 63 of file Pressure.h.

Referenced by precalculateQpJacobian().

◆ _postprocessor

const PostprocessorValue* const PressureTempl< is_ad >::_postprocessor
protectedinherited

Definition at line 51 of file Pressure.h.

◆ _q_deta

const std::vector<RealGradient>* PressureTempl< is_ad >::_q_deta
protectedinherited

Definition at line 62 of file Pressure.h.

Referenced by computeFaceStiffness(), and precalculateQpJacobian().

◆ _q_dxi

const std::vector<RealGradient>* PressureTempl< is_ad >::_q_dxi
protectedinherited

Definition at line 61 of file Pressure.h.

Referenced by precalculateQpJacobian().

◆ _use_displaced_mesh

const bool PressureTempl< is_ad >::_use_displaced_mesh
protectedinherited

Definition at line 65 of file Pressure.h.

Referenced by computeQpJacobian(), and computeQpOffDiagJacobian().

◆ usingTransientInterfaceMembers

PressureTempl< is_ad >::usingTransientInterfaceMembers
protectedinherited

Definition at line 75 of file Pressure.h.


The documentation for this class was generated from the following files: