Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

How to generate the crossed-shaped fractures by conforming mesh

  • Emily
  • New Member
  • New Member
More
1 year 8 months ago - 1 year 8 months 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)
Last edit: 1 year 8 months ago by Emily.
Time to create page: 0.140 seconds