|
[Sponsors] |
[surface handling] Decomposing Faces after Extrude2DMesh with autoPatch |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 7, 2021, 19:07 |
Decomposing Faces after Extrude2DMesh with autoPatch
|
#1 |
New Member
Jared Bland
Join Date: Nov 2020
Posts: 18
Rep Power: 6 |
I've been attempting to mesh a 3d object based on 2d surface data (over the zx-plane) displaced through some distance (in the y-direction).
In attempting to follow the tutorial from Tobias Holzmann, https://www.youtube.com/watch?v=gP36M3IyCdU, I found that the default region for the faces doesn't break up the way I would hope. Naming, I get a "ring" between the original face an the extruded face without it being properly decomposed by autoPatch when I use it. I did
I would assume that is has to do with some faces on the surface being sharply inclined, but is there a good way to separate out the patches from the extrude2DMesh? I've attached the extrude2DMeshDict and surface.obj file in the .zip folder on this post. Any guidance would be appreciated. |
|
November 9, 2021, 15:15 |
|
#2 |
New Member
Jared Bland
Join Date: Nov 2020
Posts: 18
Rep Power: 6 |
I think the topoSet and createPatch tools ought to be able to handle this even if the autoPatch tool . The normalToFace option in the topoSetDict should be able to create the necessary faces for the desired patches: https://www.openfoam.com/documentati...malToFace.html .
As I understand it, the normalToFace can inherit the faces from the "default" patch created by extrude2DMesh. I'll update this thread with what I come up with either way (hopefully it'll work). |
|
November 9, 2021, 22:38 |
|
#3 |
New Member
Jared Bland
Join Date: Nov 2020
Posts: 18
Rep Power: 6 |
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 // ************************************************************************* // 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 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 ~~~~~~~~~~~~~~~~~~~~ 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 // ************************************************************************* // 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 // ************************************************************************* // Last edited by JEBland; November 10, 2021 at 16:05. Reason: Adding small questions/details and working sample code. |
|
November 12, 2021, 11:48 |
Still not quite correct
|
#4 |
New Member
Jared Bland
Join Date: Nov 2020
Posts: 18
Rep Power: 6 |
I've had issues with the flow blowing up. In looking back at the meshing, it seems that the faces at the cells on the +/-x faces (used as in/out for this case) are not correctly mapped using the normalToFace and subset operations. Could this (help) cause the simulation blowing up?
Here is the extrude2DMeshDict (I've tried different distances and number of layers) 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 ascii; class dictionary; object extrude2DMeshDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // extrudeModel linearDirection; // extrudeModel wedge; patchType patch; // patchType wedge; //nLayers 5; nLayers 20; // number of layers across total distance expansionRatio 1.0; linearDirectionCoeffs { direction (0 -1 0); thickness 4; // total distance } // ************************************************************************* // 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; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // 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.001; } } // xPFaceSet { // xNFaceSet // Mandatory (inhereted) entries name xNFaceSet; type faceSet; action new; // Mandatory entries source normalToFace; sourceInfo { set facesFromDefaultPatch; normal (-1 0 0); cos 0.001; } } // xNFaceSet { // zPFaceSet // Mandatory (inhereted) entries name zPFaceSet; type faceSet; action new; // Mandatory entries source normalToFace; sourceInfo { set facesFromDefaultPatch; normal (0 0 1); cos 0.001; } } // zPFaceSet { // zNFaceSet // Mandatory (inhereted) entries name zNFaceSet; type faceSet; action new; // Mandatory entries source normalToFace; sourceInfo { set facesFromDefaultPatch; normal (0 0 -1); cos 0.001; } } // 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 // ************************************************************************* // And the 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: either 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: either 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 wall; // type patch; } // How to construct: either 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 wall; // type patch; } // How to construct: either from 'patches' of 'set' constructFrom set; // If constructFrom = set : name of faceSet set zNFaceSet; } // zNPatch { //yNPatch // Name of new patch name yNPatch; // Type of new patch patchInfo { type wall; } // How to construct: either from 'patches' of 'set' constructFrom patches; // If constructFrom = set : name of faceSet patches (back); } // yNPatch { //yPPatch // Name of new patch name yPPatch; // Type of new patch patchInfo { type wall; } // How to construct: either from 'patches' of 'set' constructFrom patches; // If constructFrom = set : name of faceSet patches (front); } // yPPatch ); // patches // ************************************************************************* // |
|
December 2, 2021, 20:32 |
|
#5 |
New Member
Jared Bland
Join Date: Nov 2020
Posts: 18
Rep Power: 6 |
Any extrudeMesh2D/topoSet experts able to weigh in on this?
|
|
December 6, 2021, 08:28 |
|
#6 |
Member
Join Date: May 2017
Posts: 31
Rep Power: 9 |
I'd suggest using ParaFoam to visualise your patches, so you can see if anything's gone wrong and where, rather than just looking at the statistics.
Run paraFoam, then in the properties window: tick Use VTK Polyhedron tick Show Patch Names Under Mesh Parts: Tick all of your patches (names like "inlet - patch"), untick things like "wall - group" and internalMesh Then click apply, and set the dropdown at the top to vtkBlockColours This should give each patch a different colour, with a name in the middle - any faces in the wrong patch will immediately stand out Setting the other dropdown to "Surface With Edges" can be useful as well, if it's coarse enough, so you can see the individual cells Also run checkMesh and see if there's anything dodgy on there |
|
Tags |
autopatch, extrude2dmesh, meshing |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Foam::error::PrintStack | almir | OpenFOAM Running, Solving & CFD | 92 | May 21, 2024 08:56 |
[snappyHexMesh] Add Mesh Layers doesnt work on the whole surface | Kryo | OpenFOAM Meshing & Mesh Conversion | 13 | February 17, 2022 08:34 |
[Other] Mesh Importing Problem | cuteapathy | ANSYS Meshing & Geometry | 2 | June 24, 2017 06:29 |
[snappyHexMesh] sHM layer process keeps getting killed | MBttR | OpenFOAM Meshing & Mesh Conversion | 4 | August 15, 2016 04:21 |
SigFpe when running ANY application in parallel | Pj. | OpenFOAM Running, Solving & CFD | 3 | April 23, 2015 15:53 |