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

[mesh manipulation] Details on setSet/topoSet usage

Register Blogs Community New Posts Updated Threads Search

Like Tree7Likes
  • 3 Post By Yann
  • 2 Post By Yann
  • 1 Post By Yann
  • 1 Post By Florian Mlehliw

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 8, 2023, 11:37
Question Details on setSet/topoSet usage
  #1
New Member
 
Wilhelm Furian
Join Date: Apr 2023
Location: Berlin
Posts: 16
Rep Power: 3
Florian Mlehliw is on a distinguished road
Hello everyone!

TL;DR:
I'm not very experienced with openFoam. I'm searching for pointers on how to create cellZones in v2112. Can anyone point me to an explanation/tutorial/video on how to create a cellZone from my own geometry?

What I've done:
In snappyHexMeshDict, I've created a geometry like this:
Code:
geometry
    Dam
    {
    type distributedTriSurfaceMesh; 
    file "dam.stl";
    }


refinementSurfaces
     {
        Dam  
        {
            level (6 7);
            patchInfo
            {
            type wall;
            }
        }
    }
I then created my dynamicMeshDict like this:
Code:
dynamicFvMesh   dynamicMotionSolverFvMesh;

motionSolverLibs (fvMotionSolvers);

motionSolver    solidBody;

cellZone        Dam;

solidBodyMotionFunction  linearMotion;

velocity        (0.0 0.0 -100);
But when I run interFoam, it does not find the cellZone Dam, because apparently that's not the way to go.
Code:
Create time

Create mesh for time = 0

Selecting dynamicFvMesh dynamicMotionSolverFvMesh
Selecting motion solver: solidBody
Applying solid body motion to cellZone Dam


--> FOAM FATAL ERROR: (openfoam-2112)
Unable to find cellZone Dam.  Valid cellZones are:0()

    From Foam::zoneMotion::zoneMotion(const Foam::dictionary &, const Foam::polyMesh &)
    in file motionSolvers/displacement/displacement/zoneMotion.C at line 70.

FOAM exiting
I then tried using cellSet and topoSet but since I did not find a current wiki on this, I failed. When I use cellSet to create a new set I get this error.
Code:
setSet
readline>cellSet fluidSet Dam
     Set:fluidSet  Size:0  Action:new
   Bad token - could not get word
Apparently there is something wrong with my data, but what should I have done before that?


What I have looked at:
The wiki articles seem to mainly concern v2.1, and the advice there is not compatible with 2112.
I've looked at this, too, but they work with preexisting geometries and don't show how to implement my own https://www.cfdsupport.com/OpenFOAM-...t/node161.html
On this forum, there are some unanswered questions dealing with this. Also, this post sounded promising, but there are no details on how it worked ways to create cellZones and faceZones
Florian Mlehliw is offline   Reply With Quote

Old   August 8, 2023, 12:09
Default
  #2
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 Florian,

You can define a cellZone directly into snappyHexMeshDict:

Code:
faceZone sphere;
cellZone sphere;
cellZoneInside inside;    // outside/insidePoint
insidePoint    (1 1 1);   // if (cellZoneInside == insidePoint)
Source: https://doc.openfoam.com/2306/tools/...nementSurfaces

You can also define it afterward using topoSet: https://doc.openfoam.com/2306/tools/...ation/topoSet/

Note: OpenCFD recently reworked its OpenFOAM documentation, so only v2212 and v2306 are available in the new documentation. But it should work for v2112 too, I don't think there were major changes on the specific point you are looking for.

I hope this helps,
Yann
Yann is offline   Reply With Quote

Old   August 8, 2023, 13:26
Default
  #3
New Member
 
Wilhelm Furian
Join Date: Apr 2023
Location: Berlin
Posts: 16
Rep Power: 3
Florian Mlehliw is on a distinguished road
Hi Yann,

thanks a lot for your answer, but I'm not sure I understand. Should my snappyHexMeshDict look like this:

Code:
geometry     
{     dam     
      {     type distributedTriSurfaceMesh;      
             file "dam.stl";     
}   
      refinementSurfaces      
    {     
            dam  
           {
                    level (6 7);
                    patchInfo
                    {
                          type wall;
                     }
                     faceZone sphere;
                     cellZone sphere;
                     cellZoneInside inside;    
                     insidePoint    (4000 3455 4671);   
            }
    }
I'm not sure what "sphere" means here, but in the end my cellZone should be a block^^ But I guess, my types are not correct, because if I run snappyHexMesh, I now get this error:
Code:
--> FOAM FATAL IO ERROR: (openfoam-2112)
Entry 'type' has 2 excess tokens in stream

    3(distributedTriSurfaceMesh file "dam.stl")

file: system/snappyHexMeshDict.geometry.dam at line 41.

FOAM exiting

Could you maybe take my hand a little more through this jungle?



Best regards - Wilhelm
Florian Mlehliw is offline   Reply With Quote

Old   August 9, 2023, 04:28
Default
  #4
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 Wilhelm,

sphere is just the example in the documentation. It defines the name of the faceZone and cellZone. But you can name it dam or whatever name you like. You will just have to update your dynamicMeshDict with the name of the cellZone you defined in snappyHexMeshDict.

Regarding your error, it seems you are missing a closing bracket in the geometry section:

Code:
geometry     
{     
	dam     
	{
		type distributedTriSurfaceMesh;      
		file "dam.stl";
	}
}
Regards,
Yann
hogsonik and Florian Mlehliw like this.

Last edited by Yann; August 10, 2023 at 04:04. Reason: typo
Yann is offline   Reply With Quote

Old   August 10, 2023, 04:24
Default
  #5
New Member
 
Wilhelm Furian
Join Date: Apr 2023
Location: Berlin
Posts: 16
Rep Power: 3
Florian Mlehliw is on a distinguished road
Hi Yann,

thank you so much for guiding me a bit further!!

Unfortunately, the error message stays the same - the missing closing bracket just got lost during copy and paste, in the file is was correct.

From googling I know that this means that there are errors in my dict files, but I have no idea on how to solve them, because line 41 in my snappyHexMeshDict seems okay to me:

Code:
40 {
41  type distributedTriSurfaceMesh
42  file "dam.stl";
43 }
Or can this point somewhere else?

Thanks!

Last edited by Florian Mlehliw; August 10, 2023 at 04:24. Reason: visual clarity of code part
Florian Mlehliw is offline   Reply With Quote

Old   August 10, 2023, 04:49
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 Wilhelm,

It looks like there is a semicolon missing:

Code:
40 {
41  type distributedTriSurfaceMesh;
42  file "dam.stl";
43 }
Yann
Florian Mlehliw likes this.
Yann is offline   Reply With Quote

Old   August 10, 2023, 05:04
Default That was it!
  #7
New Member
 
Wilhelm Furian
Join Date: Apr 2023
Location: Berlin
Posts: 16
Rep Power: 3
Florian Mlehliw is on a distinguished road
Thank you! That was a bit embarrassing^^


But now snappy is running. It still does not produce what I want but I need to understand the problem first.



Thanks again!
Yann likes this.
Florian Mlehliw is offline   Reply With Quote

Reply

Tags
cellzones, 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
CPUs vs GPUs for CFD? hami11 Hardware 22 July 23, 2024 16:59
OpenFOAM Solver/BC usage description murrayjc OpenFOAM 3 August 25, 2009 05:48
user subroutine error CFDUSER CFX 2 December 9, 2006 07:31
user defined function cfduser CFX 0 April 29, 2006 11:58
Fluent 5.5. What the differences with fluent 5.3?? confused FLUENT 2 July 29, 2001 22:58


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