mpacts.contact.matrix. cmtypes

In order to be able to use this module import it like this:

import mpacts.contact.matrix.cmtypes
#or assign it to a shorter name
import mpacts.contact.matrix.cmtypes as cmt

CG_Matrix_Iface

class mpacts.contact.matrix.cmtypes.CG_Matrix_Iface

Bases: mpacts.core.baseobject.BaseObject

Base class for conjugate gradient matrix data type (does not have to be based on contactdata.

Raises an exception This class cannot be instantiated from Python

CG_Matrix_Iface(name, parent, **kwargs)
get_element((CG_Matrix_Iface)self, (int)i, (int)j) → object
size((CG_Matrix_Iface)self) → int

CG_Vector_Iface

class mpacts.contact.matrix.cmtypes.CG_Vector_Iface

Bases: mpacts.core.baseobject.BaseObject

Base class for conjugate gradient Vector data type (does not have to be based on contactdata.

Raises an exception This class cannot be instantiated from Python

CG_Vector_Iface(name, parent, **kwargs)
get_element((CG_Vector_Iface)self, (int)i) → object
size((CG_Vector_Iface)self) → int

CombinedArray

class mpacts.contact.matrix.cmtypes.CombinedArray

Bases: mpacts.contact.matrix.cmtypes.CG_Vector_Iface, mpacts.core.baseobject.BaseObject

An array composed of ArLite arrays with identical names based on CombinedContactDataMatrix.
Has no default location.
  • Required keywords:
    • array_name — The name of the arrays to be combined.
    • pc_list — The particle containers between which contactdata is stored in this matrix. Order is preserved.This list cannot safely be changed once set.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: array_name, pc_list
CombinedArray(name, parent, **kwargs)

CombinedContactDataMatrix

class mpacts.contact.matrix.cmtypes.CombinedContactDataMatrix

Bases: mpacts.contact.matrix.cmtypes.CG_Matrix_Iface, mpacts.core.baseobject.BaseObject

A matrix composed out of several contactdata matrices, which can for instance be used for the conjugate gradient method.
Has no default location.
  • Required keywords:
    • array_name — The name of the arrays to be combined.
    • pc_list — The particle containers between which contactdata is stored in this matrix. Order is preserved.This list cannot safely be changed once set.
  • Optional keywords:
    • combined_diagonal_matrix (default value = docobject_OffDiag_Diag) — Returns the combined diagonal matrix
    • combined_offdiagonal_matrix (default value = docobject_OffDiag) — Returns the combined off diagonal matrix
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc_list, array_name, [combined_diagonal_matrix, combined_offdiagonal_matrix]
CombinedContactDataMatrix(name, parent, **kwargs)
add_contact_data((CombinedContactDataMatrix)self, (ContactDataBase)ContactData) → None
reset_contact_data((CombinedContactDataMatrix)self, (ContactDataBase)ContactData) → None

CombinedDiagonalMatrix

class mpacts.contact.matrix.cmtypes.CombinedDiagonalMatrix

Bases: mpacts.contact.matrix.cmtypes.CG_Matrix_Iface, mpacts.core.baseobject.BaseObject

A matrix composed out of several contactdata matrices, which can for instance be used for the conjugate gradient method.
Has no default location.
  • Required keywords:
    • array_name — The name of the arrays to be combined.
    • pc_list — The particle containers between which contactdata is stored in this matrix. Order is preserved.This list cannot safely be changed once set.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc_list, array_name
CombinedDiagonalMatrix(name, parent, **kwargs)

CombinedOffDiagonalMatrix

class mpacts.contact.matrix.cmtypes.CombinedOffDiagonalMatrix

Bases: mpacts.contact.matrix.cmtypes.CG_Matrix_Iface, mpacts.core.baseobject.BaseObject

A matrix composed out of several contactdata matrices, which can for instance be used for the conjugate gradient method.
Has no default location.
  • Required keywords:
    • pc_list — The particle containers between which contactdata is stored in this matrix. Order is preserved.This list cannot safely be changed once set.
  • Optional keywords:
    • blockmatrices (default value = Uninitialized) — Returns a list of all blockmatrices that have been added.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc_list, [blockmatrices]
CombinedOffDiagonalMatrix(name, parent, **kwargs)
add_contact_data((CombinedContactDataMatrix)self, (ContactDataBase)ContactData) → None
reset_contact_data((CombinedContactDataMatrix)self, (ContactDataBase)ContactData) → None

ConjugateGradientDenseSolver

class mpacts.contact.matrix.cmtypes.ConjugateGradientDenseSolver

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

The ConjugateGradient solver for CombinedContactDataMatrices. Uses dense matrix internally first.
Default location: ‘loop_cmds/post_contact_cmds’
  • Required keywords:
    • A — The (combined) matrix to solve
    • Op — The operator which knows the correct types of the elements in the arrays.
    • Preconditioner — Preconditioner used by CG solver.
    • b — The (combined) right-hand-side vector
    • x — The (combined) vector to solve for
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • optimization_limit ( any) (default value = -1) — The optimization limit for Conjugate Gradient.
    • reset_x (default value = 0) — Can (re)set the x-vector (it solves for) to 0, which is advantageous for e.g. Brownian motion.
    • tolerance (1) (default value = -1) — Tolerance, maximal residual expressed as |Ax-b|/|b|. This option is mutually exclusive with optimization limit. If not given and no ‘optimization_limit’ is specified, a default tolerance of 1e-5 will be used.
  • Read only properties:
    • steps — The number of steps ConjugateGradient has taken to converge at the last execution.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: A, x, b, Preconditioner, Op, [gate, optimization_limit, reset_x, tolerance]
ConjugateGradientDenseSolver(name, parent, **kwargs)

ConjugateGradientSolver

class mpacts.contact.matrix.cmtypes.ConjugateGradientSolver

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

The ConjugateGradient solver for CombinedContactDataMatrices. Uses sparse matrix intenally.
Default location: ‘loop_cmds/post_contact_cmds’
  • Required keywords:
    • A — The (combined) matrix to solve
    • Op — The operator which knows the correct types of the elements in the arrays.
    • Preconditioner — Preconditioner used by CG solver.
    • b — The (combined) right-hand-side vector
    • x — The (combined) vector to solve for
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • optimization_limit ( any) (default value = -1) — The optimization limit for Conjugate Gradient.
    • reset_x (default value = 0) — Can (re)set the x-vector (it solves for) to 0, which is advantageous for e.g. Brownian motion.
    • tolerance (1) (default value = -1) — Tolerance, maximal residual expressed as |Ax-b|/|b|. This option is mutually exclusive with optimization limit. If not given and no ‘optimization_limit’ is specified, a default tolerance of 1e-5 will be used.
  • Read only properties:
    • steps — The number of steps ConjugateGradient has taken to converge at the last execution.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: A, x, b, Preconditioner, Op, [gate, optimization_limit, reset_x, tolerance]
ConjugateGradientSolver(name, parent, **kwargs)

ConjugateGradientSolver_old

class mpacts.contact.matrix.cmtypes.ConjugateGradientSolver_old

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

The ConjugateGradient solver for CombinedContactDataMatrices.
Default location: ‘loop_cmds/post_contact_cmds’
  • Required keywords:
    • A — The (combined) matrix to solve
    • Op — The operator which knows the correct types of the elements in the arrays.
    • Preconditioner — Preconditioner used by CG solver.
    • b — The (combined) right-hand-side vector
    • x — The (combined) vector to solve for
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • ignore_singular (default value = 0) — If ‘True’, the solver will simply ignore a potentially singular matrix and return estimate of ‘x’. Use this option with care, as it might lead to erronous solutions in the simulation. To make sure you are aware of this happening, we will print a warning message nonetheless...
    • optimization_limit (default value = -1) — The optimization limit for Conjugate Gradient.
    • reset_x (default value = 0) — Can (re)set the x-vector (it solves for) to 0, which is advantageous for e.g. Brownian motion.
    • tolerance (default value = -1) — Tolerance, maximal residual expressed as |Ax-b|/|b|. This option is mutually exclusive with optimization limit. If not given and no ‘optimization_limit’ is specified, a default tolerance of 1e-5 will be used.
  • Read only properties:
    • steps — The number of steps ConjugateGradient has taken to converge at the last execution.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: A, x, b, Op, Preconditioner, [gate, optimization_limit, tolerance, ignore_singular, reset_x]
ConjugateGradientSolver_old(name, parent, **kwargs)

ContactMatrixVectorMultiplicationCommand

class mpacts.contact.matrix.cmtypes.ContactMatrixVectorMultiplicationCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Command that multiplies CombinedContactDataMatrices with CombinedVectors, i.e. A x = b.
Default location: ‘loop_cmds/post_contact_cmds’
  • Required keywords:
    • A — The (combined) matrix to solve
    • Op — The operator which knows the correct types of the elements in the arrays.
    • b — The (combined) right-hand-side vector in which the result will be stored
    • x — The (combined) vector to multiply with
  • Optional keywords:
    • flip_sign (default value = 0) — If ‘true’, will flip the sign of the result vector ‘b’ afterwards
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
object __init__(tuple args, dict kwds) :
args: name, parent kwds: A, x, b, Op, [gate, flip_sign]
ContactMatrixVectorMultiplicationCommand(name, parent, **kwargs)

DiagonalPreconditionerCommand

class mpacts.contact.matrix.cmtypes.DiagonalPreconditionerCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Setting the preconditioner matrix to the inverse diagonals of the matrix to be preconditioned - also called Jacobi preconditioner.
Default location: ‘loop_cmds/post_contact_cmds’
  • Required keywords:
    • A — The (combined) matrix to precondition
    • Op — The operator which knows the correct types of the elements in the ContactMatrix.
    • P — The (combined) preconditioner matrix
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
object __init__(tuple args, dict kwds) :
args: name, parent kwds: P, A, Op, [gate]
DiagonalPreconditionerCommand(name, parent, **kwargs)

FullMatrixConjugateGradientSolver

class mpacts.contact.matrix.cmtypes.FullMatrixConjugateGradientSolver

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

The FullMatrixConjugateGradient solver for CombinedContactDataMatrices. Uses sparse matrix intenally.
Default location: ‘loop_cmds/post_contact_cmds’
  • Required keywords:
    • A — The (combined) matrix to solve
    • Op — The operator which knows the correct types of the elements in the arrays.
    • Preconditioner — Preconditioner used by CG solver.
    • b — The (combined) right-hand-side vector
    • x — The (combined) vector to solve for
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • optimization_limit ( any) (default value = -1) — The optimization limit for Conjugate Gradient.
    • reset_x (default value = 0) — Can (re)set the x-vector (it solves for) to 0, which is advantageous for e.g. Brownian motion.
    • tolerance (1) (default value = -1) — Tolerance, maximal residual expressed as |Ax-b|/|b|. This option is mutually exclusive with optimization limit. If not given and no ‘optimization_limit’ is specified, a default tolerance of 1e-5 will be used.
  • Read only properties:
    • steps — The number of steps ConjugateGradient has taken to converge at the last execution.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: A, x, b, Preconditioner, Op, [gate, optimization_limit, reset_x, tolerance]
FullMatrixConjugateGradientSolver(name, parent, **kwargs)

LDLTSolver

class mpacts.contact.matrix.cmtypes.LDLTSolver

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

The L D L^T decomposition solver for CombinedContactDataMatrices.
Default location: ‘loop_cmds/post_contact_cmds’
  • Required keywords:
    • A — The (combined) matrix to solve
    • b — The (combined) right-hand-side vector
    • x — The (combined) vector to solve for
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
object __init__(tuple args, dict kwds) :
args: name, parent kwds: A, x, b, [gate]
LDLTSolver(name, parent, **kwargs)

LiquidFrictionCommand

class mpacts.contact.matrix.cmtypes.LiquidFrictionCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Sets the diagonal elements to the appropriate Stokes’ drag term.
Default location: ‘loop_cmds/pre_body_force_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
  • Optional keywords:
    • diagonals_name (default value = ContactMatrixDiagonal) — Name of the diagonals array (default: “ContactMatrixDiagonal”).
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
    • temperature (default value = -1) — If only temperature (in Kelvin!) is given, we will calculate the viscosity of water at the given temperature.
    • use_number_of_contacts (default value = 1) — If ‘True’, will (inversely) weight the friction by the number of contacts, up to a maximum of 12 contacts.
    • viscosity (default value = -1) — Dynamic viscosity to calculate Stokes’ drag force with. If not given, temperature must be given, then water is assumed.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, [gate, predicate, temperature, viscosity, diagonals_name, use_number_of_contacts]
LiquidFrictionCommand(name, parent, **kwargs)

SimpleStokesDragCommand

class mpacts.contact.matrix.cmtypes.SimpleStokesDragCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

Command to set the Stokes drag of a cell taking the cell’s volume and number of nodes into account.
Default location: ‘loop_cmds/body_force_cmds’
  • Required keywords:
    • pc — Particle container on which the command is applied
    • visc — Dynamic viscosity of the fluid (e.g. 7e-4 Pa*s for water @37 C)
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
    • predicate (default value = None) — Predicate that will decide whether this command is executed for a specific particle, when absent the command is executed for every particle.
object __init__(tuple args, dict kwds) :
args: name, parent kwds: pc, visc, [gate, predicate]
SimpleStokesDragCommand(name, parent, **kwargs)

SumToDiagonalCommand

class mpacts.contact.matrix.cmtypes.SumToDiagonalCommand

Bases: mpacts.core.command.Command, mpacts.core.baseobject.BaseObject

To make a correct friction matrix, we have to sum to the diagonal.
Default location: ‘loop_cmds/post_contact_cmds’
  • Required keywords:
    • A — The (combined) matrix to sum up
    • Op — The operator which knows the correct types of the elements in the ContactMatrix.
  • Optional keywords:
    • gate (default value = ET::ChildProperty const*) — Can decide to (temporarily) not execute the command in a CommandList. (Default is ExecuteAlways)
object __init__(tuple args, dict kwds) :
args: name, parent kwds: A, Op, [gate]
SumToDiagonalCommand(name, parent, **kwargs)