Registration, update, and allocation logic for linear finite-volume cell gradients. More...
#include <LinearFVGradientManager.h>
Classes | |
| struct | LinearFVGradientContainer |
| Gradient values for all variables using the same gradient method. More... | |
Public Member Functions | |
| LinearFVGradientManager (SystemBase &sys) | |
| const FVGradientMethod & | resolveFVGradientMethod (const GradientMethodName &method_name) |
| Resolve a named gradient method, constructing a built-in method when needed. | |
| LinearFVGradientReader | registerFVGradient (unsigned int variable_number, const FVGradientMethod &method, unsigned int oldest_state=0) |
| Register a variable for gradient values produced by a method object. | |
Protected Types | |
| using | GradientContainer = LinearFVGradientReader::GradientContainer |
| Non-owning view with one vector per spatial component of a cell-centered gradient field. | |
| using | GradientStateContainer = LinearFVGradientReader::GradientStateContainer |
| Gradient fields indexed by solution time state. | |
| using | OwnedGradientContainer = std::vector< std::unique_ptr< libMesh::NumericVector< libMesh::Number > > > |
| Owned vectors used for the current gradient and its replacement. | |
Protected Member Functions | |
| void | computeGradients () |
| Compute and finalize all registered linear FV gradient fields. | |
| void | updateFVGradient (const LinearFVGradientReader &reader) |
| Update a registered gradient reader explicitly. | |
| void | initializeLinearFVGradientStorage () |
| Initialize private current and replacement gradient storage. | |
| void | initializeLinearFVGradientHistoryStorage () |
| Register named system vectors for requested historical gradient states. | |
| void | rebuildLinearFVGradientStorage () |
| Rebuild cached gradient values and reusable scratch storage after mesh/DOF changes. | |
| void | copyPreviousGradientStates (Moose::SolutionIterationType iteration_type, bool skip_current_to_old) |
| Copy published gradient values into requested older states. | |
| void | restoreGradientStates () |
| Restore current gradients from state one after a failed timestep. | |
| bool | hasLinearFVGradients () const |
| Whether any linear finite-volume gradient fields have been registered to this object. | |
| void | initializeContainer (OwnedGradientContainer &container) const |
| Allocate one zeroed vector per spatial component for gradient storage. | |
| void | resizeGradientStateStorage (LinearFVGradientContainer &container, unsigned int oldest_state) |
| Ensure that a method container stores every requested time state. | |
| void | setCurrentGradientState (LinearFVGradientContainer &container) const |
| Set solution state zero to the current gradient. | |
| void | checkRestartedGradientHistory (const FVGradientMethod &method, LinearFVGradientContainer &container) |
| Validate and mark gradient history loaded during restart or recovery. | |
| void | initializeGradientStatesForTimeAdvance () |
| Compute and publish uninitialized gradients before their first time-state advancement. | |
| LinearFVGradientContainer & | computeLinearFVGradientContainer (const FVGradientMethod &method) |
| Compute replacement field values for a registered gradient method. | |
| void | finalizeLinearFVGradientContainer (LinearFVGradientContainer &container) |
| Replace the current gradient storage with the freshly computed new gradients. | |
Static Protected Member Functions | |
| static std::string | gradientStateVectorName (const FVGradientMethod &method, unsigned int state, unsigned int component) |
| Return the stable system-vector name for one old gradient component. | |
Protected Attributes | |
| SystemBase & | _sys |
| Reference to the system object. | |
| std::unordered_map< const FVGradientMethod *, LinearFVGradientContainer > | _linear_fv_gradient_container_by_method |
| Gradient containers keyed by the method object that produces them. | |
Registration, update, and allocation logic for linear finite-volume cell gradients.
This interface should be inherited by system classes that may own linear finite-volume variables
Definition at line 38 of file LinearFVGradientManager.h.
|
protected |
Non-owning view with one vector per spatial component of a cell-centered gradient field.
Definition at line 65 of file LinearFVGradientManager.h.
|
protected |
Gradient fields indexed by solution time state.
Definition at line 68 of file LinearFVGradientManager.h.
|
protected |
Owned vectors used for the current gradient and its replacement.
Definition at line 71 of file LinearFVGradientManager.h.
|
inline |
| sys | System that owns registered linear finite-volume gradient fields. |
Definition at line 44 of file LinearFVGradientManager.h.
|
protected |
Validate and mark gradient history loaded during restart or recovery.
Definition at line 237 of file LinearFVGradientManager.C.
Referenced by initializeLinearFVGradientStorage().
|
protected |
Compute and finalize all registered linear FV gradient fields.
Definition at line 110 of file LinearFVGradientManager.C.
Referenced by AuxiliarySystem::compute().
|
protected |
Compute replacement field values for a registered gradient method.
| method | Gradient method used to compute the replacement values. |
Definition at line 279 of file LinearFVGradientManager.C.
Referenced by computeGradients(), initializeGradientStatesForTimeAdvance(), and updateFVGradient().
|
protected |
Copy published gradient values into requested older states.
Non-time histories are ignored because only time gradient states are currently stored.
| iteration_type | Type of solution history being advanced. |
| skip_current_to_old | Whether state zero should not overwrite state one while deeper states still shift, matching the owning system's solution-state advancement. |
Definition at line 364 of file LinearFVGradientManager.C.
Referenced by AuxiliarySystem::copyAdditionalStateBackwards(), and LinearSystem::copyAdditionalStateBackwards().
|
protected |
Replace the current gradient storage with the freshly computed new gradients.
| container | Method container whose gradient values should be finalized. |
Definition at line 305 of file LinearFVGradientManager.C.
Referenced by computeGradients(), initializeGradientStatesForTimeAdvance(), and updateFVGradient().
|
staticprotected |
Return the stable system-vector name for one old gradient component.
Definition at line 228 of file LinearFVGradientManager.C.
Referenced by checkRestartedGradientHistory(), and initializeLinearFVGradientHistoryStorage().
|
protected |
Whether any linear finite-volume gradient fields have been registered to this object.
Definition at line 165 of file LinearFVGradientManager.C.
Referenced by AuxiliarySystem::compute().
|
protected |
Allocate one zeroed vector per spatial component for gradient storage.
| container | Component-vector container to rebuild. |
Definition at line 171 of file LinearFVGradientManager.C.
Referenced by initializeLinearFVGradientStorage(), and AuxiliarySystem::updateFVGradient().
|
protected |
Compute and publish uninitialized gradients before their first time-state advancement.
Definition at line 352 of file LinearFVGradientManager.C.
Referenced by copyPreviousGradientStates().
|
protected |
Register named system vectors for requested historical gradient states.
This must run after gradient state requirements are known and before restart or recovery data is loaded, so checkpoint data can be restored into these vectors. It does not initialize the current or replacement working storage.
Definition at line 201 of file LinearFVGradientManager.C.
Referenced by AuxiliarySystem::AuxiliarySystem(), and LinearSystem::initSolutionState().
|
protected |
Initialize private current and replacement gradient storage.
This must run after the current local solution has been created and initialized, and after restart or recovery data has been loaded. At that point, it also checks if the restored historical gradient storage is set up correctly.
Definition at line 325 of file LinearFVGradientManager.C.
Referenced by computeLinearFVGradientContainer(), AuxiliarySystem::initialSetup(), LinearSystem::initialSetup(), and rebuildLinearFVGradientStorage().
|
protected |
Rebuild cached gradient values and reusable scratch storage after mesh/DOF changes.
Definition at line 339 of file LinearFVGradientManager.C.
Referenced by AuxiliarySystem::reinit(), and LinearSystem::reinit().
| LinearFVGradientReader LinearFVGradientManager::registerFVGradient | ( | unsigned int | variable_number, |
| const FVGradientMethod & | method, | ||
| unsigned int | oldest_state = 0 |
||
| ) |
Register a variable for gradient values produced by a method object.
| variable_number | Variable number whose gradient should be stored. |
| method | Gradient method that computes the field values. |
| oldest_state | Oldest time state that consumers need to read. |
Definition at line 78 of file LinearFVGradientManager.C.
|
protected |
Ensure that a method container stores every requested time state.
| container | Method container whose state storage should be grown. |
| oldest_state | Oldest time state that must be stored. |
Definition at line 183 of file LinearFVGradientManager.C.
Referenced by AuxiliarySystem::updateFVGradient().
| const FVGradientMethod & LinearFVGradientManager::resolveFVGradientMethod | ( | const GradientMethodName & | method_name | ) |
Resolve a named gradient method, constructing a built-in method when needed.
| method_name | Name of the gradient method to retrieve. |
Definition at line 52 of file LinearFVGradientManager.C.
|
protected |
Restore current gradients from state one after a failed timestep.
Definition at line 392 of file LinearFVGradientManager.C.
Referenced by AuxiliarySystem::restoreAdditionalStates(), and LinearSystem::restoreAdditionalStates().
|
protected |
Set solution state zero to the current gradient.
Definition at line 216 of file LinearFVGradientManager.C.
Referenced by finalizeLinearFVGradientContainer(), initializeLinearFVGradientStorage(), and AuxiliarySystem::updateFVGradient().
|
protected |
Update a registered gradient reader explicitly.
| reader | Gradient reader to update. |
Definition at line 135 of file LinearFVGradientManager.C.
|
protected |
Gradient containers keyed by the method object that produces them.
Definition at line 197 of file LinearFVGradientManager.h.
Referenced by computeGradients(), computeLinearFVGradientContainer(), copyPreviousGradientStates(), hasLinearFVGradients(), initializeGradientStatesForTimeAdvance(), initializeLinearFVGradientHistoryStorage(), initializeLinearFVGradientStorage(), rebuildLinearFVGradientStorage(), restoreGradientStates(), AuxiliarySystem::updateFVGradient(), and updateFVGradient().
|
protected |
Reference to the system object.
Definition at line 193 of file LinearFVGradientManager.h.
Referenced by checkRestartedGradientHistory(), computeGradients(), computeLinearFVGradientContainer(), initializeContainer(), initializeLinearFVGradientHistoryStorage(), resizeGradientStateStorage(), resolveFVGradientMethod(), AuxiliarySystem::updateFVGradient(), and updateFVGradient().