CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Access faces in multiregion case

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   February 5, 2013, 06:16
Default Access faces in multiregion case
  #1
New Member
 
Join Date: Apr 2010
Location: Linz, Austria
Posts: 16
Rep Power: 7
sailor79 is on a distinguished road
Hi folks,

I want to access the faces of a certain patch in a certain region. I do some first tests with the code from the Thread area of a patch

Code:
// Find the patchID of the patch by name
label patchID = mesh.boundaryMesh().findPatchID("movingWall");

// Create a polyPatch for looping
const polyPatch& myPatch = mesh.boundaryMesh()[patchID];

// Initialize patchArea
scalar patchArea = 0.0;

// Loop trhough all faces on the polyPatch, adding their magnitude surface
// area vectors
forAll(myPatch, faceI)
{
    patchArea += mesh.magSf().boundaryField()[patchID][faceI];
}
But as I am working with chtMultiRegionFoam and the desired patch is an interface patch created by splitMeshRegions (region1_to_region2) I am not able to access the faces. The patchID becomes "-1" as the patch is defined in the boundary file within the regions-directory.

How do I have to modify the mentioned code?

Thanks for your support

Michael
sailor79 is offline   Reply With Quote

Old   February 7, 2013, 03:46
Default
  #2
New Member
 
Join Date: Apr 2010
Location: Linz, Austria
Posts: 16
Rep Power: 7
sailor79 is on a distinguished road
I figured out how to access the mesh of a region. Maybe the following information will help other foamers:

You just have to add these lines to the main program:

Code:
    timeSelector::addOptions();
#   include "addRegionOption.H"
and replace
Code:
#   include "createMesh.H"
by
Code:
#   include "createNamedMesh.H"
Michael
sailor79 is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
No layers in a small gap bobburnquist OpenFOAM Native Meshers: snappyHexMesh and Others 2 November 25, 2012 09:54
Basic hints for runing a multiregion case RuiVO OpenFOAM Pre-Processing 1 February 2, 2012 10:44
udf to access variables from a different case yashmash Fluent UDF and Scheme Programming 6 January 25, 2012 10:10
multi region case - access field from another region mabinty OpenFOAM Programming & Development 3 September 6, 2011 10:25
Problem with decomposePar tool vinz OpenFOAM Pre-Processing 18 January 26, 2011 03:17


All times are GMT -4. The time now is 15:45.