Solver class

This is an abstract class for defining a general solver interface.

class femedu.solver.Solver.Solver

Abstract class for any solver implementation.

This class describes the functions needed by any solver

assemble(force_only=False)

A general assembler for mixed element types.

This method will build the out-of-balance force vector (residuum \({\bf R}\)) and the tangent stiffness matrix (\({\bf K}_t\)) used by most solvers.

Specialized solvers may overload this method.

Note

The solver will apply the global load factor to the reference load returned by nodes and elements. While nodes and elements are aware of that load factor, they shall apply it only if asked explicity by passing apply_load_factor=True to the respective access functions.

Parameters:

force_only – set to True if only the residual force needs to be assembled

checkStability(verbose=True, **kwargs)

Computes the stability index as

  • \(\mathop{det}([{\bf K}_t])\) for systems with less than 25 d.o.f.s

  • \(\min\lambda_i\) where \(\lambda_i\) are the eigenvalues of \({\bf K}_t\)

Parameters:
  • verbose – set to True for log info

  • num_eigen – if set to a value greater than 0, show the num_eigen eigenvalues closest to the current load level.

Returns:

stability index

fetchState()

Fetch the current state of the solver.

state is defined as a dictionary with the following contents:

model

pointer to the linked model (required)

nodes

list of node pointers (required)

elements

list of element pointers (required)

P0

system vector of initial forces

Pref

system vector of reference forces

u1

system vector of current (converged) displacements

un

system vector of previous (converged) displacements

lam1

load level of current (converged) displacements

lamn

load level of previous (converged) displacements

Returns:

state of the solver

getBucklingMode(mode=0, **kwargs)

Perform an eigen-analysis on \({\bf K}_t\) for the requested mode. Default is the mode with the smallest absolute eigenvalue (\(\min\{\lambda_i\}\))

The mode shape will be pushed to the nodes.

Note

Use System.plotBucklingMode() for plotting of the eigenmode (see System class). This plotting method will be replaced by System.plot(...) in a future release.

Returns:

the eigenvalue, \(\lambda_{\mathtt{mode}}\)

initArcLength(load_increment=1.0, alpha=0.0, tolerance=1e-12)

This method may be implemented by a nonlinear solver

initialize()
on_converged()

This function needs to be called once a converged state was achieved by the solver.

It tells all components to update its state to “converged”

pushState(state)

Pushes state to the solver. The solver will use that data to update it’s internal state.

state is defined as a dictionary with the following contents:

model

pointer to the linked model (required)

nodes

list of node pointers (required)

elements

list of element pointers (required)

P0

system vector of initial forces

Pref

system vector of reference forces

u1

system vector of current (converged) displacements

un

system vector of previous (converged) displacements

lam1

load level of current (converged) displacements

lamn

load level of previous (converged) displacements

Parameters:

state – state of the solver

recordThisStep()

initiate writing of the current state to all existing recorders. (system, nodes, elements, materials - as supported by those objects)

Note

This method is automatically initiated by the solver for every converged solution. No data will be recorded if a load step fails to converge to the target tolerance.

Additional states can be recorded from the System object.

reset()
resetDisplacements()

Reset displacement vector to all zeros.

resetForces()

Reset force vector to all zeros.

revert()

This function needs to be called if the iterative procedure fails to converge.

It will revert the entire system to the last converged state.

setDisplacementControl(node, dof, target)

activate displacement control for the next load step

setLoadFactor(lam)

Set the target load factor to lam

This enables load control and disables alternative control methods such as displacement control or arc-length control.

The entered load pattern is considered a reference load, to be multiplied by a scalar load factor, \(\lambda\).

If no load factor is set explicitly, a factor of 1.0 is assumed, i.e., the entire entered load is applied in full.

solve(**kwargs)
stepArcLength(verbose=False)

This method may be implemented by a nonlinear solver

Derived Classes