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

How to adress boundary patch from another region in chtMultiRegionFoam?

Register Blogs Community New Posts Updated Threads Search

Like Tree4Likes
  • 2 Post By Aniy
  • 2 Post By Muerio

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 20, 2021, 06:17
Question How to adress boundary patch from another region in chtMultiRegionFoam?
  #1
New Member
 
Join Date: Feb 2021
Posts: 2
Rep Power: 0
Aniy is on a distinguished road
Hello,

I am simulating a heat transfer model which includes one fluid region and one solid region, using the solver chtMultiRegionFoam in OFv8.

The boundary condition codedFixedValue is used for the temperature setting of one fluid region patch A. I need to access the temperature feld of another fluid region patch B and the wallHeatFlux feld of one solid region patch C.

It has worked wonderful with following code to read the temperature feld of patch B in fluid region:

Code:
word patchName_patchB = "patchB";

const label patchB_ID = this->patch().boundaryMesh().findPatchID(patchName_patchB);

const volScalarField &T = db().objectRegistry::lookupObject<volScalarField>("T");

const scalarField &T_patchB_sf = T.boundaryField()[patchB_ID];

scalar T_patchB = Foam::average(T_patchB_sf);
But when it comes to the wallHeatFlux feld of patch C in solid region, because the patch C is not in the fluid region like patch A and patch B, the function findPatchID returns -1 so that patch C cannot be found.

The question is:
  • How to adress patch C (which is located in solid region) to access the temperature feld of it?

Anyone has an idea how to solve this problem would be very appreciated, thanks.
parthigcar and Muerio like this.

Last edited by Aniy; July 21, 2021 at 02:17.
Aniy is offline   Reply With Quote

Old   October 7, 2021, 07:56
Default
  #2
New Member
 
Marius
Join Date: Aug 2020
Location: Germany
Posts: 10
Rep Power: 5
Muerio is on a distinguished road
Hi there,

I managed to find a solution to the problem. (Tested with a fixedValue BC in region fluid).

Basically you can access the mesh of a different region (i.e. solid) by creating a pointer:
Code:
const fvMesh &solidFvMesh =
            db().parent().objectRegistry::lookupObject<fvMesh>("solid");
Once the targeted region has been initialized, you can access fields and evaluate them at the individual patches (i.e. average temperature at patchC):
Code:
const volScalarField &solidT =
            solidFvMesh.thisDb().objectRegistry::lookupObject<volScalarField>(
                "T");

Info << "Average temperature in solid:patchC: "
     << gAverage(
         solidT.boundaryField()[solidFvMesh.boundaryMesh().findPatchID("patchC")])
     << endl;
If needed you could also access further information for the region, i.e. the thermophysicalProperties dictionary:
Code:
solidFvMesh.thisDb().lookupObject<IOdictionary>("thermophysicalProperties")
Lorenzo210 and wht like this.
Muerio is offline   Reply With Quote

Reply

Tags
#chtmultiregionfoam, #codedfixedvalue


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
Radiation in semi-transparent media with surface-to-surface model? mpeppels CFX 11 August 22, 2019 07:30
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 07:00
Cyclic Boundary Condition Luiz Eduardo Bittencourt Sampaio (Sampaio) OpenFOAM Running, Solving & CFD 36 July 2, 2012 12:23
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 15:55
Multicomponent fluid Andrea CFX 2 October 11, 2004 05:12


All times are GMT -4. The time now is 21:00.