Numerical tools

The numerical tools are a set of tools that can be used to solve a variety of problems.

DofManager class

class edelweissmeshfree.numerics.dofmanager.MPMDofManager(nodeFields, scalarVariables=[], elements=[], constraints=[], nodeSets=[], cells=[], cellElements=[], particles=[], initializeVIJPattern=True, initializeAccumulatedNodalFluxesFieldwise=True, determiningIndexToHostObjectMappping=True)[source]

A DofManager class for the Material Point Method. Derived from DofManager, it is used to manage the degrees of freedom of the model and to provide the necessary information for the assembly of the global system matrix.

Parameters:
  • nodeFields (list) – A list of node fields.

  • scalarVariables (list) – A list of scalar variables.

  • elements (list) – A list of elements.

  • constraints (list) – A list of constraints.

  • nodeSets (list) – A list of node sets.

  • cells (list) – A list of cells.

  • cellElements (list) – A list of cell elements.

  • particles (list) – The list of particles (RKPM).

  • initializeVIJPattern (bool) – A flag indicating whether the VIJ pattern should be initialized.

  • initializeAccumulatedNodalFluxesFieldwise (bool)

  • determiningIndexToHostObjectMappping (bool)

Methods

constructDofVector()

Construct a vector with size=nDof and which has knowledge about the location of each entity.

constructVIJSystemMatrix()

Construct a VIJ (COO) Sparse System matrix object, which also has knowledge about the location of each entity.

getNodeForIndexInDofVector(index)

Find the node for a given index in the equuation system.

updateConstraints(constraints)

Updates the connectivity mapping for constraints in a serial loop.

updateParticles(particles)

Updates the connectivity mapping for particles without rebuilding the entire DofManager structure.

writeDofVectorToNodeField(dofVector, ...)

Write the current values of an entire NodeField from the respective locations in a given DofVector.

writeNodeFieldToDofVector(dofVector, ...[, ...])

Write the current values of an entire NodeField to the respective locations in a given DofVector.

_computeAccumulatedNodalFluxesFieldWise(fields)

For the VIJ (COO) system matrix and the Abaqus like convergence test, the number of dofs ‘entity-wise’ is needed: = Σ_(elements+constraints) Σ_nodes ( nDof (field) ).

Parameters:

fields (list) – The list of fields for which the accumulated nodal fluxes should be computed.

Returns:

Number of accumulated fluxes per field:
  • Field

  • Number of accumulated fluxes

Return type:

dict

_determineIndexToNodeMap()

Determine the map from each index (associated with a FieldVariable) in the DofVector to the corresponding attached Node oject.

Returns:

The dictionary containing the map from index of a FieldVariable (component) in the DofVector to the respective Node instance.

Return type:

dict[int, Node]

_gatherCellsInformation(entities)[source]

Generates some auxiliary information, which may be required by some modules of EdelweissFE.

Parameters:

entities (list) – The list of entities, for which the information is gathered.

Returns:

The tuple of
  • number of accumulated elemental degrees of freedom.

  • number of accumulated system matrix sizes.

  • the number of acummulated fluxes Σ_entities Σ_nodes ( nDof (field) ) for Abaqus-like convergence tests.

  • largest occuring number of dofs on any element.

Return type:

tuple[int,int]

_gatherConstraintsInformation(entities)

Generates some auxiliary information, which may be required by some modules of EdelweissFE.

Parameters:

entities (list) – The list of entities, for which the information is gathered.

Returns:

The tuple of
  • number of accumulated elemental degrees of freedom.

  • number of accumulated system matrix sizes.

  • the number of acummulated fluxes Σ_entities Σ_nodes ( nDof (field) ) for Abaqus-like convergence tests.

  • largest occuring number of dofs on any element.

Return type:

tuple[int,int]

_gatherElementsInformation(entities)

Generates some auxiliary information, which may be required by some modules of EdelweissFE.

Parameters:

entities (list) – The list of entities, for which the information is gathered.

Returns:

The tuple of
  • number of accumulated elemental degrees of freedom.

  • number of accumulated system matrix sizes.

  • the number of acummulated fluxes Σ_entities Σ_nodes ( nDof (field) ) for Abaqus-like convergence tests.

  • largest occuring number of dofs on any element.

Return type:

tuple[int,int]

_initializeVIJPattern()

Generate the IJ pattern for VIJ (COO) system matrices.

Returns:

  • I vector

  • J vector

  • the entities to system matrix entry mapping.

Return type:

tuple

_locateCellsInDofVector(cells)[source]

Creates a dictionary containing the location (indices) of each cell within the DofVector structure.

Returns:

A dictionary containing the location mapping.

Return type:

dict

Parameters:

cells (list)

_locateConstraintsInDofVector(constraints)

Creates a dictionary containing the location (indices) of each entity (elements, constraints) within the DofVector structure.

Returns:

A dictionary containing the location mapping.

Return type:

dict

Parameters:

constraints (list)

_locateFieldsOnNodeSetsInDofVector(nodeSets)

Creates a dictionary containing the location (indices) of each entity (elements, constraints) within the DofVector structure.

Parameters:

nodeSets (list) – The list of NodeSets to consider.

Returns:

A dictionary containing the location mapping.

Return type:

dict

_locateNodeCouplingEntitiesInDofVector(entities)

Creates a dictionary containing the location (indices) of each entity (elements, …) within the DofVector structure.

Parameters:

entities (list) – The list of entities to locate.

Returns:

A dictionary containing the location mapping.

Return type:

dict

_locateParticlesInDofVector(particles)[source]

Creates a dictionary containing the location (indices) of each particle within the DofVector structure.

In contrast to elements, cells and cell elements, particles have an identical set of fields on each attached node. Furthermore, due to the varying number attached nodes, no permutation is allowed. For particles generally a node-wise layout is assumed.

For instance: [node_1_displacement, node_1_temperature, node_2_displacement, node_2_temperature, …]

Returns:

A dictionary containing the location mapping.

Return type:

dict

Parameters:

particles (list)

_locate_serial_internal(entities)

Fast serial fallback for small chunks to avoid thread overhead.

Parameters:

entities (list)

Return type:

dict

_reserveSpaceForNodeFields(idxStart, nodeFields)

Loop over all nodes to generate the global field-dof indices.

Parameters:
  • idxStart (int) – The starting index for the DOF numbering.

  • nodeFields (list[NodeField]) – The list of NodeFields to process.

Returns:

output is a tuple of:
  • number of total DOFS

  • dictionary of field variables and indices

  • dictionary of fields and indices

Return type:

tuple

_reserveSpaceForScalarVariables(idxStart, scalarVariables)

Loop over all ScalarVariables to generate their global indices.

Returns:

output is a tuple of:
  • number of total DOFS

  • dictionary of fields and indices:
    • field

    • indices

Return type:

tuple

Parameters:
  • idxStart (int)

  • scalarVariables (list)

constructDofVector()

Construct a vector with size=nDof and which has knowledge about the location of each entity.

Returns:

A DofVector.

Return type:

DofVector

constructVIJSystemMatrix()

Construct a VIJ (COO) Sparse System matrix object, which also has knowledge about the location of each entity.

Returns:

The system Matrix.

Return type:

VIJSystemMatrix

getNodeForIndexInDofVector(index)

Find the node for a given index in the equuation system.

Parameters:

index (int) – The index in the DofVector.

Returns:

The attached Node.

Return type:

Node

updateConstraints(constraints)[source]

Updates the connectivity mapping for constraints in a serial loop. Reuses global index maps to avoid re-instancing the manager.

Parameters:

constraints (list) – The list of constraints to be considered.

updateParticles(particles)[source]

Updates the connectivity mapping for particles without rebuilding the entire DofManager structure.

Parameters:

particles (list) – The list of particles to update.

writeDofVectorToNodeField(dofVector, nodeField, resultName)

Write the current values of an entire NodeField from the respective locations in a given DofVector.

Parameters:
  • dofVector – The source DofVector.

  • nodeField – The NodeField to get the updated values.

  • resultname – The name of the value entries held by the NodeField.

Returns:

The updated NodeField.

Return type:

NodeField

writeNodeFieldToDofVector(dofVector, nodeField, resultName, nodeSet=None)

Write the current values of an entire NodeField to the respective locations in a given DofVector.

Parameters:
  • dofVector (DofVector) – The result DofVector.

  • nodeField (NodeField) – The NodeField holding the values.

  • resultname – The name of the value entries held by the NodeField.

  • NodeSet – The NodeSet to consider. If None, all nodes of the NodeField are considered.

  • resultName (str)

  • nodeSet (NodeSet)

Returns:

The DofVector.

Return type:

DofVector

_sizeVIJ

The number of nonzero entries of the system matrix, resulting from the dense higher order entities contributions

accumulatedConstraintNDof

The accumulated number of constraint dofs (= the sum of all constraint vector sizes)

accumulatedElementNDof

The accumulated number of element dofs (= the sum of all element vector sizes)

fields

The list of fields which can be found in the Dofvector

idcsOfConstraintsInDofVector

The dictionary mapping a constraint to it’s indices in the DofVector

idcsOfElementsInDofVector

The dictionary mapping an element to it’s indices in the DofVector

idcsOfFieldVariablesInDofVector

The dictionary mapping the nodal field variables to the indices in the DofVector

idcsOfFieldsInDofVector

The dictionary mapping the field names to all indices in the DofVector

idcsOfFieldsOnNodeSetsInDofVector

The dictionary mapping for each field a NodeSet to the respective indices in the DofVector

idcsOfNodeFieldsInDofVector

The dictionary mapping the a complete NodeField to the all its indices in the DofVector

idcsOfScalarVariablesInDofVector

The dictionary mapping the scalar variables to all indices in the DofVector

indexToHostObjectMapping

The reverse dictionary mapping an index to the Host (e.g., a Node) holding the index’s FieldvVariable

largestNumberOfConstraintNDof

The size of the largest of all constraint dof vectors

largestNumberOfElNDof

The size of the largest of all element dof vectors

nDof

The total number of degrees of freedom (and size of the DofVector)