BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
belfem::fem Namespace Reference

Namespaces

namespace  calculator
namespace  dofmgr
namespace  facetintpoints
namespace  maxwell

Classes

class  Bearing
class  Block
class  Calculator
class  Controller
 Nonlinear iteration controller: relaxation, timestep adaptation and convergence policy. More...
class  Dof
class  DofManager
 this class creates the DOFs based on the passed equation object. More...
class  DofManagerBase
 abstract interface of the dof manager as seen by the group classes and the IWG; DofManager is its only implementation More...
struct  DofTable
 the dof table contains the dofs per block and sideset More...
class  Domain
class  EdgeFunction
 the edge function base class More...
class  EdgeFunctionFactory
 Creates edge functions by element type. More...
class  EF_HEX8
class  EF_HEX8TB
 Edge function for the HEX8TB side-connector wall element. More...
class  EF_HEX8TS
class  EF_LINE3
 edge function for thin shell More...
class  EF_PENTA6TS
class  EF_QUAD4TS
class  EF_TET10
class  EF_TET4
class  EF_TRI3
class  EF_TRI6
class  Element
class  ElementMapper
 Inverse element map: given physical coordinates aX inside an element, solves x(xi) = aX for the natural coordinates xi. More...
class  Gradient
 Gradient recovery on a solved mesh. More...
class  Group
class  IntegrationData
 Precomputed bundle of integration points, weights and shape-function values. More...
class  InterpolationFunction
 the shape function base class More...
class  InterpolationFunctionFactory
 Creates shape functions by element and interpolation type. More...
class  InterpolationFunctionTemplate
 shape function templated class G : Geometry T : Type D : Dimension B : Number of Basis More...
class  IWG
 Prototype for Integrator of Weak Form Governing Equation. More...
class  IWG_Maxwell
 Main electromagnetic integral weak form (h-phi formulation). More...
class  IWG_MaxwellPostproc
class  IWG_MaxwellThermal
 Transient heat conduction coupled to the Maxwell solution. More...
class  IWG_Poisson
class  IWG_StaticHeatConduction
class  IWG_Timestep
 Base class for transient problems. More...
class  IWG_TransientHeatConduction
class  IwgFactory
 Creates IWG instances by equation type. More...
class  Kernel
 Top-level orchestrator; owns the mesh, materials, boundary conditions and DOF managers. More...
class  KernelParameters
class  MaxwellBoundaryConditionFactory
 Builds the physical boundary conditions of a Maxwell problem. More...
class  MaxwellFactory
 High-level orchestrator that builds a Maxwell problem from an input deck. More...
class  MaxwellPostprocessor
 Field recovery for B, H, J and J/Jc. More...
class  PhysicalBoundaryCondition
class  Postprocessor
class  SideSet
class  ThermalBoundaryConditionFactory
 Builds the thermal boundary conditions from the input deck. More...
class  ThermalFactory
 Builds the thermal kernel from an input deck, standalone or coupled to a magnetic kernel. More...
class  TimestepMatrices
 Container for element-level DENSE matrices in transient nonlinear FEM. More...
class  Tmatrix

Enumerations

enum class  MatrixFlag : index_t {
  M = 0 , D = 1 , K = 2 , F = 3 ,
  dMdX_times_x = 4 , dMdX_times_h = 5 , dKdX_times_x = 6 , dFdX = 7
}
 Flags indicating which matrices/vectors have been set by the IWG. More...
enum class  SideSetDofLinkMode {
  FacetOnly = 0 , FacetAndMaster = 1 , FacetAndSlave = 2 , MasterAndSlave = 3 ,
  Cut = 4 , Inactive = 5 , UNDEFINED = 6
}
 how the dofs of a sideset element are linked to its facet, master and slave elements ( six modes plus UNDEFINED ) More...
enum class  BoundaryConditionImposing {
  Free = 0 , Dirichlet = 1 , Neumann = 2 , Alpha = 3 ,
  Lambda = 4 , Weak = 5 , UNDEFINED = 6
}
enum class  BoundaryConditionType {
  Neumann , Dirichlet , Bearing , Gauge ,
  Current , Voltage , CircuitCurrent , CircuitVoltage ,
  Background , BackgroundDirichlet , UNDEFINED
}
enum class  GroupActivationMode { GeometryAndDofs = 0 , GeometryOnly = 1 , Inactive = 2 }
 Defines how a fem::Block or fem::SideSet is activated based on its DomainType. More...
enum class  SolverAlgorithm { Direct = 0 , NewtonRaphson = 1 , Picard = 2 , UNDEFINED = 3 }
enum class  MaxwellPostprocessorType {
  Air , Ferro , Conductor , SuperConductor ,
  ThinShellConductor , ThinShellSuperConductor , SideConnector , UNDEFINED
}

Functions

void initialize_integration_points (const ElementType &aElementType, Vector< real > &aWeights, Matrix< real > &aPoints, const uint aIntegrationOrder, const IntegrationScheme aIntegrationScheme)
void initialize_integration_points (const GeometryType &aGeometryType, Vector< real > &aWeights, Matrix< real > &aPoints, const uint aIntegrationOrder, const IntegrationScheme aIntegrationScheme)
void initialize_integration_points_on_facet (const ElementType aElementType, const uint aSideIndex, Vector< real > &aWeights, Matrix< real > &aPoints, const uint aIntegrationOrder, const IntegrationScheme aIntegrationScheme)
void initialize_integration_points_on_facet (const ElementType aElementType, const uint aSideIndex, const uint aOrientation, Vector< real > &aWeights, Matrix< real > &aPoints, const uint aIntegrationOrder, const IntegrationScheme aIntegrationScheme)
InterpolationFunctioninitialize_shape_function (const ElementType &aElementType, const Matrix< real > &aXi, Cell< Matrix< real > > &aN, Cell< Matrix< real > > &adNdXi, Cell< Matrix< real > > &ad2NdXi2)
uint num_nedelec_dofs (const ElementType aElementType)
void compute_h_trace (Calculator *aNormalCalc, const bool aMaster, const bool aIsConductor, const Vector< real > &aPhi, Vector< real > &aScratch, Vector< real > &aH)
 Full field trace of one volume side of a thin-shell facet, for linear elements ( the k = 0 contract of compute_hn ):
const Vector< real > & compute_hn (Calculator *aCalc, const uint k)
 Computes the purely-normal magnetic field hn at the thin-shell facet: the average of the master and slave volume traces ( compute_h_trace, per-side dispatch phi-region / h-conductor ), projected onto the facet normal.
bool pin_dirichlet_dof (const DofManagerBase *aParent, Dof *aDof, const real aValue, const id_t aGroupID, const id_t aNodeID, index_t &aNumFirstFlips)
 shared Dirichlet pin for a single node dof, used by SideSet::impose_dirichlet and the Maxwell factory pre-fix loop so both sites apply ONE shape test.
string to_string (const BoundaryConditionType aBoundaryConditiontype)
BoundaryConditionType boundary_condition_type (const string &aString)
bool has_block_global (const BoundaryConditionType aBoundaryConditionType)
 true if a condition of this type publishes its imposed value as a mesh global named after its deck block.
uint anderson_mixing_step (const Vector< real > &aX, const Vector< real > &aR, const ShiftRegister< Vector< real > > &aXHistory, const ShiftRegister< Vector< real > > &aRHistory, const real aBeta, Matrix< real > &aDeltaR, Vector< real > &aRhs, Vector< real > &aWork, Vector< real > &aGamma, Vector< real > &aColNorm, Vector< real > &aXNew)
 one type-II Anderson mixing step (Walker & Ni 2011) for the fixed-point iteration x <- G( x ) with residual r = G( x ) - x :
const input::Sectionwinning_nonlinear_section (const input::Section *aSolver)
 The nonlinear section the penalty blocks are read from: the same alias rule Controller::set_params applies to every key in it – nonlinear magnetic wins over nonlinear, and a block under the losing section is silently ignored.
real read_ghost_eta (const input::Section *aSolver)
 The Nitsche ghost switch as the deck states it, read from the solver section:
bool ghost_facets_requested (const input::Section *aSolver)
 true if the deck asks for duplicate interface dofs and ghost facets
bool ghost_facets_requested (const InputFile &aInputFile)
void mises_planestress (DofManagerBase *aField)
void T_h_picard (Calculator *aCalc, TimestepMatrices *aMatrices)
 Collapsed thermal Picard kernel: all per-point material math is delegated to aCalc->maxwell() ( thermal-side instance; the Maxwell peer element is linked automatically by Calculator::link ), whose constructor-time dispatch covers the bulk/thin-shell, metal/alloy/ HTS, defect, and piecewise axes.
void T_h_newton (Calculator *aCalc, TimestepMatrices *aMatrices)
void T_phi (Calculator *aCalc, TimestepMatrices *aMatrices)

Variables

constexpr real gBearingUnitWeightTol = BELFEM_EPSILON
constexpr real gAndersonGammaMax = 1.0e2

Enumeration Type Documentation

◆ BoundaryConditionImposing

Enumerator
Free 
Dirichlet 
Neumann 
Alpha 
Lambda 
Weak 
UNDEFINED 

◆ BoundaryConditionType

Enumerator
Neumann 
Dirichlet 
Bearing 
Gauge 
Current 
Voltage 
CircuitCurrent 
CircuitVoltage 
Background 
BackgroundDirichlet 
UNDEFINED 

◆ GroupActivationMode

Defines how a fem::Block or fem::SideSet is activated based on its DomainType.

Enumerator
GeometryAndDofs 
GeometryOnly 
Inactive 

◆ MatrixFlag

enum class belfem::fem::MatrixFlag : index_t
strong

Flags indicating which matrices/vectors have been set by the IWG.

The IWG declares in its constructor which matrices it will populate; initialize() sizes exactly those, reset() zeroes them, and the time-stepping scheme reads the flags to know what to include in assembly.

Enumerator

Mass matrix.

Damping matrix (reserved for second-order).

Stiffness matrix.

Force vector.

dMdX_times_x 

Contracted mass derivative: (dM_ik/dx_j) * x_k.

dMdX_times_h 

Contracted mass derivative with history: (dM_ik/dx_j) * h_k.

dKdX_times_x 

Contracted stiffness derivative.

dFdX 

Force vector Jacobian df_i/dx_j.

◆ MaxwellPostprocessorType

Enumerator
Air 
Ferro 
Conductor 
SuperConductor 
ThinShellConductor 
ThinShellSuperConductor 
SideConnector 
UNDEFINED 

◆ SideSetDofLinkMode

how the dofs of a sideset element are linked to its facet, master and slave elements ( six modes plus UNDEFINED )

Enumerator
FacetOnly 
FacetAndMaster 
FacetAndSlave 
MasterAndSlave 
Cut 
Inactive 
UNDEFINED 

◆ SolverAlgorithm

enum class belfem::fem::SolverAlgorithm
strong
Enumerator
Direct 
NewtonRaphson 
Picard 
UNDEFINED 

Function Documentation

◆ anderson_mixing_step()

uint belfem::fem::anderson_mixing_step ( const Vector< real > & aX,
const Vector< real > & aR,
const ShiftRegister< Vector< real > > & aXHistory,
const ShiftRegister< Vector< real > > & aRHistory,
const real aBeta,
Matrix< real > & aDeltaR,
Vector< real > & aRhs,
Vector< real > & aWork,
Vector< real > & aGamma,
Vector< real > & aColNorm,
Vector< real > & aXNew )
inline

one type-II Anderson mixing step (Walker & Ni 2011) for the fixed-point iteration x <- G( x ) with residual r = G( x ) - x :

gamma = argmin || r_k - DR * gamma ||_2 x_{k+1} = x_k + beta r_k - ( DX + beta DR ) gamma

where the difference columns DR / DX are formed from the committed history (newest aXHistory.size() snapshots) chained with the current pair ( aX, aR ). The least-squares solve runs on column-normalized DR via QR ( gels ); gamma is un-scaled afterwards.

Failure policy: a rank-deficient solve ( info > 0 ), a non-finite or oversized gamma ( gAndersonGammaMax ), or a vanishing difference column drops the OLDEST column and retries once; if the retry fails too, the plain relaxed Picard step x + beta r is written instead. An illegal-argument error ( info < 0 ) is a programming error and always aborts.

With an empty history ( or on fallback ) the result is exactly the relaxed Picard step: x_{k+1} = ( 1 - beta ) x + beta G( x ).

All scratch is caller-owned and must be presized: aDeltaR to n x depth, aRhs to n, aGamma and aColNorm to depth. aWork is grown to the optimal gels size on first use and reused thereafter.

Returns
number of history columns used ( 0 = plain step )

◆ boundary_condition_type()

BoundaryConditionType belfem::fem::boundary_condition_type ( const string & aString)

◆ compute_h_trace()

void belfem::fem::compute_h_trace ( Calculator * aNormalCalc,
const bool aMaster,
const bool aIsConductor,
const Vector< real > & aPhi,
Vector< real > & aScratch,
Vector< real > & aH )
inline

Full field trace of one volume side of a thin-shell facet, for linear elements ( the k = 0 contract of compute_hn ):

  • phi-side ( node-interpolated volume: air, ferro, buffer ): h = -B_sigma( 0 ) * phi_sigma, constant on a linear element ( Alves et al. 2022b, h0 = -grad phi-, hN = -grad phi+ );
  • h-side ( DomainType::Conductor, edge-interpolated, no phi ): h = integration-weighted mean over the facet rule of E_sigma( k ) * q_sigma, the conductor's own Nedelec trace. A lowest-order Nedelec field is a + b x r, so its normal component is linear over the facet and the weighted mean is the exact centroid value in 2D and 3D, independent of the rule's point ordering ( in 3D point 0 of the default 7-point rule already is the centroid; in 2D it is not ). The rule rests on [ n . B ] = 0 across the sheet with mu = mu0 on the conductor side, so n . h is continuous — the factory refuses a magnetic conductor next to a shell for that reason ( MaxwellFactory::assign_materials ).

aNormalCalc : the tape-sideset calculator from get_normal_calculator() aMaster : master ( true ) or slave ( false ) side aIsConductor: true if that side is an h-conductor ( edge trace ), false for a phi-region aPhi : nodal phi of that side ( phi-side only ) aScratch : a d-vector on the caller's calculator aH : result, a d-vector on the caller's calculator

◆ compute_hn()

const Vector< real > & belfem::fem::compute_hn ( Calculator * aCalc,
const uint k )
inline

Computes the purely-normal magnetic field hn at the thin-shell facet: the average of the master and slave volume traces ( compute_h_trace, per-side dispatch phi-region / h-conductor ), projected onto the facet normal.

Result is written into aCalc->vector("hn") and also returned. For flat linear shells call once with k=0 outside the loop.

◆ ghost_facets_requested() [1/2]

bool belfem::fem::ghost_facets_requested ( const input::Section * aSolver)
inline

true if the deck asks for duplicate interface dofs and ghost facets

◆ ghost_facets_requested() [2/2]

bool belfem::fem::ghost_facets_requested ( const InputFile & aInputFile)
inline

the same, from the whole deck; a deck without a solver section has no ghost

◆ has_block_global()

bool belfem::fem::has_block_global ( const BoundaryConditionType aBoundaryConditionType)

true if a condition of this type publishes its imposed value as a mesh global named after its deck block.

False for Bearing, which imposes a bare node constraint with no evaluated scalar, and for the four terminal types: their value AND its response are written by Controller::save_IV as one I/U pair per condition, so a block global would duplicate the I half under a second name

◆ initialize_integration_points() [1/2]

void belfem::fem::initialize_integration_points ( const ElementType & aElementType,
Vector< real > & aWeights,
Matrix< real > & aPoints,
const uint aIntegrationOrder,
const IntegrationScheme aIntegrationScheme )

◆ initialize_integration_points() [2/2]

void belfem::fem::initialize_integration_points ( const GeometryType & aGeometryType,
Vector< real > & aWeights,
Matrix< real > & aPoints,
const uint aIntegrationOrder,
const IntegrationScheme aIntegrationScheme )

◆ initialize_integration_points_on_facet() [1/2]

void belfem::fem::initialize_integration_points_on_facet ( const ElementType aElementType,
const uint aSideIndex,
const uint aOrientation,
Vector< real > & aWeights,
Matrix< real > & aPoints,
const uint aIntegrationOrder,
const IntegrationScheme aIntegrationScheme )

◆ initialize_integration_points_on_facet() [2/2]

void belfem::fem::initialize_integration_points_on_facet ( const ElementType aElementType,
const uint aSideIndex,
Vector< real > & aWeights,
Matrix< real > & aPoints,
const uint aIntegrationOrder,
const IntegrationScheme aIntegrationScheme )

◆ initialize_shape_function()

InterpolationFunction * belfem::fem::initialize_shape_function ( const ElementType & aElementType,
const Matrix< real > & aXi,
Cell< Matrix< real > > & aN,
Cell< Matrix< real > > & adNdXi,
Cell< Matrix< real > > & ad2NdXi2 )

◆ mises_planestress()

void belfem::fem::mises_planestress ( DofManagerBase * aField)

◆ num_nedelec_dofs()

uint belfem::fem::num_nedelec_dofs ( const ElementType aElementType)

◆ pin_dirichlet_dof()

bool belfem::fem::pin_dirichlet_dof ( const DofManagerBase * aParent,
Dof * aDof,
const real aValue,
const id_t aGroupID,
const id_t aNodeID,
index_t & aNumFirstFlips )

shared Dirichlet pin for a single node dof, used by SideSet::impose_dirichlet and the Maxwell factory pre-fix loop so both sites apply ONE shape test.

If the dof is condensed onto a single source with unit weight, the SOURCE is fixed to aValue / weight and the function returns true ( incrementing aNumFirstFlips when the source was still free ); every other shape returns false and the CALLER keeps its historical behaviour. BELFEM_ERRORs on a non-unit single-source weight, a broken source, or a first free-to-fixed flip after aParent->is_initialized(). Call only for non-duplicate nodes: duplicate-pair condensations ( cuts, thin shells ) can carry an inhomogeneous relation that a plain source pin would violate.

◆ read_ghost_eta()

real belfem::fem::read_ghost_eta ( const input::Section * aSolver)
inline

The Nitsche ghost switch as the deck states it, read from the solver section:

-1 no nitsche ghost penalty block -> ghost OFF ( opt-in ) 0 eta : 0 -> ghost OFF >0 eta : <value> -> ghost ON with that eta

A present block without eta is a setup error: k_reg alone cannot say whether the ghost is wanted, and an empty block that silently meant "off" would be indistinguishable from a typo.

ONE reader for three consumers – the thin-shell factory ( which decides whether duplicate interface dofs and ghost facets are created at all ), the controller ( which writes eta into the IWG ) and the mesh cache tag ( which must miss the cache when the switch flips ) – so the three cannot disagree about what "off" means. Setup-path code, called a handful of times per run

◆ T_h_newton()

void belfem::fem::T_h_newton ( Calculator * aCalc,
TimestepMatrices * aMatrices )

◆ T_h_picard()

void belfem::fem::T_h_picard ( Calculator * aCalc,
TimestepMatrices * aMatrices )

Collapsed thermal Picard kernel: all per-point material math is delegated to aCalc->maxwell() ( thermal-side instance; the Maxwell peer element is linked automatically by Calculator::link ), whose constructor-time dispatch covers the bulk/thin-shell, metal/alloy/ HTS, defect, and piecewise axes.

Dispatch in IWG_MaxwellThermal::link_to_group() is by domain type only.

The Newton companion T_h_newton adds the consistent tangent blocks ( dcp/dT with qhist contraction, the dlambda/dT mixed-operator outer product, and the drho/dT quench feedback — B and beta are frozen per thermal solve, not thermal dofs ); derivation in thermal_matrices_cleanup_and_newton_plan.md §3.

◆ T_phi()

void belfem::fem::T_phi ( Calculator * aCalc,
TimestepMatrices * aMatrices )

◆ to_string()

string belfem::fem::to_string ( const BoundaryConditionType aBoundaryConditiontype)

◆ winning_nonlinear_section()

const input::Section * belfem::fem::winning_nonlinear_section ( const input::Section * aSolver)
inline

The nonlinear section the penalty blocks are read from: the same alias rule Controller::set_params applies to every key in it – nonlinear magnetic wins over nonlinear, and a block under the losing section is silently ignored.

nullptr when neither exists or when aSolver itself is nullptr

Variable Documentation

◆ gAndersonGammaMax

real belfem::fem::gAndersonGammaMax = 1.0e2
constexpr

reject a mixing solution whose largest coefficient exceeds this bound: the least-squares system has gone near-collinear and the extrapolation would be dominated by noise. Engineering default, meaningful only together with the column normalization below; recalibrate from the gamma norms logged in validation runs.

◆ gBearingUnitWeightTol

real belfem::fem::gBearingUnitWeightTol = BELFEM_EPSILON
constexpr

a periodic pair hangs with exactly weight 1 ( a stored literal, no arithmetic on it ); anything measurably off unit is a different condensation shape and must not be pinned