CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

topoSetDict using stl file

Register Blogs Community New Posts Updated Threads Search

Like Tree16Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 7, 2020, 14:20
Default topoSetDict using stl file
  #1
Senior Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8
farzadmech is on a distinguished road
Dear friends
I am using the example given by openFoam for topoSetDict by stl file, but nothing happend in my geometry. Is it important that generated stl file is from which source? I use below lines for importing stl file, but it did not work;


Code:
//    // Select based on surface
//    source surfaceToCell;
//    sourceInfo
//    {
//        file            "www.avl.com-geometry.stl";
//        useSurfaceOrientation false;  // use closed surface inside/outside
//                                      // test (ignores includeCut,
//                                      // outsidePoints)
//        outsidePoints   ((-99 -99 -59));    // definition of outside
//        includeCut      false;              // cells cut by surface
//        includeInside   false;              // cells not on outside of surf
//        includeOutside  false;              // cells on outside of surf
//        nearDistance    -1;                 // cells with centre near surf
//                                            // (set to -1 if not used)
//        curvature       0.9;                // cells within nearDistance
//                                            // and near surf curvature
//                                            // (set to -100 if not used)
//    }

Thanks,
Farzad
farzadmech is offline   Reply With Quote

Old   November 7, 2020, 15:21
Default
  #2
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13
HPE is on a distinguished road
It is C++-style commented out. You need to remove the leading "//"s.
Also, you need to feed the STL file location to the "file" entry.
Reptider and ajithnair like this.
HPE is offline   Reply With Quote

Old   November 7, 2020, 18:06
Default reply
  #3
Senior Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8
farzadmech is on a distinguished road
Dear Herpes Free Engineer
Thanks for your reply. It was just a template which I copied from the OF tutorial, and absolutely I have omitted "//" but It is not working.
Also, I have fed model.stl(before posting this thread) to the code instead of "www.avl.com-geometry.stl", but it not working. Do you have any suggestion?


Thanks,
Farzad
farzadmech is offline   Reply With Quote

Old   November 8, 2020, 03:59
Default
  #4
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13
HPE is on a distinguished road
Mind to share the topoSetDict that causes the trouble, please?
HPE is offline   Reply With Quote

Old   November 8, 2020, 17:27
Default
  #5
Senior Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8
farzadmech is on a distinguished road
Dear Herpes Free Engineer
This is my topoSetDict;
Code:
actions
(

    {
        name    doggg;       //farzaaadSulzerCellSet;
        type    cellSet;
        action  new;               //remove;  // new;
        source  surfaceToCell;   //surfaceToCell;     //cylinderToCell;      // boxToCellfffff;

        sourceInfo
        {
//            box (0.096 0.10 0.0357) (0.404 0.20 0.0643);
//         p1 (0.0 0.30  0.0);
//         p2 (0.0 0.80  0.0); 
//         radius 0.2 ;

         file  totall.stl;   // salascii.stl;    // "TESTm.stl"; //"TestCube.stl";    //"PastorAleman.stl"; 
        outsidePoints   ((-30 -30 -20));    // definition of outside
        includeCut      false;              // cells cut by surface
        includeInside   false;              // cells not on outside of surf
        includeOutside  false;              // cells on outside of surf
        nearDistance    -1;                 // cells with centre near surf   //(set to -1 if not used)
        curvature       -100;  //0.9;                // cells within nearDistance and near surf curvature//(set to -100 if not used)

        }
    }
);
I believe there is problem in my stl files. I need an example stl file so I can use it as a model.


Thanks,
Farzad
farzadmech is offline   Reply With Quote

Old   November 9, 2020, 04:15
Default
  #6
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hello Farzad,

You have to decide which part of the mesh you want to select with these lines:

Code:
        includeCut      false;              // cells cut by surface
        includeInside   false;              // cells not on outside of surf
        includeOutside  false;              // cells on outside of surf

With your current setting, everything is set to "false" so you don't include any inside/outside or cut cells and nothing should happen.
Try to modify these lines according to what you want to achieve and see if it solved your issue.

Cheers,
Yann
farzadmech and Reptider like this.
Yann is online now   Reply With Quote

Old   November 9, 2020, 05:35
Default
  #7
Senior Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8
farzadmech is on a distinguished road
Dear Yann
Thanks for your answer. I will try it as soon as possible and I let you know. Just a few questions;
1- for outsidePoints can I use any point outside of the stl domain? Even far away from the geometry?

2- stl file must be binary or ascii?


Thanks,
Farzad
ajithnair likes this.
farzadmech is offline   Reply With Quote

Old   November 9, 2020, 05:51
Default
  #8
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Dear Farzad,


  1. You can use any point outside your STL. I think the point(s) needs to be inside the domain mesh but I am not sure about that.
  2. I tend to use ASCII but OpenFOAM should be able to manage both formats.
Regards,
Yann
farzadmech and Reptider like this.
Yann is online now   Reply With Quote

Old   November 9, 2020, 12:02
Default
  #9
Senior Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8
farzadmech is on a distinguished road
Dear Yann
I did what you wrote here;

Code:
actions
(

    {
        name    doggg;       //farzaaadSulzerCellSet;
        type    cellSet;
        action  new;               //remove;  // new;
        source  surfaceToCell; //surfaceToCell; //searchableSurfaceToFaceZone; //surfaceToCell;   //surfaceToCell;     //cylinderToCell;      // boxToCellfffff;

        sourceInfo
        {
//            box (0.096 0.10 0.0357) (0.404 0.20 0.0643);

//         p1 (0.0 0.30  0.0);
//         p2 (0.0 0.80  0.0); 
//         radius 0.2 ;

         file  Salascii.stl; //Box2.stl;   // salascii.stl;    // "TESTm.stl"; //"TestCube.stl";    //"PastorAleman.stl"; 
//         surface triSurfaceMesh;
        outsidePoints   ((1 2 3));    // definition of outside
        includeCut      true; //false;              // cells cut by surface
        includeInside   true; //false;              // cells not on outside of surf
        includeOutside  false;              // cells on outside of surf
        nearDistance    -1;                 // cells with centre near surf   //(set to -1 if not used)
        curvature       -100;  //0.9;                // cells within nearDistance and near surf curvature//(set to -100 if not used)

        }
    }

);
An I got this error;
Code:
Create time

Create polyMesh for time = 0

Reading topoSetDict

Time = 0
    mesh not changed.
Created cellSet doggg
    Applying source surfaceToCell


--> FOAM FATAL IO ERROR: 
wrong token type - expected string, found on line 35 the word 'Salascii.stl'


From function Foam::Istream& Foam::operator>>(Foam::Istream&, Foam::fileName&)
    in file primitives/strings/fileName/fileNameIO.C at line 56.

FOAM exiting

Thanks,
Farzad


Quote:
Originally Posted by Yann View Post
Dear Farzad,


  1. You can use any point outside your STL. I think the point(s) needs to be inside the domain mesh but I am not sure about that.
  2. I tend to use ASCII but OpenFOAM should be able to manage both formats.
Regards,
Yann
farzadmech is offline   Reply With Quote

Old   November 9, 2020, 12:18
Default
  #10
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hello Farzad,

Look at the error message, it speaks for itself: you have a an error line 35 on the file definition. You forgot the quotation marks:

Code:
file  "Salascii.stl;"
Also, since linux systems are case sensitive, be careful with uppercase and lowercase letters (eg."Salascii.stl" vs "salascii.stl")

Hope this helps,
Yann
ajithnair likes this.
Yann is online now   Reply With Quote

Old   November 9, 2020, 14:12
Default
  #11
Senior Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8
farzadmech is on a distinguished road
Dear Yann
Thank you very much. Since It was my first experience with stl file, I forgot to put "" for my file. Now this problem is solved, and yet another problem raised with outsidePoint as below;

Code:
--> FOAM FATAL ERROR: 
outsidePoint (100 200 300) is not inside any cell

    From function void Foam::surfaceToCell::combine(Foam::topoSet&, bool) const
    in file sets/cellSources/surfaceToCell/surfaceToCell.C at line 197.

FOAM exiting
Could you give me a hint where I can find AN outside point? I believe (100 200 300) is outside but it gives me error.


Thanks,
Farzad
farzadmech is offline   Reply With Quote

Old   November 9, 2020, 15:49
Default
  #12
Senior Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8
farzadmech is on a distinguished road
Dear Yan
Your comments are really helpful. Is there any way to find out outsidePoints? right now, my stl file is a cube, but I do not know how to define outsidePoints. I think there must be simple way rather than overthinking.


Thanks,
Farzad

Quote:
Originally Posted by Yann View Post
Hello Farzad,

Look at the error message, it speaks for itself: you have a an error line 35 on the file definition. You forgot the quotation marks:

Code:
file  "Salascii.stl;"
Also, since linux systems are case sensitive, be careful with uppercase and lowercase letters (eg."Salascii.stl" vs "salascii.stl")

Hope this helps,
Yann
farzadmech is offline   Reply With Quote

Old   November 9, 2020, 15:58
Default
  #13
New Member
 
Hesam Tofighian
Join Date: Mar 2019
Posts: 11
Rep Power: 7
H.Tofighian is on a distinguished road
Quote:
Originally Posted by Yann View Post
Hello Farzad,

Look at the error message, it speaks for itself: you have a an error line 35 on the file definition. You forgot the quotation marks:

Code:
file  "Salascii.stl;"
Also, since linux systems are case sensitive, be careful with uppercase and lowercase letters (eg."Salascii.stl" vs "salascii.stl")

Hope this helps,
Yann
Hello Yann
I have the same problem with outsidePoints. How should I define them for my geometry? is there any tool for that?

best regards,
Hesam
H.Tofighian is offline   Reply With Quote

Old   November 9, 2020, 19:40
Default It is solved!!!
  #14
Senior Member
 
Farzad Faraji
Join Date: Nov 2019
Posts: 206
Rep Power: 8
farzadmech is on a distinguished road
Dear Yann and friends
My problem is solved. For outsidePoint (X Y Z), just go to constant/polyMesh and open the points file, and choose a point which is outside of the stl file. The second figure shows the imported stl file to my meshed geometry.


Thanks,
Farzad
Attached Images
File Type: jpg WhatsApp Image 2020-11-09 at 10.12.52 PM.jpg (28.7 KB, 66 views)
File Type: jpg WhatsApp Image 2020-11-09 at 10.30.36 PM.jpg (39.8 KB, 82 views)
Yann and ajithnair like this.
farzadmech is offline   Reply With Quote

Old   November 10, 2020, 04:23
Default
  #15
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hello all,

Glad to see you both solved your problems.

AFAIK there is no specific tool for that in OpenFOAM but you can open your domain and STL in ParaView to check the bounding boxes in the "Information" tab, and/or tick the "Axes grid" option in the "Properties" tab of your object.

If you create your own case with your own stl and blockMeshDict, you usually already know the bounding boxes of your geometry and domain. You can also use your usual CAD tool to check the size and position of your geometry.

Cheers,
Yann
farzadmech likes this.
Yann is online now   Reply With Quote

Old   May 17, 2022, 11:10
Default
  #16
New Member
 
Megan
Join Date: May 2022
Posts: 11
Rep Power: 4
mega1 is on a distinguished road
Hello All,

I have a similar issue. I'm trying to simulate flow in a pipe when a porous media is kept in the flow. (I'm able to define a circular porous media in topoSetDict and it works). However, I'm facing issues when I try to define a porous media in the shape of a quarter circle in the topoSetDict file. I made the quarter circle geometry separately and imported it as a .stl file. I have attached blockMesh, stl and topoSet files here. (Was not sure how exactly to define outside points in toposetDict). Could anyone please have a look at it? Thank you!
Attached Files
File Type: txt blockMeshDict.txt (4.8 KB, 8 views)
File Type: txt blockMeshDict_quartcircle.txt (2.5 KB, 4 views)
File Type: txt topoSetDict.txt (1.5 KB, 32 views)
hxj1372583596 likes this.
mega1 is offline   Reply With Quote

Old   May 19, 2022, 04:57
Default
  #17
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hi Megan,

What issue are you facing?
Can you describe the problem or show us logs of the errors your get?

Yann
Yann is online now   Reply With Quote

Old   May 19, 2022, 06:40
Default
  #18
New Member
 
Megan
Join Date: May 2022
Posts: 11
Rep Power: 4
mega1 is on a distinguished road
Quote:
Originally Posted by Yann View Post
Hi Megan,

What issue are you facing?
Can you describe the problem or show us logs of the errors your get?

Yann

Dear Yann,

Thank you for responding. I'm simulating a flow through a cylinder in which a porous media of the shape of quarter-circle is placed. I imported the geometry of porous media as a .stl file.

/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 8
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object topoSetDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

actions
(
// porousBlockage
{
name porousBlockageCellSet;
type cellSet;
action new;
source surfaceToCell;
sourceInfo
{
file "constant/triSurface/geom90degarc.stl";
outsidePoints
(
(0 0 5)
(0.5 0 5)
(0 0.5 5)
(0 0 5.1)
(0.5 0 5.1)
(0 0.5 5.1)
);

includeCut true;
includeInside true;
includeOutside true;
nearDistance 0.5;
curvature 2;

// Optional entries
useSurfaceOrientation false;
fileType stl;
scale 1.0;
}
}

{
name porousBlockage;
type cellZoneSet;
action new;
source setToCellZone;
sourceInfo
{
set porousBlockageCellSet;
}
}

);

// ************************************************** *********************** //

If I run the above TopoSet i get this error:
--> FOAM FATAL ERROR:
outsidePoint (0 0.5 5.1) is not inside any cell

Then, I edited the Outside Points as below by Checking in the Points file in Constant/PolyMesh folder:
outsidePoints
(
(0 0 5)
(0.007479829509 0.4999440398 5)
(0 0 5)
(0 0 5.1)
(0.5 0 5.1)
(0.007479829509 0.4999440398 5.1)
When I run topoSet again, it gives this:

"cellSet porousBlockageCellSet now size 2152500
Created cellZoneSet porousBlockage
Applying source setToCellZone
Adding all cells from cellSet porousBlockageCellSet ...
cellZoneSet porousBlockage now size 2152500"

In Paraview, when I check in Mesh Parts/PorousBlockage, it shows me the original cylinder instead of porous media.

Also, I checked all combinations of includeCut, includeInside and includeOutside. Sometimes it gives:
"cellSet porousBlockageCellSet now size 0" and porous media can't be seen in paraView as size is 0.

I don't know the right way to define OutsidePoints, issue could be due to that?
Sorry for the long question.
Thanks again.

Regards,
Megan
mega1 is offline   Reply With Quote

Old   May 19, 2022, 06:43
Default
  #19
New Member
 
Megan
Join Date: May 2022
Posts: 11
Rep Power: 4
mega1 is on a distinguished road
Attached is the problem figure.
Attached Images
File Type: jpg Problem.jpg (125.3 KB, 41 views)
mega1 is offline   Reply With Quote

Old   May 19, 2022, 06:58
Default
  #20
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Thanks Megan for the additional information.

This might be related to your STL file. Can you run surfaceCheck to test your STL file and post the log here ?

Code:
surfaceCheck constant/triSurface/geom90degarc.stl
surfaceCheck will tell if the STL is closed or not. It has to be closed (watertight) for topoSet to work properly.

Regards,
Yann
ajithnair and hsia like this.
Yann is online now   Reply With Quote

Reply

Tags
openfoam, stl file, toposetdict


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
Using PengRobinsonGas EoS with sprayFoam Jabo OpenFOAM Running, Solving & CFD 36 July 16, 2024 04:52
how to calculate mass flow rate on patches and summation of that during the run? immortality OpenFOAM Post-Processing 104 February 16, 2021 09:46
what is swap4foam ?? AB08 OpenFOAM 28 February 2, 2016 02:22
[Other] Adding solvers from DensityBasedTurbo to foam-extend 3.0 Seroga OpenFOAM Community Contributions 9 June 12, 2015 18:18
OpenFOAM on MinGW crosscompiler hosted on Linux allenzhao OpenFOAM Installation 127 January 30, 2009 20:08


All times are GMT -4. The time now is 12:06.