https://mooseframework.inl.gov
INSFVScalarFieldAdvection.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 
13 
16 {
17  auto params = INSFVAdvectionKernel::validParams();
18  params.addClassDescription("Advects an arbitrary quantity, the associated nonlinear 'variable'.");
19  params.addParam<MooseFunctorName>("u_slip", "The velocity in the x direction.");
20  params.addParam<MooseFunctorName>("v_slip", "The velocity in the y direction.");
21  params.addParam<MooseFunctorName>("w_slip", "The velocity in the z direction.");
22  return params;
23 }
24 
26  : INSFVAdvectionKernel(params),
27  _dim(_subproblem.mesh().dimension()),
28  _u_slip(isParamValid("u_slip") ? &getFunctor<ADReal>("u_slip") : nullptr),
29  _v_slip(isParamValid("v_slip") ? &getFunctor<ADReal>("v_slip") : nullptr),
30  _w_slip(isParamValid("w_slip") ? &getFunctor<ADReal>("w_slip") : nullptr),
31  _add_slip_model(isParamValid("u_slip") ? true : false)
32 {
33  if (_add_slip_model)
34  {
35  if (_dim >= 2 && !_v_slip)
36  mooseError(
37  "In two or more dimensions, the v_slip velocity must be supplied using the 'v_slip' "
38  "parameter");
39  if (_dim >= 3 && !_w_slip)
40  mooseError(
41  "In three dimensions, the w_slip velocity must be supplied using the 'w_slip' parameter");
42  }
43 }
44 
45 ADReal
47 {
48  const auto state = determineState();
49  const auto & limiter_time = _subproblem.isTransient()
52 
53  ADRealVectorValue advection_velocity;
54  if (_add_slip_model)
55  {
56 
57  Moose::FaceArg face_arg;
58  if (onBoundary(*_face_info))
59  face_arg = singleSidedFaceArg();
60  else
61  face_arg = Moose::FaceArg{_face_info,
63  true,
64  false,
65  nullptr,
66  &limiter_time};
67 
68  ADRealVectorValue velocity_slip_vel_vec;
69  if (_dim >= 1)
70  velocity_slip_vel_vec(0) = (*_u_slip)(face_arg, state);
71  if (_dim >= 2)
72  velocity_slip_vel_vec(1) = (*_v_slip)(face_arg, state);
73  if (_dim >= 3)
74  velocity_slip_vel_vec(2) = (*_w_slip)(face_arg, state);
75  advection_velocity += velocity_slip_vel_vec;
76  }
77 
78  const auto v = velocity();
79  advection_velocity += v;
80  const auto var_face = _var(makeFace(*_face_info,
83  false,
84  &limiter_time),
85  state);
86 
87  return _normal * advection_velocity * var_face;
88 }
const Moose::Functor< ADReal > *const _v_slip
slip velocity in direction y
static InputParameters validParams()
Moose::FV::InterpMethod _advected_interp_method
The interpolation method to use for the advected quantity.
const FaceInfo * _face_info
Moose::StateArg determineState() const
MeshBase & mesh
auto raw_value(const Eigen::Map< T > &in)
RealVectorValue _normal
DualNumber< Real, DNDerivativeType, true > ADReal
const unsigned int _dim
The dimension of the simulation.
virtual ADReal computeQpResidual() override
bool onBoundary(const FaceInfo &fi) const
LimiterType limiterType(InterpMethod interp_method)
SubProblem & _subproblem
virtual bool isTransient() const=0
registerMooseObject("NavierStokesApp", INSFVScalarFieldAdvection)
static const std::string v
Definition: NS.h:84
An advection kernel that implements interpolation schemes specific to Navier-Stokes flow physics...
void mooseError(Args &&... args) const
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 velocity() const
MooseVariableFV< Real > & _var
static InputParameters validParams()
INSFVScalarFieldAdvection(const InputParameters &params)
An advection kernel that implements interpolation schemes specific to Navier-Stokes flow physics and ...
bool _add_slip_model
Boolean to determine if slip velocity is available.
const Moose::Functor< ADReal > *const _w_slip
slip velocity in direction z
Moose::FaceArg makeFace(const FaceInfo &fi, const Moose::FV::LimiterType limiter_type, const bool elem_is_upwind, const bool correct_skewness=false, const Moose::StateArg *state_limiter=nullptr) const