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 | computeGradientsExcept (const LinearFVGradientReader &excluded_reader) |
| Compute and finalize every registered linear FV gradient field except one method. | |
| 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 | computeGradientsForMethods (const std::vector< const FVGradientMethod * > &gradient_methods) |
| Compute and finalize the supplied registered gradient methods. | |
| 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. | |
| std::vector< const FVGradientMethod * > | _linear_fv_gradient_methods |
| Registered gradient methods in registration order. | |
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 270 of file LinearFVGradientManager.C.
Referenced by initializeLinearFVGradientStorage().
|
protected |
Compute and finalize all registered linear FV gradient fields.
Definition at line 120 of file LinearFVGradientManager.C.
Referenced by AuxiliarySystem::compute().
|
protected |
Compute and finalize every registered linear FV gradient field except one method.
| excluded_reader | Reader whose gradient method should not be updated. |
Definition at line 126 of file LinearFVGradientManager.C.
|
protected |
Compute and finalize the supplied registered gradient methods.
| gradient_methods | Methods whose gradient fields should be updated. |
Definition at line 141 of file LinearFVGradientManager.C.
Referenced by computeGradients(), and computeGradientsExcept().
|
protected |
Compute replacement field values for a registered gradient method.
| method | Gradient method used to compute the replacement values. |
Definition at line 312 of file LinearFVGradientManager.C.
Referenced by computeGradientsForMethods(), 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 397 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 338 of file LinearFVGradientManager.C.
Referenced by computeGradientsForMethods(), initializeGradientStatesForTimeAdvance(), and updateFVGradient().
|
staticprotected |
Return the stable system-vector name for one old gradient component.
Definition at line 261 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 198 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 204 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 385 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 234 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 358 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 372 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 85 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 216 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 59 of file LinearFVGradientManager.C.
|
protected |
Restore current gradients from state one after a failed timestep.
Definition at line 425 of file LinearFVGradientManager.C.
Referenced by AuxiliarySystem::restoreAdditionalStates(), and LinearSystem::restoreAdditionalStates().
|
protected |
Set solution state zero to the current gradient.
Definition at line 249 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 168 of file LinearFVGradientManager.C.
|
protected |
Gradient containers keyed by the method object that produces them.
Definition at line 209 of file LinearFVGradientManager.h.
Referenced by computeGradientsForMethods(), computeLinearFVGradientContainer(), copyPreviousGradientStates(), hasLinearFVGradients(), initializeGradientStatesForTimeAdvance(), initializeLinearFVGradientHistoryStorage(), initializeLinearFVGradientStorage(), rebuildLinearFVGradientStorage(), restoreGradientStates(), AuxiliarySystem::updateFVGradient(), and updateFVGradient().
|
protected |
Registered gradient methods in registration order.
Definition at line 212 of file LinearFVGradientManager.h.
Referenced by computeGradients(), computeGradientsExcept(), and AuxiliarySystem::updateFVGradient().
|
protected |
Reference to the system object.
Definition at line 205 of file LinearFVGradientManager.h.
Referenced by checkRestartedGradientHistory(), computeGradientsExcept(), computeGradientsForMethods(), computeLinearFVGradientContainer(), initializeContainer(), initializeLinearFVGradientHistoryStorage(), AuxiliarySystem::registerFVGradient(), resizeGradientStateStorage(), AuxiliarySystem::updateFVGradient(), and updateFVGradient().