4.1.1.6.1.2. pyfem.materials.BaseMaterial module

class BaseMaterial(props)[source]

Bases: object

Base class for material models in finite element analysis.

This class provides the fundamental structure and methods for implementing constitutive material models. It handles material properties, history variables for path-dependent materials, and output data management.

numericalTangent

Flag indicating whether to use numerical tangent computation.

Type:

bool

storeOutputFlag

Flag indicating whether to store output data.

Type:

bool

oldHistory

Dictionary storing history variables from the previous converged step.

Type:

Dict[str, Any]

newHistory

Dictionary storing history variables for the current step.

Type:

Dict[str, Any]

outLabels

Labels for output variables.

Type:

List[str]

outData

Array containing output data values.

Type:

ndarray

solverStat

Solver statistics object.

Type:

Any

setHistoryParameter(name: str, val: Any) None[source]

Set a history parameter for the current step.

History parameters are used to store internal state variables for path-dependent material models (e.g., plastic strain, damage variables).

Parameters:
  • name (str) – Name of the history parameter.

  • val (Any) – Value of the history parameter (typically float or ndarray).

getHistoryParameter(name: str) float | ndarray[source]

Retrieve a history parameter from the previous converged step.

Parameters:

name (str) – Name of the history parameter to retrieve.

Returns:

The value of the history parameter. Returns a copy for array types to prevent unintended modifications.

Return type:

Union[float, ndarray]

commitHistory() None[source]

Commit the current history variables to old history.

This method is called when a load step has converged, copying the current (new) history variables to become the old history variables for the next step. Uses deep copy to ensure complete independence.

setOutputLabels(labels: List[str]) None[source]

Set the labels for output variables.

Initializes the output data array with zeros based on the number of output labels.

Parameters:

labels (List[str]) – List of strings representing the names of output variables (e.g., [‘stress_xx’, ‘stress_yy’, ‘plastic_strain’]).

storeOutputs(data: ndarray) None[source]

Store output data if the store output flag is enabled.

Parameters:

data (ndarray) – Array of output data values corresponding to the output labels.