Post processing updates to Overset Mesh

oversetMesh::regionIDPtr_ is now a pointer to volScalarField instead of
labelField in order to allow automatic I/O for post processing.
This commit is contained in:
Vuko Vukcevic 2019-04-16 12:02:20 +02:00
parent 6bbf74eee5
commit 506c150bdb
4 changed files with 58 additions and 23 deletions

View file

@ -59,7 +59,7 @@ void Foam::oversetAdjustPhi
const unallocLabelList& neighbour = mesh.neighbour(); const unallocLabelList& neighbour = mesh.neighbour();
// Get region split to identify separate mesh components // Get region split to identify separate mesh components
const labelList& regionID = om.regionID(); const scalarField& regionID = om.regionID().internalField();
// Sum up incoming and outgoing flux // Sum up incoming and outgoing flux
scalar fringeIn = 0; scalar fringeIn = 0;
@ -80,8 +80,12 @@ void Foam::oversetAdjustPhi
{ {
// Internal face // Internal face
// Debug check // Debug check. Note: use notEqual since we are comparing two
if (regionID[owner[curFace]] != regionID[neighbour[curFace]]) // scalars
if
(
notEqual(regionID[owner[curFace]], regionID[neighbour[curFace]])
)
{ {
FatalErrorIn FatalErrorIn
( (

View file

@ -60,7 +60,7 @@ void Foam::regionWiseOversetAdjustPhi
const unallocLabelList& neighbour = mesh.neighbour(); const unallocLabelList& neighbour = mesh.neighbour();
// Get region split to identify separate mesh components // Get region split to identify separate mesh components
const labelList& regionID = om.regionID(); const scalarField& regionID = om.regionID().internalField();
// Incoming and outgoing region fluxes // Incoming and outgoing region fluxes
scalarField regionIn(om.regions().size(), 0); scalarField regionIn(om.regions().size(), 0);
@ -94,7 +94,7 @@ void Foam::regionWiseOversetAdjustPhi
// scaled // scaled
forAll (phip, i) forAll (phip, i)
{ {
// Get current region index // Get current region index. Note: conversion to label
const label curRegion = regionID[fc[i]]; const label curRegion = regionID[fc[i]];
if (phip[i] < 0.0) if (phip[i] < 0.0)
@ -124,11 +124,12 @@ void Foam::regionWiseOversetAdjustPhi
{ {
// Internal face // Internal face
// Get region index // Get region index. Note: conversion to label
const label curRegion = regionID[owner[curFace]]; const label curRegion = regionID[owner[curFace]];
// Check whether owner and neighbour belong to the same region // Check whether owner and neighbour belong to the same region.
if (curRegion != regionID[neighbour[curFace]]) // Note: use notEqual function since we are comparing two scalars
if (notEqual(curRegion, regionID[neighbour[curFace]]))
{ {
FatalErrorIn FatalErrorIn
( (
@ -210,7 +211,7 @@ void Foam::regionWiseOversetAdjustPhi
{ {
// Processor patch, master side // Processor patch, master side
// Get region index // Get region index. Note: conversion to label
const label curRegion = const label curRegion =
regionID[mesh.boundary()[patchI].faceCells()[faceI]]; regionID[mesh.boundary()[patchI].faceCells()[faceI]];
@ -321,7 +322,7 @@ void Foam::regionWiseOversetAdjustPhi
{ {
// Internal face // Internal face
// Get region index // Get region index. Note: conversion to label
const label curRegion = regionID[owner[curFace]]; const label curRegion = regionID[owner[curFace]];
// Get reference to the flux for scaling // Get reference to the flux for scaling
@ -358,7 +359,7 @@ void Foam::regionWiseOversetAdjustPhi
if (procPatch.master()) // Owner side if (procPatch.master()) // Owner side
{ {
// Get region index // Get region index. Note: conversion to label
const label curRegion = const label curRegion =
regionID[mesh.boundary()[patchI].faceCells()[faceI]]; regionID[mesh.boundary()[patchI].faceCells()[faceI]];
@ -374,7 +375,7 @@ void Foam::regionWiseOversetAdjustPhi
} }
else // Neighbouring processor side else // Neighbouring processor side
{ {
// Get region index // Get region index. Note: conversion to label
const label curRegion = const label curRegion =
regionID[mesh.boundary()[patchI].faceCells()[faceI]]; regionID[mesh.boundary()[patchI].faceCells()[faceI]];

View file

@ -121,8 +121,9 @@ private:
//- Return overset type indicator field //- Return overset type indicator field
mutable volScalarField* oversetTypesPtr_; mutable volScalarField* oversetTypesPtr_;
//- Region ID: region index for each cell //- Region ID: region index for each cell as a volScalarField for
mutable labelList* regionIDPtr_; // visualization. VV, 15/Apr/2019
mutable volScalarField* regionIDPtr_;
// Overset discretisation support // Overset discretisation support
@ -286,7 +287,7 @@ public:
const volScalarField& oversetTypes() const; const volScalarField& oversetTypes() const;
//- Return region indicator //- Return region indicator
const labelList& regionID() const; const volScalarField& regionID() const;
// Overset discretisation support // Overset discretisation support

View file

@ -27,6 +27,7 @@ License
#include "surfaceFields.H" #include "surfaceFields.H"
#include "volFields.H" #include "volFields.H"
#include "polyPatchID.H" #include "polyPatchID.H"
#include "oversetFvPatchFields.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -190,24 +191,52 @@ void Foam::oversetMesh::calcDomainMarkup() const
} }
} }
// Region ID // Region ID, initialized with -1 for sanity check later on
regionIDPtr_ = new labelList(mesh().nCells(), -1); regionIDPtr_ = new volScalarField
labelList& rID = *regionIDPtr_; (
IOobject
// Mark regions (
"regionIndex",
mesh().time().timeName(),
mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh(),
dimensionedScalar("minusOne", dimless, -1.0),
"zeroGradient"
);
volScalarField& regionID = *regionIDPtr_;
scalarField& regionIDIn = regionID.internalField();
// Mark regions (internal field)
forAll (regions_, regionI) forAll (regions_, regionI)
{ {
const labelList& curCells = regions_[regionI].zone(); const labelList& curCells = regions_[regionI].zone();
forAll (curCells, curCellI) forAll (curCells, curCellI)
{ {
rID[curCells[curCellI]] = regionI; regionIDIn[curCells[curCellI]] = regionI;
}
}
// Update boundary values, making sure that we skip the overset patch
volScalarField::GeometricBoundaryField& regionIDb =
regionID.boundaryField();
forAll (regionIDb, patchI)
{
// Get the patch field
fvPatchScalarField& ripf = regionIDb[patchI];
if (!isA<oversetFvPatchScalarField>(ripf))
{
ripf = ripf.patchInternalField();
} }
} }
// Check regions // Check regions
if (min(rID) < 0) if (min(regionID).value() < 0)
{ {
FatalErrorIn("void oversetMesh::calcDomainMarkup() const") FatalErrorIn("void oversetMesh::calcDomainMarkup() const")
<< "Found cells without region ID. Please check overset setup" << "Found cells without region ID. Please check overset setup"
@ -1166,7 +1195,7 @@ const Foam::volScalarField& Foam::oversetMesh::oversetTypes() const
} }
const Foam::labelList& Foam::oversetMesh::regionID() const const Foam::volScalarField& Foam::oversetMesh::regionID() const
{ {
if (!regionIDPtr_) if (!regionIDPtr_)
{ {