This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/src/overset/oversetMesh/include/writeOversetMasks.H
Vuko Vukcevic c7cd6b09fd Bugfix when writing overset region index
The values at the coupled boundaries haven't been properly uninitialized and the
coupled patches have been skipped from assignement to patch internal field.
2018-09-03 09:39:54 +02:00

53 lines
1.2 KiB
C++

{
const oversetMesh& om = oversetMesh::New(mesh);
om.gamma().write();
om.gammaExt().write();
om.sGamma().write();
om.oversetTypes().write();
// Create region ID field
volScalarField regionIndex
(
IOobject
(
"regionIndex",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimless,
"zeroGradient"
);
scalarField& regionIndexIn = regionIndex.internalField();
forAll (om.regions(), regionI)
{
const cellZone& cz = om.regions()[regionI].zone();
forAll (cz, cellI)
{
regionIndexIn[cz[cellI]] = regionI;
}
}
// Update boundary values, making sure that we skip the overset patch
volScalarField::GeometricBoundaryField& regionIndexb =
regionIndex.boundaryField();
forAll(regionIndexb, patchI)
{
// Get the patch field
fvPatchScalarField& ripf = regionIndexb[patchI];
if (!isA<oversetFvPatchScalarField>(ripf))
{
ripf = ripf.patchInternalField();
}
}
// Write region index
regionIndex.write();
}