Convert script to Openmpi
Dear all,
I am new on running Yade on multiple nodes using openmpi.
Still checking how to convert the code below to run in mpi.
Runnning the code below I get the messsage:
Friction: 1 porosity: 1.0 None
[95mMaster: single-core, fall back to O.run() [0m
Probably I am not using O.run and mpirun correctly.
If anyone with more experimence see what I am duing wrong, please let me know.
Cheers,
#!/usr/bin/python
# -*- encoding=utf-8 -*-
#******
# Copyright (C) 2010 by Bruno Chareyre *
# bruno.chareyre_
# *
# This program is free software; it is licensed under the terms of the *
# GNU General Public License v2 or later. See file LICENSE for details. *
#******
import os
from yade import mpy as mp
from yade import pack
from yade import bodiesHandling
from yade import export
from yade import utils
from yade import ymport
import math
#######
### DEFINING VARIABLES AND MATERIALS ###
#######
# The following 5 lines will be used later for batch execution
nRead=readParam
num_
compFricDegree = 1, # contact friction during the confining phase
key=
unknownOk=True
)
from yade.params import table
num_spheres=
key=table.key
targetPorosity = 0.35 #the porosity we want for the packing
compFricDegree = table.compFricD
finalFricDegree = 30 # contact friction during the deviatoric loading
rate=0 # loading rate (strain rate)
damp=0.8 # damping coefficient
stabilityThresh
#2e4+70e4medio 1e4+70e4bom 1e4+60e4bom 3e4+90e4+
young=20e5 # contact stiffness200e4
young2=20e5
youngcoat=20e5
bondstr=0.3e3#2e7
bondstr2=0.3e3
bondstrcoat=1e3
## create materials for spheres and plates
mat=O.materials
O.materials.
O.materials.
## create walls around the packing
mn,mx=Vector3(
mnbox,mxbox=
walls=aabbWalls
wallIds=
O.bodies.
#######
bodid=[]
a=[]
for b in O.bodies:
if b and isinstance(
# print (b.shape.radius)
if b.shape.
bodid.
a.append(
i=0
for p in bodid:
t=a[i]
f1=O.bodies.
O.bodies.
i=i+1
bodidd=[]
aa=[]
for bb in O.bodies:# in sp:
if bb and isinstance(
# print (bb.shape.radius)
if bb.shape.
bodidd.
aa.append(
ii=0
for pp in bodidd:
tt=aa[ii]
f2=O.bodies.
O.bodies.
ii=ii+1
bodiddd=[]
aaa=[]
for bbb in O.bodies:# in sp:
if bbb and isinstance(
# print (bbb.shape.radius)
if bbb.shape.
bodiddd.
aaa.
iii=0
for ppp in bodiddd:
ttt=aaa[iii]
f3=O.bodies.
O.bodies.
iii=iii+1
#######
#======
#######
### DEFINING ENGINES ###
#######
triax=TriaxialS
## TriaxialStressC
## this control of boundary conditions was used for instance in http://
maxMultipli
finalMaxMul
thickness = 0,
## switch stress/strain control using a bitmask. What is a bitmask, huh?!
## Say x=1 if stess is controlled on x, else x=0. Same for for y and z, which are 1 or 0.
## Then an integer uniquely defining the combination of all these tests is: mask = x*1 + y*2 + z*4
## to put it differently, the mask is the integer whose binary representation is xyz, i.e.
## "100" (1) means "x", "110" (3) means "x and y", "111" (7) means "x and y and z", etc.
stressMask = 0,
internalCom
wall_
wall_
wall_
wall_
wall_
wall_
goal1=-5,
goal2=-10,
goal3=-5,
)
newton=
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
GlobalStiffnes
triax,
# VTKRecorder(
# newton
# NewtonIntegrato
newton
]
#Display spheres with 2 colors for seeing rotations better
#Gl1_Sphere.
#if nRead==0: yade.qt.
#######
### REACHING A SPECIFIED POROSITY PRECISELY ###
#######
## We will reach a prescribed value of porosity with the REFD algorithm
## (see http://
## http://
import sys #this is only for the flush() below
#poro=utils.
while triax.porosity>
# we decrease friction value and apply it to all the bodies and contacts
# compFricDegree = 0.95*compFricDegree
setContactF
print ("\r Friction: ",compFricDegree," porosity:
sys.
# while we run steps, triax will tend to grow particles as the packing
# keeps shrinking as a consequence of decreasing friction. Consequently
# porosity will decrease
mp.
#O.save(
mp.mprint("### Compacted state saved ###")
#print(
#######
### DEVIATORIC LOADING ###
#######
#We move to deviatoric loading, let us turn internal compaction off to keep particles sizes constant
#triax.
# Change contact friction (remember that decreasing it would generate instantaneous instabilities)
setContactFrict
#O.materials.
#======
#set stress control on x and z, we will impose strain rate on y
triax.stressMask = 2
triax.wall_
#now goal2 is the target strain rate
triax.goal1=
triax.goal3=
triax.goal2=
##Save temporary state in live memory. This state will be reloaded from the interface with the "reload" button.
#O.saveTmp()
#######
### Example of how to record and plot data ###
#######
#from yade import plot
from yade import plot
mp.mpirun(10,True)
#strain is logarithmic strain or true strain which is ls=(ln1+e) where e=dl/L (strain)
ei0=-triax.
si0=-triax.
## a function saving variables
def history():
plot.
if 1:
## include a periodic engine calling that function in the simulation loop
O.engines=
#plot.plots=
#plot.plot()
#print(
#######
## Drainage Test under oedometer conditions ###
#######
##Instantiate a two-phase engine
unsat=TwoPhaseF
#meanDiameter=
##set boundary conditions, the drainage is controlled by decreasing W-phase pressure and keeping NW-phase pressure constant
unsat.bndCondIs
unsat.bndCondIs
unsat.bndCondVa
unsat.isPhaseTr
unsat.initializ
unsat.surfaceTe
#start invasion, the data of normalized pc-sw-strain will be written into pcSwStrain.txt
f5=open(
ts=O.dt
pgstep= 45000000*ts #30Pa/s
print (pgstep)
pgmax= 9000#9316 #Pa
for pg in arange(
unsat.
unsat.invasion()
unsat.
unsat.
unsat.
unsat.
print(
for b in O.bodies:
O.forces.
while 1:
mp.
unb=
if unb<0.1:
break
f5.write(
f5.close()
plot.plots=
plot.plot(
mp.ERASE_
mp.DOMAIN_
mp.mpirun(20000) #passive mode run
mp.MERGE_
#mp.mpirun(
mp.mergeScene() #merge scene after run.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Luis Barbosa
- Solved:
- Last query:
- Last reply: