https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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{
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{
34 {
35 if (_dim >= 2 && !_v_slip)
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)
41 "In three dimensions, the w_slip velocity must be supplied using the 'w_slip' parameter");
42 }
43}
44
47{
48 const auto state = determineState();
49 const auto & limiter_time = _subproblem.isTransient()
50 ? Moose::StateArg(1, Moose::SolutionIterationType::Time)
51 : Moose::StateArg(1, Moose::SolutionIterationType::Nonlinear);
52
53 ADRealVectorValue advection_velocity;
55 {
56
57 Moose::FaceArg face_arg;
59 face_arg = singleSidedFaceArg();
60 else
61 face_arg = Moose::FaceArg{_face_info,
62 Moose::FV::LimiterType::CentralDifference,
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,
81 limiterType(_advected_interp_method),
83 false,
84 &limiter_time),
85 state);
86
87 return _normal * advection_velocity * var_face;
88}
DualNumber< Real, DNDerivativeType, true > ADReal
const double v
registerMooseObject("NavierStokesApp", INSFVScalarFieldAdvection)
RealVectorValue _normal
bool onBoundary(const FaceInfo &fi) const
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
const FaceInfo * _face_info
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
An advection kernel that implements interpolation schemes specific to Navier-Stokes flow physics.
ADRealVectorValue velocity() const
Moose::FV::InterpMethod _advected_interp_method
The interpolation method to use for the advected quantity.
static InputParameters validParams()
An advection kernel that implements interpolation schemes specific to Navier-Stokes flow physics and ...
const Moose::Functor< ADReal > *const _v_slip
slip velocity in direction y
virtual ADReal computeQpResidual() override
bool _add_slip_model
Boolean to determine if slip velocity is available.
INSFVScalarFieldAdvection(const InputParameters &params)
static InputParameters validParams()
const Moose::Functor< ADReal > *const _w_slip
slip velocity in direction z
const unsigned int _dim
The dimension of the simulation.
void mooseError(Args &&... args) const
SubProblem & _subproblem
virtual bool isTransient() const=0
Moose::StateArg determineState() const
MeshBase & mesh
auto raw_value(const Eigen::Map< T > &in)