STYLE: use calculatedType() and zeroGradientType() methods

This commit is contained in:
Mark Olesen
2023-04-24 16:18:05 +02:00
parent 09ce87135b
commit e967305ef2
88 changed files with 165 additions and 212 deletions

View File

@ -29,7 +29,7 @@ if (mesh.changing())
wordList pcorrTypes
(
p.boundaryField().size(),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
// Set BCs of pcorr to fixed-value for patches at which p is fixed

View File

@ -29,7 +29,7 @@ if (mesh.changing())
wordList pcorrTypes
(
p.boundaryField().size(),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
// Set BCs of pcorr to fixed-value for patches at which p is fixed

View File

@ -57,7 +57,7 @@
),
solidRegions[i],
dimensionedSymmTensor(tkappaByCp().dimensions(), Zero),
zeroGradientFvPatchSymmTensorField::typeName
fvPatchFieldBase::zeroGradientType()
)
);

View File

@ -34,7 +34,7 @@ if (!thermo.isotropic())
),
mesh,
dimensionedSymmTensor(tkappaByCp().dimensions(), Zero),
zeroGradientFvPatchSymmTensorField::typeName
fvPatchFieldBase::zeroGradientType()
)
);
volSymmTensorField& aniAlpha = *taniAlpha;

View File

@ -24,7 +24,7 @@ if (mesh.changing())
wordList pcorrTypes
(
p.boundaryField().size(),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
// Set BCs of pcorr to fixed-value for patches at which p is fixed

View File

@ -130,7 +130,7 @@ int main(int argc, char *argv[])
),
mesh,
dimensionedVector(cloudSU.dimensions()/dimVolume, Zero),
zeroGradientFvPatchVectorField::typeName
fvPatchFieldBase::zeroGradientType()
);
cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V();

View File

@ -111,7 +111,7 @@ int main(int argc, char *argv[])
),
mesh,
dimensionedVector(cloudSU.dimensions()/dimVolume, Zero),
zeroGradientFvPatchVectorField::typeName
fvPatchFieldBase::zeroGradientType()
);
cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V();

View File

@ -141,7 +141,7 @@ int main(int argc, char *argv[])
),
mesh,
dimensionedVector(cloudSU.dimensions()/dimVolume, Zero),
zeroGradientFvPatchVectorField::typeName
fvPatchFieldBase::zeroGradientType()
);
cloudVolSUSu.primitiveFieldRef() = -cloudSU.source()/mesh.V();

View File

@ -64,8 +64,7 @@ volScalarField mu
mesh,
IOobject::READ_IF_PRESENT
),
mixture.mu(),
calculatedFvPatchScalarField::typeName
mixture.mu()
);
@ -139,7 +138,7 @@ volScalarField alphac
),
mesh,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
alphac.oldTime();

View File

@ -1,7 +1,7 @@
wordList pcorrTypes
(
p.boundaryField().size(),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
for (label i=0; i<p.boundaryField().size(); i++)

View File

@ -140,7 +140,7 @@ Foam::fv::VoFSolidificationMeltingSource::VoFSolidificationMeltingSource
),
mesh,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
),
curTimeIndex_(-1)
{

View File

@ -105,8 +105,7 @@ incompressibleTwoPhaseInteractingMixture
U_.db()
),
U_.mesh(),
dimensionedScalar(dimensionSet(1, -1, -1, 0, 0), Zero),
calculatedFvPatchScalarField::typeName
dimensionedScalar(dimensionSet(1, -1, -1, 0, 0), Zero)
)
{
correct();

View File

@ -48,7 +48,7 @@ Foam::wordList Foam::relativeVelocityModel::UdmPatchFieldTypes() const
wordList UdmTypes
(
U.boundaryField().size(),
calculatedFvPatchScalarField::typeName
fvPatchFieldBase::calculatedType()
);
forAll(U.boundaryField(), i)

View File

@ -119,8 +119,7 @@ Foam::incompressibleThreePhaseMixture::incompressibleThreePhaseMixture
U.db()
),
U.mesh(),
dimensionedScalar(dimensionSet(0, 2, -1, 0, 0), Zero),
calculatedFvPatchScalarField::typeName
dimensionedScalar(dimensionSet(0, 2, -1, 0, 0), Zero)
),
nuModel1_

View File

@ -27,7 +27,7 @@
wordList pcorrTypes
(
p_rgh.boundaryField().size(),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
for (label i=0; i<p_rgh.boundaryField().size(); i++)

View File

@ -76,7 +76,7 @@
mesh
),
fluid.dragCoeff(phase, dragCoeffs())/phase.rho(),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
dragCoeffi.correctBoundaryConditions();

View File

@ -41,7 +41,6 @@ Description
#include "mapPolyMesh.H"
#include "polyTopoChange.H"
#include "fvCFD.H"
#include "zeroGradientFvPatchFields.H"
#include "Random.H"
using namespace Foam;
@ -93,7 +92,7 @@ int main(int argc, char *argv[])
),
mesh,
dimensionedScalar("one", dimless, 1.0),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
Info<< "Writing one field "
<< one.name() << " in " << runTime.timeName() << endl;
@ -131,8 +130,7 @@ int main(int argc, char *argv[])
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("one", dimless, 1.0),
calculatedFvsPatchScalarField::typeName
dimensionedScalar("one", dimless, 1.0)
);
Info<< "Writing surface one field "
<< surfaceOne.name() << " in " << runTime.timeName() << endl;

View File

@ -41,7 +41,6 @@ Description
#include "mapPolyMesh.H"
#include "polyTopoChange.H"
#include "Random.H"
#include "zeroGradientFvPatchFields.H"
#include "calculatedPointPatchFields.H"
#include "pointConstraints.H"
#include "fvCFD.H"
@ -99,7 +98,7 @@ int main(int argc, char *argv[])
),
mesh,
dimensionedScalar("one", dimless, 1.0),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
Info<< "Writing one field "
<< one.name() << " in " << runTime.timeName() << endl;
@ -137,8 +136,7 @@ int main(int argc, char *argv[])
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("one", dimless, 1.0),
calculatedFvsPatchScalarField::typeName
dimensionedScalar("one", dimless, 1.0)
);
Info<< "Writing surface one field "
<< surfaceOne.name() << " in " << runTime.timeName() << endl;
@ -157,8 +155,7 @@ int main(int argc, char *argv[])
IOobject::AUTO_WRITE
),
pointMesh::New(mesh),
dimensionedScalar("one", dimless, 1.0),
calculatedPointPatchScalarField::typeName
dimensionedScalar("one", dimless, 1.0)
);
pointX.primitiveFieldRef() = mesh.points().component(0);
pointX.correctBoundaryConditions();

View File

@ -59,7 +59,7 @@ int main(int argc, char *argv[])
wordList patchFieldTypes
(
mesh.boundaryMesh().size(),
calculatedFvPatchVectorField::typeName
fvPatchFieldBase::calculatedType()
);
forAll(mesh.boundaryMesh(), patchi)

View File

@ -185,7 +185,7 @@ int main(int argc, char *argv[])
),
mesh,
dimensioned<symmTensor>(dimless, symmTensor::one),
zeroGradientFvPatchSymmTensorField::typeName
fvPatchFieldBase::zeroGradientType()
);
volTensorField tensf
@ -200,7 +200,7 @@ int main(int argc, char *argv[])
),
mesh,
dimensioned<tensor>(dimless, tensor(1,2,3,4,5,6,7,8,9)),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
SolverPerformance<symmTensor> sP =

View File

@ -98,8 +98,8 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("one", dimless, 1.0),
zeroGradientFvPatchScalarField::typeName
dimensionedScalar(word::null, dimless, 1.0),
fvPatchFieldBase::zeroGradientType()
);
const conformationSurfaces& geometry = geometryToConformTo_;

View File

@ -1098,7 +1098,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes
),
mesh,
dimensionedScalar(dimLength, Zero),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
scalarField& cellSize = targetCellSize.primitiveFieldRef();
@ -1124,7 +1124,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes
// ),
// mesh,
// dimensionedScalar(dimLength, Zero),
// zeroGradientFvPatchScalarField::typeName
// fvPatchFieldBase::zeroGradientType()
// );
// targetCellVolume.primitiveFieldRef() = pow3(cellSize);
@ -1143,7 +1143,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes
// ),
// mesh,
// dimensionedScalar(dimVolume, Zero),
// zeroGradientFvPatchScalarField::typeName
// fvPatchFieldBase::zeroGradientType()
// );
// actualCellVolume.primitiveFieldRef() = mesh.cellVolumes();
@ -1162,7 +1162,7 @@ void Foam::conformalVoronoiMesh::writeCellSizes
// ),
// mesh,
// dimensionedScalar(dimLength, Zero),
// zeroGradientFvPatchScalarField::typeName
// fvPatchFieldBase::zeroGradientType()
// );
// equivalentCellSize.primitiveFieldRef() = pow
@ -1240,11 +1240,12 @@ void Foam::conformalVoronoiMesh::writeCellAlignments
// mesh.polyMesh::instance(),
// mesh,
// IOobject::NO_READ,
// IOobject::AUTO_WRITE
// IOobject::NO_WRITE,
// IOobject::NO_REGISTER
// ),
// mesh,
// tensor::I,
// zeroGradientFvPatchTensorField::typeName
// fvPatchFieldBase::zeroGradientType()
// );
//
// tensorField& cellAlignment = cellAlignments.primitiveFieldRef();

View File

@ -79,8 +79,8 @@ bool Foam::conformalVoronoiMesh::distributeBackground(const Triangulation& mesh)
IOobject::NO_WRITE
),
bMesh,
dimensionedScalar("weight", dimless, 1e-2),
zeroGradientFvPatchScalarField::typeName
dimensionedScalar(word::null, dimless, 1e-2),
fvPatchFieldBase::zeroGradientType()
);
meshSearch cellSearch(bMesh, polyMesh::FACE_PLANES);

View File

@ -2,7 +2,6 @@
#include "volFields.H"
#include "surfaceFields.H"
#include "polyMeshTools.H"
#include "zeroGradientFvPatchFields.H"
#include "syncTools.H"
#include "tetrahedron.H"
#include "regionSplit.H"
@ -138,8 +137,7 @@ void writeSurfaceField
IOobject::NO_REGISTER
),
mesh,
dimensionedScalar(dimless, Zero),
calculatedFvsPatchScalarField::typeName
dimensionedScalar(dimless, Zero)
);
fld.primitiveFieldRef() = faceData;
//fld.correctBoundaryConditions();
@ -197,8 +195,7 @@ void Foam::writeFields
IOobject::NO_REGISTER
),
mesh,
dimensionedScalar(dimless, Zero),
calculatedFvPatchScalarField::typeName
dimensionedScalar(dimless, Zero)
);
//- Take max
maxFaceToCell(nonOrthoAngle, cellNonOrthoAngle);
@ -235,7 +232,7 @@ void Foam::writeFields
wordList // wanted bc types
(
mesh.boundary().size(),
calculatedFvPatchScalarField::typeName
fvPatchFieldBase::calculatedType()
),
mesh.weights().boundaryField().types() // current bc types
);
@ -283,8 +280,7 @@ void Foam::writeFields
IOobject::NO_REGISTER
),
mesh,
dimensionedScalar(dimless, Zero),
calculatedFvPatchScalarField::typeName
dimensionedScalar(dimless, Zero)
);
//- Take max
maxFaceToCell(faceSkewness, cellSkewness);
@ -321,7 +317,7 @@ void Foam::writeFields
),
mesh,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
cellDeterminant.primitiveFieldRef() =
primitiveMeshTools::cellDeterminant
@ -356,7 +352,7 @@ void Foam::writeFields
),
mesh,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
@ -391,7 +387,7 @@ void Foam::writeFields
),
mesh,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
aspectRatio.ref().field() = cellAspectRatio(mesh);
@ -421,7 +417,7 @@ void Foam::writeFields
),
mesh,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
const cellShapeList& cellShapes = mesh.cellShapes();
forAll(cellShapes, cellI)
@ -449,8 +445,7 @@ void Foam::writeFields
IOobject::NO_REGISTER
),
mesh,
dimensionedScalar(dimVolume, Zero),
calculatedFvPatchScalarField::typeName
dimensionedScalar(dimVolume, Zero)
);
V.ref() = mesh.V();
Info<< " Writing cell volume to " << V.name() << endl;
@ -480,8 +475,7 @@ void Foam::writeFields
IOobject::NO_REGISTER
),
mesh,
dimensionedScalar(dimless, Zero),
calculatedFvPatchScalarField::typeName
dimensionedScalar(dimless, Zero)
);
//- Take min
minFaceToCell(faceVolumeRatio, cellVolumeRatio);
@ -516,7 +510,7 @@ void Foam::writeFields
),
mesh,
dimensionedScalar("minTetVolume", dimless, GREAT),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
@ -582,7 +576,7 @@ void Foam::writeFields
),
mesh,
dimensionedScalar("minPyrVolume", dimless, GREAT),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
// Get owner and neighbour pyr volumes
@ -654,8 +648,7 @@ void Foam::writeFields
IOobject::NO_REGISTER
),
mesh,
dimensionedScalar(dimless, Zero),
calculatedFvPatchScalarField::typeName
dimensionedScalar(dimless, Zero)
);
regionSplit rs(mesh);
@ -705,8 +698,7 @@ void Foam::writeFields
IOobject::NO_REGISTER
),
mesh,
dimensionedScalar(scalar(-1)),
calculatedFvPatchScalarField::typeName
dimensionedScalar(word::null, dimless, -1)
);
const cellZoneMesh& czs = mesh.cellZones();
@ -744,8 +736,7 @@ void Foam::writeFields
IOobject::NO_REGISTER
),
mesh,
dimensionedScalar(scalar(-1)),
calculatedFvsPatchScalarField::typeName
dimensionedScalar(word::null, dimless, -1)
);
faceZone.primitiveFieldRef() =

View File

@ -100,7 +100,7 @@ label addPatch
mesh,
pp,
dictionary(), // do not set specialised patchFields
calculatedFvPatchField<scalar>::typeName,
fvPatchFieldBase::calculatedType(),
true // parallel sync'ed addition
);
}

View File

@ -1028,7 +1028,7 @@ int main(int argc, char *argv[])
mesh,
ppPtr(),
patchDict.subOrEmptyDict("patchFields"),
calculatedFvPatchScalarField::typeName,
fvPatchFieldBase::calculatedType(),
true
);
}
@ -1079,7 +1079,7 @@ int main(int argc, char *argv[])
mesh,
ppPtr(),
patchDict.subOrEmptyDict("patchFields"),
calculatedFvPatchScalarField::typeName,
fvPatchFieldBase::calculatedType(),
true
);
}
@ -1108,7 +1108,7 @@ int main(int argc, char *argv[])
mesh,
ppPtr(),
patchDict.subOrEmptyDict("patchFields"),
calculatedFvPatchScalarField::typeName,
fvPatchFieldBase::calculatedType(),
true
);
}

View File

@ -76,25 +76,14 @@ tmp<volScalarField> createScalarField
const labelUList& elems
)
{
tmp<volScalarField> tfld
auto tfld = volScalarField::New
(
new volScalarField
(
IOobject
(
name,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
IOobject::NO_REGISTER
),
mesh,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
)
name,
mesh,
dimensionedScalar(dimless, Zero),
fvPatchFieldBase::zeroGradientType()
);
volScalarField& fld = tfld.ref();
auto& fld = tfld.ref();
forAll(fld, celli)
{

View File

@ -114,7 +114,6 @@ Description
#include "ReadFields.H"
#include "mappedWallPolyPatch.H"
#include "fvMeshTools.H"
#include "zeroGradientFvPatchFields.H"
#include "processorMeshes.H"
using namespace Foam;
@ -1055,7 +1054,7 @@ labelList addRegionPatches
mesh,
patch1,
dictionary(), //optional per field value
calculatedFvPatchField<scalar>::typeName,
fvPatchFieldBase::calculatedType(),
true //validBoundary
);
@ -1076,7 +1075,7 @@ labelList addRegionPatches
mesh,
patch2,
dictionary(), //optional per field value
calculatedFvPatchField<scalar>::typeName,
fvPatchFieldBase::calculatedType(),
true //validBoundary
);
@ -1433,7 +1432,7 @@ void writeCellToRegion(const fvMesh& mesh, const labelList& cellRegion)
),
mesh,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
forAll(cellRegion, celli)
{

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,7 +28,6 @@ License
#include "domainDecompositionDryRun.H"
#include "foamVtkInternalMeshWriter.H"
#include "volFields.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -51,8 +50,8 @@ void Foam::domainDecompositionDryRun::writeVolField
IOobject::NO_REGISTER
),
this->mesh(),
dimensionedScalar("cellDist", dimless, -1),
zeroGradientFvPatchScalarField::typeName
dimensionedScalar(word::null, dimless, -1),
fvPatchFieldBase::zeroGradientType()
);
forAll(procIds, celli)

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -28,7 +28,6 @@ License
#include "domainDecomposition.H"
#include "foamVtkInternalMeshWriter.H"
#include "volFields.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -52,8 +51,8 @@ void Foam::domainDecomposition::writeVolField
IOobject::NO_REGISTER
),
this->mesh(),
dimensionedScalar("cellDist", dimless, -1),
zeroGradientFvPatchScalarField::typeName
dimensionedScalar(word::null, dimless, -1),
fvPatchFieldBase::zeroGradientType()
);
forAll(procIds, celli)

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2022 OpenCFD Ltd.
Copyright (C) 2016-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -69,7 +69,6 @@ Usage
#include "faceCoupleInfo.H"
#include "fvMeshAdder.H"
#include "polyTopoChange.H"
#include "zeroGradientFvPatchFields.H"
#include "topoSet.H"
#include "regionProperties.H"
#include "fvMeshTools.H"
@ -421,8 +420,8 @@ void writeDistribution
IOobject::NO_REGISTER
),
masterMesh,
dimensionedScalar("cellDist", dimless, -1),
zeroGradientFvPatchScalarField::typeName
dimensionedScalar(word::null, dimless, -1),
fvPatchFieldBase::zeroGradientType()
);
forAll(cellDecomposition, celli)

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2022 OpenCFD Ltd.
Copyright (C) 2015-2023 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -90,7 +90,6 @@ Usage
#include "globalIndex.H"
#include "loadOrCreateMesh.H"
#include "processorFvPatchField.H"
#include "zeroGradientFvPatchFields.H"
#include "topoSet.H"
#include "regionProperties.H"
@ -418,8 +417,8 @@ void writeDecomposition
IOobject::NO_REGISTER
),
mesh,
dimensionedScalar(name, dimless, -1),
zeroGradientFvPatchScalarField::typeName
dimensionedScalar(word::null, dimless, -1),
fvPatchFieldBase::zeroGradientType()
);
forAll(procCells, celli)

View File

@ -96,7 +96,7 @@ tmp<VolumeField<Type>> makeZeroGradientField
df.mesh(),
df.dimensions(),
std::move(df.field()),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
tfield.ref().oriented() = df.oriented();
@ -130,7 +130,7 @@ tmp<VolumeField<Type>> makeZeroGradientField
df.mesh(),
df.dimensions(),
std::move(df.primitiveFieldRef(false)), // No update accessTime
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
tfield.ref().oriented() = df.oriented();

View File

@ -52,7 +52,7 @@ volScalarField y
),
mesh,
dimensionedScalar(dimLength, Zero),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);
y.primitiveFieldRef() = wallDist::New(mesh).y().primitiveField();
y.correctBoundaryConditions();
@ -88,7 +88,7 @@ volScalarField mask
),
mesh,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
fvPatchFieldBase::zeroGradientType()
);