From 44cf9977c3a65d172aa1ce8982de6af2e84704fc Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Wed, 3 Jun 2020 17:11:56 +0100 Subject: [PATCH] Use the new primitive mesh magFaceAreas where appropriate --- .../polyPatches/constraint/processor/processorPolyPatch.C | 2 +- .../meshes/polyMesh/polyPatches/polyPatch/polyPatch.C | 8 +++++++- .../meshes/polyMesh/polyPatches/polyPatch/polyPatch.H | 5 ++++- .../polyTopoChange/polyTopoChange/hexRef8/hexRef8.C | 6 +++--- .../cellPointWeight/cellPointWeight.C | 4 ++-- src/functionObjects/lagrangian/dsmcFields/dsmcFields.C | 4 ++-- .../MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C | 4 ++-- .../DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C | 2 +- .../submodels/InflowBoundaryModel/FreeStream/FreeStream.C | 8 ++++---- .../InjectionModel/PatchInjection/patchInjectionBase.C | 4 ++-- .../decompositionMethod/decompositionMethod.C | 8 ++++---- .../regionModel/singleLayerRegion/singleLayerRegion.C | 4 ++-- 12 files changed, 34 insertions(+), 25 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C index f553476229..ed574066c8 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C @@ -228,7 +228,7 @@ void Foam::processorPolyPatch::calcGeometry(PstreamBuffers& pBufs) // Calculate normals from areas and check forAll(faceNormals, facei) { - scalar magSf = mag(faceAreas()[facei]); + scalar magSf = magFaceAreas()[facei]; scalar nbrMagSf = mag(neighbFaceAreas_[facei]); scalar avSf = (magSf + nbrMagSf)/2.0; diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C index 1e519a8d17..0162fdb2d0 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -293,6 +293,12 @@ const Foam::vectorField::subField Foam::polyPatch::faceAreas() const } +const Foam::scalarField::subField Foam::polyPatch::magFaceAreas() const +{ + return patchSlice(boundaryMesh().mesh().magFaceAreas()); +} + + Foam::tmp Foam::polyPatch::faceCellCentres() const { tmp tcc(new vectorField(size())); diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H index b0ab35524b..4e6447f627 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/polyPatch/polyPatch.H @@ -356,9 +356,12 @@ public: //- Return face centres const vectorField::subField faceCentres() const; - //- Return face normals + //- Return face areas const vectorField::subField faceAreas() const; + //- Return face area magnitudes + const scalarField::subField magFaceAreas() const; + //- Return face cell centres tmp faceCellCentres() const; diff --git a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C index 1e0748237e..f58e38ceec 100644 --- a/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C +++ b/src/dynamicMesh/polyTopoChange/polyTopoChange/hexRef8/hexRef8.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -4670,7 +4670,7 @@ void Foam::hexRef8::checkMesh() const scalarField neiFaceAreas(mesh_.nFaces()-mesh_.nInternalFaces()); forAll(neiFaceAreas, i) { - neiFaceAreas[i] = mag(mesh_.faceAreas()[i+mesh_.nInternalFaces()]); + neiFaceAreas[i] = mesh_.magFaceAreas()[i+mesh_.nInternalFaces()]; } // Replace data on coupled patches with their neighbour ones. @@ -4680,7 +4680,7 @@ void Foam::hexRef8::checkMesh() const { label facei = i+mesh_.nInternalFaces(); - const scalar magArea = mag(mesh_.faceAreas()[facei]); + const scalar magArea = mesh_.magFaceAreas()[facei]; if (mag(magArea - neiFaceAreas[i]) > smallDim) { diff --git a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.C b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.C index ae209baa48..4f51450638 100644 --- a/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.C +++ b/src/finiteVolume/interpolation/interpolation/interpolationCellPoint/cellPointWeight/cellPointWeight.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -150,7 +150,7 @@ void Foam::cellPointWeight::findTriangle mesh.faceOwner()[facei] ); - const scalar faceAreaSqr = magSqr(mesh.faceAreas()[facei]); + const scalar faceAreaSqr = sqr(mesh.magFaceAreas()[facei]); forAll(faceTets, tetI) { diff --git a/src/functionObjects/lagrangian/dsmcFields/dsmcFields.C b/src/functionObjects/lagrangian/dsmcFields/dsmcFields.C index f9bd1fb837..6e22482e87 100644 --- a/src/functionObjects/lagrangian/dsmcFields/dsmcFields.C +++ b/src/functionObjects/lagrangian/dsmcFields/dsmcFields.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -212,7 +212,7 @@ bool Foam::functionObjects::dsmcFields::write() { pBf[i] = fDMean.boundaryField()[i] - & (patch.faceAreas()/mag(patch.faceAreas())); + & (patch.faceAreas()/patch.magFaceAreas()); } } diff --git a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C index 6b07886c58..95362672df 100644 --- a/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C +++ b/src/fvAgglomerationMethods/MGridGenGamgAgglomeration/MGridGenGAMGAgglomeration.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -183,7 +183,7 @@ Foam::MGridGenGAMGAgglomeration::MGridGenGAMGAgglomeration // Start geometric agglomeration from the cell volumes and areas of the mesh scalarField* VPtr = const_cast(&fvMesh_.cellVolumes()); - scalarField magFaceAreas(sqrt(3.0)*mag(fvMesh_.faceAreas())); + scalarField magFaceAreas(sqrt(3.0)*fvMesh_.magFaceAreas()); SubField magSf(magFaceAreas, fvMesh_.nInternalFaces()); scalarField* magSfPtr = const_cast diff --git a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C index f1338cfc5c..fe94cef5cb 100644 --- a/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C +++ b/src/lagrangian/DSMC/parcels/Templates/DSMCParcel/DSMCParcel.C @@ -108,7 +108,7 @@ void Foam::DSMCParcel::hitWallPatch const label wppLocalFace = wpp.whichFace(this->face()); - const scalar fA = mag(wpp.faceAreas()[wppLocalFace]); + const scalar fA = wpp.magFaceAreas()[wppLocalFace]; const scalar deltaT = cloud.pMesh().time().deltaTValue(); diff --git a/src/lagrangian/DSMC/submodels/InflowBoundaryModel/FreeStream/FreeStream.C b/src/lagrangian/DSMC/submodels/InflowBoundaryModel/FreeStream/FreeStream.C index 07ff4a9674..ec902cc4ac 100644 --- a/src/lagrangian/DSMC/submodels/InflowBoundaryModel/FreeStream/FreeStream.C +++ b/src/lagrangian/DSMC/submodels/InflowBoundaryModel/FreeStream/FreeStream.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -204,14 +204,14 @@ void Foam::FreeStream::inflow() scalarField sCosTheta ( - (boundaryU[patchi] & -patch.faceAreas()/mag(patch.faceAreas())) + (boundaryU[patchi] & -patch.faceAreas()/patch.magFaceAreas()) / mostProbableSpeed ); // From Bird eqn 4.22 pFA[i] += - mag(patch.faceAreas())*numberDensities_[i]*deltaT + patch.magFaceAreas()*numberDensities_[i]*deltaT *mostProbableSpeed *( exp(-sqr(sCosTheta)) + sqrtPi*sCosTheta*(1 + erf(sCosTheta)) @@ -232,7 +232,7 @@ void Foam::FreeStream::inflow() const vector& fC = patch.faceCentres()[pFI]; - scalar fA = mag(patch.faceAreas()[pFI]); + scalar fA = patch.magFaceAreas()[pFI]; List faceTets = polyMeshTetDecomposition::faceTetIndices ( diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/patchInjectionBase.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/patchInjectionBase.C index e24e3f4e19..c4131bcf4b 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/patchInjectionBase.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/PatchInjection/patchInjectionBase.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -141,7 +141,7 @@ void Foam::patchInjectionBase::updateMesh(const polyMesh& mesh) sumTriMagSf_[i] += sumTriMagSf_[i-1]; } - const scalarField magSf(mag(patch.faceAreas())); + const scalarField magSf(patch.magFaceAreas()); patchArea_ = sum(magSf); patchNormal_ = patch.faceAreas()/magSf; reduce(patchArea_, sumOp()); diff --git a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C index c39078a8dc..54a708bc5e 100644 --- a/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C +++ b/src/parallel/decompose/decompositionMethods/decompositionMethod/decompositionMethod.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -599,9 +599,9 @@ void Foam::decompositionMethod::calcCellCells label neiIndex = offsets[nei] + nFacesPerCell[nei]++; m[ownIndex] = globalAgglom.toGlobal(nei); - w[ownIndex] = mag(mesh.faceAreas()[faceI]); + w[ownIndex] = mesh.magFaceAreas()[faceI]; m[neiIndex] = globalAgglom.toGlobal(own); - w[ownIndex] = mag(mesh.faceAreas()[faceI]); + w[ownIndex] = mesh.magFaceAreas()[faceI]; } // For boundary faces is offsetted coupled neighbour @@ -628,7 +628,7 @@ void Foam::decompositionMethod::calcCellCells { label ownIndex = offsets[own] + nFacesPerCell[own]++; m[ownIndex] = globalNei; - w[ownIndex] = mag(mesh.faceAreas()[faceI]); + w[ownIndex] = mesh.magFaceAreas()[faceI]; } faceI++; diff --git a/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C b/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C index c64fe75bd1..b32368c1f9 100644 --- a/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C +++ b/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -99,7 +99,7 @@ Foam::regionModels::singleLayerRegion::singleLayerRegion nBoundaryFaces += fCells.size(); UIndirectList(nHat_, fCells) = pp.faceNormals(); - UIndirectList(magSf_, fCells) = mag(pp.faceAreas()); + UIndirectList(magSf_, fCells) = pp.magFaceAreas(); } nHat_.correctBoundaryConditions();