https://mooseframework.inl.gov
Loading...
Searching...
No Matches
LinearFVGradientInterface.h
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
10#pragma once
11
12#include "MooseTypes.h"
13#include "GradientLimiterType.h"
14
15#include "libmesh/utility.h"
16
17#include <memory>
18#include <string>
19#include <unordered_map>
20#include <unordered_set>
21#include <vector>
22
23class SystemBase;
24
25namespace libMesh
26{
27template <typename T>
28class NumericVector;
29}
30
36{
37public:
39
44 const std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number>>> &
46 {
48 }
49
56 unsigned int variable_number);
57
63 const std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number>>> &
65
71 const std::unordered_set<Moose::FV::GradientLimiterType> &
76
77protected:
81 void computeGradients();
82
87
93 std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number>>> &
98
105 std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number>>> &
110
116 std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number>>> &
121
127 const std::unordered_set<unsigned int> &
129 {
130 return libmesh_map_find(_requested_limited_gradient_variables, limiter_type);
131 }
132
133 bool needsLinearFVGradientStorage() const;
134
136 std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number>>> & container) const;
137
140
142 std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number>>> _temporary_gradient;
143
145 std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number>>> _raw_grad_container;
146
148 std::unordered_set<Moose::FV::GradientLimiterType> _requested_limited_gradient_types;
149
151 std::unordered_map<Moose::FV::GradientLimiterType, std::unordered_set<unsigned int>>
153
155 std::unordered_map<Moose::FV::GradientLimiterType,
156 std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number>>>>
158
160 std::unordered_map<Moose::FV::GradientLimiterType,
161 std::vector<std::unique_ptr<libMesh::NumericVector<libMesh::Number>>>>
163};
Shared storage and allocation logic for linear finite-volume cell gradients for variables in the syst...
void rebuildLinearFVGradientStorage()
Rebuild persistent raw and temporary gradient storage after mesh/DOF changes.
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & temporaryLinearFVLimitedGradientContainer(const Moose::FV::GradientLimiterType limiter_type)
Return temporary storage for limited gradients during gradient assembly.
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & temporaryLinearFVGradientContainer()
Return temporary storage for gradients during gradient assembly.
const std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & linearFVGradientContainer() const
Access the stored raw cell-centered gradient components.
SystemBase & _sys
Reference to the system object.
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > _raw_grad_container
Persisted raw cell-centered gradient components keyed by spatial direction.
const std::unordered_set< unsigned int > & requestedLinearFVLimitedGradientVariables(const Moose::FV::GradientLimiterType limiter_type) const
Access the variable numbers that requested limited gradients for a specific limiter.
std::unordered_map< Moose::FV::GradientLimiterType, std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > > _temporary_limited_gradient
Scratch storage for limited gradients assembled during the current compute pass.
void initializeContainer(std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > &container) const
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > _temporary_gradient
Scratch storage for raw gradients assembled during the current compute pass.
void requestLinearFVLimitedGradients(const Moose::FV::GradientLimiterType limiter_type, unsigned int variable_number)
Request storage and assembly of limiter-specific cell gradients.
const std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & linearFVLimitedGradientContainer(const Moose::FV::GradientLimiterType limiter_type) const
Access the stored raw or limited cell-centered gradient components.
std::unordered_map< Moose::FV::GradientLimiterType, std::unordered_set< unsigned int > > _requested_limited_gradient_variables
Variable numbers requesting limited gradients, keyed by limiter type.
const std::unordered_set< Moose::FV::GradientLimiterType > & requestedLinearFVLimitedGradientTypes() const
Access the limiter types requested for this system.
std::unordered_set< Moose::FV::GradientLimiterType > _requested_limited_gradient_types
Set of requested limiter types for which limited gradients should be computed.
void computeGradients()
Compute and store raw and requested limited Green-Gauss gradients for linear FV variables.
std::unordered_map< Moose::FV::GradientLimiterType, std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > > _raw_limited_grad_containers
Persisted limited gradient components keyed by limiter type.
std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > & rawLinearFVLimitedGradientContainer(const Moose::FV::GradientLimiterType limiter_type)
Access the persisted limited-gradient storage for a specific limiter.
Base class for a system (of equations)
Definition SystemBase.h:87
GradientLimiterType
Cell-gradient limiter variants used for MUSCL-style reconstructions.
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...