Commit b3244750 authored by mozul's avatar mozul

update lmgc3Interface.py file to work

parent 9aee5105
......@@ -60,7 +60,9 @@ class LmgcInterface(object):
chipy.utilities_logMes('READ INI Vloc Rloc')
chipy.ReadIniVlocRloc()
chipy.PRPRx_UseCpCundallDetection(10)
##### ecriture paranoiaque du modele ###
##utilities_logMes('WRITE BODIES')
##WriteBodies()
......@@ -77,7 +79,7 @@ class LmgcInterface(object):
chipy.ComputeMass()
self._nbSpher = chipy.SPHER_GetNbSPHER()
self._d2bMap = chipy.SPHER_GetPtrSPHER2RBDY3()
self._d2bMap = chipy.SPHER_GetPtrSPHER2BDYTY()
self._position = np.zeros([self._nbSpher,3], 'd')
self._velocity = np.zeros([self._nbSpher,6], 'd')
self._externalF= np.zeros([self._nbSpher,6], 'd')
......@@ -85,7 +87,7 @@ class LmgcInterface(object):
self._mass = np.zeros([self._nbSpher,1], 'd')
for i in range(self._nbSpher):
self._volume[i] = np.pi * chipy.SPHER_GetContactorRadius(i+1)**3 * 4./3
self._mass[i] = chipy.RBDY3_GetBodyMass(int(self._d2bMap[i,0]))
self._mass[i] = chipy.RBDY3_GetMass(int(self._d2bMap[i,0]))
self._tag2bnd = {}
self._tag2id = {}
for i in range(chipy.RBDY3_GetNbRBDY3()):
......@@ -156,23 +158,22 @@ class LmgcInterface(object):
def position(self):
""" Get current position of contactors and return it """
for i in range(self._nbSphere):
self._position[i,:] = chipy.SPHER_GetContactorCoor(i+1)
return self._position[:,:2]
for i in range(self._nbSpher):
self._position[i,:] = chipy.SPHER_GetContactorCoor(i+1)[:3]
return self._position
def velocity(self):
""" Get current velocity of body of contactor and return it
Beware : it should not work very well with clusters !
"""
for i in range(self._nbSPher):
for i in range(self._nbSpher):
self._velocity[i,:] = chipy.RBDY3_GetBodyVector('V____',int(self._d2bMap[i,0]))
self._velocity[i,2] = 0.
return self._velocity[:,:2]
return self._velocity[:,:3]
def externalForces(self):
""" Get an external forces array
"""
return self._externalF[:,:2]
return self._externalF[:,:3]
def __del__(self):
"""
......
#!/usr/bin/env python
import scontact3
import numpy as np
import mesh
from pyfefp import mesh
import random
import os, time, sys
import shutil, random
......@@ -25,8 +25,7 @@ def genInitialPosition(p, N, rmin, rmax, L, H, rhop) :
return
def loadMeshBoundary(p, filename, tags, shift = [0, 0, 0]):
import mesh
m = mesh.mesh(filename)
m = mesh.Mesh(filename)
pnum = [m.getPhysicalNumber(2, i) for i in tags]
addv = set()
adde = set()
......@@ -51,8 +50,8 @@ def loadMeshBoundary(p, filename, tags, shift = [0, 0, 0]):
p.addBoundarySegment(vshift(v0), vshift(v1), stag)
p.addBoundaryTriangle(vshift(el.vertices[0]), vshift(el.vertices[1]), vshift(el.vertices[2]), stag)
r = 0.02 * 2
dr = 0.002 *2
r = 0.06 * 2
dr = 0.006 *2
N = 8000
genInitialPosition(p, N = N, rmin = r -dr, rmax = r + dr , L = 1, H = 1.5, rhop=2)
p.useJacobi(False)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment