https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FVAdvectedMUSCLDeferredCorrection.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{
19 "MUSCL reconstruction with cell gradients from a named gradient method 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 params.addParam<GradientMethodName>(
28 "gradient_method",
29 "green-gauss-venkatakrishnan",
30 "Gradient method used to compute cell gradients for the high-order reconstruction.");
31 return params;
32}
33
35 : FVInterpolationMethod(params),
36 _gradient_method_name(getParam<GradientMethodName>("gradient_method")),
37 _deferred_correction_factor(getParam<Real>("deferred_correction_factor"))
38{
39}
40
43 const FaceInfo & face,
44 const Real elem_value,
45 const Real neighbor_value,
46 const VectorValue<Real> * const elem_grad,
47 const VectorValue<Real> * const neighbor_grad,
48 const Real mass_flux) const
49{
50 mooseAssert(elem_grad && neighbor_grad,
51 "MUSCL deferred correction requires both element and neighbor gradients.");
52
53 const bool upwind_is_elem = mass_flux >= 0.0;
54 const Real phi_upwind = upwind_is_elem ? elem_value : neighbor_value;
55 const VectorValue<Real> * grad_upwind = upwind_is_elem ? elem_grad : neighbor_grad;
56
57 // Reconstruct a higher-order face value from the upwind cell using the (limited) cell gradient.
58 const Point & upwind_centroid = upwind_is_elem ? face.elemCentroid() : face.neighborCentroid();
59 // For the MUSCL scheme we reconstruct to the actual face centroid.
60 const Point face_delta = face.faceCentroid() - upwind_centroid;
61
62 const Real phi_high = phi_upwind + (*grad_upwind * face_delta);
63
65 // Matrix contribution: pure upwind.
66 result.weights_matrix = upwind_is_elem ? std::make_pair(1.0, 0.0) : std::make_pair(0.0, 1.0);
67
68 const Real phi_matrix =
69 result.weights_matrix.first * elem_value + result.weights_matrix.second * neighbor_value;
70 // Deferred correction: add the difference between low-order and high-order reconstructions
71 // explicitly on the RHS (scaled for robustness).
72 result.rhs_face_value = _deferred_correction_factor * (phi_matrix - phi_high);
73
74 return result;
75}
registerMooseObject("MooseApp", FVAdvectedMUSCLDeferredCorrection)
Multi-dimensional MUSCL reconstruction using cell gradients from a named gradient method and deferred...
Real _deferred_correction_factor
Scales the deferred correction strength (0 = upwind, 1 = full deferred correction).
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.
FVAdvectedMUSCLDeferredCorrection(const InputParameters &params)
Registered base class for linear FV interpolation objects.
static InputParameters validParams()
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition FaceInfo.h:38
const Point & neighborCentroid() const
Definition FaceInfo.h:247
const Point & elemCentroid() const
Returns the element centroids of the elements on the elem and neighbor sides of the face.
Definition FaceInfo.h:99
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.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
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)
Matrix/RHS contribution for an advected face interpolation.