# two-domain-tagged.py Chapter 4
# %%
import SVMTK as svmtk
def create_gw_mesh(pial_stl, white_stl, output):
# Load the surfaces into SVM-Tk and combine in list
pial = svmtk.Surface(pial_stl)
white = svmtk.Surface(white_stl)
surfaces = [pial, white]
# Create a map for the subdomains with tags
# 1 for inside the first and outside the second ("10")
# 2 for inside the first and inside the second ("11")
smap = svmtk.SubdomainMap()
smap.add("10", 1)
smap.add("11", 2)
# Create a tagged domain from the list of surfaces
# and the map
domain = svmtk.Domain(surfaces, smap)
# Create and save the volume mesh
resolution = 32
domain.create_mesh(resolution)
domain.save(output)
create_gw_mesh("lh.pial.stl", "lh.white.stl", "ernie-gw.mesh")
# %%
I would suggest converting the .mesh file with msh into xdmf, and try to visualize it in Paraview.
As far as I am aware, GMSH doesn’t support all .mesh files.
Great that worked well! I am now trying to import into fenicsx but I noticed that the bounding surface aren’t properly associated when I have multidomain geometries. How do I get the geometry alongside all the surfaces ready for fenicsx use?
(base) chris@gondor:/mnt/shared/chris/Projects/2024_PhysicsAug/code/svmtk_meshing/stl_files$ meshio convert combined_final.mesh combined_final.msh --output-format gmsh22
Warning: Appending zeros to replace the missing physical tag data.
Warning: Appending zeros to replace the missing geometrical tag data.
Just FYI, I am getting couple syntax errors when trying to run create_mesh.py:
line 75
aqueduct.clip(clp1, invert=True ))
^
SyntaxError: unmatched ')'
line 41, in <module>
white = svm.Surface(Z.white)
NameError: name 'Z' is not defined
Thank you! I saw couple changes on the repo and tried running it, it all runs great (I think there was import argparse missing in one). The meshes come out well but I have trouble getting well formed boundaries, with boundaries not aligning with the volumes