Exemplo n.º 1
0
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]
Vbc = left*[0,0]+base*[0,0]+bottom*[0,0]+wall*[vel,0]
# Neumann BC, apply surcharge at the top surface
Nbc = top*[0,surcharge]

stress = prob.getCurrentStress()
proj = Projector(mydomain)
sig = proj(stress)
sig_bounda = interpolate(sig,FunctionOnBoundary(mydomain))
traction = matrix_mult(sig_bounda,mydomain.getNormal())
tract = traction*wallBF # traction on wall
forceWall = integrate(tract,where=FunctionOnBoundary(mydomain)) # force on wall
lengthWall = integrate(wallBF,where=FunctionOnBoundary(mydomain))
fout=file('./result/pressure.dat','w')
fout.write('0 '+str(forceWall[0])+' '+str(lengthWall)+'\n')

while t < 100:

   prob.initialize(f=Nbc,specified_u_mask=Dbc,specified_u_val=Vbc)
   t += 1
   du=prob.solve(iter_max=100)
Exemplo n.º 2
0
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
lengthTop = integrate(topSurf,where=FunctionOnBoundary(mydomain)) # length of top surface
fout=file('./result/biaxial_surf.dat','w')
fout.write('0 '+str(forceTop[1])+' '+str(lengthTop)+'\n')
# Dirichlet BC positions, smooth at bottom and top, fixed at the center of bottom
Dbc = whereZero(x[1])*[0,1]+whereZero(x[1]-ly)*[0,1]+whereZero(x[1])*whereZero(x[0]-.5*lx)*[1,1]
# Dirichlet BC values
Exemplo n.º 3
0
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]
Vbc = left * [0, 0] + base * [0, 0] + bottom * [0, 0] + wall * [vel, 0]
# Neumann BC, apply surcharge at the top surface
Nbc = top * [0, surcharge]

stress = prob.getCurrentStress()
proj = Projector(mydomain)
sig = proj(stress)
sig_bounda = interpolate(sig, FunctionOnBoundary(mydomain))
traction = matrix_mult(sig_bounda, mydomain.getNormal())
tract = traction * wallBF  # traction on wall
forceWall = integrate(tract,
                      where=FunctionOnBoundary(mydomain))  # force on wall
lengthWall = integrate(wallBF, where=FunctionOnBoundary(mydomain))
fout = file('./result/pressure.dat', 'w')
fout.write('0 ' + str(forceWall[0]) + ' ' + str(lengthWall) + '\n')

while t < 100:

    prob.initialize(f=Nbc, specified_u_mask=Dbc, specified_u_val=Vbc)
    t += 1
Exemplo n.º 4
0
# 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
lengthTop = integrate(
    topSurf, where=FunctionOnBoundary(mydomain))  # length of top surface
fout = file('./result/biaxial_surf.dat', 'w')
fout.write('0 ' + str(forceTop[1]) + ' ' + str(lengthTop) + '\n')
# Dirichlet BC positions, smooth at bottom and top, fixed at the center of bottom