From 8886e9087021557cedd36d98ef06997f7bf46ddf Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Mon, 24 Apr 2017 13:05:19 +0100 Subject: [PATCH] ENH: Progagted oriented() flag through field mapping --- ...parFvFieldReconstructorReconstructFields.C | 4 ++-- .../fvMeshDistributeTemplates.C | 6 +++-- src/dynamicMesh/fvMeshSubset/fvMeshSubset.H | 6 ++--- .../fvMeshSubset/fvMeshSubsetInterpolate.C | 11 +++++----- .../fvsPatchField/fvsPatchField.C | 22 +++++++------------ 5 files changed, 21 insertions(+), 28 deletions(-) diff --git a/applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructorReconstructFields.C b/applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructorReconstructFields.C index 3df020099f..6f1ebfd8a4 100644 --- a/applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructorReconstructFields.C +++ b/applications/utilities/parallelProcessing/redistributePar/parFvFieldReconstructorReconstructFields.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -269,7 +269,7 @@ Foam::parFvFieldReconstructor::reconstructFvSurfaceField } // Map all faces - Field internalField(flatFld, mapper); + Field internalField(flatFld, mapper, fld.oriented()()); // Trim to internal faces (note: could also have special mapper) internalField.setSize diff --git a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C index 86a9617750..e03840aaa5 100644 --- a/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C +++ b/src/dynamicMesh/fvMeshDistribute/fvMeshDistributeTemplates.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -205,6 +205,8 @@ void Foam::fvMeshDistribute::mapExposedFaces forAllIter(typename HashTable, flds, iter) { fldType& fld = *iter(); + const bool oriented = fld.oriented()(); + typename fldType::Boundary& bfld = fld.boundaryFieldRef(); const Field& oldInternal = oldFlds[fieldI++]; @@ -225,7 +227,7 @@ void Foam::fvMeshDistribute::mapExposedFaces { patchFld[i] = oldInternal[oldFaceI]; - if (map.flipFaceFlux().found(faceI)) + if (oriented && map.flipFaceFlux().found(faceI)) { patchFld[i] = flipOp()(patchFld[i]); } diff --git a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H index 54c4141107..84089eae2a 100644 --- a/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H +++ b/src/dynamicMesh/fvMeshSubset/fvMeshSubset.H @@ -275,16 +275,14 @@ public: const fvMesh& sMesh, const labelList& patchMap, const labelList& cellMap, - const labelList& faceMap, - const bool negateIfFlipped = true + const labelList& faceMap ); template tmp> interpolate ( - const GeometricField&, - const bool negateIfFlipped = true + const GeometricField& ) const; //- Map point field diff --git a/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C b/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C index 7a0192ee06..8e5680737d 100644 --- a/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C +++ b/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C @@ -180,10 +180,11 @@ tmp> fvMeshSubset::interpolate const fvMesh& sMesh, const labelList& patchMap, const labelList& cellMap, - const labelList& faceMap, - const bool negateIfFlipped + const labelList& faceMap ) { + const bool negateIfFlipped = vf.oriented()(); + // 1. Create the complete field with dummy patch fields PtrList> patchFields(patchMap.size()); @@ -342,8 +343,7 @@ tmp> fvMeshSubset::interpolate template tmp> fvMeshSubset::interpolate ( - const GeometricField& sf, - const bool negateIfFlipped + const GeometricField& sf ) const { return interpolate @@ -352,8 +352,7 @@ tmp> fvMeshSubset::interpolate subMesh(), patchMap(), cellMap(), - faceMap(), - negateIfFlipped + faceMap() ); } diff --git a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C index cb0276cc7c..f1ebd2e690 100644 --- a/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C +++ b/src/finiteVolume/fields/fvsPatchFields/fvsPatchField/fvsPatchField.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -26,6 +26,7 @@ License #include "IOobject.H" #include "dictionary.H" #include "fvMesh.H" +#include "surfaceMesh.H" #include "fvPatchFieldMapper.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -93,20 +94,15 @@ Foam::fvsPatchField::fvsPatchField } else { - FatalIOErrorInFunction - ( - dict - ) << "essential value entry not provided" + FatalIOErrorInFunction(dict) + << "essential 'value' entry not provided" << exit(FatalIOError); } } template -Foam::fvsPatchField::fvsPatchField -( - const fvsPatchField& ptf -) +Foam::fvsPatchField::fvsPatchField(const fvsPatchField& ptf) : Field(ptf), patch_(ptf.patch_), @@ -149,12 +145,10 @@ void Foam::fvsPatchField::check(const fvsPatchField& ptf) const template -void Foam::fvsPatchField::autoMap -( - const fvPatchFieldMapper& m -) +void Foam::fvsPatchField::autoMap(const fvPatchFieldMapper& m) { - Field::autoMap(m); + const bool oriented = internalField_.oriented()(); + Field::autoMap(m, oriented); }