22 "diffusion term in a partial differential equation.");
24 "use_nonorthogonal_correction",
26 "If the nonorthogonal correction should be used when computing the normal gradient.");
28 "use_nonorthogonal_correction_on_boundary",
29 "If the nonorthogonal correction should be used when computing the normal gradient.");
31 "Functor describing a diagonal diffusion tensor.");
32 params.
addParam<InterpolationMethodName>(
33 "coeff_interp_method",
34 "Optional finite volume interpolation method used to compute a face-centered diagonal " 35 "diffusion tensor. If omitted, the functor is evaluated directly on the face.");
43 _coeff_interp_method(isParamValid(
"coeff_interp_method")
44 ? &getFVFaceInterpolationMethod(
45 getParam<InterpolationMethodName>(
"coeff_interp_method"))
47 _use_nonorthogonal_correction(getParam<bool>(
"use_nonorthogonal_correction")),
48 _use_nonorthogonal_correction_on_boundary(
49 isParamValid(
"use_nonorthogonal_correction_on_boundary")
50 ? getParam<bool>(
"use_nonorthogonal_correction_on_boundary")
51 : _use_nonorthogonal_correction),
52 _flux_matrix_contribution(0.0),
53 _flux_rhs_contribution(0.0)
62 if (!dynamic_cast<const LinearFVAdvectionDiffusionBC *>(bc.second))
64 bc.second->type(),
" is not a compatible boundary condition with ", this->
type(),
"!");
76 "Face interpolation is only valid for two-sided internal faces.");
79 const auto neighbor_tensor =
154 const auto interp_coeffs =
157 const auto interpolated_gradient =
158 (interp_coeffs.first * grad_elem + interp_coeffs.second * grad_neighbor);
169 interpolated_gradient;
175 const auto correction_vector =
181 normal_scaled_diff_tensor * interpolated_gradient * correction_vector;
195 mooseAssert(diff_bc,
"This should be a valid BC!");
197 auto grad_contrib = diff_bc->computeBoundaryGradientMatrixContribution() *
_current_face_area;
200 if (!diff_bc->includesMaterialPropertyMultiplier())
211 grad_contrib *= normal_scaled_diff_tensor;
221 mooseAssert(diff_bc,
"This should be a valid BC!");
225 auto grad_contrib = diff_bc->computeBoundaryGradientRHSContribution();
236 mooseAssert(elem_info,
"We should always have an element info for the current face");
238 auto boundary_grad =
_var.
gradSln(*elem_info, state_arg);
242 if (!diff_bc->includesMaterialPropertyMultiplier())
243 grad_contrib *= normal_scaled_diff_tensor;
247 const Real boundary_normal_multiplier =
250 grad_contrib += (scaled_diff_tensor - normal_scaled_diff_tensor * boundary_normal_multiplier *
259 const auto correction_vector =
263 normal_scaled_diff_tensor * boundary_grad * boundary_normal_multiplier * correction_vector;
virtual Real interpolate(const FaceInfo &face, Real elem_value, Real neighbor_value) const =0
Face interpolation operation for this method.
MetaPhysicL::DualNumber< V, D, asd > abs(const MetaPhysicL::DualNumber< V, D, asd > &a)
Base class for boundary conditions for linear FV systems.
std::pair< Real, Real > interpCoeffs(const InterpMethod m, const FaceInfo &fi, const bool one_is_elem, const T &face_flux=0.0)
Produce the interpolation coefficients in the equation:
const Moose::Functor< RealVectorValue > & _diffusion_tensor
The functor for the diagonal diffusion tensor (diagonal entries arranged in a vector) ...
virtual Real computeElemMatrixContribution() override
Computes the system matrix contribution from an element side on an internal face. ...
Moose::FaceArg singleSidedFaceArg(const FaceInfo *fi, Moose::FV::LimiterType limiter_type=Moose::FV::LimiterType::CentralDifference, bool correct_skewness=false) const
Determine the single sided face argument when evaluating a functor on a face.
registerMooseObject("MooseApp", LinearFVAnisotropicDiffusion)
Moose::StateArg determineState() const
Create a functor state argument that corresponds to the implicit state of this object.
const ElemInfo * neighborInfo() const
const Point & faceCentroid() const
Returns the coordinates of the face centroid.
Finite volume kernel that contributes approximations of discretized face flux terms to the matrix and...
MooseLinearVariableFV< Real > & _var
Reference to the linear finite volume variable.
Kernel that adds contributions from an anisotropic diffusion term discretized using the finite volume...
static constexpr std::size_t dim
This is the dimension of all vector and tensor datastructures used in MOOSE.
const ElemInfo * elemInfo() const
RealVectorValue faceDiffusionTensor() const
Returns the diagonal diffusion tensor interpolated to the current face.
FaceInfo::VarFaceNeighbors _current_face_type
Face ownership information for the current face.
virtual Real computeBoundaryMatrixContribution(const LinearFVBoundaryCondition &bc) override
Computes the matrix contribution from a boundary face.
VectorValue< Real > gradSln(const ElemInfo &elem_info, const StateArg &state) const
Get the variable gradient at a cell center.
Moose::ElemArg makeElemArg(const Elem *elem, bool correct_skewnewss=false) const
Helper method to create an elemental argument for a functor that includes whether to perform skewness...
LinearFVAnisotropicDiffusion(const InputParameters ¶ms)
Class constructor.
Base class for boundary conditions that are valid for advection diffusion problems.
static InputParameters validParams()
const FaceInfo * _current_face_info
Pointer to the face info we are operating on right now.
const Elem * neighborPtr() const
virtual Real computeNeighborRightHandSideContribution() override
Computes the right hand side contribution from the neighbor side on an internal face.
virtual Real computeElemRightHandSideContribution() override
Computes the right hand side contribution from the element side on an internal face.
const std::string & type() const
Get the type of this class.
virtual Real computeNeighborMatrixContribution() override
Computes the system matrix contribution from the neighbor side on an internal face.
const bool _use_nonorthogonal_correction_on_boundary
Switch to enable/disable nonorthogonal correction on boundary, this is mostly used to disable boundar...
const bool _use_nonorthogonal_correction
Switch to enable/disable nonorthogonal correction.
virtual Real computeBoundaryRHSContribution(const LinearFVBoundaryCondition &bc) override
Computes the right hand side contribution from a boundary face.
const Point & normal() const
Returns the unit normal vector for the face oriented outward from the face's elem element...
Real _flux_matrix_contribution
The cached matrix contribution.
const Elem * elemPtr() const
bool _cached_rhs_contribution
If we already built the right hand side contribution.
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Point & eCN() const
Helper interface for objects that need access to FVInterpolationMethod instances. ...
const std::unordered_map< BoundaryID, LinearFVBoundaryCondition * > & getBoundaryConditionMap()
Real computeFluxMatrixContribution()
Computes the matrix contribution from the diffusive face flux.
IntRange< T > make_range(T beg, T end)
void mooseError(Args &&... args) const
Emits an error prefixed with object name and type and optionally a file path to the top-level block p...
static InputParameters validParams()
bool _cached_matrix_contribution
If we already built the matrix contribution.
Real _current_face_area
The current, coordinate system specific face area.
Moose::FaceArg makeCDFace(const FaceInfo &fi, const bool correct_skewness=false) const
Make a functor face argument with a central differencing limiter, e.g.
void computeCellGradients()
Switch to request cell gradient computations.
Real _flux_rhs_contribution
The cached right hand side contribution.
const FVFaceInterpolationMethod * _coeff_interp_method
Optional interpolation method for the diagonal diffusion tensor components.
Real computeFluxRHSContribution()
Computes the right hand side contribution from the diffusive face flux.
const Point & dCN() const