System class

class femedu.domain.System.System(verbose=False)

class: representing a System model

addConstraint(*newConstraints)
Parameters:

newConstraints – one or more Constraint or a subclass objects

addElement(*newElements)
Parameters:

newElement – an Element object

addNode(*nodes)

Add one or more nodes to the model.

Parameters:

newNode – a Node object

beamValuePlot(variable, factor=0.0, filename=None, **kwargs)

Create a traditional beam value plot, i.e., moment and shear diagrams.

Parameters:
  • variable – string code for variable

  • deformed – True | False

  • filename (str) – if filename is given, store the plot to that file. Use proper file extensions to indicate the desired format (.png, .pdf)

checkStability(**kwdargs)

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\)

Implemented by Solver.

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

fetchRecord(keys=[])

Request recorded time history data for the listed keys. If a single key is given as a string, a single np.array() is returned. If a list of keys is given, a list of np.array() is returned.

Returns:

time history data for the listed keys.

findFacesAlongLine(pos, dir, orientation=0, tol=0.01)

Find any element faces within distance tol from the given target position (pos). If a 2d position is given for a 3d-problem, the input target defines a cylinder with a vertical axis (3rd direction) and radius tol. If a 3d position is given for a 2d-problem, the 3rd coordinate of pos will be ignored.

orientation

filter

0

Any face aligned with the plane will be returned

+1

Only faces with an outward normal pointing to the right of dir will be selected.

-1

Only faces with an outward normal pointing to the left of dir will be selected.

Parameters:
  • pos – a coordinate tuple (2d or 3d) defining th etarget position

  • dir – direction vector defining the orientation of the line

  • orientation – search filter

  • tol – search radius for find. Any node within distance tol will be returned.

Returns:

a list of tuples (node_pointer, distance)

findFacesOnPlane(pos, dir, orientation=0, tol=0.001)

Find any element faces within distance tol from the given target position (pos).

If a 2d position is given for a 3d-problem, the input target defines a cylinder with a vertical axis (3rd direction) and radius tol.

If a 3d position is given for a 2d-problem, the 3rd coordinate of pos will be ignored.

orientation

filter

0

Any face aligned with the plane will be returned

+1

Only faces with an outward normal pointing in the direction of dir will be selected.

-1

Only faces with an outward normal pointing against the direction of dir will be selected.

Parameters:
  • pos – a coordinate tuple (2d or 3d) defining th etarget position

  • dir – normal vector to the target plane

  • orientation – search filter

  • tol – search radius for find. Any node within distance tol will be returned.

Returns:

a list of tuples (element_ptr, face_ptr)

findNodesAlongLine(pos, dir, tol=0.001)

Find any node within distance tol from the given target position (pos).

If a 2d position is given for a 3d-problem, the input target defines a cylinder with a vertical axis (3rd direction) and radius tol.

If a 3d position is given for a 2d-problem, the 3rd coordinate of pos will be ignored.

Parameters:
  • pos – a coordinate tuple (2d or 3d) defining th etarget position

  • dir – direction vector defining the orientation of the line

  • tol – search radius for find. Any node within distance tol will be returned.

Returns:

a list of tuples (node_pointer, distance)

findNodesAt(pos, tol=0.001)

Find any node within distance tol from the given target position (pos).

If a 2d position is given for a 3d-problem, the input target defines a cylinder with a vertical axis (3rd direction) and radius tol.

If a 3d position is given for a 2d-problem, the 3rd coordinate of pos will be ignored.

Parameters:
  • pos – a coordinate tuple (2d or 3d) defining th etarget position

  • tol – search radius for find. Any node within distance tol will be returned.

Returns:

a list of tuples (node_pointer, distance)

findNodesOnPlane(pos, dir, tol=0.001)

Find any node within distance tol from the reference plane.

The plane is defined by

\[| {\bf n} \cdot ( {\bf X}_{node} - {\bf X}_0 ) | < TOL\]

where \({\bf n}\) is the unit normal vector to the plane (normalized dir), \({\bf X}_{node}\) is the position vector of any node, and \({\bf X}_0 )\) is the position vector of a reference point on the plane (pos),

Parameters:
  • pos – a coordinate tuple (2d or 3d) defining th etarget position

  • dir – normal vector to the target plane

  • tol – search radius for find. Any node within distance tol will be returned.

Returns:

a list of tuples (node_pointer, distance)

getSolver()

Provides a pointer to the current solver instance.

This function is used to get access to the solver and give instructions directly to that solver.

historyPlot(varX='', varY='', filename=None, **kwargs)

Create a generic X-Y plot using recorder data for load-level (horizontal) and varY (vertical).

If filename is given, store the plot to that file. Use proper file extensions to indicate the desired format (.png, .pdf)

Parameters:
  • varX

    X-axis parameter; This must be a variable code previously set by initRecorder().

    If varX is a str, it is assumed to be a global parameter/variable, e.g., load factor lam, or pseudo time time (time not yet supported)

    If varX is a tuple containing a variable code and a Node pointer, the respective nodal DOF defined by the parameter will be used.

    If varX is a tuple containing a variable code and a Element pointer, the respective element DOF defined by the parameter will be used. The parameter must identify a scalar parameter. Hence, you may use 'sig:xx' but not 'stress'.

  • varY – a variable code previously set by initRecorder()

  • filename (str)

  • node – (optional)

  • nodes – (optional)

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

Initializes parameters for the arc-length constraint.

\[g({\bf u}, \lambda)) := \alpha ||\bar {\bf P}|| (\lambda-\lambda_n)^2 + ({\bf u} - {\bf u}_n)({\bf u} - {\bf u}_n) - \Delta s^2 = 0\]

Note

This feature requires a nonlinear solver. Review the setSolver() function.

Parameters:
  • load_increment – load increment used to calibrate the constraint

  • alpha – load contribution factor

  • tolerance – convergence tolerance

initRecorder(**kwargs)

initializes data arrays for gathering of load history data

Parameters:
  • variables (list-type) – list of variables or d.o.f.-codes to be recorded

  • nodes (list of Node) – nodes for which to record

  • elements (list of Element) – elements for which to record

# examples:

# system recorder tracking the stability index
initRecorder(variables=['stability',])

# tracking 'ux' at nodes X1 and X7
initRecorder(variables=['ux',], nodes=[X1, X7])

# tracking all components of stress at Elem2 and Elem42
initRecorder(variables=['stress',], elements=[Elem2, Elem42, ...])
pauseRecorder()

pauses the recorder. You can restart the recorder by calling startRecorder().

plot(factor=1.0, show_reactions=True, show_loads=True, force_limit=1e-06, **kwargs)

Create mesh plot showing the undeformed and the deformed system

If filename is given, store the plot to that file. Use proper file extensions to indicate the desired format (.png, .pdf)

Parameters:
  • factor – deformation magnification factor

  • show_reactions – plot reaction forces if this evaluates to True

  • show_loads – plot nodal load vectors if this evaluates to True

  • force_limit – don’t plot forces smaller than this value

  • filename – filename (str)

plotBucklingMode(factor=1.0, mode=0, filename=None, **kwargs)

Warning

This method has been marked DEPRECATED !

Use the System.plot() method with appropriate **kwargs instead.

Select a mode shape by setting mode to an integer, where 0 stands for the mode with the smallest absolute eigenvalue, 1 the second smallest, and so forth. If the resulting eigenvalue (shown in the plot) is negative, the load-level associated with that mode is below the current load level.

If a filename is given, e.g., filename=”buckling_mode.png”, the plot will be saved to the respective file. The file type will be determined from the given extensions, e.g., .png for a PNG format.

Parameters:
  • factor – Scale the mode shape by this factor.

  • mode – which mode shape shall be plotted?

  • filename – string

  • kwargs – not specified here. These are handed over to the Solver(...) instance.

plotDOF(dofs=[])

Warning

This method has been marked DEPRECATED !

Use the System.plot() method with appropriate **kwargs instead.

plotSystem(filename='')

This is a shortcut for

System.plot(filename=filename,
            factor=0.0,
            title="Undeformed system",
            show_loads=1,
            show_reactions=0)
Parameters:

filename – if given, save the plot to that file

popU()

Restore a previously pushed displacement vector (using pushU()).

pushU()

Store the current displacement vector for later restore using popU().

recordThisStep()

record current state of the system

report()

print a text-based summary report

resetAll()

Resets load and displacement vectors.

resetDisp()

Resets the displacement vector.

resetLoad()

Resets the load vector.

setDisplacementControl(node, dof, target)

activate displacement control for the next load step

Parameters:
  • node – pointer to the controlling node

  • dof – dof code for controlled dof

  • target – target displacement value

setLoadFactor(lam)

Set the target load factor to lam

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.

setSolver(solver)

This method will change the current solver to the provided solver.

Upon successful update of the solver, the old solver state will be pushed to the new solver.

Parameters:

solver – a pointer to a solver object.

solve(**kwargs)

Solve system of equations and find state of deformation for the given load level.

startRecorder()

starts the recorder

stepArcLength(verbose=False, max_iter=10)

Progresses the model state by one arc-length.

Note

You need to initialize arc-length control by one call to initArcLength() at least once to set all necessary parameters.

Return normR:

the norm of the generalized residuum from the last iteration step

stopRecorder()

stops the recorder

valuePlot(variable, factor=0.0, filename=None, **kwargs)

Create a false color contour plot for the selected variable. A value of zero (0.0) will be assigned for any variable not provided by an element or a node.

known variables

keyword

description

‘ux’, ‘uy’, ‘uz’

displacement component in the x, y or z direction

‘rx’, ‘ry’, ‘rz’

rotation around the x, y or z axis

‘sxx’, ‘syy’, ‘szz’

normal stress \(\sigma_{xx}\), \(\sigma_{yy}\), \(\sigma_{zz}\)

‘sxy’, ‘syz’, ‘szx’

shear stress \(\sigma_{xy}\), \(\sigma_{yz}\), \(\sigma_{zx}\)

‘epsxx’, ‘epsyy’, ‘epszz’

normal strain \(\varepsilon_{xx}\), \(\varepsilon_{yy}\), \(\varepsilon_{zz}\)

‘epsxy’, ‘epsyz’, ‘epszx’

engineering shear strain \(\gamma_{xy}=2\varepsilon_{xy}\), \(\gamma_{yz}=2\varepsilon_{yz}\), \(\gamma_{zx}=2\varepsilon_{zx}\)

‘T’

temperature

‘qx’, ‘qy’, ‘qz’

x, y or z component of the temperature gradient, \(q_i = \partial T/\partial x_i\)

Parameters:
  • variable – string code for variable to show

  • factor – deformation magnification factor (default is undeformed)

  • filename (str) – if filename is given, store the plot to that file. Use proper file extensions to indicate the desired format (.png, .pdf)