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 22 of file MomentumFreeSlipBC.h.

Constructor & Destructor Documentation

◆ MomentumFreeSlipBC()

MomentumFreeSlipBC::MomentumFreeSlipBC ( const InputParameters &  parameters)

Definition at line 31 of file MomentumFreeSlipBC.C.

32  : NodalNormalBC(parameters),
33  _mesh_dimension(_mesh.dimension()),
34  _rho_u(coupledValue("rho_u")),
35  _rho_v(_mesh_dimension >= 2 ? coupledValue("rho_v") : _zero),
36  _rho_w(_mesh_dimension >= 3 ? coupledValue("rho_w") : _zero)
37 {
38 }

◆ ~MomentumFreeSlipBC()

MomentumFreeSlipBC::~MomentumFreeSlipBC ( )
virtual

Definition at line 40 of file MomentumFreeSlipBC.C.

40 {}

Member Function Documentation

◆ computeQpResidual()

Real MomentumFreeSlipBC::computeQpResidual ( )
overrideprotectedvirtual

Definition at line 50 of file MomentumFreeSlipBC.C.

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

◆ shouldApply()

bool MomentumFreeSlipBC::shouldApply ( )
overridevirtual

Definition at line 43 of file MomentumFreeSlipBC.C.

44 {
45  // this prevents zeroing out the row
46  return !_fe_problem.currentlyComputingJacobian();
47 }

Member Data Documentation

◆ _mesh_dimension

const unsigned int MomentumFreeSlipBC::_mesh_dimension
protected

The dimension of the mesh.

Definition at line 34 of file MomentumFreeSlipBC.h.

Referenced by computeQpResidual().

◆ _rho_u

const VariableValue& MomentumFreeSlipBC::_rho_u
protected

Momentum in x-direction.

Definition at line 37 of file MomentumFreeSlipBC.h.

Referenced by computeQpResidual().

◆ _rho_v

const VariableValue& MomentumFreeSlipBC::_rho_v
protected

Momentum in y-direction.

Definition at line 39 of file MomentumFreeSlipBC.h.

Referenced by computeQpResidual().

◆ _rho_w

const VariableValue& MomentumFreeSlipBC::_rho_w
protected

Momentum in z-direction.

Definition at line 41 of file MomentumFreeSlipBC.h.


The documentation for this class was generated from the following files:
MomentumFreeSlipBC::_mesh_dimension
const unsigned int _mesh_dimension
The dimension of the mesh.
Definition: MomentumFreeSlipBC.h:34
MomentumFreeSlipBC::_rho_w
const VariableValue & _rho_w
Momentum in z-direction.
Definition: MomentumFreeSlipBC.h:41
name
const std::string name
Definition: Setup.h:21
MomentumFreeSlipBC::_rho_v
const VariableValue & _rho_v
Momentum in y-direction.
Definition: MomentumFreeSlipBC.h:39
MomentumFreeSlipBC::_rho_u
const VariableValue & _rho_u
Momentum in x-direction.
Definition: MomentumFreeSlipBC.h:37