pre module’s docstrings

Basic functions

Model

class pylmgc90.pre.model(name, physics, element, dimension=None, external_fields=None, external_vfields=None, external_vsizes=None, user_model_name=None, **kargs)[source]

class model():

associated methods:

  • __init__
  • listeOptions
  • addOptions

Methods

check(self) checks if mandatory options are present
listeOptions()
check(self)[source]

checks if mandatory options are present

class pylmgc90.pre.models[source]

class models(mapping_container):

this class defines a container of models

methods:

  • addModel: function that add a model to the container
  • listeType
  • listeElements

overridden operators:

  • __add__: operetor ‘+’ adds a model in the model container
  • __str__: this function returns a string describing the model container

Methods

addModel
check
clear
copy
fromkeys
get
getKey
has_key
items
iteritems
iterkeys
itervalues
keys
listeElements
listeType
pop
popitem
setdefault
sortedKeys
update
values
viewitems
viewkeys
viewvalues
addModel(*mo)[source]

addModel(self, * mo):

this function adds a model in the models container

parameters:

  • self: the model container itself
  • *mo: the list of models to add
check()[source]

check(self):

this function checks all the models in the model container

parameters:

  • self: the model container itself
listeElements()[source]

listeType(self):

this function returns the list of elements defined in the model container

parameters:

  • self: the model container itself
listeType()[source]

listeType(self):

this function returns the list of models defined in the model container

parameters:

  • self: the model container itself

Material

class pylmgc90.pre.material(name='acier', materialType='ELAS', **args)[source]

class material() class permettant de definir un materiau methodes associees: - __init__ - addProperties - addProperty

Methods

check()
class pylmgc90.pre.materials[source]

class materials: permet de stocker l’ensemble des materiaux

Methods

addMaterial(self,\*mat) this function adds a material in the materials container
clear(() -> None.  Remove all items from D.)
copy(() -> a shallow copy of D)
fromkeys(...) v defaults to None.
get((k[,d]) -> D[k] if k in D, ...)
getKey(value) getKey(self, value):
has_key((k) -> True if D has a key k, else False)
items(() -> list of D’s (key, value) pairs, ...)
iteritems(() -> an iterator over the (key, ...)
iterkeys(() -> an iterator over the keys of D)
itervalues(...)
keys(() -> list of D’s keys)
pop((k[,d]) -> v, ...) If key is not found, d is returned if given, otherwise KeyError is raised
popitem(() -> (k, v), ...) 2-tuple; but raise KeyError if D is empty.
setdefault((k[,d]) -> D.get(k,d), ...)
sortedKeys(self) this function returns the sorted list of keys giving
update(([E, ...) If E present and has a .keys() method, does: for k in E: D[k] = E[k]
values(() -> list of D’s values)
viewitems(...)
viewkeys(...)
viewvalues(...)
addMaterial(self, *mat)[source]

this function adds a material in the materials container

parameters
*mat the liste of materials

Avatar

class pylmgc90.pre.avatar(dimension, number=None)[source]

Methods

addBulk
addBulks
addContactors
addGroupUsingPredicate
addNode
addNodes
checkModelAndMaterialDefinitions
computeRigidProperties
defineGroups
defineMaterial
defineModel
findNode
getNodebyGroup
hasGroup
imposeDrivenDof
imposeInitValue
mirror
relaxDrivenDof
rotate
scale
translate((s,table [,deletions]) -> string) Return a copy of the string s, where all characters occurring in the optional argument deletions are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256.
addBulk(Ele)[source]

Usage : avatar.addBulk(Ele)

where Ele is a bulk

addBulks(Eles)[source]

Usage : avatar.addBulks(Eles)

where Eles is a bulk iterator

addContactors(self, shape, color, group='all', **options)[source]

define contactors for the elements of a group

parameters:

  • self: the contactor itself
  • shape: type of the contactors
  • color: color of the contactor

optional parameters:

  • group=’all’: name of the considered group
  • ** options’: a set of options associated to the contactors
addGroupUsingPredicate(name, predicate, super_group='all')[source]

adddGroupUsingPredicate(self, name, predicate, super_group=’all’):

this function builds and add a new group to the avatar, by selecting nodes verifying a given predicate. All nodes verifying the predicate are added to the new group. If all nodes supporting an element are in the new group, this element is also added to the new group.

parameters:

  • self : the avatar itself
  • name : the name of the new group
  • predicate : the given predicate defined as a function of the coordinates returning a boolean

optional parameters:

  • super_group=’all’ : the new group is defines as a subgroup of this group
addNode(Noeud)[source]

Usage : avatar.addNode(noeud)

where noeud is a node object

addNodes(Noeuds)[source]

Usage : avatar.addNodes(noeuds)

where noeuds is a node iterator

checkModelAndMaterialDefinitions()[source]

checkModelAndMaterialDefinitions(self):

this functions checks if all volumic (or surfacic, in 2D) elements of the given avatar are associated to a model and a material. If any of the elements of tha given avatar is not associated to a model or a material it stops the exectution of the script.

computeRigidProperties()[source]

computeRigidProperties(self):

this function computes rigid properties of a rigid avatar : mass, inertia and mass center, from the contactors

parameters:

  • self: the avatar itself
defineGroups(self)[source]

define groups linked to each elements ! beware the method is not robuste for too many mesh elements

defineMaterial(self, group='all', material=None)[source]

associate a material or a material container to the element

defineModel(self, group='all', model=None)[source]

match a model (class model) or a set of models (class model) to a group

findNode(coor, atol=1e-08)[source]

findNode(self, n, atol=1.e-8):

this function return the index of the node which coordinates are coor, subject to the absolute tolerance atol, if it exists; None otherwise

parameters:

  • self: the avatar
  • coor: the given coordinates
  • atol: absolute tolerance

returned value:

  • index of the node, if it exists; None otherwise
getNodebyGroup(group)[source]

getNodebyGroup(self,group): this functions return the node list by physical group to this avatar

hasGroup(group)[source]

hasGroup(self,group):

this functions return “True” iff the given group belongs to the given avatar

imposeDrivenDof(self, group='all', component=1, description='predefined', ct=0., amp=0., omega=0., phi=0., rampi=1., ramp=0., evolutionFile='', dofty='temp')[source]

this function associate a boundary condition to each node of the considered group of the considered avatar

parameters:

  • dofty : type of boundary condition (vlocy for velocity, force for.. force, temp for temperature and flux for heat flux)
  • description : ‘predefined’ or ‘evolution’
    • ‘predefined’: ct, amp, omega, phi, rampi and ramp must be defined so that the boundary value will be : [ ct + amp * cos(omega*t+phi) ] * sgn(rampi + ramp*t) * min(abs(rampi + ramp*t), 1), where t is the time
    • ‘evolution’ : evolutionFile must be defined the input file must contain two columns separated by a blank character. First columns is time and the second one the imposed value. A linear interpolation is made by LMGC90 to compute values at computational times different from those given in input
imposeInitValue(self, group='all', component=1, value=0.)[source]

impose a value to a degree of freedom

mirror(n, center, atol=1e-08)[source]

mirror(slef, n, center, atol=1.e-8):

this function changes an avatar to its symmetrical through the given plane

parameters:

  • self the avatar itself
  • n: normal to the considered plane
  • center: a point beonging to the considered plane

optional parameters:

  • atol: absolute tolerance
relaxDrivenDof(group='all', component=1)[source]

relaxDrivenDof(self, group=’all’, component=1):

this function relax driven dof

rotate(self, description='Euler', phi=0., theta=0., psi=0., alpha=0., axis=[0., 0., 1.], center=[0., 0., 0.])[source]

this function rotates the considered avatar, according to the given rotation parameters and a rotation center. Supported rotation paramters are: Euler’s angles or an axis and an angle

parameters:

  • self: the avatar itself
  • description=’Euler’: defines the rotation parameters:
    • if description = ‘Euler’, the rotation uses Euler’s angles, consequently only phi, theta, psi and center are considered
    • if description = ‘axis’, the rotation uses an axis and an angle, consequently only axis, alpha and center are considered
  • phi: first Euler’s angle (rotation with respect to z-axis)
  • theta: second Euler’s angle (rotation with respect to x-axis)
  • psi: third Euler’s angle (rotation with respect to z-axis, the only one admissible in 2D)
  • axis: a 3D vector defining rotation axis (colinear to z-axis in 2D)
  • angle: rotation angle
  • center: rotation center

N.B. all angles are in radians

scale(scale=1.0)[source]

usage self.scale(scale = 1.0)

where scale is the scale

translate(dx=0.0, dy=0.0, dz=0.0)[source]

usage self.tranlsate(dx=0.,dy=0.,dz=0.)

where dx,dy, dz are components of translation vector

class pylmgc90.pre.avatars[source]

avatar container class

Methods:

  • addAvatar
  • getFemAvatar
  • getRigidAvatar

Methods

addAvatar
append
count((s, sub[, start[,end]]) -> int) Return the number of occurrences of substring sub in string s[start:end].
extend
getFemAvatar
getKey
getRigidAvatar
index((s, sub [,start [,end]]) -> int) Like find but raises ValueError when the substring is not found.
insert
keys
pop
remove
reverse
rotate
sort
sortedKeys
translate((s,table [,deletions]) -> string) Return a copy of the string s, where all characters occurring in the optional argument deletions are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256.
addAvatar(av)[source]

addAvatar(self,av):

this function adds the input avatar to the container

parameters:

  • self: the container itself
  • av: a given avatar
getFemAvatar(self)[source]

get the list of avatar of MAILx type

getRigidAvatar(self)[source]

get the list of avatar of RBDY2 or RBDY3 type

rotate(self, description='Euler', phi=0., theta=0., psi=0., alpha=0., axis=[0., 0., 1.], center=[0., 0., 0.])[source]

this function rotates every avatar in the set, according to the given rotation parameters and a rotation center. Supported rotation paramters are: Euler’s angles or an axis and an angle

parameters:

  • self: the avatar itself
  • description=’Euler’: defines the rotation parameters:
    • if description = ‘Euler’, the rotation uses Euler’s angles, consequently only phi, theta, psi and center are considered
    • if description = ‘axis’, the rotation uses an axis and an angle, consequently only axis, alpha and center are considered
  • phi: first Euler’s angle (rotation with respect to z-axis)
  • theta: second Euler’s angle (rotation with respect to x-axis)
  • psi: third Euler’s angle (rotation with respect to z-axis, the only one admissible in 2D)
  • axis: a 3D vector defining rotation axis (colinear to z-axis in 2D)
  • angle: rotation angle
  • center: rotation center
translate(dx=0.0, dy=0.0, dz=0.0)[source]

usage self.tranlsate(dx=0., dy=0., dz=0.)

where dx, dy, dz are components of translation vector

Node

class pylmgc90.pre.node(coor=None, number=0)[source]

Class defining the node entity

Methods

applyAffineMapToCoor(q, center) applyAffineMapToCoor(self, q, center):
checkType()
defineDof(mod)
getCoor(self) returns coor
get_anonymous_shape()
imposeDrivenDof(composantes[, description, ...])
imposeInitValue(composantes, values)
relaxDrivenDof(composantes)
scale(scale)
translate(dx, dy, dz)
applyAffineMapToCoor(q, center)[source]

applyAffineMapToCoor(self, q, center):

this function applies an affine map to the node coordinates.

parameters:

  • self: the node itself
  • q: a linear map expressed as a 3x3 matrix
  • center: coordinates of the reference point of the affine map
getCoor(self)[source]

returns coor

class pylmgc90.pre.nodes[source]

node container

inherits from container class ‘iterator’ key is the number of the node

Methods

addNode(self,noeud) add a node to the container and index it with its number
clear(() -> None.  Remove all items from D.)
copy(() -> a shallow copy of D)
fromkeys(...) v defaults to None.
get((k[,d]) -> D[k] if k in D, ...)
getKey(value) getKey(self, value):
has_key((k) -> True if D has a key k, else False)
items(() -> list of D’s (key, value) pairs, ...)
iteritems(() -> an iterator over the (key, ...)
iterkeys(() -> an iterator over the keys of D)
itervalues(...)
keys(() -> list of D’s keys)
pop((k[,d]) -> v, ...) If key is not found, d is returned if given, otherwise KeyError is raised
popitem(() -> (k, v), ...) 2-tuple; but raise KeyError if D is empty.
setdefault((k[,d]) -> D.get(k,d), ...)
sortedKeys(self) this function returns the sorted list of keys giving
update(([E, ...) If E present and has a .keys() method, does: for k in E: D[k] = E[k]
values(() -> list of D’s values)
viewitems(...)
viewkeys(...)
viewvalues(...)
addNode(self, noeud)[source]

add a node to the container and index it with its number usage: nodes.addNode(node)

Bulk

class pylmgc90.pre.bulk(elem_dim, connectivity, physicalEntity='1', geometricalEntity='1', number=None, nbNodes=None)[source]

Methods

defineMaterial(mat) ‘mat’ is either a string or a of the class ‘material’
defineModel(mod) ‘mod’ is a model
defineMaterial(mat)[source]

‘mat’ is either a string or a of the class ‘material’

defineModel(mod)[source]

‘mod’ is a model

class pylmgc90.pre.bulks[source]

bulk container

inherits from container class ‘sequence_container’ i.e. keys are automatically attributed

Methods

addBulk(self,new) add a bulk to the container and index it with its number
append L.append(object) – append object to end
count(...)
draw(Nodes, fen)
extend L.extend(iterable) – extend list by appending elements from the iterable
getKey(value) getKey(self, value):
index((value, [start, ...) Raises ValueError if the value is not present.
insert L.insert(index, object) – insert object before index
keys(self) this function returns the list of keys (i.e. indices) giving
pop(...) Raises IndexError if list is empty or index is out of range.
remove L.remove(value) – remove first occurrence of value.
reverse L.reverse() – reverse IN PLACE
sort L.sort(cmp=None, key=None, reverse=False) – stable sort IN PLACE;
sortedKeys(self) this function returns the sorted list of keys giving
addBulk(self, new)[source]

add a bulk to the container and index it with its number

Contactor

class pylmgc90.pre.contactor(elements, shape, color, number=None)[source]

class contactor()

attributs:

  • number : an identifier
  • shape : lmgc90 tact type (char[5])
  • elements: a bulk list
  • color : lmgc90 color for tact_behav (char[5])
  • connectivity: nodes’ indices defining the contactor

methods:

  • addOptions
  • addOption
  • modifie

Methods

getOption(self,attribut)
get_anonymous_shape() get_anonympous_shape(self, number):
strInBodiesFile(number) strInBodiesFile(self, number):
writeOpt()
getOption(self, attribut)[source]
get_anonymous_shape()[source]

get_anonympous_shape(self, number):

this function returns the contactor type (type), the contactor color (color), a list of integers (i4_vector) and a list of real numbers (r8_vector) describing the contactor.

parameters:

  • self: the contactor itself

returned value: the tuple (shape, color, i4_vector, r8_vector).

strInBodiesFile(number)[source]

strInBodiesFile(self, number):

this function returns a string used to represent the contactor in the BODIES.DAT file.

parameters:

  • self: the contactor itself
  • number: index oh the contactor

returned value: a string used to represent the contactor in the BODIES.DAT file.

class pylmgc90.pre.contactors[source]

contactor container

inherits from container class ‘sequence container’ i.e. keys are automatically attributed

Methods

addContactor(self,tact) assign a number to a contactor and add it to the container
append L.append(object) – append object to end
count(...)
extend L.extend(iterable) – extend list by appending elements from the iterable
getKey(value) getKey(self, value):
index((value, [start, ...) Raises ValueError if the value is not present.
insert L.insert(index, object) – insert object before index
keys(self) this function returns the list of keys (i.e. indices) giving
lastContactor(self) returns last contactor number of the list
pop(...) Raises IndexError if list is empty or index is out of range.
remove L.remove(value) – remove first occurrence of value.
reverse L.reverse() – reverse IN PLACE
sort L.sort(cmp=None, key=None, reverse=False) – stable sort IN PLACE;
sortedKeys(self) this function returns the sorted list of keys giving
addContactor(self, tact)[source]

assign a number to a contactor and add it to the container

lastContactor(self)[source]

returns last contactor number of the list

Interaction

class pylmgc90.pre.tact_behav(name, law, **kargs)[source]

class behav() definit un comportement d interaction defini dans ‘behavOptions’ methodes associees: -__init__ -addOption

class pylmgc90.pre.tact_behavs[source]

classe behavs : conteneur de comportement methodes associees: -addBehav

Methods

addBehav
clear
copy
fromkeys
get
getKey
has_key
items
iteritems
iterkeys
itervalues
keys
pop
popitem
setdefault
sortedKeys
update
values
viewitems
viewkeys
viewvalues
addBehav(self, bebe)[source]

ajoute un comportement au conteneur

Visibility table

class pylmgc90.pre.see_table(CorpsCandidat, candidat, colorCandidat, behav, CorpsAntagoniste, antagoniste, colorAntagoniste, alert, halo=None, name=None)[source]

class see_table()

this class defines objects to store the see tables used by the contact detection

methods:

  • __init__: constructor
class pylmgc90.pre.see_tables[source]

classe see_tables derive de ‘sequence_container’ methodes definies: -addSeeTable

Methods

addSeeTable(self,st) ou st est une table de visu
append L.append(object) – append object to end
count(...)
extend L.extend(iterable) – extend list by appending elements from the iterable
getKey(value) getKey(self, value):
index((value, [start, ...) Raises ValueError if the value is not present.
insert L.insert(index, object) – insert object before index
keys(self) this function returns the list of keys (i.e. indices) giving
pop(...) Raises IndexError if list is empty or index is out of range.
remove L.remove(value) – remove first occurrence of value.
reverse L.reverse() – reverse IN PLACE
sort L.sort(cmp=None, key=None, reverse=False) – stable sort IN PLACE;
sortedKeys(self) this function returns the sorted list of keys giving
addSeeTable(self, st)[source]

ou st est une table de visu

Granular functions

Granulometry generation

pylmgc90.pre.granulo_Monodisperse(nb, radius)[source]

Generate a list of radii following a monodisperse distribution

pylmgc90.pre.granulo_Random(nb, r_min, r_max, seed=None)[source]

Generates a list of radii bewteen r_min and r_max following a uniform distribution in number

pylmgc90.pre.granulo_Uniform(nb, r_min, r_max, seed=None)[source]

Generates a list of radii between r_min and r_max following a uniform distribution in surface

pylmgc90.pre.granulo_TwoSizesNumber(nb, r_min, r_max, p_min, seed=None)[source]

Generates a granulometry composed of two radii, r_min and r_max. The distribution is binomial in number

pylmgc90.pre.granulo_TwoSizesVolume(nb, r_min, r_max, p_min, seed=None)[source]

Generates a granulometry composed of two radii, r_min and r_max. The distribution is binomial in surface

pylmgc90.pre.granulo_ReadFromFile(name)[source]

Read a granulometry from a file

Deposit

pylmgc90.pre.depositInBox2D(radii, lx, ly, deposited_radii=None, deposited_coor=None)[source]

[nb_remaining_particles, coor]=depositInBox2D(radii, lx, ly, deposited_radii=None, deposited_coor=None):

this function deposits circular particles in a box

parameters:

  • radii: radii of the particles
  • lx: length of the box
  • ly: heigth of the box

optional parameters:

  • deposited_radii=None: radii of particles supposed to be in the box before the deposit
  • deposited_coor=None: radii of these deposited particles

returned values:

  • nb_remaining_particles: number of deposited particles
  • coor: coordinates of the deposited particles [x1, y1, x2, y2, ...]

WARNING:

  1. this function changes the radii list since it nullifies radii of the particles out of the box. So, after calling this function, only the first nb_remaining_particles particles are of interest
  2. to avoid interpenetrations between particles and walls, this function uses a shrink based on the size of the particles
pylmgc90.pre.depositInDisk2D(radii, r, deposited_radii=None, deposited_coor=None)[source]

[nb_remaining_particles, coor]=depositInDisk2D(radii, r, deposited_radii=None, deposited_coor=None):

this function deposits circular particles in a circular container

parameters:

  • radii: radii of the particles
  • r: radius of the container

optional parameters:

  • deposited_radii=None: radii of particles supposed to be in the box before the deposit
  • deposited_coor=None: radii of these deposited particles

returned values:

  • nb_remaining_particles: number of deposited particles
  • coor: coordinates of the deposited particles [x1, y1, x2, y2, ...]

WARNING: this function changes the radii list since it nullifies radii of the particles out of the box. So, after calling this function, only the first nb_remaining_particles particles are of interest

pylmgc90.pre.depositInCouette2D(radii, rint, rext, deposited_radii=None, deposited_coor=None)[source]

[nb_remaining_particles, coor]=depositInCouetteD(radii, rint, rext, deposited_radii=None, deposited_coor=None):

this function deposits circular particles in container designed for a Couette shear

parameters:

  • radii: radii of the particles
  • rint: internal radius of the ring occupied by particles
  • rext: external radius of the ring occupied by particles

optional parameters:

  • deposited_radii=None: radii of particles supposed to be in the box before the deposit
  • deposited_coor=None: radii of these deposited particles

returned values:

  • nb_remaining_particles: number of deposited particles
  • coor: coordinates of the deposited particles [x1, y1, x2, y2, ...]

WARNING:

  1. this function changes the radii list since it nullifies radii of the particles out of the box. So, after calling this function, only the first nb_remaining_particles particles are of interest
  2. to avoid interpenetrations between particles and walls, this function uses a shrink based on the size of the particles
pylmgc90.pre.depositInDrum2D(radii, r, deposited_radii=None, deposited_coor=None)[source]

[nb_remaining_particles, coor]=depositInDrum2D(radii, deposited_radii=None, deposited_coor=None):

this function deposits circular particles in the lower half part of a drum

parameters:

  • radii: radii of the particles
  • r: radius of the container

optional parameters:

  • deposited_radii=None: radii of particles supposed to be in the box before the deposit
  • deposited_coor=None: radii of these deposited particles

returned values:

  • nb_remaining_particles: number of deposited particles
  • coor: coordinates of the deposited particles [x1, y1, x2, y2, ...]

WARNING:

  1. this function changes the radii list since it nullifies radii of the particles out of the box. So, after calling this function, only the first nb_remaining_particles particles are of interest
  2. to avoid interpenetrations between particles and walls, this function uses a shrink based on the size of the particles
pylmgc90.pre.depositInBox3D(radii, lx, ly, lz, deposited_radii=None, deposited_coor=None, seed=None)[source]

[nb_remaining_particles, coor]=depositInBox3D(radii, lx, ly, lz, deposited_radii=None, deposited_coor=None):

this function deposits spherical particles in a box

parameters:

  • radii: radii of the particles
  • lx: width of the box, following Ox axis
  • ly: width of the box, following Oy axis
  • lz: heigth of the box

N.B. a point (x, y, z) is in the box iff x is in [-lx/2, lx/2], y is in [-ly/2, ly/2] and z is in [0, lz]

optional parameters:

  • deposited_radii=None: radii of particles supposed to be already deposited
  • deposited_coor=None: coordinates of these deposited particles
  • seed=None: an input seed to control randomness

returned values:

  • nb_remaining_particles: number of deposited particles
  • coor: coordinates of the deposited particles [x1, y1, z1, x2, y2, z2, ...]

WARNING: this function changes the radii list since it nullifies radii of the particles out of the box. So, after calling this function, only the first nb_remaining_particles particles are of interest

pylmgc90.pre.depositInCylinder3D(radii, R, lz, deposited_radii=None, deposited_coor=None, seed=None)[source]

[nb_remaining_particles, coor]=depositInCylinder3D(radii, R, lz, deposited_radii=None, deposited_coor=None, seed=None):

this function deposits spherical particles in a cylinder

parameters:

  • radii: radii of the particles
  • R: radius of the cylinder
  • lz: heigth of the cylinder

N.B. a point (x, y, z) is in the cylinder iff x^2 + y^2 is in [0, R^2] and z is in [0, lz]

optional parameters:

  • deposited_radii=None: radii of particles supposed to be already deposited
  • deposited_coor=None: coordinates of these deposited particles
  • seed=None: an input seed to control randomness

returned values:

  • nb_remaining_particles: number of deposited particles
  • coor: coordinates of the deposited particles [x1, y1, z1, x2, y2, z2, ...]

WARNING: this function changes the radii list since it nullifies radii of the particles out of the box. So, after calling this function, only the first nb_remaining_particles particles are of interest

pylmgc90.pre.depositInSphere3D(radii, R, center, deposited_radii=None, deposited_coor=None, seed=None)[source]

[nb_remaining_particles, coor]=depositInSphere3D(radii, R, center, deposited_radii=None, deposited_coor=None, seed=None):

this function deposits spherical particles in a cylinder

parameters:

  • radii: radii of the particles
  • R: radius of the sphere
  • center: center of the sphere

N.B. a point (x, y, z) is in the sphere iff (x - x_C)^2 + (y - y_C)^2 + (z - z_C)^2 is in [0, R^2]

optional parameters:

  • deposited_radii=None: radii of particles supposed to be already deposited
  • deposited_coor=None: coordinates of these deposited particles
  • seed=None: an input seed to control randomness

returned values:

  • nb_remaining_particles: number of deposited particles
  • coor: coordinates of the deposited particles [x1, y1, z1, x2, y2, z2, ...]

WARNING: this function changes the radii list since it nullifies radii of the particles out of the box. So, after calling this function, only the first nb_remaining_particles particles are of interest

pylmgc90.pre.squareLattice2D(nb_ele, nb_layer, l, x0=0.0, y0=0.0)[source]

coor=squareLattice2D(nb_ele, nb_layer, l, x0=0., y0=0.):

this function compute a list of positions on a square lattice

parameters:

  • nb_ele: number of particles on the first layer (the lowest)
  • nb_layer: number of layers
  • l: length of a lattice element, i.e. distance between two consecutive positions on the same layer, or the same column

optional parameters:

  • (x0, y0): position of the lower left corner of the bounding box of the lattice, i.e. the first position is (x0 + l/2, y0 + l/2)

return value:

  • coordinates of the positions [x1, y1, x2, y2, ...]

N.B.: the total number of positions is nb_ele*nb_layer

WARNING:

  1. the maximal radius of the particles to be deposited max_radius must verify: max_radius <= l/2
  2. the dimensions of the bounding box of the lattice are : nb_ele*l x nb_layer*l
pylmgc90.pre.triangularLattice2D(nb_ele, nb_layer, l, x0=0.0, y0=0.0, orientation='up')[source]

coor=triangularLattice2D(nb_ele, nb_layer, l, x0=0., y0=0., orientation=’up’):

this function compute a list of positions on an equilateral triangular lattice

parameters:

  • nb_ele: number of particles on the first layer (the lowest)
  • nb_layer: number of layers
  • l: length of a lattice element, i.e. distance between two consecutive positions on the same layer, or the same column

optional parameters:

  • (x0, y0): position of the lower left corner of the bounding box of the lattice, i.e. the first position is (x0 + l/2, y0 + l/2)
  • orientation=’up’: orientation of the first layer of triangle : * up * down

return value:

  • coordinates of the positions [x1, y1, x2, y2, ...]

WARNING: the maximal radius of the particles to be deposited max_radius must verify: max_radius <= l/2

pylmgc90.pre.cubicLattice3D(nb_ele_x, nb_ele_y, nb_layer, l, x0=0.0, y0=0.0, z0=0.0)[source]

coor=cubicLattice3D(nb_ele_x, nb_ele_y, nb_layer, l, x0=0., y0=0., z0=0.):

this function compute a list of positions on a cubic lattice

parameters:

  • nb_ele_x: number of particles on the first layer, following axis (Ox) (the lowest)
  • nb_ele_z: number of particles on the first layer, following axis (Oz) (the lowest)
  • nb_layer: number of layers
  • l: length of a lattice element, i.e. distance between two consecutive positions on the same layer, or the same column

optional parameters:

  • (x0, y0, z0): position of the lower left corner of the bounding box of the lattice, i.e. the first position is (x0 + l/2, y0 + l/2, z0 + l/2)

return value:

  • coordinates of the positions [x1, y1, z1, x2, y2, z2, ...]

N.B.: the total number of positions is nb_ele_x*nb_ele_y*nb_layer

WARNING:

  1. the maximal radius of the particles to be deposited max_radius must verify: max_radius <= l/2
  2. the dimensions of the bounding box of the lattice are : nb_ele_x*l x nb_ele_y x nb_layer*l

Particle generation

pylmgc90.pre.rigidDisk(r, center, model, material, color='BLEUx', number=None, is_Hollow=False, is_Pneum=False)[source]

usage:

body=rigidDisk(r, center, model, material, color=’BLEUx’, number=None, is_Hollow=False, is_Pneum=False)

this function builds a rigid disk and returns the generated body

parameters :

  • r : radius of the particle
  • center : position of the center of inertia in the global frame, as a two coordinates vector
  • model : rigid model for the particle
  • material : the particle is made of this material

optional parameters :

  • color=’BLEUx’ : color of the contactor
  • number=None: index of the avatar (still present to ensure compatibility)
  • is_Hollow = False: is the contactor to be a hollow one (xKSID instead of DISKx or xPSID instead of DISPx).
  • is_Pneum = False: is the contactor to be a pneumatic one (DISPx instead of DISKx or xPSID instead of xKSID).
pylmgc90.pre.rigidCluster(r, center, nb_disk, model, material, color='BLEUx', number=None)[source]

usage:

body=rigidCluster(r, center, nb_disk, model, material, color=’BLEUx’, number=None)

this function builds a rigid cluster of disks in a disk and returns the generated body

parameters :

  • r : radius of the bounding disk
  • center : position of the center of inertia in the global frame
  • nb_disk : number of disks of the cluster
  • model : rigid model for the particle
  • material : the particle is made of this material

optional parameters :

  • color=’BLEUx’ : color of the contactors
  • number=None: index of the avatar (still present to ensure compatibility)
pylmgc90.pre.rigidDiscreteDisk(r, center, model, material, color='BLEUx', number=None)[source]

body=rigidDiscreteDisk(r, center, model, material, color=’BLEUx’, number=None):

this function builds a rigid cluster of diskx contained in a disk and returns the generated body

parameters :

  • r : radius of the particle
  • center : position of the center of inertia in the global frame, as a two coordinates vector
  • model : rigid model for the particle
  • material : the particle is made of this material

optional parameters :

  • color=’BLEUx’ : color of the contactors
  • number=None: index of the avatar (still present to ensure compatibility)
pylmgc90.pre.rigidJonc(axe1, axe2, center, model, material, color='BLEUx', number=None)[source]

usage:

body=rigidJonc(axe1, axe2, center, model, material, color=’BLEUx’, number=None)

this function builds an horizontal rigid jonc and returns the generated body

parameters :

  • axe1 : half length of the jonc
  • axe2 : half height of the jonc
  • center : position of the center of inertia in the global frame, as a two coordinates vector
  • model : rigid model for the particle
  • material : the particle is made of this material

optional parameters :

  • color=’BLEUx’ : color of the contactor
  • number=None: index of the avatar (still present to ensure compatibility)
pylmgc90.pre.rigidPolygon(model, material, center, theta=0.0, color='BLEUx', generation_type='regular', nb_vertices=0, vertices=None, radius=1.0, number=None)[source]

usage:

body=rigidPolygon(model, material, center, theta=0., color=’BLEUx’, generation_type, nb_vertices, vertices, radius, number=None)

This function builds a rigid polygon using 2 methods (see below).

Some parameters are common to the methods and mandatory:

  • model : rigid model of the particle
  • material : material of the particle
  • center : position of the center of inertia the particle in the global frame

Some parameters are common but optional:

  • theta=0. : rotation angle of the inertia frame
  • number=None : index of the avatar
  • generation_type =’regular’ : the method used to generate the polygon contactor
  • color=’BLEUx’ : color of the polygon contactor

One way (generation_type =’regular’) consists in generating a polygon with its nodes located on a circle:

parameters :

  • radius=1. : radius of the circle
  • nb_vertices=0. : number of vertices of the contactor

The other way (generation_type =’full’) consists in generating a polygon giving a list of vertices:

parameters :

  • vertices : array of coordinates (nb_vertices,2)
pylmgc90.pre.rigidOvoidPolygon(ra, rb, nb_vertices, center, model, material, theta=0.0, color='BLEUx', number=None)[source]

usage :

body=rigidOvoidPolygon(ra, rb, nb_vertices, center, model, material, theta=0., color=’BLEUx’, number=None)

this function builds a rigid polygon and returns the generated body

parameters :

  • ra : radius along x of the bounding disk
  • rb : radius along y of the bounding disk
  • nb_vertices : number of vertices of the polygon
  • center : position of the center of inertia in the global frame
  • model : rigid model for the particle
  • material : the particle is made of this material

optional parameters :

  • theta=0. : rotation angle in the inertial frame
  • color=’BLEUx’ : color of the polygon contactor
  • number=None : index of the body
pylmgc90.pre.deformableParticle2D(r, center, type_part, model, material, color='BLEUx', number=None)[source]

usage:

body=deformableParticle2D(r, center, type_part, model, material, color=’BLEUx’, number=None)

this function builds a deformable particle and returns the generated body

N.B. elements on the skin of the particle belong to the group ‘skin’

parameters :

  • r : radius of the particle
  • center : position of the center of inertia in the global frame
  • type_part : type of particule, it must correspond to a known precalculated mesh (‘Disk’ or ‘pent’)
  • model : model
  • material : material

optional parameters :

  • color=’BLEUx’ : color of the candidate and antagonist contactors
  • number=None: index of the avatar (still present to ensure compatibility)
pylmgc90.pre.rigidSphere(r, center, model, material, color='BLEUx', number=None)[source]

usage:

body=rigidSphere(r, center, model, material, color=’BLEUx’, number=None)

this function builds a rigid sphere and returns the generated body

parameters :

  • r : radius of the particle
  • center : position of the center of inertia in the global frame, as a three coordinates vector
  • model : rigid model for the particle
  • material : the particle is made of this material

optional parameters :

  • color=’BLEUx’ : color of the contactor
  • number=None: index of the avatar (still present to ensure compatibility)
pylmgc90.pre.rigidPlan(axe1, axe2, axe3, center, model, material, color='BLEUx', number=None)[source]

usage:

body=rigidPlan(axe1, axe2, axe3, center, model, material, color=’BLEUx’, number=None)

this function builds an horizontal rigid plan and returns the generated body

parameters :

  • axe1 : half length of the plan
  • axe2 : half width of the plan
  • axe3 : half thickness of the plan
  • center : position of the center of inertia in the global frame, as a three coordinates vector
  • model : rigid model for the particle
  • material : the particle is made of this material

optional parameters :

  • color=’BLEUx’ : color of the contactor
  • number=None: index of the avatar (still present to ensure compatibility)
pylmgc90.pre.rigidCylinder(r, h, center, model, material, color='BLEUx', number=None, is_Hollow=False)[source]

usage:

body=rigidCylinder(r, h, center, model, material, color=’BLEUx’, number=None, is_Hollow=False)

this function builds a rigid cylinder and returns the generated body

parameters :

  • r : radius of the cylinder
  • h : heigth of the cylinder
  • center : position of the center of inertia in the global frame, as a three coordinates vector
  • model : rigid model for the cylinder
  • material : the cylinder is made of this material

optional parameters :

  • color=’BLEUx’ : color of the contactor
  • number=None: index of the avatar (still present to ensure compatibility)
  • is_Hollow = False: is the contactor to be a hollow one (DNLYC instead of CYLND)
pylmgc90.pre.rigidPolyhedron(model, material, center=array([ 0., 0., 0.]), color='BLEUx', generation_type='regular', nb_vertices=0, vertices=None, faces=None, radius=1.0, tol=0.0, number=None, seed=None)[source]

usage:

body = rigidPolyhedron(model, material, center=numpy.zeros(3,’d’), generation_type=’regular’, color=’BLEUx’,
nb_vertices=0, vertices=None, faces=None, radius=1., tol=0., number=None, s=None)

This function builds a rigid convex polyhedron using 4 methods (see below).

Some parameters are common to the methods and mandatory:

  • model : rigid model for the particle
  • material : the particle is made of this material

Some parameters are common but optional:

  • center=numpy.zeros(3,’d’) : position of the center of inertia the particle in the global frame
  • color=’BLEUx’ : color of the sphere contactor.
  • generation_type=’regular’ : the method used to generate the polyhedron contactor.
  • number=None: index of the avatar (still present to ensure compatibility).

Generation methods:

  • First method (generation_type =’regular’) consists in generating vertices of the polyhedron regularly disposed on a sphere (of radius ‘radius’). For Platon’s polyhedra (number of vertices is 4, 6, 8, 12 or 20) the number of vertices used is exactly the one given in input, otherwise the number of vertices found by the generator may differ from the one in input (especially for low number of vertices).

    parameters :

    • nb_vertices=0. : number of vertices of the contactor
    • radius=1. : radius of the encompassing sphere.
  • Second method (generation_type =’random’) consists in generating vertices of the polyhedron randomly disposed on a sphere (of radius ‘radius’). The number of vertices used is exactly the one given in input (contrary to the first method).

    • nb_vertices=0. : number of vertices of the contactor
    • radius=1. : radius of the encompassing sphere.
    • tol=0. : tolerance to use to remove a vertex if the one found is to close to others (if 0. no check)
    • seed=None : seed to use to control the randomness
  • Third method (generation_type =’vertices’) generates the polyhedron defined by the convex hull of the vertices given in input. The ‘vertices’ array may be modified on output if the vertices set given was not convex.

    • vertices=None : array of coordinates (nb_vertices,3), if the vertices set is not convex on input, some points will be deleted on output.
  • Fourth method (generation_type =’full’|’bevel’) generates the polyhedron using the vertices and connectivity given in input. Using ‘bevel’ will cut corners.

    • vertices=None : array of coordinates (nb_vertices,3).
    • faces=None: faces as triangles connectivity of vertices (nb_faces,3). Numbering of vertices in ‘faces’ array is 1 to nb_vertices (and not 0 to nb_vertices-1 like in Python).

Wall generation

pylmgc90.pre.roughWall(center, l, r, model, material, theta=0.0, color='WALLx', nb_vertex=0, number=None)[source]

body=roughWall(center, l, r, model, material, theta=0., color=’WALLx’, nb_vertex=0, number=None):

this function builds a 2D rough wall: it returns a body made of a cluster of disks or polygons

parameters:

  • center: mass center of the wall in the global frame
  • l: minimal length of the wall, i.e. since the wall is made of disk having a given radius, it could be bigger than expected
  • r: radius of a particle
  • model: rigid model for the particle
  • material: the particle is made of this material

optional parameters:

  • theta=0.: rotation angle in the inertial frame
  • color=’WALLx’: color of a disk contactor
  • nb_vertex=0: if nb_vertex is greater or equal to three, generated particles are regular polygons having nb_vertex vertices
  • number=None: index of the avatar (still present to ensure compatibility)
pylmgc90.pre.fineWall(center, l, r, model, material, theta=0.0, color='WALLx', nb_vertex=0, number=None)[source]

body=roughWall(center, l, r, model, material, theta=0., color=’WALLx’, nb_vertex=0, number=None):

this function builds a 2D not too rough wall: it returns a body made of a cluster of disks or polygons but with contactors overlapping each others to reduce the roughness

parameters:

  • center: mass center of the wall in the global frame
  • l: minimal length of the wall, i.e. since the wall is made of disk having a given radius, it could be bigger than expected
  • r: radius of a particle
  • model: rigid model for the particle
  • material: the particle is made of this material

optional parameters:

  • theta=0.: rotation angle in the inertial frame
  • color=’WALLx’: color of a disk contactor
  • nb_vertex=0: if nb_vertex is greater or equal to three, generated particles are regular polygons having nb_vertex vertices
  • number=None: index of the avatar (still present to ensure compatibility)
pylmgc90.pre.smoothWall(center, l, h, nb_polyg, model, material, theta=0.0, color='WALLx', number=None)[source]

body=RoughWall(center, l, h, nb_polyg, model, material, theta=0., color=’WALLx’, number=None):

this function builds a 2D smooth wall: it returns a body made of a cluster of rectangular polygons

parameters :

  • center: mass center of the wall in the global frame
  • l: length of the wall
  • h: height of the wall
  • nb_polyg: number of bricks in the wall
  • model: rigid model for the wall
  • material: the wall is made of this material

optional parameters:

  • theta=0.: rotation angle in the inertial frame
  • color=’WALLx’: color of a polygon contactor
  • number=None: index of the avatar (still present to ensure compatibility)
pylmgc90.pre.granuloRoughWall(center, l, rmin, rmax, model, material, theta=0.0, color='WALLx', nb_vertex=0, seed=None)[source]

body=granuloRoughWall(center, l, rmin, rmax, model, material, theta=0., color=’WALLx’, nb_vertex=0, seed=None):

this function builds a 2D rough wall: it returns a body made of a cluster of disks or polygons. The radii of the particles defining the cluster are randomly distrubuted in the interval [rmin, rmax]

parameters:

  • center: mass center of the wall in the global frame
  • l: minimal length of the wall, i.e. since the wall is made of disk having a given radius, it could be bigger than expected
  • rmin, rmax: bounds of the interval of radii defining the roughness of the wall
  • model: rigid model for the particle
  • material: the particle is made of this material

optional parameters:

  • theta=0.: rotation angle in the inertial frame
  • color=’WALLx’: color of a disk contactor
  • nb_vertex=0: if nb_vertex is greater or equal to three, generated particles are regular polygons having nb_vertex vertices
  • seed=None: seed to use to control the randomness
pylmgc90.pre.roughWall3D(center, lx, ly, r, model, material, color='WALLx')[source]

body=roughWall3D(center, l, r, model, material, color=’WALLx’):

this function builds a 3D rough wall: it returns a body made of a cluster of spheres

parameters:

  • center: mass center of the wall in the global frame
  • lx: minimal length of the wall along x-axis, i.e. since the wall is made of spheres having a given radius, it could be bigger than expected
  • ly: minimal length of the wall along y-axis, i.e. since the wall is made of spheres having a given radius, it could be bigger than expected
  • r: radius of a particle
  • model: rigid model for the particle
  • material: the particle is made of this material

optional parameters:

  • color=’WALLx’: color of a sphere contactor
pylmgc90.pre.granuloRoughWall3D(center, lx, ly, rmin, rmax, model, material, color='WALLx', seed=None)[source]

body=granuloRoughWall3D(center, l, rmin, rmax, model, material, color=’WALLx’, seed=None):

this function builds a 3D rough wall using the same granulometry than the sample: it returns a body made of a cluster of spheres of different radius

parameters:

  • center: mass center of the wall in the global frame
  • lx: minimal length of the wall along x-axis, i.e. since the wall is made of spheres having a given radius, it could be bigger than expected
  • ly: minimal length of the wall along y-axis, i.e. since the wall is made of spheres having a given radius, it could be bigger than expected
  • rmin: minimal radius of a particle
  • rmax: maximal radius of a particle
  • model: rigid model for the particle
  • material: the particle is made of this material

optional parameters:

  • color=’WALLx’: color of a sphere contactor
  • seed=None: seed to use to control the randomness

Masonry

Bricks

class pylmgc90.pre.brick2D(name, lx, ly)[source]

class designed to build rigid or deformable bricks in 2D

Methods:

  • __init__
  • rigidBrick
  • deformableBrick
  • explodedDeformableBrick

Methods

deformableBrick(center, material, model[, ...]) deformableBrick(self, center, material, model, number, mesh_type=‘4T3’,
explodedDeformableBrick(center, material, model) explodedDeformableBrick(self, center, material, model, mesh_type=‘4T3’,
rigidBrick(center, model, material[, color, ...]) rigidBrick(self, center, model, material, color=’BLEUx’, number=None):
deformableBrick(center, material, model, mesh_type='4T3', nb_elem_x=1, nb_elem_y=1, apabh=None, apabv=None, apabhc=0.25, apabvc=0.25, colors=['HORIx', 'VERTx', 'HORIx', 'VERTx'], number=None)[source]

deformableBrick(self, center, material, model, number, mesh_type=‘4T3’, nb_elem_x=1, nb_elem_y=1, apabh=None, apabv=None, apabhc=0.25, apabvc=0.25, colors=[‘HORIx’, ‘VERTx’, ‘HORIx’, ‘VERTx’]):

this function builds and returns a deformable brick

parameters:

  • self: the object brick itself
  • center: position of the center of inertia in the global frame
  • material: the brick is made of this material
  • model: mechanical model for the brick

optional parameters :

  • mesh_type=‘4T3’: meshing strategy for the brick (possible values: ‘Q4’, ‘Q8’, ‘2T3’ and ‘4T3’)
  • nb_elem_x: number of elements Q4 following direction Ox
  • nb_elem_y: number of elements Q4 following direction Oy
  • apabh: curvilign abscissas used to put candidate points on horizontal lines
  • apabv: curvilign abscissas used to put candidate points on vertical lines
  • apabhc: curvilign abscissa used to put candidate point near a corner, on an horizontal line
  • apabvc: curvilign abscissa used to put candidate point near a corner, on an vertical line
  • colors=[‘HORIx’, ‘VERTx’, ‘HORIx’, ‘VERTx’]: colors of the contactors for each side of the brick, given in the following order: ‘down’, ‘right’, ‘up’, ‘left’
  • number=None: index of the avatar (still present to ensure compatibility)
explodedDeformableBrick(center, material, model, mesh_type='4T3', nb_elem_x=1, nb_elem_y=1, apabh=None, apabv=None, apabhc=0.25, apabvc=0.25, colors=['HORIx', 'VERTx', 'HORIx', 'VERTx'], color='BLEUx', shift=0)[source]

explodedDeformableBrick(self, center, material, model, mesh_type=‘4T3’, nb_elem_x=1, nb_elem_y=1, apabh=None, apabv=None, apabhc=0.25, apabvc=0.25, colors=[‘HORIx’, ‘VERTx’, ‘HORIx’, ‘VERTx’], color=’BLEUx’, shift=0):

this function builds and returns a deformable brick

parameters:

  • self: the object brick itself
  • center: position of the center of inertia in the global frame
  • material: the brick is made of this material
  • model: mechanical model for the brick

optional parameters :

  • mesh_type=‘4T3’: meshing strategy for the brick (possible values: ‘Q4’, ‘Q8’, ‘2T3’ and ‘4T3’)
  • nb_elem_x: number of elements Q4 following direction Ox
  • nb_elem_y: number of elements Q4 following direction Oy
  • apabh: curvilign abscissas used to put candidate points on horizontal lines
  • apabv: curvilign abscissas used to put candidate points on vertical lines
  • apabhc: curvilign abscissa used to put candidate point near a corner, on an horizontal line
  • apabvc: curvilign abscissa used to put candidate point near a corner, on an vertical line
  • color: color of contactors used to set cohesive zones
  • colors=[‘HORIx’, ‘VERTx’, ‘HORIx’, ‘VERTx’]: colors of the contactors for each side of the brick, given in the following order: ‘down’, ‘right’, ‘up’, ‘left’
  • shift: shift in the bodies numbering (still present to ensure compatibility)
rigidBrick(center, model, material, color='BLEUx', number=None)[source]

rigidBrick(self, center, model, material, color=’BLEUx’, number=None):

this function build and returns a rigid brick

parameters:

  • self: the object brick itself
  • center: position of the center of inertia in the global frame
  • model: rigid model for the brick
  • material: the brick is made of this material

optional parameter :

  • color=’BLEUx’: color of the contactor polygon
  • number=None: index of the avatar (still present to ensure compatibility)
class pylmgc90.pre.brick3D(name, lx, ly, lz)[source]

class designed to build rigid bricks in 3D Methods:

  • __init__
  • rigidBrick

Methods

rigidBrick(center, model, material[, color]) rigidBrick(self, center, model, material, color=’BLEUx’):
rigidBrick(center, model, material, color='BLEUx')[source]

rigidBrick(self, center, model, material, color=’BLEUx’): this function build and returns a rigid brick

parameters:

  • self: the object brick itself
  • center: position of the center of inertia in the global frame
  • model: rigid model for the brick
  • material: the brick is made of this material

optional parameter :

  • color=’BLEUx’: color of the contactor polhedron

Walls

class pylmgc90.pre.paneresse_simple(brick_ref, disposition)[source]

class paneresse_simple:

this class defines an objet representing a brick wall, using the so called “apareil en paneresses, simple”

Methods

buildRigidWall(origin, model, material[, ...]) buildRigidWall(self, origin, model, material, color, rtol=1e-5):
buildRigidWallWithoutHalfBricks(origin, ...) buildRigidWallWithoutHalfBricks(self, origin, model, material, color, rtol=1e-5):
computeHeight() computeHeight(self):
computeJointThickness() computeJointThickness(self):
computeNbRows([trend, rtol]) commputeNbRows(self, trend=”max”, rtol=1e-5):
evaluateHeight(nb_rows, joint_thickness) evaluateHeight(self, nb_rows, joint_thickness):
getLength() getLength(self):
getThickness() getThickness(self):
limitNbRows(height, joint_thickness) limitNbRows(self, height, joint_thickness):
setFirstRowByLength(first_brick_type, ...) setFirstRowByLength(self, first_brick_type, length, joint_thickness):
setFirstRowByNumberOfBricks(...) setFirstRowByNumberOfBricks(self, first_brick_type, nb_bricks, joint_thickness):
setHeight(height) setHeight(self, length):
setJointThicknessBetweenRows(joint_thickness) setJointThicknessBetweenRows(self, joint_thickness):
setNumberOfRows(nb_rows[, rtol]) setNumberOfRows(self, nb_rows, rtol=1e-5):
buildRigidWall(origin, model, material, colors=['BLEUx', 'REDxx'], rtol=1e-05)[source]

buildRigidWall(self, origin, model, material, color, rtol=1e-5):

this function builds the wall, as it generates a list of rigid avatars representing bricks of the wall

parameters:

  • self: the wall itself
  • origin: location of origin of the wall
  • model: rigid model for the bricks
  • material: the bricks are made of this material
  • color: color of the contactors

optional parameters:

  • rtol: relative tolerance used in floatting number comparaisons
buildRigidWallWithoutHalfBricks(origin, model, material, colors=['BLEUx', 'REDxx'], rtol=1e-05)[source]

buildRigidWallWithoutHalfBricks(self, origin, model, material, color, rtol=1e-5):

this function builds the wall, as it generates a list of rigid avatars representing bricks of the wall ; the built wall is “harpage” ready, since half bricks have been removed

parameters:

  • self: the wall itself
  • origin: location of origin of the wall
  • model: rigid model for the bricks
  • material: the bricks are made of this material
  • color: color of the contactors

optional parameters:

  • rtol: relative tolerance used in floatting number comparaisons
class pylmgc90.pre.paneresse_double(brick_ref, disposition)[source]

class paneresse_double:

this class defines an objet representing a brick wall, using the so called “apareil en paneresses, double”

Methods

buildRigidWall(origin, model, material[, ...]) buildRigidWall(self, origin, model, material, colors, rtol=1e-5):
computeHeight() computeHeight(self):
computeJointThickness() computeJointThickness(self):
computeNbRows([trend, rtol]) commputeNbRows(self, trend=”max”, rtol=1e-5):
evaluateHeight(nb_rows, joint_thickness) evaluateHeight(self, nb_rows, joint_thickness):
getLength() getLength(self):
getThickness() getThickness(self):
limitNbRows(height, joint_thickness) limitNbRows(self, height, joint_thickness):
setFirstRowByLength(first_brick_type, ...) setFirstRowByLength(self, first_brick_type, length, joint_thickness):
setFirstRowByNumberOfBricks(...) setFirstRowByNumberOfBricks(self, first_brick_type, nb_bricks, joint_thickness):
setHeight(height) setHeight(self, length):
setJointThicknessBetweenRows(joint_thickness) setJointThicknessBetweenRows(self, joint_thickness):
setNumberOfRows(nb_rows[, rtol]) setNumberOfRows(self, nb_rows, rtol=1e-5):
buildRigidWall(origin, model, material, colors=['BLEUx', 'REDxx', 'JAUNE', 'VERTx'], rtol=1e-05)[source]

buildRigidWall(self, origin, model, material, colors, rtol=1e-5):

this function builds the wall, as it generates a list of rigid avatars representing bricks of the wall

parameters:

  • self: the wall itself
  • origin: location of origin of the wall
  • model: rigid model for the bricks
  • material: the bricks are made of this material
  • color: color of the contactors

optional parameters:

  • rtol: relative tolerance used in floatting number comparaisons

Mesh manipulation

mesh creation

pylmgc90.pre.lecture(name, dim, keep_elements=None, scale_factor=None, incomplete_elements=True)[source]

lecture(name, dim):

this function builds sets of nodes and elements by reading a file wherein a mesh is stored

parameters:

  • mesh_file_name: a string giving the nameof the file in which the mesh is stored supported file extensions are:
    • ‘.msh’: for gmsh outputs
    • ‘.txt’: for sysweld outputs
  • dim: dim=2, in 2D and dim=3, in 3D

optional parameters:

  • keep_elements: this parameter is used to filter elements, if keep_elements=None, no filter used, else keep_elements is the list of elements types that can be stored in the built mesh, others will be forgotten
  • scale_factor=None: this parameter is used to rescale the read mesh
  • incomplete_elements: used to reduce the order of an element

returned value:

  • read_mesh: the built mesh
pylmgc90.pre.buildMesh2D(mesh_type, x0, y0, lx, ly, nb_elem_x, nb_elem_y, vertices=None, number=None)[source]

buildMesh2D=buildMesh2D(mesh_type, x0, y0, lx, ly, nb_elem_x, nb_elem_y, vertices=None, number=None):

this function meshes a given rectangle, and returns the generated mesh

WARNING: this function automaticaly defines four groups of surfacic elements: ‘left’, ‘down’, ‘right’, ‘up’

parameters:

  • mesh_type: type of mesh:
    • ‘Q4’: mesh with elements Q4
    • ‘2T3’: mesh with elements T3, obtained by spitting one Q4 in two T3
    • ‘4T3’: mesh with elements T3, obtained by spitting one Q4 in four T3
    • ‘Q8’: mesh with elements Q8
  • (x, y) is position of the lower left corner of the rectangle
  • lx: dimension of the rectangle, following the axis Ox
  • ly: dimension of the rectangle, following the axis Oy
  • nb_elem_x: number of elements, following the axis Ox
  • nb_elem_y: number of elements, following the axis Oy

optional parameters:

  • vertices=None: a given list of x,y-coordinates, following a suitable Q4-mesh node ordering
  • number=None: index of the avatar (still present to ensure compatibility)
pylmgc90.pre.buildMeshH8(x0, y0, z0, lx, ly, lz, nb_elem_x, nb_elem_y, nb_elem_z, surfacic_mesh_type='Q4')[source]

buildMeshH8(x0, y0, z0, lx, ly, lz, nb_elem_x, nb_elem_y, nb_elem_z):

this function meshes a given box, and returns the generated mesh

WARNING: this function automaticaly defines four groups of surfacic elements: ‘left’ (y=y0), ‘down’ (z=z0), ‘right’ (y=y0 + lx), ‘up’ (z=z0 + lz), ‘front’ (x=x0 + lx), ‘rear’ (x=x0)

parameters:

  • (x0, y0, z0) is position of the rear lower left corner of the box
  • lx: dimension of the rectangle, following the axis Ox
  • ly: dimension of the rectangle, following the axis Oy
  • lz: dimension of the rectangle, following the axis Oy
  • nb_elem_x: number of elements, following the axis Ox
  • nb_elem_y: number of elements, following the axis Oy
  • nb_elem_z: number of elements, following the axis Oz

optional parameters:

  • surfacic_mesh_type=’Q4’: sufacic mesh type:
    • “Q4”: classic surfacic mesh involving Q4
    • “2T3”: surfacic mesh involving T3, obtained by splitting one Q4 in two T3

mesh class

class pylmgc90.pre.mesh(dimension)[source]

class mesh():

this class defines a mesh object, as a couple of a nodes set and a bulk set.

Methods

addBulk(ele) addBulk(ele):
addNode(noeud) addNode(noeud):
computeNormal(n, e, reverse) Compute normal of a node of an element
extrudePhysicalEntity(pE, length[, reverse]) Extrude an external layer of mesh.
getSubMeshes([entity_type]) getSubMeshes(self, entity_type=”geometricalEntity”):
rankRenumbering() rankRenumbering(self):
removeFreeNodes(self) removes nodes not attached to an element
separateMeshes(dim[, entity_type, ...]) separateMeshes(self, dim, entity_type=”geometricalEntity”):
addBulk(ele)[source]

addBulk(ele):

this function add an element to the mesh

parameters:

  • self: the mesh itself
  • ele: a given element
addNode(noeud)[source]

addNode(noeud):

this function add a node to the mesh

parameters:

  • self: the mesh itself
  • noeud: a given node
computeNormal(n, e, reverse)[source]

Compute normal of a node of an element

extrudePhysicalEntity(pE, length, reverse=False)[source]

Extrude an external layer of mesh.

This functions use the nodes of a physical entity to create the node extrusion and the corresponding element in the mesh. Linear elements only !!! Physical entities are created with prefix ‘E’ for the extruded elements and ‘P’ for the projected nodes.

To work, the rankRenumbering function must have been called beforehand, and the elements correctly oriented. At this time only ‘S2xxx’ and ‘T3xxx’ element are supported.

parameters: - pE : physical entity name to extrude from - length : size of extrusion along the computed normals

getSubMeshes(entity_type='geometricalEntity')[source]

getSubMeshes(self, entity_type=”geometricalEntity”):

this function computes handles to sub-meshes of the given mesh and returns the computed meshes. Elements of a mesh share a same physical or geometrical entity. N.B.: nodes and elements of the generated meshes are references of nodes and elements of the original mesh and not deep copies!

parameters:

  • self: a given mesh

optional parameters:

  • entity_type=”geometricalEntity”: give the entity type to consider to separate meshes, i.e. entity_type=”geometricalEntity”, if geometrical entities have to be used and entity_type=”physicalEntity”, if physical entities have to be used

returned values: a dictionnary mapping enities value on separated meshes.

rankRenumbering()[source]

rankRenumbering(self):

this function renumbers the nodes of the mesh, in order to avoid holes in the numbering, i.e. nodes number are in [1, nbNodes]

parameters:

  • self: the mesh itself
removeFreeNodes(self)[source]

removes nodes not attached to an element

separateMeshes(dim, entity_type='geometricalEntity', keep_all_elements=True)[source]

separateMeshes(self, dim, entity_type=”geometricalEntity”):

this function separates several meshes, stored in a single one (read from a mesh), and returns the extracted meshes, as meshes. Elements of a mesh share a same physical or geometrical entity.

parameters:

  • self: a given mesh
  • dim: dim=1 for linear mesh; dim=2 for surfacic meshes; dim=3 for volumic meshes

optional parameters:

  • entity_type=”geometricalEntity”: give the entity type to consider to separate meshes, i.e. entity_type=”geometricalEntity”, if geometrical entities have to be used and entity_type=”physicalEntity”, if physical entities have to be used
  • keep_all_elements=True: if keep_all_elements=True, all elements have to be sorted and returned, else only the considered elements (i.e. surfacic if dim=2 or volumic if dim=3) have to be sorted and returned. N.B.: elements of greater dimension than the considered one are ignored, e.g. if dim=2, volumic elements are neither sorted nor returned

returned values: a dictionnary mapping enities value on separated meshes.

mesh manipulation

pylmgc90.pre.extractFreeSurface(volumic_mesh)[source]

extractFreeSurface(volumic_mesh):

this function computes and returns the free surface of a volumic mesh, as a surfacic mesh.

N.B.: this function handles tetrahedra and prism

parameters:

  • volumic_mesh: the given volumic mesh

returned value: the built surfacic mesh

pylmgc90.pre.reorientSurfacicElements(volumic_mesh)[source]

reorientSurfacicElements(volumic_mesh):

this function reorient surfacic elements of a 3D mesh, using orientation of volumic elements

N.B.: this function only handle tetrahedra

parameters:

  • volumic_mesh: the given volumic mesh

mesh to avatar(s)

pylmgc90.pre.buildMeshedAvatar(mesh, model, material)[source]

buildMeshedAvatar(mesh, model, material):

this function builds a meshed avatar from the mesh.

parameters:

  • mesh: a given mesh
  • model: a given model
  • material: a given material
pylmgc90.pre.rigidFromMesh2D(surfacic_mesh, model, material, color='BLEUx', reverse=False)[source]

rigidFromMesh2D(surfacic_mesh, model, material, color=’BLEUx’, reverse=False):

this function build a rigid from a 2D mesh, each contactor is a polygon made from an element of the given mesh

parameters:

  • surfacic_mesh: a 2D mesh
  • model: a given model
  • material: a given material

optional parameter:

  • color=’BLEUx’: color of the polygon contactors
  • reverse=False: reverse=True iff the elements need to be reversed
pylmgc90.pre.rigidsFromMesh2D(surfacic_mesh, model, material, color='BLEUx', reverse=False, shrink=0.0)[source]

rigidsFromMesh2D(surfacic_mesh, model, material, color=’BLEUx’, reverse=False, shrink=0.):

this function build a set of rigids from a 2D mesh, each rigid is a polygon made from an element of the given mesh

parameters:

  • surfacic_mesh: a 2D mesh
  • model: a given model
  • material: a given material

optional parameter:

  • color=’BLEUx’: color of the polygon contactors
  • reverse=False: reverse=True iff the elements need to be reversed
  • shrink=0.:
pylmgc90.pre.explodeMeshedAvatar2D(body, nbPoints=2, color='BLEUx', w=None, color_dict=None)[source]

bodies=explodeMeshedAvatar2D(body, nbPoints=2, color=’BLEUx’, w=None):

this function “explodes” a given 2D meshed avatar, i.e. gets a meshed avatar and returns a list of bodies, where each body is a cell of the given meshed avatar. Each new body have a list of contactor inherited from the connectivity of the given meshed avatar.

parameters:

  • body: a 2D meshed avatar

optional parameters:

  • nbPoints: number of points on the contactors candidate
  • color: default color of the contactors
  • w: vector of CLxxx positions
  • color_dict: a dictionnary associating a color to the physical entity of the element
pylmgc90.pre.volumicMeshToRigid3D(volumic_mesh, model, material, color='BLEUx')[source]

volumicMeshToRigid3D(volumic_mesh, model, material, color=’BLEUx’):

this function builds a rigid body from a volumic mesh, by extracting the skin mesh and compute mass and inertia from volumic elements.

N.B.: this function only handle tetrahedra

parameters:

  • volumic_mesh: the given volumic mesh
  • model: a given model
  • material: a given material

optional parameters:

  • color=’BLEUx’: color of the polyhedron contactor

returned value: the built rigid body

pylmgc90.pre.surfacicMeshToRigid3D(surfacic_mesh, model, material, color='BLEUx')[source]

surfacicMeshToRigid3D(surfacic_mesh, model, material, color=’BLEUx’):

this function builds a rigid body from a surfacic mesh, by computing mass and inertia from surfacic elements (amazing, isn’t it ^^).

N.B.: this function only handle triangles

parameters:

  • surfacic_mesh: the given surfacic mesh
  • model: a given model
  • material: a given material

optional parameters:

  • color=’BLEUx’: color of the polyhedron contactor

returned value: the built rigid body

pylmgc90.pre.surfacicMeshesToRigid3D(surfacic_meshes, model, material, color='BLEUx', reverse='no')[source]

surfacicMeshesToRigid3D(surfacic_meshes, model, material, color=’BLEUx’):

this function builds a rigid body from a list of surfacic mesh, by computing mass and inertia from surfacic elements

N.B.: this function only handle triangles

parameters:

  • surfacic_mesh: the given list of surfacic meshes
  • model: a given model
  • material: a given material

optional parameters:

  • color=’BLEUx’: color of the polyhedron contactor (aka POLYF)

returned value: the built rigid body

Miscellaneous

Display

pylmgc90.pre.visuAvatars(cont, with_axis=False)[source]

visuAvatars(cont):

Create a visualization window of a container of avatars using vtk.

parameter:

  • cont: container of avatars
  • with_axis (optional) : (boolean) add normalized axis to visualization

Evolution

pylmgc90.pre.writeEvolution(f, instants, path='', name='evolution.dat')[source]

this function writes an evolution file used to apply specific boundary conditions. parameters: ———– - f: a function of time - instants: for each instant t in the list, the function

f is evaluated and the couple (t, f(t)) is write in the file

Extrusion

pylmgc90.pre.extrudeRigid(body2D, model3D, depth, factor=1.0, extrudedDisk='Sphere', number=None)[source]

extrudeRigid(body2D, model3D, depth, factor=1.e0, number=None):

this function builds a 3D rigid body by extruding a given 2D rigid avatar and returns the generated body. The extruded body is made of the same material as the given one. The colors of each contactor of the body is the same as those of the coresponding contactor of the given body.

Warning: extrusion follow axis Oz, except for the JONCx, which are placed in xOz plane

parameters:

  • body2D: a 2D rigid body
  • model3D: 3D rigid model for the extruded body
  • depth: depth of the extrusion

optional paramters:

  • factor: dilatation factor of homothety
  • extrudedDisk: a string used to define how to extrude a disk:
    • ‘Sphere’: for a sphere (SPHER)
    • ‘Cylinder’: for a solid cylinder (CYLND)
  • number=None: index of the avatar (still present to ensure compatibility)
pylmgc90.pre.extrudeRigids(bodies2D, model3D, depth, factor=1.0, extrudedDisk='Sphere', number=None)[source]

extrudeRigids(bodies2D, model3D, depth, factor=1.e0, number=None):

this function extrudes each avatar in a given avatar container and returns the generated list of 3D avatars in a new avatar container.

Warning: extrusion follow axis Oz, except for the JONCx, which are placed in xOz plane

parameters:

  • bodies2D: a 2D rigid avatar container
  • model3D: 3D rigid model for the extruded body
  • depth: depth of the extrusion

optional paramters:

  • factor: dilatation factor of homothety
  • extrudedDisk: a string used to define how to extrude a disk:
    • ‘Sphere’: for a sphere (SPHER)
    • ‘Cylinder’: for a solid cylinder (CYLND)
  • number=None: index of the avatar (still present to ensure compatibility)