From 473331a62dbbe24f95168f30176c6545a7aa77e5 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 5 Sep 2013 16:43:44 +0100 Subject: [PATCH] ENH: fvMeshSubset: surface fields mapping coupled faces --- .../fvMeshSubset/fvMeshSubsetInterpolate.C | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetInterpolate.C b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetInterpolate.C index ff86f2c2e5..130b08072a 100644 --- a/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetInterpolate.C +++ b/src/finiteVolume/fvMesh/fvMeshSubset/fvMeshSubsetInterpolate.C @@ -272,10 +272,8 @@ tmp > fvMeshSubset::interpolate { // Mapped from internal face. Do what? Leave up to // patchField. This would require also to pass in - // original internal field so for now keep original - // behaviour of mapping original patch face 0 - //directAddressing[i] = -1; - directAddressing[i] = 0; + // original internal field so for now do as postprocessing + directAddressing[i] = -1; } } @@ -290,27 +288,32 @@ tmp > fvMeshSubset::interpolate patchFieldSubset(directAddressing) ) ); - } - } - // Map exposed internal faces. Note: Only necessary if exposed faces added - // into existing patch but since we don't know that at this point... - // Ideally the vf.internalField should be passed in to the mapper - // constructor above so it can handle this. - forAll(bf, patchI) - { - fvsPatchField& pfld = bf[patchI]; + // Postprocess patch field for exposed faces - label meshFaceI = pfld.patch().start(); + fvsPatchField& pfld = bf[patchI]; - forAll(pfld, i) - { - label oldFaceI = faceMap[meshFaceI++]; - - if (oldFaceI < vf.internalField().size()) + forAll(pfld, i) { - pfld[i] = vf.internalField()[oldFaceI]; + label baseFaceI = faceMap[subPatch.start()+i]; + if (baseFaceI < vf.internalField().size()) + { + // Exposed internal face + pfld[i] = vf.internalField()[baseFaceI]; + } + else + { + // Exposed face from other patch. + // Only possible in case of a coupled boundary + label patchI = vf.mesh().boundaryMesh().whichPatch + ( + baseFaceI + ); + const fvPatch& otherPatch = vf.mesh().boundary()[patchI]; + label patchFaceI = otherPatch.patch().whichFace(baseFaceI); + pfld[i] = vf.boundaryField()[patchI][patchFaceI]; + } } } }