https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FVGreenGaussGradient.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#include "FEProblemBase.h"
15#include "MathFVUtils.h"
16#include "SystemBase.h"
17
19
22{
24 params.addClassDescription("Green-Gauss cell-centered gradient method.");
25 return params;
26}
27
32
35 const ElemInfo & /*elem_info*/,
36 const ElemInfo & /*neighbor_info*/,
37 const MooseLinearVariableFV<Real> & /*variable*/,
38 Real elem_value,
39 Real neighbor_value) const
40{
41 const Real face_value = Moose::FV::linearInterpolation(elem_value, neighbor_value, fi, true);
42 return {face_value, face_value};
43}
44
45void
47 SystemBase & system,
48 GradientContainer & gradient,
49 const std::unordered_set<unsigned int> & variable_numbers) const
50{
51 auto & fe_problem = system.feProblem();
52
53 PARALLEL_TRY
54 {
56 FaceInfoRange face_info_range(fe_problem.mesh().ownedFaceInfoBegin(),
57 fe_problem.mesh().ownedFaceInfoEnd());
58
60 fe_problem, system, gradient, variable_numbers, *this);
61 Threads::parallel_reduce(face_info_range, gradient_face_thread, system.numThreads());
62 }
63 fe_problem.checkExceptionAndStopSolve();
64
65 for (auto & vec : gradient)
66 vec->close();
67
68 PARALLEL_TRY
69 {
71 ElemInfoRange elem_info_range(fe_problem.mesh().ownedElemInfoBegin(),
72 fe_problem.mesh().ownedElemInfoEnd());
73
75 fe_problem, system, gradient, variable_numbers);
76 Threads::parallel_reduce(elem_info_range, gradient_volume_thread, system.numThreads());
77 }
78 fe_problem.checkExceptionAndStopSolve();
79}
registerMooseObject("MooseApp", FVGreenGaussGradient)
The gradient in a volume using Green Gauss theorem and a cell-centered finite-volume approximation ca...
StoredRange< MooseMesh::const_face_info_iterator, const FaceInfo * > FaceInfoRange
The gradient in a volume using Green Gauss theorem and a cell-centered finite-volume approximation ca...
StoredRange< MooseMesh::const_elem_info_iterator, const ElemInfo * > ElemInfoRange
Class used for caching additional information for elements such as the volume and centroid.
Definition ElemInfo.h:26
Base class for linear finite-volume cell-gradient methods.
static InputParameters validParams()
Input parameters shared by all the gradient methods.
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > GradientContainer
One vector per spatial component of the cell-centered gradient.
Green-Gauss cell-centered gradient method for linear finite-volume variables.
static InputParameters validParams()
virtual InternalFaceValues internalFaceValues(const FaceInfo &fi, const ElemInfo &elem_info, const ElemInfo &neighbor_info, const MooseLinearVariableFV< Real > &variable, Real elem_value, Real neighbor_value) const
Return the two Green-Gauss face values on an internal face.
void computeGradientWithoutLimiter(SystemBase &system, GradientContainer &gradient, const std::unordered_set< unsigned int > &variable_numbers) const override
Compute the method-specific gradient before this base class applies any limiter.
std::pair< Real, Real > InternalFaceValues
Element-side and neighbor-side values contributed by an internal face.
FVGreenGaussGradient(const InputParameters &params)
This data structure is used to store geometric and variable related metadata about each cell face in ...
Definition FaceInfo.h:38
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
This class provides variable solution interface for linear finite volume problems.
Base class for a system (of equations)
Definition SystemBase.h:87
THREAD_ID numThreads() const
Definition SystemBase.C:89
FEProblemBase & feProblem()
Definition SystemBase.h:104
libMesh::CompareTypes< T, T2 >::supertype linearInterpolation(const T &value1, const T2 &value2, const FaceInfo &fi, const bool one_is_elem, const InterpMethod interp_method=InterpMethod::Average)
A simple linear interpolation of values between cell centers to a cell face.
void parallel_reduce(const Range &range, Body &body, unsigned int n_threads=libMesh::n_threads())