Particles
BaseParticle class
Together with meshfree kernel functions (BaseMeshfreeKernelFunction), particles represent the basic building blocks of a particle based method. They
are used for computing the quadrature.
Implementing your own particles can be done easily by subclassing from
the abstract base class BaseParticle.
- class edelweissmeshfree.particles.base.baseparticle.BaseParticle[source]
The BaseParticle class is an abstract base class for all particles.
If you want to implement a new particle, you have to inherit from this class.
Particles communicate with field variables (
FieldVariable) through meshfree kernel functions (BaseMeshfreeKernelFunction), which are attached to nodes. During a simulation, particles are used to compute the quadrature of the weak form of the governing equations. Accordingly, like elements and cells, they are responsible for computing the residual and stiffness matrix.Naturally, and 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, …]
- Attributes:
baseFieldsDefines which fields are attached to the particle.
dimensionDefines the dimension of the particle, e.g., 1, 2 or 3.
dofIndicesPermutationIf the provides computes residual vectors and stiffness matrices not nodewise, but e.g., fieldwise, this permutation pattern is used to aggregate all entries in order to resemble the defined fields nodewise.
ensightTypeThe shape of the element in Ensight Gold notation.
fieldsThe list of fields per node which this entity couples.
kernelFunctionsThe kernel functions assigned to the particle.
nDofThe total number of degrees of freedom this entity has.
nNodesThe number of nodes this entity couples.
nodesThe list of nodes this currently entity holds.
propertyNamesDefines which properties are valid for the particle.
visualizationNodesThe nodes for visualization.
Methods
Accept the computed state (in nonlinear iteration schemes) and the position.
assignMeshfreeKernelFunctions(kernelFunctions)Assign the meshfree kernel functions to the particle.
computeBodyLoad(loadType, load, P, K, ...)Compute bulk loads (body loads) for given time based for all assigned MaterialPoints.
computeBodyLoadExplicit(loadType, load, P, ...)Compute bulk loads (body loads) for given time based for all assigned MaterialPoints.
computeDistributedLoad(loadType, surfaceID, ...)Compute distributed (surface) a for given time based for a specific assigned material point.
computeDistributedLoadExplicit(loadType, ...)Compute distributed (surface) a for given time based for a specific assigned material point.
Compute the lumped mass matrix for explicit time integration.
computePhysicsKernels(dU, P, K, timeTotal, dTime)Evaluate the kernel residual and stiffness for given time based for all assigned MaterialPoints.
computePhysicsKernelsExplicit(dU, P, ...)Evaluate the kernel residual and stiffness for given time based for all assigned MaterialPoints.
Get the bounding box of the particle.
Get the center coordinates of the particle.
Get the evaluation coordinates of the particle.
getFaceCoordinates(faceID)The vertices defining the shape of the particle.
getInterpolationVector(coordinate)Get the interpolation vector for a given global coordinate.
Get the restart data in form of a numpy array.
getResultArray(result[, getPersistentView, qp])Get the array of a result, possibly as a persistent view which is continiously updated by a MaterialPoint.
The vertices defining the shape of the particle.
Get the undeformed volume of the particle.
Initalize the particle to be ready for computing.
prepareYourself(timeTotal, dTime)Prepare the particle to be ready for computing.
readRestartData(restartData)Set the restart data.
setInitialCondition(stateType, values)Assign initial conditions.
setProperties(properties)Set all properties of the particle.
setProperty(propertyName, propertyValue)Set a single property of the particle.
Assign the shape function correction terms in for of a 3D numpy array.
vci_compute_MMatrix(M_ACD)Compute the symmetric M-matrix.
Compute the volume integral for the test function gradient.
Compute the volume integral for the test function gradient.
vci_compute_Test_P_BoundaryIntegral(R_AiC, ...)Compute the boundary integral for the test function.
Get the number of constraints if a variationally consistent integration is used.
- abstractmethod acceptStateAndPosition()[source]
Accept the computed state (in nonlinear iteration schemes) and the position.
- abstractmethod assignMeshfreeKernelFunctions(kernelFunctions)[source]
Assign the meshfree kernel functions to the particle.
- Parameters:
shapeFunctions – The meshfree shape functions.
kernelFunctions (list[BaseMeshfreeKernelFunction])
- abstractmethod computeBodyLoad(loadType, load, P, K, timeTotal, dTime)[source]
Compute bulk loads (body loads) for given time based for all assigned MaterialPoints.
- Parameters:
loadType (str) – The type of load to be computed (e.g., ‘bodyforce’)
load (ndarray) – The float (vector) describing the load.
P (ndarray) – The external load vector to be defined.
K (ndarray) – The stiffness matrix to be defined.
timeTotal (float) – The current total time.
dTime (float) – The time increment.
- abstractmethod computeBodyLoadExplicit(loadType, load, P, timeTotal, dTime)[source]
Compute bulk loads (body loads) for given time based for all assigned MaterialPoints.
- Parameters:
loadType (str) – The type of load to be computed (e.g., ‘bodyforce’)
load (ndarray) – The float (vector) describing the load.
P (ndarray) – The external load vector to be defined.
timeTotal (float) – The current total time.
dTime (float) – The time increment.
- abstractmethod computeDistributedLoad(loadType, surfaceID, load, P, K, timeTotal, dTime)[source]
Compute distributed (surface) a for given time based for a specific assigned material point.
- Parameters:
loadType (str) – The type of load to be computed (e.g., ‘pressure’)
surfaceID (int) – The ID describing the surface of the material point.
load (ndarray) – The float (vector) describing the load.
P (ndarray) – The external load vector to be defined.
K (ndarray) – The stiffness matrix to be defined.
timeTotal (float) – The current total time.
dTime (float) – The time increment.
- abstractmethod computeDistributedLoadExplicit(loadType, surfaceID, load, P, timeTotal, dTime)[source]
Compute distributed (surface) a for given time based for a specific assigned material point.
- Parameters:
loadType (str) – The type of load to be computed (e.g., ‘pressure’)
surfaceID (int) – The ID describing the surface of the material point.
load (ndarray) – The float (vector) describing the load.
P (ndarray) – The external load vector to be defined.
timeTotal (float) – The current total time.
dTime (float) – The time increment.
- abstractmethod computeLumpedInertia(M)[source]
Compute the lumped mass matrix for explicit time integration.
- Parameters:
M (ndarray) – The mass matrix to be defined.
- abstractmethod computePhysicsKernels(dU, P, K, timeTotal, dTime)[source]
Evaluate the kernel residual and stiffness for given time based for all assigned MaterialPoints.
- Parameters:
dU (ndarray) – The current solution increment.
P (ndarray) – The external load vector to be defined.
K (ndarray) – The stiffness matrix to be defined.
timeTotal (float) – The current total time.
dTime (float) – The time increment.
- abstractmethod computePhysicsKernelsExplicit(dU, P, timeTotal, dTime)[source]
Evaluate the kernel residual and stiffness for given time based for all assigned MaterialPoints.
- Parameters:
dU (ndarray) – The current solution increment.
P (ndarray) – The external load vector to be defined.
timeTotal (float) – The current total time.
dTime (float) – The time increment.
- abstractmethod getBoundingBox()[source]
Get the bounding box of the particle.
- Returns:
All coordinates for all bounding vertices.
- Return type:
np.ndarray
- abstractmethod getCenterCoordinates()[source]
Get the center coordinates of the particle.
- Returns:
The center coordinates.
- Return type:
np.ndarray
- abstractmethod getEvaluationCoordinates()[source]
Get the evaluation coordinates of the particle.
- Returns:
All coordinates for all bounding vertices.
- Return type:
np.ndarray
- abstractmethod getFaceCoordinates(faceID)[source]
The vertices defining the shape of the particle. :param faceID: The ID of the face to be returned.
- Returns:
All coordinates for all bounding vertices.
- Return type:
np.ndarray
- Parameters:
faceID (int)
- abstractmethod getInterpolationVector(coordinate)[source]
Get the interpolation vector for a given global coordinate.
- Returns:
The interpolation vector for all nodes.
- Return type:
np.ndarray
- Parameters:
coordinate (ndarray)
- abstractmethod getRestartData()[source]
Get the restart data in form of a numpy array.
- Returns:
The restart data.
- Return type:
np.ndarray
- abstractmethod getResultArray(result, getPersistentView=True, qp=0)[source]
Get the array of a result, possibly as a persistent view which is continiously updated by a MaterialPoint.
- Parameters:
result (str) – The name of the result.
getPersistentView (bool) – If true, the returned array should be continiously updated by the element.
qp (int) – The quadrature point index. This is only relevant for higher order particles.
- Returns:
The result.
- Return type:
np.ndarray
- abstractmethod getVertexCoordinates()[source]
The vertices defining the shape of the particle.
- Returns:
All coordinates for all bounding vertices.
- Return type:
np.ndarray
- abstractmethod getVolumeUndeformed()[source]
Get the undeformed volume of the particle.
- Returns:
The undeformed volume.
- Return type:
float
- abstractmethod prepareYourself(timeTotal, dTime)[source]
Prepare the particle to be ready for computing.
- Parameters:
timeTotal (float)
dTime (float)
- abstractmethod readRestartData(restartData)[source]
Set the restart data.
- Parameters:
restartData (ndarray) – The restart data.
- abstractmethod setInitialCondition(stateType, values)[source]
Assign initial conditions.
- Parameters:
stateType (str) – The type of initial state.
values (ndarray) – The numpy array describing the initial state.
- abstractmethod setProperties(properties)[source]
Set all properties of the particle. The order of the properties is defined by the order of the
propertyNamesproperty.- Parameters:
properties (ndarray) – The properties to be set.
- abstractmethod setProperty(propertyName, propertyValue)[source]
Set a single property of the particle. :param propertyName: The name of the property to be set. :param propertyValue: The value of the property to be set.
- Parameters:
propertyName (str)
propertyValue (ndarray)
- abstractmethod vci_assignTestFunctionCorrectionTerms(eta_AjC)[source]
Assign the shape function correction terms in for of a 3D numpy array.
- Parameters:
corrections – The correction terms.
eta_AjC (ndarray)
- abstractmethod vci_compute_MMatrix(M_ACD)[source]
Compute the symmetric M-matrix.
- Parameters:
M_ACD (ndarray) – The M-matrix
- abstractmethod vci_compute_TestGradient_P_Integral(R_AiC)[source]
Compute the volume integral for the test function gradient.
- Parameters:
R_AiC (ndarray) – The integral.
- abstractmethod vci_compute_Test_PGradient_Integral(R_AiC)[source]
Compute the volume integral for the test function gradient.
- Parameters:
R_AiC (ndarray) – The integral.
- abstractmethod vci_compute_Test_P_BoundaryIntegral(R_AiC, boundarySurfaceVector, boundaryFaceID)[source]
Compute the boundary integral for the test function.
- Parameters:
R_AiC (ndarray) – The integral.
boundarySurfaceVector (ndarray) – The surface vector defining the area and orientation of the boundary. For higher order (non point) particles, the surface vector might be omitted and computed internally from the boundary face ID.
boundaryFaceID (int) – The ID of the boundary face (for point shaped particles, this one is ignored).
- abstractmethod vci_getNumberOfConstraints()[source]
Get the number of constraints if a variationally consistent integration is used.
- Returns:
The number of VCI constraints.
- Return type:
int
- abstract property baseFields: list[str]
Defines which fields are attached to the particle.
- abstract property dimension: int
Defines the dimension of the particle, e.g., 1, 2 or 3.
- abstract property kernelFunctions: list[BaseMeshfreeKernelFunction]
The kernel functions assigned to the particle.
- abstract property propertyNames: list[str]
Defines which properties are valid for the particle.
MarmotParticleWrapper class
- class edelweissmeshfree.particles.marmot.marmotparticlewrapper.MarmotParticleWrapper
This class as a wrapper for MarmotParticles.
For the documentation of MarmotParticles, please refer to Marmot.
- Attributes:
- baseFields
- dimension
- dofIndicesPermutation
- ensightType
- fields
- kernelFunctions
- nDof
- nodes
- number
propertyNamesGet the list of valid properties for this particle.
Methods
computeLumpedInertia(mLumped)Compute the lumped mass matrix for the particle.
computeLumpedMomentum(mLumped)Compute the lumped mass matrix for the particle.
computePhysicsKernels(dUc, Pc, Kc, timeNew, ...)Evaluate residual and stiffness for given time, field, and field increment.
Evaluate residual for given time, field, and field increment.
Get the underlying MarmotParticle center coordinates.
getFaceCoordinates(faceID)Get the underlying coordinates of a given face of the MarmotParticle.
getResultArray(result[, getPersistentView, qp])Get the array of a result, possibly as a persistent view which is continiously updated by the underlying MarmotParticle.
Return the number of entries this entity contributes to the VIJ (COO) system matrix.
Get the underlying MarmotParticle vertex coordinates.
Get the underlying MarmotParticle undeformed volume.
initializeVIJContribution(idcs, I_, J_, offset)Initialize the I and J arrays for the VIJ (COO) system matrix assembly.
setInitialCondition(stateType, value)Set initial condition of the particle.
setProperties(properties)Set a list of properties of the particle.
setProperty(propertyName, value)Set a property of the particle.
updatePhysicsExplicit(dUc, timeNew, dTime)Evaluate residual for given time, field, and field increment.
acceptStateAndPosition
assignKernelFunctions
computeBodyLoad
computeDistributedLoad
computeDistributedLoadExplicit
getEvaluationCoordinates
getInterpolationVector
getRestartData
initializeYourself
prepareYourself
readRestartData
vci_assignTestFunctionCorrectionTerms
vci_compute_MMatrix
vci_compute_TestGradient_P_Integral
vci_compute_Test_PGradient_Integral
vci_compute_Test_P_BoundaryIntegral
vci_getNumberOfConstraints
- computeLumpedInertia(mLumped)
Compute the lumped mass matrix for the particle.
- computeLumpedMomentum(mLumped)
Compute the lumped mass matrix for the particle.
- computePhysicsKernels(dUc, Pc, Kc, timeNew, dTime)
Evaluate residual and stiffness for given time, field, and field increment.
- computePhysicsKernelsExplicit(Pc)
Evaluate residual for given time, field, and field increment.
- getCenterCoordinates()
Get the underlying MarmotParticle center coordinates.
- getFaceCoordinates(faceID)
Get the underlying coordinates of a given face of the MarmotParticle.
- getResultArray(result, getPersistentView=True, qp=0)
Get the array of a result, possibly as a persistent view which is continiously updated by the underlying MarmotParticle.
- Parameters:
result (str)
getPersistentView (bool)
qp (int)
- getVIJContributionSize()
Return the number of entries this entity contributes to the VIJ (COO) system matrix.
- Return type:
int
- getVertexCoordinates()
Get the underlying MarmotParticle vertex coordinates.
- getVolumeUndeformed()
Get the underlying MarmotParticle undeformed volume.
- initializeVIJContribution(idcs, I_, J_, offset)
Initialize the I and J arrays for the VIJ (COO) system matrix assembly.
- Parameters:
idcs (ndarray)
I_ (ndarray)
J_ (ndarray)
offset (int)
- Return type:
None
- setInitialCondition(stateType, value)
Set initial condition of the particle.
- setProperties(properties)
Set a list of properties of the particle.
- setProperty(propertyName, value)
Set a property of the particle.
- updatePhysicsExplicit(dUc, timeNew, dTime)
Evaluate residual for given time, field, and field increment.
- propertyNames
Get the list of valid properties for this particle.