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:
parent
7b4ec99683
commit
189078e98e
4 changed files with 58 additions and 23 deletions
|
@ -59,7 +59,7 @@ void Foam::oversetAdjustPhi
|
|||
const unallocLabelList& neighbour = mesh.neighbour();
|
||||
|
||||
// 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
|
||||
scalar fringeIn = 0;
|
||||
|
@ -80,8 +80,12 @@ void Foam::oversetAdjustPhi
|
|||
{
|
||||
// Internal face
|
||||
|
||||
// Debug check
|
||||
if (regionID[owner[curFace]] != regionID[neighbour[curFace]])
|
||||
// Debug check. Note: use notEqual since we are comparing two
|
||||
// scalars
|
||||
if
|
||||
(
|
||||
notEqual(regionID[owner[curFace]], regionID[neighbour[curFace]])
|
||||
)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
|
|
|
@ -60,7 +60,7 @@ void Foam::regionWiseOversetAdjustPhi
|
|||
const unallocLabelList& neighbour = mesh.neighbour();
|
||||
|
||||
// Get region split to identify separate mesh components
|
||||
const labelList& regionID = om.regionID();
|
||||
const scalarField& regionID = om.regionID().internalField();
|
||||
|
||||
// Incoming and outgoing region fluxes
|
||||
scalarField regionIn(om.regions().size(), 0);
|
||||
|
@ -94,7 +94,7 @@ void Foam::regionWiseOversetAdjustPhi
|
|||
// scaled
|
||||
forAll (phip, i)
|
||||
{
|
||||
// Get current region index
|
||||
// Get current region index. Note: conversion to label
|
||||
const label curRegion = regionID[fc[i]];
|
||||
|
||||
if (phip[i] < 0.0)
|
||||
|
@ -124,11 +124,12 @@ void Foam::regionWiseOversetAdjustPhi
|
|||
{
|
||||
// Internal face
|
||||
|
||||
// Get region index
|
||||
// Get region index. Note: conversion to label
|
||||
const label curRegion = regionID[owner[curFace]];
|
||||
|
||||
// Check whether owner and neighbour belong to the same region
|
||||
if (curRegion != regionID[neighbour[curFace]])
|
||||
// Check whether owner and neighbour belong to the same region.
|
||||
// Note: use notEqual function since we are comparing two scalars
|
||||
if (notEqual(curRegion, regionID[neighbour[curFace]]))
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
|
@ -210,7 +211,7 @@ void Foam::regionWiseOversetAdjustPhi
|
|||
{
|
||||
// Processor patch, master side
|
||||
|
||||
// Get region index
|
||||
// Get region index. Note: conversion to label
|
||||
const label curRegion =
|
||||
regionID[mesh.boundary()[patchI].faceCells()[faceI]];
|
||||
|
||||
|
@ -321,7 +322,7 @@ void Foam::regionWiseOversetAdjustPhi
|
|||
{
|
||||
// Internal face
|
||||
|
||||
// Get region index
|
||||
// Get region index. Note: conversion to label
|
||||
const label curRegion = regionID[owner[curFace]];
|
||||
|
||||
// Get reference to the flux for scaling
|
||||
|
@ -358,7 +359,7 @@ void Foam::regionWiseOversetAdjustPhi
|
|||
|
||||
if (procPatch.master()) // Owner side
|
||||
{
|
||||
// Get region index
|
||||
// Get region index. Note: conversion to label
|
||||
const label curRegion =
|
||||
regionID[mesh.boundary()[patchI].faceCells()[faceI]];
|
||||
|
||||
|
@ -374,7 +375,7 @@ void Foam::regionWiseOversetAdjustPhi
|
|||
}
|
||||
else // Neighbouring processor side
|
||||
{
|
||||
// Get region index
|
||||
// Get region index. Note: conversion to label
|
||||
const label curRegion =
|
||||
regionID[mesh.boundary()[patchI].faceCells()[faceI]];
|
||||
|
||||
|
|
|
@ -121,8 +121,9 @@ private:
|
|||
//- Return overset type indicator field
|
||||
mutable volScalarField* oversetTypesPtr_;
|
||||
|
||||
//- Region ID: region index for each cell
|
||||
mutable labelList* regionIDPtr_;
|
||||
//- Region ID: region index for each cell as a volScalarField for
|
||||
// visualization. VV, 15/Apr/2019
|
||||
mutable volScalarField* regionIDPtr_;
|
||||
|
||||
|
||||
// Overset discretisation support
|
||||
|
@ -286,7 +287,7 @@ public:
|
|||
const volScalarField& oversetTypes() const;
|
||||
|
||||
//- Return region indicator
|
||||
const labelList& regionID() const;
|
||||
const volScalarField& regionID() const;
|
||||
|
||||
|
||||
// Overset discretisation support
|
||||
|
|
|
@ -27,6 +27,7 @@ License
|
|||
#include "surfaceFields.H"
|
||||
#include "volFields.H"
|
||||
#include "polyPatchID.H"
|
||||
#include "oversetFvPatchFields.H"
|
||||
#include "demandDrivenData.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
@ -190,24 +191,52 @@ void Foam::oversetMesh::calcDomainMarkup() const
|
|||
}
|
||||
}
|
||||
|
||||
// Region ID
|
||||
regionIDPtr_ = new labelList(mesh().nCells(), -1);
|
||||
labelList& rID = *regionIDPtr_;
|
||||
|
||||
// Mark regions
|
||||
// Region ID, initialized with -1 for sanity check later on
|
||||
regionIDPtr_ = new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"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)
|
||||
{
|
||||
const labelList& curCells = regions_[regionI].zone();
|
||||
|
||||
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
|
||||
if (min(rID) < 0)
|
||||
if (min(regionID).value() < 0)
|
||||
{
|
||||
FatalErrorIn("void oversetMesh::calcDomainMarkup() const")
|
||||
<< "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_)
|
||||
{
|
||||
|
|
Reference in a new issue