Loading [MathJax]/extensions/tex2jax.js
https://mooseframework.inl.gov
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
NSFVOutflowTemperatureBC.C
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 
11 #include "SystemBase.h"
12 #include "NS.h"
13 
15 
18 {
20  params.addClassDescription("Outflow velocity temperature advection boundary conditions for "
21  "finite volume method allowing for thermal backflow.");
22  params.addRequiredParam<MooseFunctorName>(NS::density, "The name of the density");
23  params.addRequiredParam<MooseFunctorName>(NS::cp, "The name of the specific heat");
24  params.addRequiredParam<MooseFunctorName>("u", "The velocity in the x direction.");
25  params.addParam<MooseFunctorName>("v", "The velocity in the y direction.");
26  params.addParam<MooseFunctorName>("w", "The velocity in the z direction.");
27  params.addRequiredParam<MooseFunctorName>("backflow_T",
28  "The backflow temperature entering the domain.");
29  return params;
30 }
31 
33  : FVFluxBC(parameters),
34  _rho(getFunctor<ADReal>(NS::density)),
35  _cp(getFunctor<ADReal>(NS::cp)),
36  _u(getFunctor<ADReal>("u")),
37  _v(isParamValid("v") ? &getFunctor<ADReal>("v") : nullptr),
38  _w(isParamValid("w") ? &getFunctor<ADReal>("w") : nullptr),
39  _backflow_T(getFunctor<ADReal>("backflow_T")),
40  _dim(_subproblem.mesh().dimension())
41 {
42  if (_dim >= 2 && !_v)
43  mooseError(
44  "In two or more dimensions, the v velocity must be supplied using the 'v' parameter");
45  if (_dim >= 3 && !_w)
46  mooseError("In threedimensions, the w velocity must be supplied using the 'w' parameter");
47 }
48 
49 ADReal
51 {
52  const auto boundary_face = singleSidedFaceArg();
53  const auto state = determineState();
54 
55  ADRealVectorValue v(_u(boundary_face, state));
56  if (_v)
57  v(1) = (*_v)(boundary_face, state);
58  if (_w)
59  v(2) = (*_w)(boundary_face, state);
60 
61  const auto vol_flux = v * _normal;
62  const auto rho_cp_face = _rho(boundary_face, state) * _cp(boundary_face, state);
63 
64  if (vol_flux > 0)
65  return rho_cp_face * _var(boundary_face, state) * vol_flux;
66  else
67  {
68  auto backflow_T = _backflow_T(boundary_face, state);
69  return rho_cp_face * backflow_T * vol_flux;
70  }
71 }
const Moose::Functor< ADReal > & _u
x-velocity
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
static InputParameters validParams()
Moose::StateArg determineState() const
MeshBase & mesh
static const std::string density
Definition: NS.h:33
Moose::FaceArg singleSidedFaceArg(const FaceInfo *fi=nullptr, Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false, const Moose::StateArg *state_limiter=nullptr) const
MooseVariableFV< Real > & _var
const unsigned int _dim
the dimension of the simulation
const Moose::Functor< ADReal > & _rho
Density.
DualNumber< Real, DNDerivativeType, true > ADReal
void addRequiredParam(const std::string &name, const std::string &doc_string)
static const std::string cp
Definition: NS.h:121
ADRealVectorValue _normal
virtual ADReal computeQpResidual() override
const Moose::Functor< ADReal > *const _w
z-velocity
static const std::string v
Definition: NS.h:84
const Moose::Functor< ADReal > & _backflow_T
Backflow Temperature.
Temperature advection boundary condition allowing for inflow and outflow.
const Moose::Functor< ADReal > *const _v
y-velocity
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
NSFVOutflowTemperatureBC(const InputParameters &parameters)
registerMooseObject("NavierStokesApp", NSFVOutflowTemperatureBC)
static InputParameters validParams()
const Moose::Functor< ADReal > & _cp
Specific Heat at Constant Pressure.