19 std::vector<std::unique_ptr<NumericVector<Number>>> & gradient,
20 const std::unordered_set<unsigned int> & gradient_variables)
21 : _fe_problem(fe_problem),
22 _dim(_fe_problem.
mesh().dimension()),
24 _libmesh_system(system.system()),
25 _system_number(_libmesh_system.number()),
27 _gradient_data(gradient.size()),
28 _owns_gradient_data(true),
29 _gradient_variables(gradient_variables)
31 for (
const auto dim_index : index_range(
_gradient))
33 auto & gradient_vector =
34 libMesh::cast_ref<libMesh::PetscVector<Number> &>(*
_gradient[dim_index]);
41 : _fe_problem(x._fe_problem),
44 _libmesh_system(x._libmesh_system),
45 _system_number(x._system_number),
46 _gradient(x._gradient),
47 _gradient_data(x._gradient_data),
48 _owns_gradient_data(false),
49 _gradient_variables(x._gradient_variables)
56 for (
const auto dim_index : index_range(
_gradient))
58 auto & gradient_vector =
59 libMesh::cast_ref<libMesh::PetscVector<Number> &>(*
_gradient[dim_index]);
60 gradient_vector.restore_array();
84 auto & first_gradient_vector =
85 libMesh::cast_ref<libMesh::PetscVector<Number> &>(*
_gradient.front());
87 for (
auto elem_iterator = range.begin(); elem_iterator != range.end(); ++elem_iterator)
89 const auto & elem_info = *elem_iterator;
97 "We have not yet implemented the correct translation from gradient to "
98 "divergence for spherical coordinates yet.");
101 const auto local_dof = first_gradient_vector.map_global_to_local_index(dof);
103 const auto volume = elem_info->volume() * elem_info->coordFactor();
105 for (
const auto dim_index : index_range(
_gradient))
110 mooseAssert(elem_info->centroid()(rz_radial_coord) != 0,
111 "Axisymmetric control volumes should not have a zero radial coordinate");
The gradient in a volume using Green Gauss theorem and a cell-centered finite-volume approximation ca...
FEProblemBase & _fe_problem
SystemBase & _system
The system wrapper this thread operates on.
const unsigned int _system_number
Global system number.
const std::unordered_set< unsigned int > & _gradient_variables
Indices of the variables this producer should compute gradients for.
std::vector< Real * > _gradient_data
Writable local arrays, one per gradient component.
void operator()(const ElemInfoRange &range)
Operator which is used to execute the thread over a certain iterator range.
std::vector< std::unique_ptr< NumericVector< Number > > > & _gradient
Normalized (by cell volume) gradients to write into.
StoredRange< MooseMesh::const_elem_info_iterator, const ElemInfo * > ElemInfoRange
MooseLinearVariableFV< Real > * _current_var
Pointer to the current variable.
void join(const ComputeLinearFVGreenGaussGradientVolumeThread &y)
Join threads at the end of the execution.
ComputeLinearFVGreenGaussGradientVolumeThread(FEProblemBase &fe_problem, SystemBase &system, std::vector< std::unique_ptr< NumericVector< Number > > > &gradient, const std::unordered_set< unsigned int > &gradient_variables)
Class constructor.
const bool _owns_gradient_data
True only for the original thread object that acquired and must restore the arrays.
~ComputeLinearFVGreenGaussGradientVolumeThread()
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
virtual MooseMesh & mesh() override
This class provides variable solution interface for linear finite volume problems.
Real getElemValue(const ElemInfo &elem_info, const StateArg &state) const
Get the solution value for the provided element and seed the derivative for the corresponding dof ind...
unsigned int getAxisymmetricRadialCoord() const
Returns the desired radial direction for RZ coordinate transformation.
Moose::CoordinateSystemType getCoordSystem(SubdomainID sid) const
Get the coordinate system type, e.g.
unsigned int number() const
Get variable number coming from libMesh.
bool hasBlocks(const SubdomainID id) const override
Returns whether the functor is defined on this block.
Base class for a system (of equations)
const std::vector< MooseVariableFieldBase * > & getVariables(THREAD_ID tid)