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

Access faces in multiregion case

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 5, 2013, 05:16
Default Access faces in multiregion case
  #1
New Member
 
Join Date: Apr 2010
Location: Linz, Austria
Posts: 16
Rep Power: 15
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 http://www.cfd-online.com/Forums/ope...tml#post298405

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, 02:46
Default
  #2
New Member
 
Join Date: Apr 2010
Location: Linz, Austria
Posts: 16
Rep Power: 15
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

Old   March 23, 2017, 11:48
Default
  #3
New Member
 
Join Date: Oct 2016
Posts: 20
Rep Power: 9
JoeFriend is on a distinguished road
Hi! I'm having a similar problem...I need to access a temperature field in a patch from a different region.

When you said "you just have to add these lines to the main program", you meant chtMultiRegionFoam, right? Then, how did you excecute this in your code for creating a mesh in an specific region?

Hope you see this post! Or if any one else knows anything related to this, I would be very grateful!
JoeFriend is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] No layers in a small gap bobburnquist OpenFOAM Meshing & Mesh Conversion 6 August 26, 2015 09:38
Basic hints for runing a multiregion case RuiVO OpenFOAM Pre-Processing 1 February 2, 2012 09:44
udf to access variables from a different case yashmash Fluent UDF and Scheme Programming 6 January 25, 2012 09: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 02:17


All times are GMT -4. The time now is 10:35.