Use the new primitive mesh magFaceAreas where appropriate

This commit is contained in:
Henry Weller
2020-06-03 17:11:56 +01:00
parent 6ef064984d
commit 44cf9977c3
12 changed files with 34 additions and 25 deletions

View File

@ -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;

View File

@ -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::vectorField> Foam::polyPatch::faceCellCentres() const
{
tmp<vectorField> tcc(new vectorField(size()));

View File

@ -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<vectorField> faceCellCentres() const;

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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());
}
}

View File

@ -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<scalarField*>(&fvMesh_.cellVolumes());
scalarField magFaceAreas(sqrt(3.0)*mag(fvMesh_.faceAreas()));
scalarField magFaceAreas(sqrt(3.0)*fvMesh_.magFaceAreas());
SubField<scalar> magSf(magFaceAreas, fvMesh_.nInternalFaces());
scalarField* magSfPtr = const_cast<scalarField*>

View File

@ -108,7 +108,7 @@ void Foam::DSMCParcel<ParcelType>::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();

View File

@ -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<CloudType>::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<CloudType>::inflow()
const vector& fC = patch.faceCentres()[pFI];
scalar fA = mag(patch.faceAreas()[pFI]);
scalar fA = patch.magFaceAreas()[pFI];
List<tetIndices> faceTets = polyMeshTetDecomposition::faceTetIndices
(

View File

@ -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<scalar>());

View File

@ -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++;

View File

@ -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<vector>(nHat_, fCells) = pp.faceNormals();
UIndirectList<scalar>(magSf_, fCells) = mag(pp.faceAreas());
UIndirectList<scalar>(magSf_, fCells) = pp.magFaceAreas();
}
nHat_.correctBoundaryConditions();