ENH: align use of extrapolatedCalculated in faMatrix with fvMatrix
STYLE: prefer GeometricField::New factory methods
This commit is contained in:
parent
87eed5e3b8
commit
e5e1440020
@ -29,6 +29,7 @@ License
|
||||
#include "areaFields.H"
|
||||
#include "edgeFields.H"
|
||||
#include "calculatedFaPatchFields.H"
|
||||
#include "extrapolatedCalculatedFaPatchFields.H"
|
||||
#include "zeroGradientFaPatchFields.H"
|
||||
#include "IndirectList.H"
|
||||
#include "UniformList.H"
|
||||
@ -610,7 +611,7 @@ void Foam::faMatrix<Type>::relax()
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::scalarField> Foam::faMatrix<Type>::D() const
|
||||
{
|
||||
tmp<scalarField> tdiag(new scalarField(diag()));
|
||||
auto tdiag = tmp<scalarField>::New(diag());
|
||||
addCmptAvBoundaryDiag(tdiag.ref());
|
||||
return tdiag;
|
||||
}
|
||||
@ -619,20 +620,12 @@ Foam::tmp<Foam::scalarField> Foam::faMatrix<Type>::D() const
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::areaScalarField> Foam::faMatrix<Type>::A() const
|
||||
{
|
||||
tmp<areaScalarField> tAphi
|
||||
auto tAphi = areaScalarField::New
|
||||
(
|
||||
new areaScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"A("+psi_.name()+')',
|
||||
psi_.instance(),
|
||||
psi_.db()
|
||||
),
|
||||
psi_.mesh(),
|
||||
dimensions_/psi_.dimensions()/dimArea,
|
||||
zeroGradientFaPatchScalarField::typeName
|
||||
)
|
||||
"A(" + psi_.name() + ')',
|
||||
psi_.mesh(),
|
||||
dimensions_/psi_.dimensions()/dimArea,
|
||||
faPatchFieldBase::extrapolatedCalculatedType()
|
||||
);
|
||||
|
||||
tAphi.ref().primitiveFieldRef() = D()/psi_.mesh().S();
|
||||
@ -646,22 +639,14 @@ template<class Type>
|
||||
Foam::tmp<Foam::GeometricField<Type, Foam::faPatchField, Foam::areaMesh>>
|
||||
Foam::faMatrix<Type>::H() const
|
||||
{
|
||||
tmp<GeometricField<Type, faPatchField, areaMesh>> tHphi
|
||||
auto tHphi = GeometricField<Type, faPatchField, areaMesh>::New
|
||||
(
|
||||
new GeometricField<Type, faPatchField, areaMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"H("+psi_.name()+')',
|
||||
psi_.instance(),
|
||||
psi_.db()
|
||||
),
|
||||
psi_.mesh(),
|
||||
dimensions_/dimArea,
|
||||
zeroGradientFaPatchScalarField::typeName
|
||||
)
|
||||
"H(" + psi_.name() + ')',
|
||||
psi_.mesh(),
|
||||
dimensions_/dimArea,
|
||||
faPatchFieldBase::extrapolatedCalculatedType()
|
||||
);
|
||||
GeometricField<Type, faPatchField, areaMesh>& Hphi = tHphi.ref();
|
||||
auto& Hphi = tHphi.ref();
|
||||
|
||||
// Loop over field components
|
||||
for (direction cmpt=0; cmpt<Type::nComponents; ++cmpt)
|
||||
@ -698,23 +683,13 @@ Foam::faMatrix<Type>::flux() const
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// construct GeometricField<Type, faePatchField, edgeMesh>
|
||||
tmp<GeometricField<Type, faePatchField, edgeMesh>> tfieldFlux
|
||||
auto tfieldFlux = GeometricField<Type, faePatchField, edgeMesh>::New
|
||||
(
|
||||
new GeometricField<Type, faePatchField, edgeMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"flux("+psi_.name()+')',
|
||||
psi_.instance(),
|
||||
psi_.db()
|
||||
),
|
||||
psi_.mesh(),
|
||||
dimensions()
|
||||
)
|
||||
"flux(" + psi_.name() + ')',
|
||||
psi_.mesh(),
|
||||
dimensions()
|
||||
);
|
||||
GeometricField<Type, faePatchField, edgeMesh>& fieldFlux =
|
||||
tfieldFlux.ref();
|
||||
auto& fieldFlux = tfieldFlux.ref();
|
||||
|
||||
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; ++cmpt)
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2016-2017 Wikki Ltd
|
||||
Copyright (C) 2019-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2019-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -24,13 +24,11 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Description
|
||||
Finite-Area scalar matrix member functions and operators
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "faScalarMatrix.H"
|
||||
#include "zeroGradientFaPatchFields.H"
|
||||
#include "extrapolatedCalculatedFaPatchFields.H"
|
||||
#include "profiling.H"
|
||||
#include "PrecisionAdaptor.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
@ -136,24 +134,14 @@ Foam::tmp<Foam::scalarField> Foam::faMatrix<Foam::scalar>::residual() const
|
||||
template<>
|
||||
Foam::tmp<Foam::areaScalarField> Foam::faMatrix<Foam::scalar>::H() const
|
||||
{
|
||||
tmp<areaScalarField> tHphi
|
||||
auto tHphi = areaScalarField::New
|
||||
(
|
||||
new areaScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"H("+psi_.name()+')',
|
||||
psi_.instance(),
|
||||
psi_.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
psi_.mesh(),
|
||||
dimensions_/dimArea,
|
||||
zeroGradientFaPatchScalarField::typeName
|
||||
)
|
||||
"H(" + psi_.name() + ')',
|
||||
psi_.mesh(),
|
||||
dimensions_/dimArea,
|
||||
faPatchFieldBase::extrapolatedCalculatedType()
|
||||
);
|
||||
areaScalarField& Hphi = tHphi.ref();
|
||||
auto& Hphi = tHphi.ref();
|
||||
|
||||
Hphi.primitiveFieldRef() = (lduMatrix::H(psi_.primitiveField()) + source_);
|
||||
addBoundarySource(Hphi.primitiveFieldRef());
|
||||
|
@ -38,10 +38,11 @@ Author
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef faScalarMatrix_H
|
||||
#define faScalarMatrix_H
|
||||
#ifndef Foam_faScalarMatrix_H
|
||||
#define Foam_faScalarMatrix_H
|
||||
|
||||
#include "faMatrix.H"
|
||||
#include "faMatricesFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2022 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -1285,7 +1285,7 @@ void Foam::fvMatrix<Type>::boundaryManipulate
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::scalarField> Foam::fvMatrix<Type>::D() const
|
||||
{
|
||||
tmp<scalarField> tdiag(new scalarField(diag()));
|
||||
auto tdiag = tmp<scalarField>::New(diag());
|
||||
addCmptAvBoundaryDiag(tdiag.ref());
|
||||
return tdiag;
|
||||
}
|
||||
@ -1318,22 +1318,12 @@ Foam::tmp<Foam::Field<Type>> Foam::fvMatrix<Type>::DD() const
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::volScalarField> Foam::fvMatrix<Type>::A() const
|
||||
{
|
||||
tmp<volScalarField> tAphi
|
||||
auto tAphi = volScalarField::New
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"A("+psi_.name()+')',
|
||||
psi_.instance(),
|
||||
psi_.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
psi_.mesh(),
|
||||
dimensions_/psi_.dimensions()/dimVol,
|
||||
extrapolatedCalculatedFvPatchScalarField::typeName
|
||||
)
|
||||
"A(" + psi_.name() + ')',
|
||||
psi_.mesh(),
|
||||
dimensions_/psi_.dimensions()/dimVol,
|
||||
fvPatchFieldBase::extrapolatedCalculatedType()
|
||||
);
|
||||
|
||||
tAphi.ref().primitiveFieldRef() = D()/psi_.mesh().V();
|
||||
@ -1347,24 +1337,14 @@ template<class Type>
|
||||
Foam::tmp<Foam::GeometricField<Type, Foam::fvPatchField, Foam::volMesh>>
|
||||
Foam::fvMatrix<Type>::H() const
|
||||
{
|
||||
tmp<GeometricField<Type, fvPatchField, volMesh>> tHphi
|
||||
auto tHphi = GeometricField<Type, fvPatchField, volMesh>::New
|
||||
(
|
||||
new GeometricField<Type, fvPatchField, volMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"H("+psi_.name()+')',
|
||||
psi_.instance(),
|
||||
psi_.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
psi_.mesh(),
|
||||
dimensions_/dimVol,
|
||||
extrapolatedCalculatedFvPatchScalarField::typeName
|
||||
)
|
||||
"H(" + psi_.name() + ')',
|
||||
psi_.mesh(),
|
||||
dimensions_/dimVol,
|
||||
fvPatchFieldBase::extrapolatedCalculatedType()
|
||||
);
|
||||
GeometricField<Type, fvPatchField, volMesh>& Hphi = tHphi.ref();
|
||||
auto& Hphi = tHphi.ref();
|
||||
|
||||
// Loop over field components
|
||||
for (direction cmpt=0; cmpt<Type::nComponents; cmpt++)
|
||||
@ -1409,24 +1389,14 @@ Foam::fvMatrix<Type>::H() const
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::volScalarField> Foam::fvMatrix<Type>::H1() const
|
||||
{
|
||||
tmp<volScalarField> tH1
|
||||
auto tH1 = volScalarField::New
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"H(1)",
|
||||
psi_.instance(),
|
||||
psi_.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
psi_.mesh(),
|
||||
dimensions_/(dimVol*psi_.dimensions()),
|
||||
extrapolatedCalculatedFvPatchScalarField::typeName
|
||||
)
|
||||
"H(1)",
|
||||
psi_.mesh(),
|
||||
dimensions_/(dimVol*psi_.dimensions()),
|
||||
fvPatchFieldBase::extrapolatedCalculatedType()
|
||||
);
|
||||
volScalarField& H1_ = tH1.ref();
|
||||
auto& H1_ = tH1.ref();
|
||||
|
||||
H1_.primitiveFieldRef() = lduMatrix::H1();
|
||||
|
||||
@ -1452,7 +1422,6 @@ Foam::tmp<Foam::volScalarField> Foam::fvMatrix<Type>::H1() const
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::GeometricField<Type, Foam::fvsPatchField, Foam::surfaceMesh>>
|
||||
Foam::fvMatrix<Type>::
|
||||
@ -1475,25 +1444,13 @@ flux() const
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// construct GeometricField<Type, fvsPatchField, surfaceMesh>
|
||||
tmp<GeometricField<Type, fvsPatchField, surfaceMesh>> tfieldFlux
|
||||
auto tfieldFlux = GeometricField<Type, fvsPatchField, surfaceMesh>::New
|
||||
(
|
||||
new GeometricField<Type, fvsPatchField, surfaceMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"flux("+psi_.name()+')',
|
||||
psi_.instance(),
|
||||
psi_.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
psi_.mesh(),
|
||||
dimensions()
|
||||
)
|
||||
"flux(" + psi_.name() + ')',
|
||||
psi_.mesh(),
|
||||
dimensions()
|
||||
);
|
||||
GeometricField<Type, fvsPatchField, surfaceMesh>& fieldFlux =
|
||||
tfieldFlux.ref();
|
||||
auto& fieldFlux = tfieldFlux.ref();
|
||||
|
||||
fieldFlux.setOriented();
|
||||
|
||||
@ -2898,24 +2855,14 @@ Foam::operator&
|
||||
const DimensionedField<Type, volMesh>& psi
|
||||
)
|
||||
{
|
||||
tmp<GeometricField<Type, fvPatchField, volMesh>> tMphi
|
||||
auto tMphi = GeometricField<Type, fvPatchField, volMesh>::New
|
||||
(
|
||||
new GeometricField<Type, fvPatchField, volMesh>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"M&" + psi.name(),
|
||||
psi.instance(),
|
||||
psi.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
psi.mesh(),
|
||||
M.dimensions()/dimVol,
|
||||
extrapolatedCalculatedFvPatchScalarField::typeName
|
||||
)
|
||||
"M&" + psi.name(),
|
||||
psi.mesh(),
|
||||
M.dimensions()/dimVol,
|
||||
fvPatchFieldBase::extrapolatedCalculatedType()
|
||||
);
|
||||
GeometricField<Type, fvPatchField, volMesh>& Mphi = tMphi.ref();
|
||||
auto& Mphi = tMphi.ref();
|
||||
|
||||
// Loop over field components
|
||||
if (M.hasDiag())
|
||||
|
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2016-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2016-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -356,24 +356,14 @@ Foam::tmp<Foam::scalarField> Foam::fvMatrix<Foam::scalar>::residual() const
|
||||
template<>
|
||||
Foam::tmp<Foam::volScalarField> Foam::fvMatrix<Foam::scalar>::H() const
|
||||
{
|
||||
tmp<volScalarField> tHphi
|
||||
auto tHphi = volScalarField::New
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"H("+psi_.name()+')',
|
||||
psi_.instance(),
|
||||
psi_.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
psi_.mesh(),
|
||||
dimensions_/dimVol,
|
||||
extrapolatedCalculatedFvPatchScalarField::typeName
|
||||
)
|
||||
"H(" + psi_.name() + ')',
|
||||
psi_.mesh(),
|
||||
dimensions_/dimVol,
|
||||
fvPatchFieldBase::extrapolatedCalculatedType()
|
||||
);
|
||||
volScalarField& Hphi = tHphi.ref();
|
||||
auto& Hphi = tHphi.ref();
|
||||
|
||||
Hphi.primitiveFieldRef() = (lduMatrix::H(psi_.primitiveField()) + source_);
|
||||
addBoundarySource(Hphi.primitiveFieldRef());
|
||||
@ -388,24 +378,14 @@ Foam::tmp<Foam::volScalarField> Foam::fvMatrix<Foam::scalar>::H() const
|
||||
template<>
|
||||
Foam::tmp<Foam::volScalarField> Foam::fvMatrix<Foam::scalar>::H1() const
|
||||
{
|
||||
tmp<volScalarField> tH1
|
||||
auto tH1 = volScalarField::New
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"H(1)",
|
||||
psi_.instance(),
|
||||
psi_.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
psi_.mesh(),
|
||||
dimensions_/(dimVol*psi_.dimensions()),
|
||||
extrapolatedCalculatedFvPatchScalarField::typeName
|
||||
)
|
||||
"H(1)",
|
||||
psi_.mesh(),
|
||||
dimensions_/(dimVol*psi_.dimensions()),
|
||||
fvPatchFieldBase::extrapolatedCalculatedType()
|
||||
);
|
||||
volScalarField& H1_ = tH1.ref();
|
||||
auto& H1_ = tH1.ref();
|
||||
|
||||
H1_.primitiveFieldRef() = lduMatrix::H1();
|
||||
//addBoundarySource(Hphi.primitiveField());
|
||||
|
@ -34,8 +34,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef fvScalarMatrix_H
|
||||
#define fvScalarMatrix_H
|
||||
#ifndef Foam_fvScalarMatrix_H
|
||||
#define Foam_fvScalarMatrix_H
|
||||
|
||||
#include "fvMatrix.H"
|
||||
#include "fvMatricesFwd.H"
|
||||
|
Loading…
Reference in New Issue
Block a user