https://mooseframework.inl.gov
FVAdvectedVenkatakrishnanDeferredCorrection.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(
19  "MUSCL reconstruction with Venkatakrishnan-limited cell gradients using deferred "
20  "correction.");
21  params.addRangeCheckedParam<Real>(
22  "deferred_correction_factor",
23  1.0,
24  "deferred_correction_factor>=0 & deferred_correction_factor<=1",
25  "Scales the deferred correction strength; 0 gives pure upwind (no deferred correction), 1 "
26  "gives full deferred correction. Values < 1 can improve fixed point robustness.");
27  return params;
28 }
29 
31  const InputParameters & params)
32  : FVInterpolationMethod(params),
33  _deferred_correction_factor(getParam<Real>("deferred_correction_factor"))
34 {
35 }
36 
39  const FaceInfo & face,
40  const Real elem_value,
41  const Real neighbor_value,
42  const VectorValue<Real> * const elem_grad,
43  const VectorValue<Real> * const neighbor_grad,
44  const Real mass_flux) const
45 {
46  mooseAssert(elem_grad && neighbor_grad,
47  "Venkatakrishnan deferred correction requires both element and neighbor gradients.");
48 
49  const bool upwind_is_elem = mass_flux >= 0.0;
50  const Real phi_upwind = upwind_is_elem ? elem_value : neighbor_value;
51  const VectorValue<Real> * grad_upwind = upwind_is_elem ? elem_grad : neighbor_grad;
52 
53  // Reconstruct a higher-order face value from the upwind cell using the (limited) cell gradient.
54  const Point & upwind_centroid = upwind_is_elem ? face.elemCentroid() : face.neighborCentroid();
55  // For the Venkatakrishnan MUSCL scheme we reconstruct to the actual face centroid.
56  const Point face_delta = face.faceCentroid() - upwind_centroid;
57 
58  const Real phi_high = phi_upwind + (*grad_upwind * face_delta);
59 
61  // Matrix contribution: pure upwind.
62  result.weights_matrix = upwind_is_elem ? std::make_pair(1.0, 0.0) : std::make_pair(0.0, 1.0);
63 
64  const Real phi_matrix =
65  result.weights_matrix.first * elem_value + result.weights_matrix.second * neighbor_value;
66  // Deferred correction: add the difference between low-order and high-order reconstructions
67  // explicitly on the RHS (scaled for robustness).
68  result.rhs_face_value = _deferred_correction_factor * (phi_matrix - phi_high);
69 
70  return result;
71 }
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 override
Compute the matrix weights for the advected face value.
const Point & faceCentroid() const
Returns the coordinates of the face centroid.
Definition: FaceInfo.h:75
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Registered base class for linear FV interpolation objects.
const Point & neighborCentroid() const
Definition: FaceInfo.h:247
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition: FaceInfo.h:37
registerMooseObject("MooseApp", FVAdvectedVenkatakrishnanDeferredCorrection)
const Point & elemCentroid() const
Returns the element centroids of the elements on the elem and neighbor sides of the face...
Definition: FaceInfo.h:99
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real _deferred_correction_factor
Scales the deferred correction strength (0 = upwind, 1 = full deferred correction).
Matrix/RHS contribution for an advected face interpolation.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
Multi-dimensional MUSCL reconstruction using Venkatakrishnan-limited cell gradients and deferred corr...