BELFEM 0.9.3
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
belfem::fem::DofManager Class Reference

Main workhorse: DOF management, assembly coordination and the solver interface. More...

#include <cl_FEM_DofManager.hpp>

Inheritance diagram for belfem::fem::DofManager:
[legend]
Collaboration diagram for belfem::fem::DofManager:
[legend]

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

Detailed Description

Main workhorse: DOF management, assembly coordination and the solver interface.

See also
DofManager and FEM Kernel Usage Guide

Constructor & Destructor Documentation

◆ DofManager()

belfem::fem::DofManager::DofManager ( Kernel * aParent,
const index_t aIndex )

Borrows aParent, which owns this manager.

aIndex is this manager's index in the kernel.

◆ ~DofManager()

belfem::fem::DofManager::~DofManager ( )
override

Member Function Documentation

◆ absolute_residual()

real belfem::fem::DofManager::absolute_residual ( ) const

absolute residual norm of the last residual() call

◆ abstract_dofs()

Cell< Dof * > & belfem::fem::DofManager::abstract_dofs ( )
inline

◆ bearing()

Bearing * belfem::fem::DofManager::bearing ( const id_t aID)
inline

◆ block()

Block * belfem::fem::DofManager::block ( const id_t aID)
inlineoverridevirtual

Reimplemented from belfem::fem::DofManagerBase.

◆ block_exists()

bool belfem::fem::DofManager::block_exists ( const id_t & aID) const
inlineoverridevirtual

Reimplemented from belfem::fem::DofManagerBase.

◆ block_integration_order()

uint belfem::fem::DofManager::block_integration_order ( ) const
inlineoverridevirtual

Reimplemented from belfem::fem::DofManagerBase.

◆ blocks()

Cell< Block * > & belfem::fem::DofManager::blocks ( )
inline

The blocks of this manager; owned here, the container is a view.

◆ calculate_dof_id() [1/4]

id_t belfem::fem::DofManager::calculate_dof_id ( const mesh::Edge * aEdge,
const uint aDofType ) const
inlineoverridevirtual

Reimplemented from belfem::fem::DofManagerBase.

◆ calculate_dof_id() [2/4]

id_t belfem::fem::DofManager::calculate_dof_id ( const mesh::Face * aFace,
const uint aDofType ) const
inline

◆ calculate_dof_id() [3/4]

id_t belfem::fem::DofManager::calculate_dof_id ( const mesh::Facet * aFacet,
const uint aDofType ) const
inlineoverridevirtual

Reimplemented from belfem::fem::DofManagerBase.

◆ calculate_dof_id() [4/4]

id_t belfem::fem::DofManager::calculate_dof_id ( const mesh::Node * aNode,
const uint aDofType ) const
inlineoverridevirtual

Reimplemented from belfem::fem::DofManagerBase.

◆ collect_field()

void belfem::fem::DofManager::collect_field ( const string & aFieldLabel)

Collects one field, with barriers before and after collection.

◆ collect_fields()

void belfem::fem::DofManager::collect_fields ( const Cell< string > & aFieldLabels)
overridevirtual

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.

◆ compute_full_matrices()

void belfem::fem::DofManager::compute_full_matrices ( )

◆ compute_jacobian()

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.

◆ compute_jacobian_and_rhs()

void belfem::fem::DofManager::compute_jacobian_and_rhs ( const bool aReset = true)

◆ compute_residual()

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

◆ compute_rhs()

void belfem::fem::DofManager::compute_rhs ( const bool aReset = true)

◆ compute_volume_loads()

void belfem::fem::DofManager::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 ).

◆ create_fields()

void belfem::fem::DofManager::create_fields ( IWG * aIWG)

check that the fields demanded by the IWG exist on the mesh and create them otherwise

◆ dirichlet()

SpMatrix * belfem::fem::DofManager::dirichlet ( )
inline

◆ disconnect_dofs_from_mesh()

void belfem::fem::DofManager::disconnect_dofs_from_mesh ( )

◆ distribute_fields()

void belfem::fem::DofManager::distribute_fields ( const Cell< string > & aFieldLabels)
overridevirtual

Collective and asymmetric, the inverse of collect_fields(): the master sends, the workers receive; not a broadcast.

Reimplemented from belfem::fem::DofManagerBase.

◆ dof()

Dof * belfem::fem::DofManager::dof ( const id_t aID)
inlineoverridevirtual

return a specific dof

Reimplemented from belfem::fem::DofManagerBase.

◆ dof_exists()

bool belfem::fem::DofManager::dof_exists ( const id_t aID) const
inlineoverridevirtual

Reimplemented from belfem::fem::DofManagerBase.

◆ dofs()

Cell< Dof * > & belfem::fem::DofManager::dofs ( )
inline

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.

◆ eigen_values()

dofmgr::EigenValues * belfem::fem::DofManager::eigen_values ( )
inline

Borrowed from this manager, which owns it.

◆ element()

Element * belfem::fem::DofManager::element ( const id_t aID)
inline

One element by ID, through the element cache; borrowed.

◆ element_exists()

bool belfem::fem::DofManager::element_exists ( const id_t aID) const
inline

◆ enforcement()

SpMatrix * belfem::fem::DofManager::enforcement ( )
inline

◆ extract_abstract_dofs_from_mesh()

void belfem::fem::DofManager::extract_abstract_dofs_from_mesh ( )

◆ fixed_point_residual()

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 )

◆ full_lhs()

void belfem::fem::DofManager::full_lhs ( Vector< real > & aLHS)

Resizes aLHS and fills it in DOF order: free DOFs first, then fixed.

◆ full_mass()

SpMatrix * belfem::fem::DofManager::full_mass ( )
inline

◆ full_stiffness()

SpMatrix * belfem::fem::DofManager::full_stiffness ( )
inline

◆ imposition()

SpMatrix * belfem::fem::DofManager::imposition ( )
inline

◆ init_dof_values()

void belfem::fem::DofManager::init_dof_values ( )

◆ initialize() [1/2]

void belfem::fem::DofManager::initialize ( )
overridevirtual

Reimplemented from belfem::fem::DofManagerBase.

◆ initialize() [2/2]

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

◆ initialize_postprocessors()

void belfem::fem::DofManager::initialize_postprocessors ( )

Collective: computes the projection matrices; every rank must enter.

compute the matrices for the projections

◆ integration_scheme()

IntegrationScheme belfem::fem::DofManager::integration_scheme ( ) const
inlineoverridevirtual

Reimplemented from belfem::fem::DofManagerBase.

◆ is_initialized()

bool belfem::fem::DofManager::is_initialized ( ) const
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.

◆ load_system()

void belfem::fem::DofManager::load_system ( const string & aPath)

◆ number_of_wetted_nodes()

index_t belfem::fem::DofManager::number_of_wetted_nodes ( ) const
inline

return the number of wetted nodes ( nodes on sidesets with a Neumann or Alpha BC )

Returns

◆ postprocess()

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

◆ postprocessors()

Cell< Postprocessor * > & belfem::fem::DofManager::postprocessors ( )
inline

Owned by this manager; the container is a view.

expose the projector arrays

◆ pre_update_residual()

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

◆ print()

void belfem::fem::DofManager::print ( const proc_t aRank = 0)

Prints only on rank aRank.

It does not communicate.

◆ reset_convection()

void belfem::fem::DofManager::reset_convection ( )

◆ residual()

real belfem::fem::DofManager::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.

◆ rhs_norm()

real belfem::fem::DofManager::rhs_norm ( )
inline

◆ rhs_vector()

Vector< real > & belfem::fem::DofManager::rhs_vector ( )
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.

◆ save_system()

void belfem::fem::DofManager::save_system ( const string & aPath)

◆ seed_dof_values()

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 )

◆ set_equation()

void belfem::fem::DofManager::set_equation ( IWG * aIWG)

select the equation that is to be solved

◆ set_solver()

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.

◆ sideset()

SideSet * belfem::fem::DofManager::sideset ( const id_t aID)
inlineoverridevirtual

Reimplemented from belfem::fem::DofManagerBase.

◆ sideset_exists()

bool belfem::fem::DofManager::sideset_exists ( const id_t & aID) const
inlineoverridevirtual

Reimplemented from belfem::fem::DofManagerBase.

◆ sideset_integration_order()

uint belfem::fem::DofManager::sideset_integration_order ( ) const
inlineoverridevirtual

Reimplemented from belfem::fem::DofManagerBase.

◆ sidesets()

Cell< SideSet * > & belfem::fem::DofManager::sidesets ( )
inline

The sidesets of this manager; owned here, the container is a view.

◆ solve()

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.

◆ solve_failed()

bool belfem::fem::DofManager::solve_failed ( )

true if the last solve failed softly ( soft-fail contract, see solver::Wrapper ); rank-uniform

◆ solve_from_residual()

void belfem::fem::DofManager::solve_from_residual ( )

phase 2: linear solve + update consuming compute_residual()'s result; must be entered on every rank

◆ solver()

Solver * belfem::fem::DofManager::solver ( )
inline

The solver is borrowed; this manager's solver data owns it.

◆ solver_data()

dofmgr::SolverData * belfem::fem::DofManager::solver_data ( )
inline

◆ synchronize_fields()

void belfem::fem::DofManager::synchronize_fields ( const Cell< string > & aFieldLabels)
overridevirtual

Collective: a collect, a barrier, then a distribute.

Reimplemented from belfem::fem::DofManagerBase.

◆ system_matrix()

SpMatrix * belfem::fem::DofManager::system_matrix ( )
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().

◆ zero()

void belfem::fem::DofManager::zero ( )

The documentation for this class was generated from the following files: