The gradient in a volume using Green Gauss theorem and a cell-centered finite-volume approximation can be computed as follows: More...
#include <ComputeLinearFVGreenGaussGradientVolumeThread.h>
Public Types | |
| using | ElemInfoRange = StoredRange< MooseMesh::const_elem_info_iterator, const ElemInfo * > |
Public Member Functions | |
| ComputeLinearFVGreenGaussGradientVolumeThread (FEProblemBase &fe_problem, SystemBase &system, std::vector< std::unique_ptr< NumericVector< Number > > > &gradient, const std::unordered_set< unsigned int > &gradient_variables) | |
| Class constructor. | |
| ComputeLinearFVGreenGaussGradientVolumeThread (ComputeLinearFVGreenGaussGradientVolumeThread &x, Threads::split split) | |
| Splitting constructor. | |
| ~ComputeLinearFVGreenGaussGradientVolumeThread () | |
| void | operator() (const ElemInfoRange &range) |
| Operator which is used to execute the thread over a certain iterator range. | |
| void | join (const ComputeLinearFVGreenGaussGradientVolumeThread &y) |
| Join threads at the end of the execution. | |
Protected Attributes | |
| FEProblemBase & | _fe_problem |
| const unsigned int | _dim |
| The dimension of the domain. | |
| SystemBase & | _system |
| The system wrapper this thread operates on. | |
| const libMesh::System & | _libmesh_system |
| Reference to the libmesh system. | |
| const unsigned int | _system_number |
| Global system number. | |
| THREAD_ID | _tid |
| Thread ID. | |
| MooseLinearVariableFV< Real > * | _current_var |
| Pointer to the current variable. | |
| std::vector< std::unique_ptr< NumericVector< Number > > > & | _gradient |
| Normalized (by cell volume) gradients to write into. | |
| std::vector< Real * > | _gradient_data |
| Writable local arrays, one per gradient component. | |
| const bool | _owns_gradient_data |
| True only for the original thread object that acquired and must restore the arrays. | |
| const std::unordered_set< unsigned int > & | _gradient_variables |
| Indices of the variables this producer should compute gradients for. | |
The gradient in a volume using Green Gauss theorem and a cell-centered finite-volume approximation can be computed as follows:
\nabla u \approx \frac{1}{V_C} \sum_f u_f\vec{n}_f,
where V_C denotes the volume of the cell, f is a face iterator, while u_f and \vec{S}_f are the face value of the variable and surface area vector (the product of the surface area and normals), respectively. This object carries out the normalization with the element volumes.
Furthermore, in cylindrical coordinates, the radial value of the gradient needs to be extended with a u(r)/r value which is added in this object as well.
Definition at line 40 of file ComputeLinearFVGreenGaussGradientVolumeThread.h.
| using ComputeLinearFVGreenGaussGradientVolumeThread::ElemInfoRange = StoredRange<MooseMesh::const_elem_info_iterator, const ElemInfo *> |
Definition at line 66 of file ComputeLinearFVGreenGaussGradientVolumeThread.h.
| ComputeLinearFVGreenGaussGradientVolumeThread::ComputeLinearFVGreenGaussGradientVolumeThread | ( | FEProblemBase & | fe_problem, |
| SystemBase & | system, | ||
| std::vector< std::unique_ptr< NumericVector< Number > > > & | gradient, | ||
| const std::unordered_set< unsigned int > & | gradient_variables | ||
| ) |
Class constructor.
| fe_problem | Reference to the problem |
| system | The system which contains variables that need gradients. |
| input_gradient | Scratch storage holding the unnormalized face sums. |
| output_gradient | Storage where normalized (with element volume) gradients are written. |
Definition at line 16 of file ComputeLinearFVGreenGaussGradientVolumeThread.C.
| ComputeLinearFVGreenGaussGradientVolumeThread::ComputeLinearFVGreenGaussGradientVolumeThread | ( | ComputeLinearFVGreenGaussGradientVolumeThread & | x, |
| Threads::split | split | ||
| ) |
Splitting constructor.
| x | Reference to the other bodies |
| split | The thread split |
Definition at line 39 of file ComputeLinearFVGreenGaussGradientVolumeThread.C.
| ComputeLinearFVGreenGaussGradientVolumeThread::~ComputeLinearFVGreenGaussGradientVolumeThread | ( | ) |
Definition at line 53 of file ComputeLinearFVGreenGaussGradientVolumeThread.C.
| void ComputeLinearFVGreenGaussGradientVolumeThread::join | ( | const ComputeLinearFVGreenGaussGradientVolumeThread & | y | ) |
Join threads at the end of the execution.
| y | Reference to the other bodies |
Definition at line 121 of file ComputeLinearFVGreenGaussGradientVolumeThread.C.
| void ComputeLinearFVGreenGaussGradientVolumeThread::operator() | ( | const ElemInfoRange & | range | ) |
Operator which is used to execute the thread over a certain iterator range.
| range | The range of ElemInfos which should be computed. |
Definition at line 65 of file ComputeLinearFVGreenGaussGradientVolumeThread.C.
|
protected |
Pointer to the current variable.
Definition at line 95 of file ComputeLinearFVGreenGaussGradientVolumeThread.h.
Referenced by operator()().
|
protected |
The dimension of the domain.
Definition at line 80 of file ComputeLinearFVGreenGaussGradientVolumeThread.h.
|
protected |
Definition at line 77 of file ComputeLinearFVGreenGaussGradientVolumeThread.h.
Referenced by operator()().
|
protected |
Normalized (by cell volume) gradients to write into.
Definition at line 98 of file ComputeLinearFVGreenGaussGradientVolumeThread.h.
Referenced by ComputeLinearFVGreenGaussGradientVolumeThread(), operator()(), and ~ComputeLinearFVGreenGaussGradientVolumeThread().
|
protected |
Writable local arrays, one per gradient component.
_gradient_data[component][local_dof] stores that component at a local DOF.
The original thread object acquires the arrays before threaded execution. Threaded copies share the pointers and write only to DOFs in their element range.
Definition at line 107 of file ComputeLinearFVGreenGaussGradientVolumeThread.h.
Referenced by ComputeLinearFVGreenGaussGradientVolumeThread(), and operator()().
|
protected |
Indices of the variables this producer should compute gradients for.
Definition at line 113 of file ComputeLinearFVGreenGaussGradientVolumeThread.h.
Referenced by operator()().
|
protected |
Reference to the libmesh system.
Definition at line 86 of file ComputeLinearFVGreenGaussGradientVolumeThread.h.
|
protected |
True only for the original thread object that acquired and must restore the arrays.
Definition at line 110 of file ComputeLinearFVGreenGaussGradientVolumeThread.h.
Referenced by ~ComputeLinearFVGreenGaussGradientVolumeThread().
|
protected |
The system wrapper this thread operates on.
Definition at line 83 of file ComputeLinearFVGreenGaussGradientVolumeThread.h.
Referenced by operator()().
|
protected |
Global system number.
Definition at line 89 of file ComputeLinearFVGreenGaussGradientVolumeThread.h.
Referenced by operator()().
|
protected |
Thread ID.
Definition at line 92 of file ComputeLinearFVGreenGaussGradientVolumeThread.h.
Referenced by operator()().