https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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)
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
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}
DualNumber< Real, DNDerivativeType, true > ADReal
const double v
registerMooseObject("NavierStokesApp", NSFVOutflowTemperatureBC)
MooseVariableFV< Real > & _var
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
ADRealVectorValue _normal
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void mooseError(Args &&... args) const
Temperature advection boundary condition allowing for inflow and outflow.
const unsigned int _dim
the dimension of the simulation
const Moose::Functor< ADReal > *const _v
y-velocity
const Moose::Functor< ADReal > & _u
x-velocity
static InputParameters validParams()
NSFVOutflowTemperatureBC(const InputParameters &parameters)
const Moose::Functor< ADReal > *const _w
z-velocity
const Moose::Functor< ADReal > & _backflow_T
Backflow Temperature.
const Moose::Functor< ADReal > & _cp
Specific Heat at Constant Pressure.
virtual ADReal computeQpResidual() override
const Moose::Functor< ADReal > & _rho
Density.
Moose::StateArg determineState() const
MeshBase & mesh
static const std::string density
Definition NS.h:34
static const std::string cp
Definition NS.h:125