Okay, so I've attempted to follow a tutorial on using topoSet to create the desired patches from already defined faces, but my topoSetDict file produces an error despite the tutorial in $FOAM_TUTORIALS/mesh/foamyHexMesh/blob example having the same form for the boxToCell. The idea is to create boxes that exclude the faces of interest, copy the default patch to the <newPatchName> then remove the faces that undesired for that particular patch. Since the normals face the +/-
x-direction and +/-
z-direction, I've cleverly come up with a naming convention like xP for the positive
x-direction face.
So the goal is to create a list of cells inside the box, then the faceSet of the faces on those cells in the cellSet, then subtract the faceSets from the default in order to produce a new patch. The goal will be to run the flow along the
x- and
z-directions, so keeping the names based on the normals to those patches is beneficial.
The error says "Not implemented". What does that mean?
Code:
/*--------------------------------*- 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 binary;
class dictionary;
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// bounding box is (-5 -0.34039 -9) (5 1.14071 9)
// size between patches on .obj is 0.1
actions
(
{
name facesFromDefaultPatch;
type faceSet;
action new;
source patchToFace;
sourceInfo
{
name "default";
}
}
// Create the faces for the four directions of interest
{ // xPFaceSet
name xPFaceSet;
type faceSet;
action new;
source faceToFace;
sourceInfo
{
set facesFromDefaultPatch;
}
} // xPFaceSet
{ // xNFaceSet
name xNFaceSet;
type faceSet;
action new;
source faceToFace;
sourceInfo
{
set facesFromDefaultPatch;
}
} // xNFaceSet
{ // zPFaceSet
name zPFaceSet;
type faceSet;
action new;
source faceToFace;
sourceInfo
{
set facesFromDefaultPatch;
}
} // zPFaceSet
{ // zNFaceSet
name zNFaceSet;
type faceSet;
action new;
source faceToFace;
sourceInfo
{
set facesFromDefaultPatch;
}
} // zNFaceSet
////
//
// Create negative cells to remove
//
////
// bounding box is (-5 -0.34039 -9) (5 1.14071 9)
// size between patches on .obj is 0.1
{
name xPNegCellSet;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (-10 -2 -10)(4.99 2 10) ;
}
}
{
name xNNegCellSet;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (-4.99 -2 -10)(10 2 10) ;
}
}
{
name zPNegCellSet;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (-10 -2 -8.99)(10 2 10) ;
}
}
{
name zNNegCellSet;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (-10 -2 -10)(10 2 8.99) ;
}
}
); // actions
// ************************************************************************* //
Just the boxToCell stuff fails, but here is the rest of the topoSetDict that I'd like to implement once I can figure out why the cellSets from the boxToCell are failing:
Code:
////
//
// Create faces from negative cells to remove
//
////
{
name xPNegFaceSet;
type faceSet;
action new;
source cellToFace;
sourceInfo
{
set xPNegCellSet;
option all;
}
}
{
name xNNegFaceSet;
type faceSet;
action new;
source cellToFace;
sourceInfo
{
set xNNegCellSet;
option all;
}
}
{
name zPNegFaceSet;
type faceSet;
action new;
source cellToFace;
sourceInfo
{
set zPNegCellSet;
option all;
}
}
{
name zNNegFaceSet;
type faceSet;
action new;
source cellToFace;
sourceInfo
{
set zNNegCellSet;
option all;
}
}
{ // xPFaceSet
name xPFaceSet;
type faceSet;
action delete;
source faceToFace;
sourceInfo
{
set xPNegFaceSet;
}
} // xPFaceSet
{ // xNFaceSet
name xNFaceSet;
type faceSet;
action delete;
source faceToFace;
sourceInfo
{
set xNNegFaceSet;
}
} // xNFaceSet
{ // zPFaceSet
name zPFaceSet;
type faceSet;
action delete;
source faceToFace;
sourceInfo
{
set zPNegFaceSet;
}
} // zPFaceSet
{ // zNFaceSet
name zNFaceSet;
type faceSet;
action delete;
source faceToFace;
sourceInfo
{
set zNNegFaceSet;
}
} // zNFaceSet
Edit: Does this (likely) mean that there's some issue in my installation?
Edit2: It seems that the boxToCell and boxToFace are not implemented in my version of OpenFOAM (OpenFoam-8 from the OpenFoam.org source). It is in the online documentation:
https://cpp.openfoam.org/v3/a02625.h...c44149cee260be
When I try the normalToFace, this works, but creates the oversized sets. When I tried to do use things like
Code:
{ // xPFaceSet
// Mandatory (inhereted) entries
name xPFaceSetOversized;
type faceSet;
action new;
// Mandatory entries
source normalToFace;
sourceInfo
{
set facesFromDefaultPatch;
normal (1 0 0);
cos 0.01;
}
} // xPFaceSet
{ // xPFaceSet
// Mandatory (inhereted) entries
name xPFaceSet;
type faceSet;
action subset;
// Mandatory entries
source boundaryToFace;
sourceInfo
{
set xPFaceSetOversized;
}
} // xPFaceSet
for all four faces (pos/neg x/z), it just created one non-empty patch after calling createPatch. The 2d array that I extrude using extrude2DMesh is over a rectangle in the
zx-plane. I don't get why I can't take the subset of the faceSet generated from the normalToFace source that is in the boundary (it just assigns the entire 'default' patch's faceSet). When I do this for all four faceSets, then generate the patches using createPatch, whichever is created last is the only non-empty patch of those four.
~~~~~~~~~~~~~~~~~~~~
Edit3: Okay, got it working.
~~~~~~~~~~~~~~~~~~~~
This seems to produce the four face separately and correctly. Will try to do the fluid flow next. Working files below.
topoSetDict:
Code:
/*--------------------------------*- 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 binary;
class dictionary;
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// bounding box is (-5 -0.34039 -9) (5 1.14071 9)
// size between patches on .obj is 0.1
actions
(
{
name facesFromDefaultPatch;
type faceSet;
action new;
source patchToFace;
sourceInfo
{
name "default";
}
}
{
name facesFromFrontPatch;
type faceSet;
action new;
source patchToFace;
sourceInfo
{
name "front";
}
}
{
name facesFromBackPatch;
type faceSet;
action new;
source patchToFace;
sourceInfo
{
name "back";
}
}
// Create the faces for the four directions of interest
{ // xPFaceSet
// Mandatory (inhereted) entries
name xPFaceSet;
type faceSet;
action new;
// Mandatory entries
source normalToFace;
sourceInfo
{
set facesFromDefaultPatch;
normal (1 0 0);
cos 0.01;
}
} // xPFaceSet
{ // xNFaceSet
// Mandatory (inhereted) entries
name xNFaceSet;
type faceSet;
action new;
// Mandatory entries
source normalToFace;
sourceInfo
{
set facesFromDefaultPatch;
normal (-1 0 0);
cos 0.01;
}
} // xNFaceSet
{ // zPFaceSet
// Mandatory (inhereted) entries
name zPFaceSet;
type faceSet;
action new;
// Mandatory entries
source normalToFace;
sourceInfo
{
set facesFromDefaultPatch;
normal (0 0 1);
cos 0.01;
}
} // zPFaceSet
{ // zNFaceSet
// Mandatory (inhereted) entries
name zNFaceSet;
type faceSet;
action new;
// Mandatory entries
source normalToFace;
sourceInfo
{
set facesFromDefaultPatch;
normal (0 0 -1);
cos 0.01;
}
} // zNFaceSet
//
// Take subset of oversized initial faceSets
//
// bounding box is (-5 -0.34039 -9) (5 1.14071 9)
{ // xPFaceSet
name xPFaceSet;
type faceSet;
action subset;
source boundaryToFace;
sourceInfo
{
}
} // xPFaceSet
{ // xNFaceSet
name xNFaceSet;
type faceSet;
action subset;
source boundaryToFace;
sourceInfo
{
}
} // xNFaceSet
{ // zPFaceSet
name zPFaceSet;
type faceSet;
action subset;
source boundaryToFace;
sourceInfo
{
}
} // zPFaceSet
{ // zNFaceSet
name zNFaceSet;
type faceSet;
action subset;
source boundaryToFace;
sourceInfo
{
}
} // zNFaceSet
); // actions
// ************************************************************************* //
createPatchDict:
Code:
/*--------------------------------*- 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 binary;
class dictionary;
object createPatchDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
pointSync false;
patches // Patches to create.
(
{ // xPPatch
// Name of new patch
name xPPatch;
// Type of new patch
patchInfo
{
type patch;
}
// How to construct: eiter from 'patches' of 'set'
constructFrom set;
// If constructFrom = set : name of faceSet
set xPFaceSet;
} // xPPatch
{ // xNPatch
// Name of new patch
name xNPatch;
// Type of new patch
patchInfo
{
type patch;
}
// How to construct: eiter from 'patches' of 'set'
constructFrom set;
// If constructFrom = set : name of faceSet
set xNFaceSet;
} // xNPatch
{ // zPPatch
// Name of new patch
name zPPatch;
// Type of new patch
patchInfo
{
type patch;
}
// How to construct: eiter from 'patches' of 'set'
constructFrom set;
// If constructFrom = set : name of faceSet
set zPFaceSet;
} // zPPatch
{ //zNPatch
// Name of new patch
name zNPatch;
// Type of new patch
patchInfo
{
type patch;
}
// How to construct: eiter from 'patches' of 'set'
constructFrom set;
// If constructFrom = set : name of faceSet
set zNFaceSet;
} // zNPatch
); // patches
// ************************************************************************* //