Accelerating Yade’s PFV scheme with GPU
Hi,
I used GPU to accelerate PFV, CPU i7-8850H, GPU Quardro P1000, and tested it with oedometer.py on Github. I found that when num_spheres=1000, GPU acceleration is slower than CPU. When num_spheres=10000, the GPU is as fast as the CPU. Is this normal?
Why GPU is slower than CPU?
#******
# 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. *
#******
## Example script for using the DEM-PFV coupling introduced with E. Catalano, as reported in:
## * [Chareyre2012a] Chareyre, B., Cortis, A., Catalano, E., Barthélemy, E. (2012), Pore-scale modeling of viscous flow and induced forces in dense sphere packings. Transport in Porous Media (92), pages 473-493. DOI 10.1007/
## http://
## * [Catalano2014a] Catalano, E., Chareyre, B., Barthélémy, E. (2013), Pore-scale modeling of fluid-particles interaction and emerging poromechanical effects. International Journal for Numerical and Analytical Methods in Geomechanics. DOI 10.1002/nag.2198
## http://
## Also used in:
## * Tong et al.2012 (http://
## * Sari et al 2011 (http://
## The DEM-PFV is applied here to 1D consolidation (oedometer test). The example includes the determination of oedometer modulus Ee and permeability K.
## The 1D consolidation is simulated as a coupled problem and the analytical solution corresponding to the abovementionned Ee and K is used for comparison.
## See triax-tutorial/
## ______________ First section, similar to triax-tutorial/
from yade import pack
num_spheres=1000# number of spheres
young=1e6
compFricDegree = 3 # initial contact friction during the confining phase
finalFricDegree = 30 # contact friction during the deviatoric loading
mn,mx=Vector3(
O.materials.
O.materials.
walls=aabbWalls
wallIds=
sp=pack.
sp.makeCloud(
sp.toSimulation
triax=TriaxialS
maxMultiplier=
finalMaxMultip
thickness = 0,
stressMask = 7,
max_vel = 0.005,
internalCompac
)
newton=
O.engines=[
ForceResetter(),
InsertionSortC
InteractionLoop(
[Ig2_
[Ip2_
[Law2_
),
FlowEngine(
GlobalStiffnes
triax,
newton
]
triax.goal1=
while 1:
O.run(1000, True)
unb=unbalance
if unb<0.001 and abs(-10000-
break
setContactFrict
## ______________ Oedometer section _________________
#A. Check bulk modulus of the dry material from load/unload cycles
triax.stressMask=2
triax.goal1=
triax.internalC
triax.wall_
#load
triax.goal2=-11000; O.run(2000,1)
#unload
triax.goal2=-10000; O.run(2000,1)
#load
triax.goal2=-11000; O.run(2000,1)
e22=triax.strain[1]
#unload
triax.goal2=-10000; O.run(2000,1)
e22=e22-
modulus = 1000./abs(e22)
#B. Activate flow engine and set boundary conditions in order to get permeability
flow.dead=0
flow.defToleran
flow.meshUpdate
flow.useSolver=3
flow.permeabili
flow.viscosity=10
flow.bndCondIsP
flow.bndCondVal
flow.boundaryUs
O.dt=0.1e-3
O.dynDt=False
O.run(1,1)
Qin = flow.getBoundar
Qout = flow.getBoundar
permeability = abs(Qin)/1.e-4 #size is one, we compute K=V/∇H
print "Qin=",Qin," Qout=",Qout," permeability=
#C. now the oedometer test, drained at the top, impermeable at the bottom plate
flow.bndCondIsP
flow.bndCondVal
flow.updateTria
newton.damping=0
#we want the theoretical value from Terzaghi's solution
#keep in mind that we are not in an homogeneous material and the small strain
#assumption is not verified => we don't expect perfect match
#there can be also an overshoot of pressure in the very beginning due to dynamic effects
Cv=permeability
zeroTime=O.time
zeroe22 = - triax.strain[1]
dryFraction=0.05 #the top layer is affected by drainage on a certain depth, we account for it here
drye22 = 1000/modulus*
wetHeight=
def consolidation(Tv): #see your soil mechanics handbook...
U=1
for k in range(50):
M=pi/2*(2*k+1)
U=U-2/
return U
triax.goal2=-11000
from yade import plot
## a function saving variables
def history():
plot.
#plot.
O.engines=
##make nice animations:
#O.engines=
from yade import plot
plot.plots=
plot.plot()
O.saveTmp()
O.timingEnabled=1
from yade import timing
print "starting oedometer simulation"
O.run(200,1)
timing.stats()
## Make more steps to see the convergence to the stationnary solution
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- Yade Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Robert Caulk
- Solved:
- Last query:
- Last reply: