Dear Xavier,
Thanks for using Mmg.
To cut a domain at a constant radius, you just need to provide the value of the level-set function at your mesh nodes.
Being:
- (x,y,z) the coordinates at a mesh node P,
- (cx,cy,cz) the coordinates of the sphere center,
- r the sphere radius,
the value of level-set function at P is computed as:
f_p = sqrt( (x-cx)^2 + (y-cy)^2 + (z-cz)^2 ) - r
To provide the discrete values of the level-set you must use a solution file at the medit format (file with .sol extension).
Here is an example of solution file for a mesh with 4 nodes (the given solution is 0.5 for all nodes):
MeshVersionFormatted 2
Dimension
3
SolAtVertices
4
1 1
0.5
0.5
0.5
0.5
End
After the SolAtVertices
keyword, you must give:
- The number of nodes (the same as in your mesh file).
- Then the line
1 1
gives the number of solutions at each node (for now, we only handle one solution at a node) and the type of each solution (scalar=1, vector=2, tensor=3).
- Last, you can provide the solution at each node.
To end, you can run Mmg as explained here.
I hope this will help you.
Best regards,
Algiane.