I am currently working on solving a single edge notch problem implementing phase-field formulation. I have successfully written the code to mark boundary subdomains in FEniCS. However, I now want to mark these boundary subdomains in GMSH. Part of my .gmsh script is structured as follows:
// ------------------------------
// Geometry: Define Points
// ------------------------------
Point(1) = {0.0, L/2, 0.0, h};
Point(2) = {W, L/2, 0, h};
Point(3) = {W, -L/2, 0, h};
Point(4) = {0.0, -L/2, 0, h};
Point(5) = {0.0, 0.00, 0, h};
Point(6) = {L/2, 0.00, 0, h};
// ------------------------------
// Geometry: Define Outer Boundary and Surface
// ------------------------------
Line(7) = {1, 2};
Line(8) = {2, 3};
Line(9) = {3, 4};
Line(10) = {4, 5};
Line(11) = {5, 1};
Line Loop(12) = {7, 8, 9, 10, 11};
Plane Surface(13) = {12};
Physical Surface(14) = {13};
// ------------------------------
// Geometry: Define Internal Crack
// ------------------------------
Line(15) = {5, 6};
Curve{15} In Surface{13};
Physical Curve(16) = {15};
Physical Point(17) = {5};
// ------------------------------
// Mark Boundary Subdomains (Physical Lines)
// ------------------------------
Physical Point("RightTop") = {2}; // RighTop boundary point (x, y = W, L/2)
Physical Line("Top") = {7}; // Top boundary (y = L/2)
Physical Line("Bottom") = {9}; // Bottom boundary (y = -L/2)
Physical Line("Left") = {8}; // Left boundary (x = 0)
Physical Line("Right") = {10}; // Right boundary (x = W)
Physical Line("Crack") = {15}; // Crack (y = 0)
Additionally, the FEniCS code I wrote to define the Dirichlet boundary conditions is as follows:
# Create mesh and define function space
mesh=Mesh("crack.xml")
h=FacetArea(mesh) #area/length of a cell facet on a given mesh
h_avg = (h('+') + h('-'))/2
n=FacetNormal(mesh)
# Assume the mesh conversion produces a MeshFunction of type "size_t" for boundaries.
boundary_markers = MeshFunction("size_t", mesh, mesh.topology().dim() - 1)
# Define ds measure using the loaded markers
ds = ds(subdomain_data=boundary_markers)
physical_tags = {
"RightTop": 2, # Example tag number for the RightTop point
"Top": 7, # Example tag number for Top boundary
"Bottom": 9, # Example tag number for Bottom boundary
"Left": 8, # Example tag number for Left boundary
"Right": 10, # Example tag number for Right boundary
"Crack": 15 # Example tag number for Crack curve
}
# Define Dirichlet boundary conditions
c = Expression(...)
r = Expression(...)
# Here, for example, we set the displacement in the x-direction to zero on the RightTop boundary.
bcl = DirichletBC(V.sub(0), Constant(0.0), boundary_markers, physical_tags["RightTop"])
# Prescribe the y-displacement r on both Top and Bottom boundaries.
bcb2 = DirichletBC(V.sub(1), r, boundary_markers, physical_tags["Bottom"])
bct2 = DirichletBC(V.sub(1), r, boundary_markers, physical_tags["Top"])
bcs = [bcl, bcb2, bct2]
Despite this, unlike the code I wrote for marking boundary subdomains directly in FEniCS, which gives me correct results, the current approach using GMSH to mark boundary subdomains is not converging and is producing incorrect results.
Any guidance or suggestions on this issue would be greatly appreciated.