From 8886e9087021557cedd36d98ef06997f7bf46ddf Mon Sep 17 00:00:00 2001 From: Andrew Heather <a.heather@opencfd.co.uk> 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 3df020099ff..6f1ebfd8a45 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<Type> internalField(flatFld, mapper); + Field<Type> 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 86a9617750a..e03840aaa53 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<fldType*>, flds, iter) { fldType& fld = *iter(); + const bool oriented = fld.oriented()(); + typename fldType::Boundary& bfld = fld.boundaryFieldRef(); const Field<T>& 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 54c41411073..84089eae2af 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<class Type> tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> interpolate ( - const GeometricField<Type, fvsPatchField, surfaceMesh>&, - const bool negateIfFlipped = true + const GeometricField<Type, fvsPatchField, surfaceMesh>& ) const; //- Map point field diff --git a/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C b/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C index 7a0192ee06c..8e5680737d2 100644 --- a/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C +++ b/src/dynamicMesh/fvMeshSubset/fvMeshSubsetInterpolate.C @@ -180,10 +180,11 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> 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<fvsPatchField<Type>> patchFields(patchMap.size()); @@ -342,8 +343,7 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate template<class Type> tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> fvMeshSubset::interpolate ( - const GeometricField<Type, fvsPatchField, surfaceMesh>& sf, - const bool negateIfFlipped + const GeometricField<Type, fvsPatchField, surfaceMesh>& sf ) const { return interpolate @@ -352,8 +352,7 @@ tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> 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 cb0276cc7c4..f1ebd2e6908 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<Type>::fvsPatchField } else { - FatalIOErrorInFunction - ( - dict - ) << "essential value entry not provided" + FatalIOErrorInFunction(dict) + << "essential 'value' entry not provided" << exit(FatalIOError); } } template<class Type> -Foam::fvsPatchField<Type>::fvsPatchField -( - const fvsPatchField<Type>& ptf -) +Foam::fvsPatchField<Type>::fvsPatchField(const fvsPatchField<Type>& ptf) : Field<Type>(ptf), patch_(ptf.patch_), @@ -149,12 +145,10 @@ void Foam::fvsPatchField<Type>::check(const fvsPatchField<Type>& ptf) const template<class Type> -void Foam::fvsPatchField<Type>::autoMap -( - const fvPatchFieldMapper& m -) +void Foam::fvsPatchField<Type>::autoMap(const fvPatchFieldMapper& m) { - Field<Type>::autoMap(m); + const bool oriented = internalField_.oriented()(); + Field<Type>::autoMap(m, oriented); } -- GitLab