Page MenuHomec4science

fracture_nodomain.py
No OneTemporary

File Metadata

Created
Thu, Nov 14, 04:27

fracture_nodomain.py

import numpy as np
import ufl
import fenics as fen
from rrompy.hfengines.linear_problem import MembraneFractureEngineNoDomain \
as MFEND
from rrompy.solver.fenics import affine_warping
verb = 100
mu0Aug = [45. ** .5, .6]
mu0Aug = [45. ** .5, .1]
mu0 = mu0Aug[0]
H = 1.
L = .75
delta = .05
n = 50
solver = MFEND(mu0 = mu0Aug, H = H, L = L, delta = delta,
n = n, verbosity = verb)
u0 = solver.liftDirichletData(mu0)
uh = solver.solve(mu0)[0]
solver.plotmesh(figsize = (7.5, 4.5))
solver.plot(u0, what = 'REAL', figsize = (8, 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))
solver.outParaviewTimeDomain(uh, mu0, filename = 'outND', folder = True)
##
L = mu0Aug[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(u0, [warp, warpI], what = 'REAL', figsize = (8, 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))
solver.outParaviewTimeDomain(uh, mu0, [warp, warpI],
filename = 'outNDW', folder = True)

Event Timeline