|
[Sponsors] |
[mesh manipulation] mirrorMesh and undoing the joining of patches |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 7, 2011, 19:46 |
mirrorMesh and undoing the joining of patches
|
#1 |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
Hello All,
I used mirrorMesh to mirror a mesh (yes I know that's wierd) and it did a wonderful job at joining patches and such. However now I have a problem. Imagine joining a meshed pipe to make a new pipe twice as long as the original. The original had an inlet an outlet and walls. After reflecting, the inlet was removed and I have two outlets (one patch)...one at the top and one at the bottom of type patch. How can I split this outlet patch to get an inlet patch again? Thanks in advance. Dan |
|
September 8, 2011, 17:44 |
[Solved] mirrorMesh and undoing the joining of patches
|
#2 |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
So to fix this I used the following steps
1. faceSet to extract the faces from the outlet patch into a set called outletPatch. 2. made of copy of the outletPatch set named inletPatch 3. Used setSet with the command setSet -batch createInletSet.setSet where createInletSet.setSet was a text file with the line: faceSet inletPatch delete normalToFace (0 0 1) 0.01 4. Used setSet with the command setSet -batch createOutletSet.setSet where createOUtletSet.setSet was a text file with the line: faceSet outletPatch delete normalToFace (0 0 -1) 0.01 5. used createPatch with the lines Code:
{ name inlet; // Type of new patch dictionary { type patch; } constructFrom set; patches (); set inletPatch; } { name outlet; // Type of new patch dictionary { type patch; } constructFrom set; patches (); set outletPatch; } Dan |
|
November 30, 2011, 20:10 |
|
#3 |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
I had an even simpler method that starts from a combined patch, in my case it was called "outlet".
1. use faceSet and create a set for your combined "outlet" patch, call it "inletOutletSet" Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM Extend Project: Open source CFD | | \\ / O peration | Version: 1.6-ext | | \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object faceSetDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Name of set to operate on name inletOutletSet; // One of clear/new/invert/add/delete|subset/list action new; // Actions to apply to pointSet. These are all the topoSetSource's ending // in ..ToFace (see the meshTools library). topoSetSources ( // All faces of patch patchToFace { name "outlet"; // Name of patch, regular expressions allowed } ); // ************************************************************************* // 3. now subtract out the faces from the inletSet and outletSet you don't need using faceSet again. This was relatively easy since my inlet and outlet patches had normal vectors in opposite direction. For my case, to remove the remove the outlet patch faces from the inletSet i used a faceSetDict like Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM Extend Project: Open source CFD | | \\ / O peration | Version: 1.6-ext | | \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object faceSetDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Name of set to operate on name inletSet; // One of clear/new/invert/add/delete|subset/list action delete; // Actions to apply to pointSet. These are all the topoSetSource's ending // in ..ToFace (see the meshTools library). topoSetSources ( // Faces with normal to within certain angle aligned with vector. normalToFace { normal (0 0 1); // Vector cos 0.01; // Tolerance (max cos of angle) } ); // ************************************************************************* // Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM Extend Project: Open source CFD | | \\ / O peration | Version: 1.6-ext | | \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object faceSetDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // Name of set to operate on name outletSet; // One of clear/new/invert/add/delete|subset/list action delete; // Actions to apply to pointSet. These are all the topoSetSource's ending // in ..ToFace (see the meshTools library). topoSetSources ( // Faces with normal to within certain angle aligned with vector. normalToFace { normal (0 0 -1); // Vector cos 0.01; // Tolerance (max cos of angle) } ); // ************************************************************************* // 4. Now use createPatch to create separate patches from your inletSet and outletSet sets using a createPatchDict similar to Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM Extend Project: Open source CFD | | \\ / O peration | Version: 1.6-ext | | \\ / A nd | Web: www.extend-project.de | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object createPatchDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // This application/dictionary controls: // - optional: create new patches from boundary faces (either given as // a set of patches or as a faceSet) // - always: order faces on coupled patches such that they are opposite. This // is done for all coupled faces, not just for any patches created. // - optional: synchronise points on coupled patches. // 1. Create cyclic: // - specify where the faces should come from // - specify the type of cyclic. If a rotational specify the rotationAxis // and centre to make matching easier // - pointSync true to guarantee points to line up. // 2. Correct incorrect cyclic: // This will usually fail upon loading: // "face 0 area does not match neighbour 2 by 0.0100005%" // " -- possible face ordering problem." // - change patch type from 'cyclic' to 'patch' in the polyMesh/boundary file. // - loosen match tolerance to get case to load // - regenerate cyclic as above // Tolerance used in matching faces. Absolute tolerance is span of // face times this factor. To load incorrectly matches meshes set this // to a higher value. matchTolerance 1E-3; // Do a synchronisation of coupled points after creation of any patches. // Note: this does not work with points that are on multiple coupled patches // with transformations. pointSync true; // Patches to create. patchInfo ( { name inlet; // Type of new patch dictionary { type patch; } constructFrom set; //patches ("inlet"); set inletSet; } ); // ************************************************************************* // |
|
October 21, 2015, 09:09 |
|
#4 | ||||
Senior Member
Join Date: Mar 2015
Posts: 250
Rep Power: 12 |
Dear Daniel,
Thanks for this post. It helped me a lot. However I think this method doesn't work with OpenFOAM 2.3.1. Here are my suggestions: Quote:
Code:
setSet faceSet inletOutletSet new patchToFace outlet quit Quote:
Quote:
Code:
setSet faceSet inletSet delete normalToFace (0 0 1) 0.01 faceSet outletSet delete normalToFace (0 0 -1) 0.01 quit Quote:
Set up the following createPatchDict: Code:
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class dictionary; object createPatchDict; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // This application/dictionary controls: // - optional: create new patches from boundary faces (either given as // a set of patches or as a faceSet) // - always: order faces on coupled patches such that they are opposite. This // is done for all coupled faces, not just for any patches created. // - optional: synchronise points on coupled patches. // - always: remove zero-sized (non-coupled) patches (that were not added) // 1. Create cyclic: // - specify where the faces should come from // - specify the type of cyclic. If a rotational specify the rotationAxis // and centre to make matching easier // - always create both halves in one invocation with correct 'neighbourPatch' // setting. // - optionally pointSync true to guarantee points to line up. // 2. Correct incorrect cyclic: // This will usually fail upon loading: // "face 0 area does not match neighbour 2 by 0.0100005%" // " -- possible face ordering problem." // - in polyMesh/boundary file: // - loosen matchTolerance of all cyclics to get case to load // - or change patch type from 'cyclic' to 'patch' // and regenerate cyclic as above // Do a synchronisation of coupled points after creation of any patches. // Note: this does not work with points that are on multiple coupled patches // with transformations (i.e. cyclics). pointSync false; // Patches to create. patches ( { // Name of new patch name inlet; // Dictionary to construct new patch from patchInfo { type patch; // Optional: explicitly set transformation tensor. // Used when matching and synchronising points. //transform rotational; //rotationAxis (1 0 0); //rotationCentre (0 0 0); // transform translational; // separationVector (1 0 0); // Optional non-default tolerance to be able to define cyclics // on bad meshes //matchTolerance 1E-2; } // How to construct: either from 'patches' or 'set' constructFrom set; // If constructFrom = patches : names of patches. Wildcards allowed. patches (periodic1); // If constructFrom = set : name of faceSet set inletSet; } { // Name of new patch name outlet; // Dictionary to construct new patch from patchInfo { type patch; // Optional: explicitly set transformation tensor. // Used when matching and synchronising points. //transform rotational; //rotationAxis (1 0 0); //rotationCentre (0 0 0); // transform translational; // separationVector (1 0 0); } // How to construct: either from 'patches' or 'set' constructFrom set; // If constructFrom = patches : names of patches. Wildcards allowed. patches (periodic2); // If constructFrom = set : name of faceSet set outletSet; } ); // ************************************************************************* // Code:
createPatch Kate |
|||||
Tags |
mirrormesh |
Thread Tools | Search this Thread |
Display Modes | |
|
|