Main workhorse: DOF management, assembly coordination and the solver interface. More...
#include <cl_FEM_DofManager.hpp>
Public Member Functions | |
| DofManager (Kernel *aParent, const index_t aIndex) | |
| Borrows aParent, which owns this manager. | |
| ~DofManager () override | |
| void | set_equation (IWG *aIWG) |
| select the equation that is to be solved | |
| void | print (const proc_t aRank=0) |
| Prints only on rank aRank. | |
| uint | sideset_integration_order () const override |
| uint | block_integration_order () const override |
| IntegrationScheme | integration_scheme () const override |
| bool | is_initialized () const override |
| true once initialize() has frozen the free/fixed dof split and the matrix graphs; a first fix() of a free dof after that point changes a classification the solver containers are sized for ( see SideSet::impose_dirichlet ) | |
| Dof * | dof (const id_t aID) override |
| return a specific dof | |
| bool | dof_exists (const id_t aID) const override |
| Cell< Dof * > & | dofs () |
| The non-hanging dofs, free and fixed ( hanging dofs live in DofData::hanging_dofs() ). | |
| Bearing * | bearing (const id_t aID) |
| SideSet * | sideset (const id_t aID) override |
| Block * | block (const id_t aID) override |
| void | extract_abstract_dofs_from_mesh () |
| id_t | calculate_dof_id (const mesh::Node *aNode, const uint aDofType) const override |
| id_t | calculate_dof_id (const mesh::Edge *aEdge, const uint aDofType) const override |
| id_t | calculate_dof_id (const mesh::Face *aFace, const uint aDofType) const |
| id_t | calculate_dof_id (const mesh::Facet *aFacet, const uint aDofType) const override |
| void | initialize () override |
| void | initialize (const bool aSeedFreeDofsOnly) |
| void | zero () |
| void | compute_jacobian (const bool aReset=true) |
| Collective: every rank assembles and the matrices are collected across ranks. | |
| void | compute_rhs (const bool aReset=true) |
| void | compute_jacobian_and_rhs (const bool aReset=true) |
| void | compute_full_matrices () |
| void | set_solver (const SolverParameters &aParams) |
| Collective: every rank constructs the solver ( whose constructor synchronizes the solver settings from rank 0 ), then performs a barrier. | |
| dofmgr::SolverData * | solver_data () |
| Solver * | solver () |
| The solver is borrowed; this manager's solver data owns it. | |
| void | solve () |
| Collective. | |
| void | compute_residual () |
| void | solve_from_residual () |
| real | residual (const uint aIteration) |
| Collective ( a barrier and four broadcasts ): the convergence measure of iteration aIteration, identical on every rank afterwards; absolute_residual() is the unnormalized norm of the same step. | |
| real | absolute_residual () const |
| absolute residual norm of the last residual() call | |
| real | pre_update_residual () const |
| pre-update residual of the entry state under the current assembly ( Newton iterates only, QUIET_NAN otherwise ) — the honest backtracking reference for the controller's line search | |
| real | fixed_point_residual () const |
| fixed-point residual ||G(x)-x|| / ||x|| of the last Anderson update ( REAL_MAX while Anderson is off ) | |
| bool | solve_failed () |
| true if the last solve failed softly ( soft-fail contract, see solver::Wrapper ); rank-uniform | |
| void | collect_fields (const Cell< string > &aFieldLabels) override |
| Collective, a gather to the master rank: the workers send their packed node data, the master receives ( a barrier inside ). | |
| void | collect_field (const string &aFieldLabel) |
| Collects one field, with barriers before and after collection. | |
| void | distribute_fields (const Cell< string > &aFieldLabels) override |
| Collective and asymmetric, the inverse of collect_fields(): the master sends, the workers receive; not a broadcast. | |
| void | synchronize_fields (const Cell< string > &aFieldLabels) override |
| Collective: a collect, a barrier, then a distribute. | |
| void | compute_volume_loads (const Vector< id_t > &aBlockIDs) |
| Collective: every rank assembles its loads and they are collected here; a single right-hand side only ( asserted ). | |
| SpMatrix * | system_matrix () |
| Block form of the assembled system, x = free dofs, y = fixed dofs: [ J D ] [ x ] [ f ] [ E I ] [ y ] = [ g ] The reduced system J x = f - D y solves for the unknowns; E x + I y = g gives the reactions at the fixed dofs. | |
| SpMatrix * | dirichlet () |
| SpMatrix * | enforcement () |
| SpMatrix * | imposition () |
| SpMatrix * | full_mass () |
| SpMatrix * | full_stiffness () |
| void | full_lhs (Vector< real > &aLHS) |
| Resizes aLHS and fills it in DOF order: free DOFs first, then fixed. | |
| Vector< real > & | rhs_vector () |
| The assembled right-hand side as the solver data holds it: rank-local entries on the workers, the collected global vector on the master. | |
| real | rhs_norm () |
| void | load_system (const string &aPath) |
| void | save_system (const string &aPath) |
| void | init_dof_values () |
| void | seed_dof_values () |
| void | reset_convection () |
| bool | sideset_exists (const id_t &aID) const override |
| bool | block_exists (const id_t &aID) const override |
| void | create_fields (IWG *aIWG) |
| check that the fields demanded by the IWG exist on the mesh and create them otherwise | |
| Cell< Postprocessor * > & | postprocessors () |
| Owned by this manager; the container is a view. | |
| void | initialize_postprocessors () |
| Collective: computes the projection matrices; every rank must enter. | |
| void | postprocess () |
| Collective: distributes the source fields, runs every projector with a barrier each, so the projector list must be identical on all ranks. | |
| Cell< Block * > & | blocks () |
| The blocks of this manager; owned here, the container is a view. | |
| Cell< SideSet * > & | sidesets () |
| The sidesets of this manager; owned here, the container is a view. | |
| index_t | number_of_wetted_nodes () const |
| return the number of wetted nodes ( nodes on sidesets with a Neumann or Alpha BC ) | |
| void | disconnect_dofs_from_mesh () |
| dofmgr::EigenValues * | eigen_values () |
| Borrowed from this manager, which owns it. | |
| Element * | element (const id_t aID) |
| One element by ID, through the element cache; borrowed. | |
| bool | element_exists (const id_t aID) const |
| Cell< Dof * > & | abstract_dofs () |
| Public Member Functions inherited from belfem::fem::DofManagerBase | |
| DofManagerBase (const DofManagerType aType, Kernel *aParent) | |
| virtual | ~DofManagerBase ()=default |
| DofManagerType | type () const |
| proc_t | rank () const |
| return the rank of this proc ( faster than comm_rank() ) | |
| Mesh * | mesh () |
| Kernel * | parent () |
| IWG * | iwg () |
| Vector< real > & | field_data (const string &aLabel) |
| virtual uint | number_of_dofs_per_node () const |
| virtual uint | number_of_dofs_per_edge () const |
| bool | is_master () const |
| virtual void | print_worst_dof () |
| virtual void | write_residuals_to_mesh () |
Additional Inherited Members | |
| Protected Attributes inherited from belfem::fem::DofManagerBase | |
| Kernel * | mParent |
| Mesh * | mMesh |
| IWG * | mIWG = nullptr |
| const proc_t | mCommRank |
Main workhorse: DOF management, assembly coordination and the solver interface.
Borrows aParent, which owns this manager.
aIndex is this manager's index in the kernel.
|
override |
| real belfem::fem::DofManager::absolute_residual | ( | ) | const |
absolute residual norm of the last residual() call
Reimplemented from belfem::fem::DofManagerBase.
|
inlineoverridevirtual |
Reimplemented from belfem::fem::DofManagerBase.
|
inlineoverridevirtual |
Reimplemented from belfem::fem::DofManagerBase.
The blocks of this manager; owned here, the container is a view.
|
inlineoverridevirtual |
Reimplemented from belfem::fem::DofManagerBase.
|
inline |
|
inlineoverridevirtual |
Reimplemented from belfem::fem::DofManagerBase.
|
inlineoverridevirtual |
Reimplemented from belfem::fem::DofManagerBase.
| void belfem::fem::DofManager::collect_field | ( | const string & | aFieldLabel | ) |
Collects one field, with barriers before and after collection.
Collective, a gather to the master rank: the workers send their packed node data, the master receives ( a barrier inside ).
Reimplemented from belfem::fem::DofManagerBase.
| void belfem::fem::DofManager::compute_full_matrices | ( | ) |
| void belfem::fem::DofManager::compute_jacobian | ( | const bool | aReset = true | ) |
Collective: every rank assembles and the matrices are collected across ranks.
The first call initializes the system, and the stored eigenvalues become void. The three compute_* below share this contract.
| void belfem::fem::DofManager::compute_jacobian_and_rhs | ( | const bool | aReset = true | ) |
| void belfem::fem::DofManager::compute_residual | ( | ) |
phase 1 of the two-phase iterative solve: residual of the committed state under the current assembly, no update
| void belfem::fem::DofManager::compute_rhs | ( | const bool | aReset = true | ) |
Collective: every rank assembles its loads and they are collected here; a single right-hand side only ( asserted ).
| void belfem::fem::DofManager::create_fields | ( | IWG * | aIWG | ) |
check that the fields demanded by the IWG exist on the mesh and create them otherwise
|
inline |
| void belfem::fem::DofManager::disconnect_dofs_from_mesh | ( | ) |
|
overridevirtual |
Collective and asymmetric, the inverse of collect_fields(): the master sends, the workers receive; not a broadcast.
Reimplemented from belfem::fem::DofManagerBase.
return a specific dof
Reimplemented from belfem::fem::DofManagerBase.
|
inlineoverridevirtual |
Reimplemented from belfem::fem::DofManagerBase.
The non-hanging dofs, free and fixed ( hanging dofs live in DofData::hanging_dofs() ).
Owned by DofData; the container is a view and every accessor of this class hands out borrowed pointers that a reset of the dof data invalidates.
|
inline |
Borrowed from this manager, which owns it.
One element by ID, through the element cache; borrowed.
|
inline |
|
inline |
| void belfem::fem::DofManager::extract_abstract_dofs_from_mesh | ( | ) |
| real belfem::fem::DofManager::fixed_point_residual | ( | ) | const |
fixed-point residual ||G(x)-x|| / ||x|| of the last Anderson update ( REAL_MAX while Anderson is off )
Resizes aLHS and fills it in DOF order: free DOFs first, then fixed.
|
inline |
|
inline |
|
inline |
| void belfem::fem::DofManager::init_dof_values | ( | ) |
|
overridevirtual |
Reimplemented from belfem::fem::DofManagerBase.
| void belfem::fem::DofManager::initialize | ( | const bool | aSeedFreeDofsOnly | ) |
seed-mode overload: aSeedFreeDofsOnly = true skips the fixed-dof dof -> field write during init_dof_values(), so fields restored before this call ( load_memdump ) survive at Dirichlet nodes. The zero-arg override above must stay: it keeps base-pointer callers on full-mode virtual dispatch
| void belfem::fem::DofManager::initialize_postprocessors | ( | ) |
Collective: computes the projection matrices; every rank must enter.
compute the matrices for the projections
|
inlineoverridevirtual |
Reimplemented from belfem::fem::DofManagerBase.
|
inlineoverridevirtual |
true once initialize() has frozen the free/fixed dof split and the matrix graphs; a first fix() of a free dof after that point changes a classification the solver containers are sized for ( see SideSet::impose_dirichlet )
Reimplemented from belfem::fem::DofManagerBase.
| void belfem::fem::DofManager::load_system | ( | const string & | aPath | ) |
|
inline |
return the number of wetted nodes ( nodes on sidesets with a Neumann or Alpha BC )
| void belfem::fem::DofManager::postprocess | ( | ) |
Collective: distributes the source fields, runs every projector with a barrier each, so the projector list must be identical on all ranks.
perform the L2 projections for the secondary fields
|
inline |
Owned by this manager; the container is a view.
expose the projector arrays
| real belfem::fem::DofManager::pre_update_residual | ( | ) | const |
pre-update residual of the entry state under the current assembly ( Newton iterates only, QUIET_NAN otherwise ) — the honest backtracking reference for the controller's line search
| void belfem::fem::DofManager::print | ( | const proc_t | aRank = 0 | ) |
Prints only on rank aRank.
It does not communicate.
| void belfem::fem::DofManager::reset_convection | ( | ) |
Collective ( a barrier and four broadcasts ): the convergence measure of iteration aIteration, identical on every rank afterwards; absolute_residual() is the unnormalized norm of the same step.
|
inline |
The assembled right-hand side as the solver data holds it: rank-local entries on the workers, the collected global vector on the master.
| void belfem::fem::DofManager::save_system | ( | const string & | aPath | ) |
| void belfem::fem::DofManager::seed_dof_values | ( | ) |
copy field values into the FREE dofs only ( fixed dofs keep their imposed values and do not write back into the field ). Call after the fields have been populated or restored — the initialize() pass seeds the dofs from whatever the fields held at that moment, and does not run again on this path ( only reset() via set_equation() clears the flag )
| void belfem::fem::DofManager::set_equation | ( | IWG * | aIWG | ) |
select the equation that is to be solved
| void belfem::fem::DofManager::set_solver | ( | const SolverParameters & | aParams | ) |
Collective: every rank constructs the solver ( whose constructor synchronizes the solver settings from rank 0 ), then performs a barrier.
Reimplemented from belfem::fem::DofManagerBase.
|
inlineoverridevirtual |
Reimplemented from belfem::fem::DofManagerBase.
|
inlineoverridevirtual |
Reimplemented from belfem::fem::DofManagerBase.
The sidesets of this manager; owned here, the container is a view.
| void belfem::fem::DofManager::solve | ( | ) |
Collective.
It requires an up-to-date Jacobian: compute_jacobian() must have run since the last solve ( BELFEM_ERROR otherwise ), and this call consumes it.
| bool belfem::fem::DofManager::solve_failed | ( | ) |
true if the last solve failed softly ( soft-fail contract, see solver::Wrapper ); rank-uniform
| void belfem::fem::DofManager::solve_from_residual | ( | ) |
phase 2: linear solve + update consuming compute_residual()'s result; must be entered on every rank
|
inline |
The solver is borrowed; this manager's solver data owns it.
|
inline |
|
overridevirtual |
Collective: a collect, a barrier, then a distribute.
Reimplemented from belfem::fem::DofManagerBase.
|
inline |
Block form of the assembled system, x = free dofs, y = fixed dofs: [ J D ] [ x ] [ f ] [ E I ] [ y ] = [ g ] The reduced system J x = f - D y solves for the unknowns; E x + I y = g gives the reactions at the fixed dofs.
The four accessors below hand out the blocks, borrowed from the solver data and invalidated by the next initialize().
| void belfem::fem::DofManager::zero | ( | ) |