CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[CAD formats] Clean / Repair STL file with multiple regions on command line

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 15, 2016, 21:30
Default Clean / Repair STL file with multiple regions on command line
  #1
New Member
 
Matthias D
Join Date: Mar 2016
Posts: 11
Rep Power: 10
matthiasd is on a distinguished road
Hi,

I have a STL file, which I later want to process via snappyHexMesh. But first I have to "clean" the file and fill some holes in it.
My problem is: The file is very large! So when I try tools with a GUI (like salome, netfabb-basic, ...), they usually crash or are very slow and tedious to work with. Therefor I am looking for a command line solution.

I found "admesh", which is easy to use and does a great job. The only downside: I did not manage to use admesh on a STL file with multiple regions.
As I am not sure if regions is the correct term here, what I mean are several solid blocks within one file:
Code:
solid region1
...
endsolid region1
solid region2
...
endsolid region 2
I use those regions mainly for two reasons:
1. I want to different refinement levels within SHM for those regions
2. I can later apply different material properties (in my case heating rates) to those regions.

But as I said: So far I was not able to do this with admesh, as it produces an error when reading a multi region STL file.

Do you either know a way to make this work with admesh? Or do you maybe know of a command line tool, which is capable of the described tasks?


Additionally I want to add: I am quite new to CFD and OpenFOAM. So if you have comments on my general approach, this is also much appreciated:
1. I generate the STL-files from GeoTiff-files.
2. I cat the different STL-files together in one big file.
3. This works pretty well so far. The STL-surface looks good and there is no gap where two regions touch.
4. Now I would like to clean/repair the one big file with the different regions.


I hope you can help me and I appreciate every hint or suggestion!

Thank you very much in advance,
Matthias
matthiasd is offline   Reply With Quote

Old   May 15, 2016, 22:07
Default
  #2
Senior Member
 
Join Date: Aug 2013
Posts: 407
Rep Power: 16
Antimony is on a distinguished road
Hi,

Since you generate the different STL files separately and then cat them together, perhaps you could run adMesh on the individual STL files first before combining them together?

Or you could leave it as separate STL files specify refinement levels individually in SHM?

Cheers,
Antimony
Antimony is offline   Reply With Quote

Old   May 16, 2016, 00:01
Default
  #3
New Member
 
Matthias D
Join Date: Mar 2016
Posts: 11
Rep Power: 10
matthiasd is on a distinguished road
Hi Antimony,

thanks for your reply!
I forgot to mention it, but I tried this already.
Problem here is: The different regions are kind of patchy. So there are some irregular fields here and there.
When I use admesh on the single region it alters the shape. I am not really sure what and why, but it gets kind of smoother. I think admesh is connecting some edges with other ones.
But after that I can/should not remerge those regions.

Is there a way to use admesh in a way it won't do that?

Cheers,
Matthias
matthiasd is offline   Reply With Quote

Old   May 16, 2016, 21:45
Default
  #4
Senior Member
 
Join Date: Aug 2013
Posts: 407
Rep Power: 16
Antimony is on a distinguished road
Hi,

The more I think about it, the more unsure I am that any code that lets you amend the geometry will allow for multiple solids in the same STL file. From my point of view, any changes that the code makes (let us say introducing new faces/vertices), there is uncertainty as to which solid region it should belong to.

I could be wrong, but those are my thoughts on it.

Also, you can check out the VTK library, to see if it has anything that you can use, as an alternative to or to be used in conjunction with adMesh.

Hope this helps.

Cheers,
Antimony
Antimony is offline   Reply With Quote

Old   May 19, 2016, 07:18
Default
  #5
New Member
 
Matthias D
Join Date: Mar 2016
Posts: 11
Rep Power: 10
matthiasd is on a distinguished road
Hi Antimony,

thanks for your thoughts on that issue. And this does sound kind of reasonable to me.

So maybe I should alter my approach here and try to get the STL-file as good as possible with one region only. And then specify my different regions afterwards in some way.
I guess I can skip the first reason for using a multi region STL-file, which was doing refinements based on them. I can do this with refinement boxes as well.

But I do need those regions to apply different heating rates. Can you think of an alternative way to do this?
I found the OpenFOAM tool "surfaceToPatch", but so far I am not really sure how/when it is used and if it suits my needs.

I am open for every advice!

Thanks a lot and have a nice day,
Matthias
matthiasd is offline   Reply With Quote

Old   May 19, 2016, 09:56
Default
  #6
Senior Member
 
Join Date: Aug 2013
Posts: 407
Rep Power: 16
Antimony is on a distinguished road
Hi Matthias,

Do you have a specific example/case that we can look at? I think trying to formulate a rule for a generic case is a little difficult and there might be some shortcuts/tricks that are applicable in a more specific one.

Cheers,
Antimony
Antimony is offline   Reply With Quote

Old   May 24, 2016, 07:51
Default
  #7
New Member
 
Matthias D
Join Date: Mar 2016
Posts: 11
Rep Power: 10
matthiasd is on a distinguished road
Quote:
Originally Posted by Antimony View Post
Hi Matthias,

Do you have a specific example/case that we can look at? I think trying to formulate a rule for a generic case is a little difficult and there might be some shortcuts/tricks that are applicable in a more specific one.

Cheers,
Antimony
Hi Antimony,

sorry for my late response, but thanks for your willingness to help!

As my specific case is rather large, I attached a small sample case consisting of a small island surrounded by ocean. The STL-file consists of those two regions island and ocean. I also attached the blockMeshDict and the snappyHexMeshDict.

This sample case does work for me. Although surfaceCheck gives me a couple of problems:
Code:
/*---------------------------------------------------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.3.x                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
Build  : 2.3.x-2f9138f6f49f
Exec   : surfaceCheck kleineinsel.stl
Date   : May 24 2016
Time   : 12:47:13
Host   : "login"
PID    : 19530
Case   : /gpfs/gpfs1/scratch/c7071010/v2/insel_tobi/stl_insel/constant/triSurface
nProcs : 1
sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).
fileModificationChecking : Monitoring run-time modified files using timeStampMaster
allowSystemOperations : Allowing user-supplied system call operations

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Reading surface from "kleineinsel.stl" ...

Statistics:
Triangles    : 9576
Vertices     : 4930
Bounding Box : (0 0 0) (2850.05 4200.07 383.807)

Region    Size
------    ----
ocean    6186
insel    3390


Surface has no illegal triangles.

Triangle quality (equilateral=1, collapsed=0):
    0 .. 0.05  : 0
    0.05 .. 0.1  : 0
    0.1 .. 0.15  : 0
    0.15 .. 0.2  : 0
    0.2 .. 0.25  : 0
    0.25 .. 0.3  : 0
    0.3 .. 0.35  : 0
    0.35 .. 0.4  : 0.000313283
    0.4 .. 0.45  : 0.00093985
    0.45 .. 0.5  : 0.00177527
    0.5 .. 0.55  : 0.00449039
    0.55 .. 0.6  : 0.0123225
    0.6 .. 0.65  : 0.0121136
    0.65 .. 0.7  : 0.0163952
    0.7 .. 0.75  : 0.049812
    0.75 .. 0.8  : 0.767335
    0.8 .. 0.85  : 0.0455305
    0.85 .. 0.9  : 0.0385338
    0.9 .. 0.95  : 0.0344612
    0.95 .. 1  : 0.0159774

    min 0.392694 for triangle 7858
    max 0.999437 for triangle 8539

Edges:
    min 50.0005 for edge 171 points (50.0009 4150.07 0)(50.0009 4100.07 0)
    max 121.084 for edge 11719 points (1500.03 1650.03 147.975)(1450.03 1700.03 246.266)

Checking for points less than 1e-6 of bounding box ((2850.05 4200.07 383.807) metre) apart.
Found 0 nearby points.

Surface is not closed since not all edges connected to two faces:
    connected to one face : 282
    connected to >2 faces : 0
Conflicting face labels:282
Dumping conflicting face labels to "problemFaces"
Paste this into the input for surfaceSubset

Number of unconnected parts : 1

Number of zones (connected area with consistent normal) : 1


End

However, my real case does not work. And I suspect the stl-surface to be part of the problem. Which is why I want to refine and improve it as much as possible!

All the best,
Matthias
Attached Files
File Type: zip island.zip (83.1 KB, 8 views)
matthiasd is offline   Reply With Quote

Reply

Tags
admesh, mesh, openfoam, snappyhexmesh, stl


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[foam-extend.org] Problems installing foam-extend-4.0 on openSUSE 42.2 and Ubuntu 16.04 ordinary OpenFOAM Installation 19 September 3, 2019 19:13
OpenFoam "Permission denied" and "command not found" problems. iyidaniel@yahoo.co.uk OpenFOAM Running, Solving & CFD 11 January 2, 2018 07:47
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation 225 August 25, 2015 20:43
[OpenFOAM] Annoying issue of automatic "Rescale to Data Range " with paraFoam/paraview 3.12 keepfit ParaView 60 September 18, 2013 04:23
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 11:23


All times are GMT -4. The time now is 13:09.