Page MenuHomec4science

fracture.py
No OneTemporary

File Metadata

Created
Tue, May 21, 15:15

fracture.py

from rrompy.hfengines.linear_problem.bidimensional import \
MembraneFractureEngine as MFE
verb = 100
mu0 = [45. ** .5, .6]
H = 1.
L = .75
delta = .05
n = 50
solver = MFE(mu0 = mu0, H = H, L = L, delta = delta, n = n, verbosity = verb)
uh = solver.solve(mu0)[0]
solver.plotmesh(figsize = (7.5, 4.5))
print(solver.norm(uh))
solver.plot(uh, what = 'REAL', figsize = (8, 5))
solver.plot(solver.residual(uh, mu0)[0], name = 'res',
what = 'REAL', figsize = (8, 5))
##
import numpy as np
import ufl
import fenics as fen
from rrompy.solver.fenics import affine_warping
L = mu0[1]
y = fen.SpatialCoordinate(solver.V.mesh())[1]
warp1, warpI1 = affine_warping(solver.V.mesh(), np.array([[1, 0], [0, 2. * L]]))
warp2, warpI2 = affine_warping(solver.V.mesh(), np.array([[1, 0], [0, 2. - 2. * L]]))
warp = ufl.conditional(ufl.ge(y, 0.), warp1, warp2)
warpI = ufl.conditional(ufl.ge(y, 0.), warpI1, warpI2)
solver.plotmesh([warp, warpI], figsize = (7.5, 4.5))
solver.plot(uh, [warp, warpI], what = 'REAL', figsize = (8, 5))
solver.plot(solver.residual(uh, mu0)[0], [warp, warpI], name = 'res',
what = 'REAL', figsize = (8, 5))

Event Timeline