CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   MRFSimpleFoam: what's the point of running setSets…? (https://www.cfd-online.com/Forums/openfoam/99534-mrfsimplefoam-whats-point-running-setsets.html)

lovecraft22 April 5, 2012 11:47

MRFSimpleFoam: what's the point of running setSets…?
 
Hi all;
I'm trying to simulate a spinning wheel in a free stream.
The tyre was set as a rotating wall and then I set a rotating reference frame for the spokes of the rim. What I did was basically to enclose these within a cylindrical surface that I called "rotating" and I stated this in my snappyHexMeshDict:

Code:

geometry
{
 
  rotating.stl
    {
        type triSurfaceMesh;
        name rotating;
    }

    …
    …
    …

Quote:

refinementSurfaces
{

rotating
{
level (3 3);
faceZone rotating_face;
cellZone rotating_cell;
zoneInside true;
}



}
And then, in my MRFZones:

Code:

1
(
    rotating_cell
    {
        // Fixed patches (by default they 'move' with the MRF zone)
        nonRotatingPatches ();

        origin    origin [0 1 0 0 0 0 0]  (0 0 0.2);
        axis      axis  [0 0 0 0 0 0 0]  (0 -1 0);
        omega    omega  [0 0 -1 0 0 0 0] 100;

        patches       
        1
        (
        rotating_cell
        )
        ;
        faceZoneName  rotating_cell;

    }
)

Now, whether I run or not topoSet, setSets, setsToZones and so on, I keep having the same good result, i.e. the wheel seems to be rotating even if I do not run any of the above…

So, what's the point of these commands in MRFSimpleFoam?

Thank you!

lovecraft22 April 6, 2012 08:53

Also: what is the point of having both SimpleFoam and MRFSimpleFoam solvers since the latter includes the first?

You could just have MRFSimpleFoam which could check for the file MRFZones to exist and trigger or not the multi reference frame functionality…

wyldckat April 6, 2012 15:13

Hello again lovecraft22,

I haven't looked deep enough into this, but here's my deduction based on what I already know and briefly can see:
  • simpleFoam vs MRFSimpleFoam: my guess is that the two exist for educational purposes. The OpenFOAM Team has been merging solvers whenever they can, mostly for simplifying things. But when it comes to more complex solvers - such as having MRF - it's best to have them in separate codes, because this way it's easier to study them and because the simpler ones will not have redundant code.
  • "MRFZones" is a specific designation of the MRF zones, and not associated to any "cellSet" or zone derived from a cell set. I've taken for example the tutorial "incompressible/MRFSimpleFoam/mixerVessel2D", where no setSet batch file nor "topoSetDict" can be found.
  • If "MRFZones" can accept the usage of a cellSetZone or faceSetZone, it shouldn't really matter if that zone has been created with setSet, topoSet or straight out of snappyHexMesh!
  • edit: the "MRFZones" dictionary defines the zone that will be dynamically moving. The cellSetZone or faceSetZone are simply lists of cells/faces that can be used for something, such as porosity or mesh manipulation.
Best regards,
Bruno

lovecraft22 April 6, 2012 15:45

Thank you Bruno. Your answer is really clear: I can run MRFSimple foam without the need of setSet or topoSet.

Thank you again.

One day I hope I'll understand what these commands are for…

wyldckat April 6, 2012 16:19

Quote:

Originally Posted by lovecraft22 (Post 353505)
Thank you Bruno. Your answer is really clear: I can run MRFSimple foam without the need of setSet or topoSet.

Thank you again.

One day I hope I'll understand what these commands are for…

It's simple: setSet and topoSet are basically selection tools that can select parts of the mesh, including points, faces and cells. Once you select parts of the mesh and assign each selection a "tag" (i.e. a "set"), then you can do something with that "tag".

The first example I've seen for setSet was this: http://openfoamwiki.net/index.php/SetSet
Basically it's a command sequence that creates a new selection of the "sets" created by checkMesh and then inverts the selection to select all of the mesh except the previous selection. The inverted selection is then used for extracting only the cells that you really want to use, namely with subsetMesh. In other words, you have at the end a mesh without the bad cells.
FYI: the name "bubu" is used in the sense of "mistake". Googling for it's meaning can be a bit daunting... apparently the technical wording should be "booboo" :)

Anyway, this example can be a bit dangerous, since removing damaged cells can lead to unbounded zones in the mesh, or simply creates obstacles where they shouldn't be.

I hope this is now clearer to you and any other reader ;)

Best regards,
Bruno

lovecraft22 April 6, 2012 16:39

Thanks again Bruno… I need to reflect a little bit on what you wrote to make things clearer in my head…

I think I'll also have a look at the propeller tutorial (PimpleDyMFoam) to try and understand what's going on there too…

lovecraft22 April 7, 2012 06:37

So, looking at the wiki page you linked:

Code:

cellSet bubu new cellToCell underdeterminedCells any
This creates a new Set of cells called bubu and subsequently add the undeterminedCells to this set. What's "any" for? I'd say it's to include any of the cells but then what would the alternatives to "any" be?

Code:

cellSet bubu add faceToCell concaveFaces any
This add the concaveFaces to the set of cells bubu

Code:

cellSet bubu invert
This is not so clear… I would say it takes the whole domain without the set bubu, and the new set is, again, called bubu, correct? So, if no argument is passed after invert, the whole domain is considered by default? What if I wanted to subtract bubu to another set called, say, "yoghi"? Would that be something like "cellSet bubu invert yoghi"?

But something still doesn't add up then… because with the commands you set a set of cells called bubu which are the bad cells. The with invert you invert the cells and so at this point you should have the good cells in your set. But then, with

Code:

cellSet bubu subset
these good cells, are subtracted from the domain…

So, where's my mistake here?

Thank you again for your help, I really appreciate that!

wyldckat April 7, 2012 08:11

Hi lovecraft22,

setSet has a live help system. Examples:
Code:

help
For getting a list of possible sub-commands, you can use a dummy word, for example:
Code:

cellSet help
Or
Code:

cellSet bananas
About "invert", the help system says:
Quote:

invert - inverts the set (undefined orientation)
Another example for getting the valid values:
Code:

cellSet c0 new faceToCell f0 bananas
That replies:
Code:

Usage: faceToCell <faceSet> neighbour|owner|any|all

Select cells that are the owner|neighbour|any of the faces in the faceSet or where all faces are in the faceSet

Best regards,
Bruno

lovecraft22 April 7, 2012 08:53

Thanks Bruno, I'll have a look at the help!

emirust January 17, 2013 04:46

Hey all!

I was reading this interesting and useful thread about setSet and topoSet.

I have been playing around with both, and I was wondering if it was possible to avoid to type the commands of setSet in the command line. The reason I ask, is because I want to include it in a shell script, so I can do things such as:

runScript.sh:

Code:

blockMesh
setSet
cellSet thenameoftheset new boxToCell (xmin ymin zmin) (xmax ymax zmax)
.
.
.
interFoam

Running the previous script will require the user to type the information on cell selection in the command line. How can I avoid that, and make it automatically?

I would rather not use dict files, because I want to automate this, i.e. refine the mesh in a box, and then repeat several times. In other words, I want to select cells on a refined mesh, update the cell set, refine and so on...

Apparently the refineMesh utility will refine only dividing cells in 4 (for a 2D case), and it is not possible to refine more by using it. ;-)

Thanks!

wyldckat January 17, 2013 09:09

Greetings Emirust,

Take a look at the tutorial "heatTransfer/chtMultiRegionFoam/multiRegionHeater" and check the files "makeCellSets.setSet" and "Allrun" in that folder.

You can find more examples by running:
Code:

find $FOAM_TUTORIALS -name "*.set*"
Best regards,
Bruno

emirust January 17, 2013 14:11

Awesome! Thanks!

I was also wondering, if there is a way to select cells, after the mesh is refined. What I mean is I want to:

1-Select cells
2-Refine Mesh in selected cells (i.e. dividing cells in 4, for a 2D case) and overwrite current mesh
3-Reselect other cells on the new mesh for further refinement

I can't seem to think of a way to automate this, and my current investigation seem to say that refineMesh need to be called on "manually" selected cellSets. Any trick or other way to do this?

More at the end of the following post: http://www.cfd-online.com/Forums/ope...efinemesh.html

Cheers!

E.

wyldckat January 19, 2013 15:55

Hi Emirust,

I guess you already got your answer at http://www.cfd-online.com/Forums/ope...tml#post402605 post #15.

Best regards,
Bruno


All times are GMT -4. The time now is 01:29.