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

Boundary condition that applies free slip condition at nodes. More...

#include <MomentumFreeSlipBC.h>

Inheritance diagram for MomentumFreeSlipBC:
[legend]

Public Member Functions

 MomentumFreeSlipBC (const InputParameters &parameters)
 
virtual ~MomentumFreeSlipBC ()
 
virtual bool shouldApply () override
 

Protected Member Functions

virtual Real computeQpResidual () override
 

Protected Attributes

const unsigned int _mesh_dimension
 The dimension of the mesh. More...
 
const VariableValue & _rho_u
 Momentum in x-direction. More...
 
const VariableValue & _rho_v
 Momentum in y-direction. More...
 
const VariableValue & _rho_w
 Momentum in z-direction. More...
 

Detailed Description

Boundary condition that applies free slip condition at nodes.

Definition at line 14 of file MomentumFreeSlipBC.h.

Constructor & Destructor Documentation

◆ MomentumFreeSlipBC()

MomentumFreeSlipBC::MomentumFreeSlipBC ( const InputParameters &  parameters)

Definition at line 20 of file MomentumFreeSlipBC.C.

21  : NodalNormalBC(parameters),
22  _mesh_dimension(_mesh.dimension()),
23  _rho_u(coupledValue("rho_u")),
24  _rho_v(_mesh_dimension >= 2 ? coupledValue("rho_v") : _zero),
25  _rho_w(_mesh_dimension >= 3 ? coupledValue("rho_w") : _zero)
26 {
27 }
const VariableValue & _rho_w
Momentum in z-direction.
const VariableValue & _rho_v
Momentum in y-direction.
const VariableValue & _rho_u
Momentum in x-direction.
const unsigned int _mesh_dimension
The dimension of the mesh.

◆ ~MomentumFreeSlipBC()

MomentumFreeSlipBC::~MomentumFreeSlipBC ( )
virtual

Definition at line 29 of file MomentumFreeSlipBC.C.

29 {}

Member Function Documentation

◆ computeQpResidual()

Real MomentumFreeSlipBC::computeQpResidual ( )
overrideprotectedvirtual

Definition at line 39 of file MomentumFreeSlipBC.C.

40 {
41  for (auto tag : _vector_tags)
42  if (_sys.hasVector(tag) && _var.isNodalDefined())
43  {
44  auto & residual = _sys.getVector(tag);
45 
46  if (_mesh_dimension == 1)
47  {
48  mooseError(name(), ": Not implemented yet");
49  }
50  else if (_mesh_dimension == 2)
51  {
52  MooseVariable & rho_u_var = *getVar("rho_u", 0);
53  dof_id_type & rho_u_dof_idx = rho_u_var.nodalDofIndex();
54 
55  MooseVariable & rho_v_var = *getVar("rho_v", 0);
56  dof_id_type & rho_v_dof_idx = rho_v_var.nodalDofIndex();
57 
58  Real rho_un = _normal(0) * _rho_u[0] + _normal(1) * _rho_v[0];
59  Real Re_u = residual(rho_u_dof_idx);
60  Real Re_v = residual(rho_v_dof_idx);
61 
62  // We obtain these contributions in 3 steps:
63  // 1.) Tranform the momentum residuals into (tangential, normal)
64  // components by left-multiplying the residual by:
65  // R = [tx ty] = [-ny nx]
66  // [nx ny] [ nx ny]
67  // 2.) Impose the no-normal-flow BC, rho_un = 0, in the normal momentum component's
68  // residual.
69  // 3.) Transform back to (x,y) momentum components by left-multiplying the residual by
70  // R^{-1} = R^T.
71  Real rho_u_val =
72  (Re_u * _normal(1) * _normal(1) - Re_v * _normal(0) * _normal(1)) + rho_un * _normal(0);
73  Real rho_v_val = (-Re_u * _normal(0) * _normal(1) + Re_v * _normal(0) * _normal(0)) +
74  rho_un * _normal(1);
75 
76  // NOTE: we have to handle all components at the same time, otherwise we'd work with the
77  // modified residual and we do not want that
78  residual.set(rho_u_dof_idx, rho_u_val);
79  residual.set(rho_v_dof_idx, rho_v_val);
80  }
81  else if (_mesh_dimension == 3)
82  {
83  mooseError(name(), ": Not implemented yet");
84  }
85  }
86 
87  // The return value is not used for anything, so we simply return 0.
88  return 0.;
89 }
const std::string name
Definition: Setup.h:22
const VariableValue & _rho_v
Momentum in y-direction.
const VariableValue & _rho_u
Momentum in x-direction.
const unsigned int _mesh_dimension
The dimension of the mesh.

◆ shouldApply()

bool MomentumFreeSlipBC::shouldApply ( )
overridevirtual

Definition at line 32 of file MomentumFreeSlipBC.C.

33 {
34  // this prevents zeroing out the row
35  return !_fe_problem.currentlyComputingJacobian();
36 }

Member Data Documentation

◆ _mesh_dimension

const unsigned int MomentumFreeSlipBC::_mesh_dimension
protected

The dimension of the mesh.

Definition at line 26 of file MomentumFreeSlipBC.h.

Referenced by computeQpResidual().

◆ _rho_u

const VariableValue& MomentumFreeSlipBC::_rho_u
protected

Momentum in x-direction.

Definition at line 29 of file MomentumFreeSlipBC.h.

Referenced by computeQpResidual().

◆ _rho_v

const VariableValue& MomentumFreeSlipBC::_rho_v
protected

Momentum in y-direction.

Definition at line 31 of file MomentumFreeSlipBC.h.

Referenced by computeQpResidual().

◆ _rho_w

const VariableValue& MomentumFreeSlipBC::_rho_w
protected

Momentum in z-direction.

Definition at line 33 of file MomentumFreeSlipBC.h.


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