コード例 #1
0
ファイル: retainingSmooth.py プロジェクト: DEMANY/trunk
from msFEM2D import MultiScale
from saveGauss import saveGauss2D
import time

vel = -0.00017; surcharge=-2.e4; # surcharge equals to the initial vertical stress of the RVE packing; vel<0 passive failure; vel>0 active failure
B = 0.4; H = 0.2; wallH = 0.17; baseH = H-wallH; # setup dimensions
nx = 40; ny = 20 # discretization with 40x20 quads
mydomain = Rectangle(l0=B,l1=H,n0=nx,n1=ny,order=2,integrationOrder=2)
dim = mydomain.getDim()
k = kronecker(mydomain)
numg = 4*nx*ny; nump = 16;
packNo=range(0,numg,16)

disp = Vector(0.,Solution(mydomain))

prob = MultiScale(domain=mydomain,ng=numg,np=nump,random=False,rtol=1e-2,usePert=False,pert=-2.e-5,verbose=True)

t=0
time_start = time.time()

x = mydomain.getX()
bx = FunctionOnBoundary(mydomain).getX()
left = whereZero(x[0])
right = whereZero(x[0]-B)
bottom = whereZero(x[1])
top = whereZero(bx[1]-H)
base = whereZero(x[0]-B)*whereNegative(x[1]-baseH)
wall = whereZero(x[0]-B)*whereNonNegative(x[1]-baseH)
wallBF = whereZero(bx[0]-B)*whereNonNegative(bx[1]-baseH)
# Dirichlet BC, all fixed in space except wall (only fixed in x direction, smooth)
Dbc = left*[1,1]+base*[1,1]+bottom*[1,1]+wall*[1,0]
コード例 #2
0
ファイル: biaxialSmooth.py プロジェクト: yade/trunk
   os.mkdir('./result/packing')
except OSError as exc:
   if exc.errno != errno.EEXIST:
      raise
   pass

vel = -0.0001; confining=-1.e5;
lx = 0.05; ly = 0.1; # sample size, 50mm by 100mm
nx = 8; ny = 16; # sample discretization, 8 by 16 quadrilateral elements
mydomain = Rectangle(l0=lx,l1=ly,n0=nx,n1=ny,order=2,integrationOrder=2)
dim = mydomain.getDim()
k = kronecker(mydomain)
numg = 4*nx*ny; # number of Gauss points, 4 GP each element (reduced integration)
nump = 16; # number of processes for multiprocessing

prob = MultiScale(domain=mydomain,ng=numg,np=nump,random=False,rtol=1e-2,usePert=False,pert=-2.e-5,verbose=True)

disp = Vector(0.,Solution(mydomain))

t=0

stress = prob.getCurrentStress() # initial stress
proj = Projector(mydomain)
sig = proj(stress) # project Gauss point value to nodal value
sig_bounda = interpolate(sig,FunctionOnBoundary(mydomain)) # interpolate
traction = matrix_mult(sig_bounda,mydomain.getNormal()) # boundary traction
x = mydomain.getX() # nodal coordinate
bx = FunctionOnBoundary(mydomain).getX()
topSurf = whereZero(bx[1]-sup(bx[1]))
tractTop = traction*topSurf # traction at top surface
forceTop = integrate(tractTop,where=FunctionOnBoundary(mydomain)) # resultant force at top
コード例 #3
0
ファイル: retainingSmooth.py プロジェクト: HuanranWU/Yade
# setup dimensions
nx = 40
ny = 20  # discretization with 40x20 quads
mydomain = Rectangle(l0=B, l1=H, n0=nx, n1=ny, order=2, integrationOrder=2)
dim = mydomain.getDim()
k = kronecker(mydomain)
numg = 4 * nx * ny
nump = 16
packNo = list(range(0, numg, 16))

disp = Vector(0., Solution(mydomain))

prob = MultiScale(domain=mydomain,
                  ng=numg,
                  np=nump,
                  random=False,
                  rtol=1e-2,
                  usePert=False,
                  pert=-2.e-5,
                  verbose=True)

t = 0
time_start = time.time()

x = mydomain.getX()
bx = FunctionOnBoundary(mydomain).getX()
left = whereZero(x[0])
right = whereZero(x[0] - B)
bottom = whereZero(x[1])
top = whereZero(bx[1] - H)
base = whereZero(x[0] - B) * whereNegative(x[1] - baseH)
wall = whereZero(x[0] - B) * whereNonNegative(x[1] - baseH)
コード例 #4
0
ファイル: biaxialSmooth.py プロジェクト: HuanranWU/Yade
# sample size, 50mm by 100mm
nx = 8
ny = 16
# sample discretization, 8 by 16 quadrilateral elements
mydomain = Rectangle(l0=lx, l1=ly, n0=nx, n1=ny, order=2, integrationOrder=2)
dim = mydomain.getDim()
k = kronecker(mydomain)
numg = 4 * nx * ny
# number of Gauss points, 4 GP each element (reduced integration)
nump = 16
# number of processes for multiprocessing

prob = MultiScale(domain=mydomain,
                  ng=numg,
                  np=nump,
                  random=False,
                  rtol=1e-2,
                  usePert=False,
                  pert=-2.e-5,
                  verbose=True)

disp = Vector(0., Solution(mydomain))

t = 0

stress = prob.getCurrentStress()  # initial stress
proj = Projector(mydomain)
sig = proj(stress)  # project Gauss point value to nodal value
sig_bounda = interpolate(sig, FunctionOnBoundary(mydomain))  # interpolate
traction = matrix_mult(sig_bounda, mydomain.getNormal())  # boundary traction
x = mydomain.getX()  # nodal coordinate
bx = FunctionOnBoundary(mydomain).getX()