|
[Sponsors] |
Changing boundary patch type on constant/polymesh/boundary in solver |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 26, 2022, 19:50 |
Changing boundary patch type on constant/polymesh/boundary in solver
|
#1 |
New Member
Join Date: Dec 2021
Location: Argentina, BB
Posts: 5
Rep Power: 4 |
Hello foamers,
We are attempting to modify the boundary patches on constant/polymesh/boundary at runTime in a multi-region solver based upon interFoam. Here's what we are trying to do:
Code:
--> FOAM FATAL IO ERROR: patch type 'wall' not constraint type 'empty' for patch front of field p_rgh in file "/home/ar/OpenFOAM/ar-dev/run/ar/ar04/0/region/p_rgh" file: /home/ariedinger/OpenFOAM/ariedinger-dev/run/ar/ar04/0/region/p_rgh/boundaryField/front from line 24 to line 24. From function Foam::emptyFvPatchField<Type>::emptyFvPatchField(const Foam::fvPatch&, const Foam::DimensionedField<Type, Foam::volMesh>&, const Foam::dictionary&) [with Type = double] in file fields/fvPatchFields/constraint/empty/emptyFvPatchField.C at line 54. FOAM exiting Code:
const word& patchTypeEmpty = "empty"; allRegions[2].boundaryMesh().types()[0] = patchTypeEmpty; allRegions[2].boundaryMesh().types()[1] = "empty"; Info << "\nBoundary mesh patchTypes: " << allRegions[2].boundaryMesh().types() << nl << endl; Code:
Boundary mesh patchTypes: 3 ( wall wall mappedWall ) Code:
const word& patchTypeEmpty = "empty"; allRegions[2].boundaryMesh().types()[0] = patchTypeEmpty; allRegions[2].boundaryMesh().types()[1] = "empty"; Info << "\nBoundary mesh patchTypes: " << allRegions[2].boundaryMesh().types() << nl << endl; forAll(allRegions[2].boundary(), patch) { /* Boundary patch name and types */ const word& patchName = allRegions[2].boundary()[patch].name(); const word& patchType = allRegions[2].boundary()[patch].type(); Info << "Read patchName: " << patchName << ", patchType: " << patchType << " in region " << allRegions[2].name() << nl << endl; if ( (patchName == "front" || patchName == "back") && (patchType == "wall") ) { Info << "Attempting to change patch " << patchName << " from type " << patchType << " to type " << patchTypeEmpty << nl << endl; } } Code:
Boundary mesh patchTypes: 3 ( wall wall mappedWall ) Read patchName: front, patchType: wall in region region1 Attempting to change patch front from type wall to type empty Read patchName: back, patchType: wall in region region1 Attempting to change patch back from type wall to type empty Read patchName: region1_to_region2, patchType: mappedWall in region region1 There are functions such as changePatchType() [https://cpp.openfoam.org/v8/classFoam_1_1boundaryMesh.html#ae598cc11969a83a0ec f2be3e967948dd] and renamePatches() [https://cpp.openfoam.org/v10/classFo...fe1147025538f5], but we are not sure how to use them. EDIT1: mesh.boundaryMesh().changePatchType() does not seem to exist anymore in version 10. Is there any similar function that does the same? EDIT2: We found the function changePatchType() in the class repatchMesh().changePatchType() (that is included with the dyamic meshes libraries). We are now testing the following code Code:
Info << "Boundary mesh patchTypes: " << allRegions[2].boundaryMesh().types() << nl << endl; Info << "Reading mesh with repatchMesh() ... " << nl << endl; repatchMesh().read(allRegions[2]); Info << "Boundary mesh read with repatchMesh(): " << repatchMesh().mesh() << nl << endl; Info << "Boundary patches read with repatchMesh(): " << repatchMesh().patches() << nl << endl; forAll(allRegions[2].boundary(), patch) { /* Boundary patch name and types */ const word& patchName = allRegions[2].boundary()[patch].name(); const word& patchType = allRegions[2].boundary()[patch].type(); Info << "Read patchName: " << patchName << ", patchType: " << patchType << " in region " << allRegions[2].name() << nl << endl; if ( (patchName == "front" || patchName == "back") && (patchType == "wall") ) { Info << "Attempting to change patch " << patchName << " from type " << patchType << " to type empty" << nl << endl; allRegions[2].boundaryMesh().findPatchID("front"); repatchMesh().changePatchType("back", "empty"); Info << "Now patch " << patchName << " is of type " << patchType << nl << endl; } } Info << "\nBoundary mesh patchTypes are now: " << allRegions[2].boundaryMesh().types() << nl << endl; Code:
Reading mesh with repatchMesh() ... Boundary mesh read with repatchMesh(): --> FOAM FATAL ERROR: No mesh available. Probably mesh not yet read. From function const Foam::repatchMesh::rMesh& Foam::repatchMesh::mesh() const in file repatchMesh.H at line 185. FOAM aborting Code:
Reading mesh with repatchMesh() ... Boundary patches read with repatchMesh(): 0 ( ) Read patchName: front, patchType: wall in region ferrofluid Attempting to change patch front from type wall to type empty --> FOAM FATAL ERROR: Can't find patch named back From function void Foam::repatchMesh::changePatchType(const Foam::word&, const Foam::word&) in file repatchMesh/repatchMesh.C at line 1243. FOAM aborting EDIT 3: Now tested Code:
Info << "Reading mesh with repatchMesh() ... " << nl << endl; //repatchMesh().read(allRegions[2]); repatchMesh().read(allRegions[2].boundaryMesh().mesh()); // repatchMesh().read(allRegions[2].boundary().mesh()); Info << "Boundary mesh read with repatchMesh(): " << repatchMesh().mesh() << nl << endl; But both repatchMesh().read(allRegions[2].boundaryMesh().mesh()); and repatchMesh().read(allRegions[2].boundary().mesh()); result in the ERROR message: repatchMesh.mesh() isn't able to find a mesh. Any help is appreciated. Best Regards, Last edited by ariedinger; September 29, 2022 at 13:33. |
|
Tags |
boundary condition, patches, polymesh, programming, solver compilation |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Illegal cell label -1, fluent3DMeshToFoam | BenGher | OpenFOAM | 7 | October 10, 2023 01:02 |
activeBaffleVelocity boundary condition ? | om3ro | OpenFOAM Programming & Development | 10 | November 17, 2020 00:26 |
twoPhaseEulerFoam confined plunging jet simulation failed | ves | OpenFOAM Running, Solving & CFD | 2 | June 17, 2020 06:08 |
rSF: p divergence in combustor (wt negative value) | zonda | OpenFOAM Pre-Processing | 4 | April 10, 2018 07:59 |
[Commercial meshers] Using starToFoam | clo | OpenFOAM Meshing & Mesh Conversion | 33 | September 26, 2012 05:04 |