CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Pre-Processing (https://www.cfd-online.com/Forums/openfoam-pre-processing/)
-   -   topoSet with surfaceToCell (https://www.cfd-online.com/Forums/openfoam-pre-processing/231992-toposet-surfacetocell.html)

sunagra27 November 25, 2020 23:56

topoSet with surfaceToCell
 
Dear all,


I have created a mesh using snappyHexmesh with two different regions specified. Now, I have one stl file which needs to be inside my existing geometry for which I have imported to triSurface folder and meshed using snappyHexMesh.


For me, this new stl file should be another region for me for which I am trying to use surfaceToCell in topoSetDict. But when I run topoSet, it shows that it is unable to read the stl file.



Below is the topoSet assignment. I want to create cellSet, later from cellSet I want to create cellZone using cellSet.





actions
(


{
name duct;
type cellSet;
action new;
source surfaceToCell;
sourceInfo
{

file "duct_cadquery_heat.stl";
outsidePoints ((0 0.01 0));
includeCut true;
includeInside true;
includeOutside false;
nearDistance -1;
curvature -100;
useSurfaceOrientation false;

}
}

);





Error:


--> FOAM FATAL ERROR:
Cannnot read "duct_cadquery_heat.stl"




The stl file is present in constant/triSurface folder. The mesh works fine in snappyHexmesh but problem is with the topoSet.


Let me know any leads related to this.


Regards,


Sunag R A.

Yann November 26, 2020 03:35

Hello Sunag,


I think you have to give the path to file :

Code:

file            "constant/triSurface/duct_cadquery_heat.stl";

Cheers,
Yann

olesen November 29, 2020 03:28

Quote:

Originally Posted by Yann (Post 788899)
Hello Sunag,
I think you have to give the path to file :
Code:

file            "constant/triSurface/duct_cadquery_heat.stl";

Yes exactly. It's also good practice to fully resolve the path. The following are equivalent:
Code:

file  "<constant>/triSurface/file.stl";
file  "<case>/constant/triSurface/file.stl";
file  "$FOAM_CASE/constant/triSurface/file.stl";

I definitely prefer the first form as being the most concise and clear. Similarly for things a system directory
Code:

file  "<system>/file";
file  "<case>/file";
file  "$FOAM_CASE/system/file";

// other examples
#includeEtc  "someFile"
#include "<etc>/someFile"
#sinclude "<etc>/optionalFile"


Yann November 29, 2020 05:48

Thanks Mark for the tips.

If you don't mind, can you elaborate on the "<directory>" syntax?
What is the difference between these two lines?

Code:

file  "constant/triSurface/file.stl";
file  "<constant>/triSurface/file.stl";


olesen November 29, 2020 06:15

Quote:

Originally Posted by Yann (Post 789247)
Thanks Mark for the tips.

If you don't mind, can you elaborate on the "<directory>" syntax?
What is the difference between these two lines?

Code:

file  "constant/triSurface/file.stl";
file  "<constant>/triSurface/file.stl";


In almost all places where OpenFOAM gets a file name from a dictionary it is followed internally by an 'expand()' which replaces environment variables in the string (you can also embed basic maths in OpenFOAM-v1912 and later). There are a few special pointy tags recognized at the begin of strings to reduce the amount of typing (and mistakes).
https://www.openfoam.com/documentati...41778898bea3ba

If you use the first version, it resolves to a relative path with "constant/..." in the second version it resolves to an absolute path "/path/mycase/constant/..."
This difference can be essential if you run with the -case option. Most utilities in OpenFOAM will do the right thing and know to treat the relative path as relative to the case, but there are some that handle it as relative to your CWD. So better safe than sorry.

Yann November 29, 2020 08:19

Thanks for the clarification, I did not know about this.

Despite I usually don't use the -case option, it might come handy in some cases, especially when working on automatized workflow.

As you said, better safe than sorry!

sunagra27 November 30, 2020 00:22

Thank you for the reply Mark and Yann.


The solution worked and helped me.


All times are GMT -4. The time now is 15:51.