How to recreate surfaces from stl files in mesh

Dear cummunity,
I want to make mesh for a geometry consisting of bricks, cylinders and one irregulars surface. The surface is made out of some points (x, y and z coordinates). I have the csv file of the coordiantes and also the stl file of the surface. The surface should be embedded in the model and should share nodes, edges and surfaces with the volumes. In the solver the surface will have it’s own material properties and also can be used as a BC. In the following journal script I am making the geomtry with a very simple surface to show what I want. The surface number 25 should be replaced by the complicated surface that I have uploaded its stl (zip file) and coordinate (.csv) files:

reset
brick x 20000 y 10000 z 2000
brick x 20000 y 10000 z 1000
brick x 20000 y 10000 z 2000
move Volume 1 y 5000 z -1000 include_merged  
move Volume 2 y 5000 z -2500 include_merged 
move Volume 3 y 5000 z -4000 include_merged
cylinder rad 50 height 5000
move Volume 4  x 2000 z -2500 include_merged 
cylinder rad 50 height 5000
move Volume 5  x 4000 z -2500 include_merged
create surface rectangle width 4000 height 5000 yplane
move Surface 25 y 5000 z -2500 include_merged
rotate Surface 25 angle 10  about Z include_merged 
subtract volume 4 5 from volume 1 2 3
webcut volume all with plane from surface 25
imprint all
merge all
curve 56 46  interval 5
curve 56 46  scheme equal
mesh volume all except 6
mesh surface all
set unmerge duplicate_mesh on
unmerge volume 6

These two plots show a scatter plot of the points that create the surface and also the stl file:

I very much appreciate any help.

Cheers

surface.csv (36.9 KB)

surface.zip (47.7 KB)

Hi Ali,

In this case, you can use the create net surface command. This only works on surfaces that are basically rectangular. I’m attaching a loom video that shows the entire process. The commands are below as well.

Karl

reset
import stl "~/Downloads/surface.stl" feature_angle 135.00 merge 
create vertex 8557 4927 -907.7 on curve 3 
create vertex 8150 4903 -546.7 on curve 3 
create vertex 13.9 1250 -921.8 on curve 2 
partition create curve 3  vertex 4 5 
partition create curve 2  vertex 6 
surface 1  vertex 8 3 2 1  type End
surface 1  vertex 7 9  type Side
surface 1  submap smooth off
surface 1  scheme submap
Surface 1 size 250
mesh surface 1
create surface net from mapped surface 1  heal 
draw surf 2
delete body 1
surf 2 scheme trimesh
surf 2 size 125
mesh surf 2
1 Like

Dear @karl
First and foremost, thanks a lot for being so supportive. I very much appreciate your help.
Your demo was super informative for me. Thanks.
I tried to add the bricks and ylinders to the model but it failed. I hvae a question: is the generated surface a volume? I tried to make mesh using the following script but it failed:

reset
import stl "~/Downloads/surface.stl" feature_angle 135.00 merge 
create vertex 8557 4927 -907.7 on curve 3 
create vertex 8150 4903 -546.7 on curve 3 
create vertex 13.9 1250 -921.8 on curve 2 
partition create curve 3  vertex 4 5 
partition create curve 2  vertex 6 
surface 1  vertex 8 3 2 1  type End
surface 1  vertex 7 9  type Side
surface 1  submap smooth off
surface 1  scheme submap
Surface 1 size 250
mesh surface 1
create surface net from mapped surface 1 heal 
draw surf 2
delete body 1
brick x 20000 y 10000 z 2000
brick x 20000 y 10000 z 1000
brick x 20000 y 10000 z 2000
move Volume 3 y 5000 z -1000 include_merged  
move Volume 4 y 5000 z -2500 include_merged 
move Volume 5 y 5000 z -4000 include_merged
cylinder rad 50 height 5000
move Volume 6  x 2000 z -2500 include_merged 
cylinder rad 50 height 5000
move Volume 7  x 4000 z -2500 include_merged
subtract volume 6 7 from volume 3 4 5
# webcut volume all with plane from surface 2
imprint all
merge all
volume all size auto factor 5
mesh volume all

I expect to have a mesh in which the complex surface shares nodes with the body of the model.
Thanks again

Hi Ali,

The body that gets created is a “sheet body” there is no actual volume only the underlying representation of the surface and the topological representation of a volume (no geometry).

Do you require a hex mesh with model? If so, you will have to find a way to decompose the model into hex-meshable sub-volumes that include the fault plane. That will take some work.

If a tet-mesh is acceptable, I would recommend using the tetmesh respect option. Mesh the fault plane first with triangles. Add the triangles in the surface associated with each volume and set the scheme on the volumes as tetmesh.

Karl

reset
import stl "~/Downloads/surface.stl" feature_angle 135.00 merge 
create vertex 8557 4927 -907.7 on curve 3 
create vertex 8150 4903 -546.7 on curve 3 
create vertex 13.9 1250 -921.8 on curve 2 
partition create curve 3  vertex 4 5 
partition create curve 2  vertex 6 
surface 1  vertex 8 3 2 1  type End
surface 1  vertex 7 9  type Side
surface 1  submap smooth off
surface 1  scheme submap
Surface 1 size 250
mesh surface 1
create surface net from mapped surface 1 heal 
draw surf 2
delete body 1
brick x 20000 y 10000 z 2000
brick x 20000 y 10000 z 1000
brick x 20000 y 10000 z 2000
move Volume 3 y 5000 z -1000 include_merged  
move Volume 4 y 5000 z -2500 include_merged 
move Volume 5 y 5000 z -4000 include_merged
cylinder rad 50 height 5000
move Volume 6  x 2000 z -2500 include_merged 
cylinder rad 50 height 5000
move Volume 7  x 4000 z -2500 include_merged
subtract volume 6 7 from volume 3 4 5
imprint all
merge all
Surface 50 49 48 size 125
Surface 50 49 48 scheme trimesh
mesh surface 50 49 48
surf with radius=50 size 125
disp
volume 3 tetmesh respect tri in surface 50 
volume 3  scheme tetmesh
volume 4  tetmesh respect tri  in surface 49
volume 4  scheme tetmesh
volume 5  tetmesh respect tri in surf 48
volume 5  scheme tetmesh
mesh vol 3 4 5

@karl
Thanks again for your help.
The tet mesh looks perfect for me.