https://mooseframework.inl.gov
FVAdvectedInterpolationMethod.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 
14  const FaceInfo & face,
15  const Moose::StateArg & state,
16  const Real mass_flux) const
17 {
18  mooseAssert(face.neighborPtr(),
19  "Advected interpolation with a Moose functor requires a two-sided internal face.");
20 
21  const Moose::ElemArg elem_arg{face.elemPtr(), false};
22  const Moose::ElemArg neighbor_arg{face.neighborPtr(), false};
23  const Real elem_value = functor(elem_arg, state);
24  const Real neighbor_value = functor(neighbor_arg, state);
25 
26  if (!needsGradients())
27  return advectedInterpolate(face, elem_value, neighbor_value, nullptr, nullptr, mass_flux);
28 
29  const auto elem_grad = functor.gradient(elem_arg, state);
30  const auto neighbor_grad = functor.gradient(neighbor_arg, state);
31  return advectedInterpolate(
32  face, elem_value, neighbor_value, &elem_grad, &neighbor_grad, mass_flux);
33 }
34 
35 Real
37  Real elem_value,
38  Real neighbor_value,
39  const VectorValue<Real> * elem_grad,
40  const VectorValue<Real> * neighbor_grad,
41  Real mass_flux) const
42 {
43  const auto result =
44  advectedInterpolate(face, elem_value, neighbor_value, elem_grad, neighbor_grad, mass_flux);
45  return result.weights_matrix.first * elem_value + result.weights_matrix.second * neighbor_value -
46  result.rhs_face_value;
47 }
48 
49 Real
51  const FaceInfo & face,
52  const Moose::StateArg & state,
53  const Real mass_flux) const
54 {
55  mooseAssert(face.neighborPtr(),
56  "Advected interpolation with a Moose functor requires a two-sided internal face.");
57 
58  const Moose::ElemArg elem_arg{face.elemPtr(), false};
59  const Moose::ElemArg neighbor_arg{face.neighborPtr(), false};
60  const Real elem_value = functor(elem_arg, state);
61  const Real neighbor_value = functor(neighbor_arg, state);
62 
63  if (!needsGradients())
64  return advectedInterpolateValue(face, elem_value, neighbor_value, nullptr, nullptr, mass_flux);
65 
66  const auto elem_grad = functor.gradient(elem_arg, state);
67  const auto neighbor_grad = functor.gradient(neighbor_arg, state);
69  face, elem_value, neighbor_value, &elem_grad, &neighbor_grad, mass_flux);
70 }
virtual Real advectedInterpolateValue(const FaceInfo &face, Real elem_value, Real neighbor_value, const VectorValue< Real > *elem_grad, const VectorValue< Real > *neighbor_grad, Real mass_flux) const
Compute the advected face value.
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition: FaceInfo.h:37
const Elem * neighborPtr() const
Definition: FaceInfo.h:88
virtual AdvectedSystemContribution advectedInterpolate(const FaceInfo &face, Real elem_value, Real neighbor_value, const VectorValue< Real > *elem_grad, const VectorValue< Real > *neighbor_grad, Real mass_flux) const =0
Compute the matrix weights for the advected face value.
A structure that is used to evaluate Moose functors logically at an element/cell center.
const Elem * elemPtr() const
Definition: FaceInfo.h:86
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual bool needsGradients() const
Whether advected interpolation requires adjacent-cell gradients.
Matrix/RHS contribution for an advected face interpolation.
GradientType gradient(const ElemArg &elem, const StateArg &state) const
Same as their evaluateGradient overloads with the same arguments but allows for caching implementatio...
Definition: MooseFunctor.h:853
State argument for evaluating functors.