diff --git a/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.C b/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.C index 5c17fac148..9b1154a99d 100644 --- a/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.C +++ b/src/finiteVolume/fvMesh/fvMeshStitchers/fvMeshStitcher/fvMeshStitcher.C @@ -1122,7 +1122,6 @@ Foam::fvMeshStitcher::calculateOwnerOrigBoundaryEdgeParts } - void Foam::fvMeshStitcher::applyOwnerOrigBoundaryEdgeParts ( surfaceVectorField& SfSf, @@ -1159,7 +1158,8 @@ void Foam::fvMeshStitcher::applyOwnerOrigBoundaryEdgeParts const label patchi = mesh_.isInternalFace(facei) - ? -1 : pbMesh.patchIndices()[facei - mesh_.nInternalFaces()]; + ? -1 + : pbMesh.patchIndices()[facei - mesh_.nInternalFaces()]; if (patchi != -1 && patchIsOwnerOrig[patchi]) { @@ -1428,6 +1428,8 @@ void Foam::fvMeshStitcher::intersect const nonConformalBoundary& ncb = nonConformalBoundary::New(mesh_); const labelList ownerOrigPatchIndices = ncb.ownerOrigPatchIndices(); + const edgeList& ownerOrigBoundaryMeshEdges = + ncb.ownerOrigBoundaryMeshEdges(); // Alias the boundary geometry fields surfaceVectorField::Boundary& SfBf = SfSf.boundaryFieldRef(); @@ -1562,21 +1564,37 @@ void Foam::fvMeshStitcher::intersect const label ownerOrigBoundaryEdgei = origPatchEdgeOwnerOrigBoundaryEdges[origPatchEdgei]; + const label sign = + edge::compare + ( + meshEdge(origPatch, origPatchEdgei), + ownerOrigBoundaryMeshEdges[ownerOrigBoundaryEdgei] + ); + part errorP = patchEdgeParts[origPatchi][origPatchEdgei]; - errorP -= ownerOrigBoundaryEdgeParts[ownerOrigBoundaryEdgei]; + errorP -= + sign > 0 + ? ownerOrigBoundaryEdgeParts[ownerOrigBoundaryEdgei] + : -ownerOrigBoundaryEdgeParts[ownerOrigBoundaryEdgei]; forAll(origPatch.edgeFaces()[origPatchEdgei], patchEdgeFacei) { const label patchFacei = origPatch.edgeFaces()[origPatchEdgei][patchEdgeFacei]; + const label sign = + origPatch.localFaces()[patchFacei].edgeDirection + ( + origPatch.edges()[origPatchEdgei] + ); + part p ( SfBf[origPatchi][patchFacei], CfBf[origPatchi][patchFacei] ); - p += errorP; + p += sign > 0 ? errorP : -errorP; SfBf[origPatchi][patchFacei] = p.area; CfBf[origPatchi][patchFacei] = p.centre; diff --git a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.C b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.C index 1f727ae32b..5e86987294 100644 --- a/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.C +++ b/src/finiteVolume/fvMesh/fvPatches/constraint/processor/processorFvPatch.C @@ -25,7 +25,8 @@ License #include "processorFvPatch.H" #include "addToRunTimeSelectionTable.H" -#include "transformField.H" +#include "volFields.H" +#include "surfaceFields.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -42,13 +43,26 @@ void Foam::processorFvPatch::makeWeights(scalarField& w) const { if (Pstream::parRun()) { - coupledFvPatch::makeWeights - ( - w, - procPolyPatch_.neighbFaceAreas(), - procPolyPatch_.neighbFaceCentres() - - procPolyPatch_.neighbFaceCellCentres() - ); + if (!boundaryMesh().mesh().conformal()) + { + coupledFvPatch::makeWeights + ( + w, + - boundaryMesh().mesh().Sf().boundaryField()[index()], + boundaryMesh().mesh().Cf().boundaryField()[index()] + - boundaryMesh().mesh().C().boundaryField()[index()] + ); + } + else + { + coupledFvPatch::makeWeights + ( + w, + procPolyPatch_.neighbFaceAreas(), + procPolyPatch_.neighbFaceCentres() + - procPolyPatch_.neighbFaceCellCentres() + ); + } } else { @@ -61,12 +75,24 @@ Foam::tmp Foam::processorFvPatch::delta() const { if (Pstream::parRun()) { - return - coupledFvPatch::delta - ( - procPolyPatch_.neighbFaceCentres() - - procPolyPatch_.neighbFaceCellCentres() - ); + if (!boundaryMesh().mesh().conformal()) + { + return + coupledFvPatch::delta + ( + boundaryMesh().mesh().Cf().boundaryField()[index()] + - boundaryMesh().mesh().C().boundaryField()[index()] + ); + } + else + { + return + coupledFvPatch::delta + ( + procPolyPatch_.neighbFaceCentres() + - procPolyPatch_.neighbFaceCellCentres() + ); + } } else { diff --git a/src/meshTools/nonConformal/boundary/nonConformalBoundary.C b/src/meshTools/nonConformal/boundary/nonConformalBoundary.C index 9dee387a5d..1e28b63cf7 100644 --- a/src/meshTools/nonConformal/boundary/nonConformalBoundary.C +++ b/src/meshTools/nonConformal/boundary/nonConformalBoundary.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -179,28 +179,6 @@ void Foam::nonConformalBoundary::nonConformalOtherPatchIndices {} -const Foam::labelList& -Foam::nonConformalBoundary::meshPointOwnerOrigBoundaryPoint() const -{ - if (!meshPointOwnerOrigBoundaryPointPtr_.valid()) - { - meshPointOwnerOrigBoundaryPointPtr_.set - ( - new labelList(mesh().nPoints(), -1) - ); - - forAll(ownerOrigBoundary_.meshPoints(), ownerOrigBoundaryPointi) - { - meshPointOwnerOrigBoundaryPointPtr_() - [ownerOrigBoundary_.meshPoints()[ownerOrigBoundaryPointi]] = - ownerOrigBoundaryPointi; - } - } - - return meshPointOwnerOrigBoundaryPointPtr_(); -} - - const Foam::vectorField& Foam::nonConformalBoundary::ownerOrigBoundaryPointNormals() const { @@ -373,20 +351,30 @@ Foam::nonConformalBoundary::ownerOrigBoundaryPointMeshPoint() const { if (!ownerOrigBoundaryPointMeshPointPtr_.valid()) { + // Construct the local maps using the owner-orig primitive patch ownerOrigBoundaryPointMeshPointPtr_.set ( new labelList(ownerOrigBoundary_.meshPoints()) ); - // ... - meshPointOwnerOrigBoundaryPoint(); - labelList& map = meshPointOwnerOrigBoundaryPointPtr_(); + meshPointOwnerOrigBoundaryPointPtr_.set + ( + new labelList(mesh().nPoints(), -1) + ); - // ... + labelList& meshPointOwnerOrigBoundaryPoint = + meshPointOwnerOrigBoundaryPointPtr_(); + + forAll(ownerOrigBoundary_.meshPoints(), ownerOrigBoundaryPointi) + { + meshPointOwnerOrigBoundaryPoint + [ownerOrigBoundary_.meshPoints()[ownerOrigBoundaryPointi]] = + ownerOrigBoundaryPointi; + } + + // Construct the remote map by enumerating newly identified points label ownerOrigBoundaryPointi = ownerOrigBoundary_.nPoints(); - DynamicList