How to generate the crossed-shaped fractures by conforming mesh
- Emily
-
Topic Author
- New Member
-
Less
More
3 years 1 month ago - 3 years 1 month ago #4466
by Emily
I have already generate a cross-shaped fractures by setting the fractures as very thin rectangles in figure1, but the mesh is very dense at the boundary. How can generate the fractures as crossed lines like figure2?
from ngsolve import *
from ngsolve.webgui import Draw
from netgen.geom2d import *
import matplotlib.pyplot as plt
def MakeGeometry():
geometry = SplineGeometry()
geometry.AddRectangle((0,0),(1,1),
bcs=["b","r","t","l"],
leftdomain=1)
# point coordinates ...
pnts = [(0.25,0.4995),(0.4995,0.4995),(0.4995,0.25),(0.5005,0.25),(0.5005,0.4995),(0.75,0.4995),(0.75,0.5005),(0.5005,0.5005),(0.5005,0.75),(0.4995,0.75),(0.4995,0.5005),(0.25,0.5005)]
pnums = [geometry.AppendPoint(*p) for p in pnts]
# start-point, end-point, boundary-condition, left-domain, right-domain:
lines = [(0,1,"dir",2,1), (1,2,"dir",2,1), (2,3,"dir",2,1), (3,4,"dir",2,1), (4,5,"dir",2,1), (5,6,"dir",2,1), (6,7,"dir",2,1),\
(7,8,"dir",2,1), (8,9,"dir",2,1), (9,10,"dir",2,1), (10,11,"dir",2,1), (11,0,"dir",2,1) ]
for p1,p2,bc,left,right in lines:
geometry.Append(["line", pnums[p1], pnums[p2]], bc=bc, leftdomain=left, rightdomain=right)
geometry.SetMaterial(1,"Matrix")
geometry.SetMaterial(2,"Fracture")
return geometry
mesh = Mesh(MakeGeometry().GenerateMesh(maxh=0.2))
Draw(mesh)
from ngsolve import *
from ngsolve.webgui import Draw
from netgen.geom2d import *
import matplotlib.pyplot as plt
def MakeGeometry():
geometry = SplineGeometry()
geometry.AddRectangle((0,0),(1,1),
bcs=["b","r","t","l"],
leftdomain=1)
# point coordinates ...
pnts = [(0.25,0.4995),(0.4995,0.4995),(0.4995,0.25),(0.5005,0.25),(0.5005,0.4995),(0.75,0.4995),(0.75,0.5005),(0.5005,0.5005),(0.5005,0.75),(0.4995,0.75),(0.4995,0.5005),(0.25,0.5005)]
pnums = [geometry.AppendPoint(*p) for p in pnts]
# start-point, end-point, boundary-condition, left-domain, right-domain:
lines = [(0,1,"dir",2,1), (1,2,"dir",2,1), (2,3,"dir",2,1), (3,4,"dir",2,1), (4,5,"dir",2,1), (5,6,"dir",2,1), (6,7,"dir",2,1),\
(7,8,"dir",2,1), (8,9,"dir",2,1), (9,10,"dir",2,1), (10,11,"dir",2,1), (11,0,"dir",2,1) ]
for p1,p2,bc,left,right in lines:
geometry.Append(["line", pnums[p1], pnums[p2]], bc=bc, leftdomain=left, rightdomain=right)
geometry.SetMaterial(1,"Matrix")
geometry.SetMaterial(2,"Fracture")
return geometry
mesh = Mesh(MakeGeometry().GenerateMesh(maxh=0.2))
Draw(mesh)
Last edit: 3 years 1 month ago by Emily.
Time to create page: 0.108 seconds