GeometricField: Rationalized and simplified access to the dimensioned internal field

Given that the type of the dimensioned internal field is encapsulated in
the GeometricField class the name need not include "Field"; the type
name is "Internal" so

volScalarField::DimensionedInternalField -> volScalarField::Internal

In addition to the ".dimensionedInternalField()" access function the
simpler "()" de-reference operator is also provided to greatly simplify
FV equation source term expressions which need not evaluate boundary
conditions.  To demonstrate this kEpsilon.C has been updated to use
dimensioned internal field expressions in the k and epsilon equation
source terms.
This commit is contained in:
Henry Weller
2016-04-27 21:32:45 +01:00
parent d82049c0b2
commit a25a449c9e
40 changed files with 196 additions and 167 deletions

View File

@ -75,7 +75,7 @@ License
// Reaction source time scale // Reaction source time scale
if (alphaTemp < 1.0) if (alphaTemp < 1.0)
{ {
volScalarField::DimensionedInternalField rDeltaTT volScalarField::Internal rDeltaTT
( (
mag(reaction->Sh())/(alphaTemp*rho*thermo.Cp()*T) mag(reaction->Sh())/(alphaTemp*rho*thermo.Cp()*T)
); );

View File

@ -74,7 +74,7 @@ License
// Reaction source time scale // Reaction source time scale
{ {
volScalarField::DimensionedInternalField rDeltaTT volScalarField::Internal rDeltaTT
( (
mag mag
( (

View File

@ -74,7 +74,7 @@ License
// Reaction source time scale // Reaction source time scale
{ {
volScalarField::DimensionedInternalField rDeltaTT volScalarField::Internal rDeltaTT
( (
mag mag
( (

View File

@ -6,7 +6,7 @@
for (int gCorr=0; gCorr<nAlphaCorr; gCorr++) for (int gCorr=0; gCorr<nAlphaCorr; gCorr++)
{ {
volScalarField::DimensionedInternalField Sp volScalarField::Internal Sp
( (
IOobject IOobject
( (
@ -18,7 +18,7 @@
dimensionedScalar("Sp", dgdt.dimensions(), 0.0) dimensionedScalar("Sp", dgdt.dimensions(), 0.0)
); );
volScalarField::DimensionedInternalField Su volScalarField::Internal Su
( (
IOobject IOobject
( (

View File

@ -1058,7 +1058,7 @@ void Foam::multiphaseMixtureThermo::solveAlphas
surfaceScalarField& alphaPhi = alphaPhiCorrs[phasei]; surfaceScalarField& alphaPhi = alphaPhiCorrs[phasei];
alphaPhi += upwind<scalar>(mesh_, phi_).flux(alpha); alphaPhi += upwind<scalar>(mesh_, phi_).flux(alpha);
volScalarField::DimensionedInternalField Sp volScalarField::Internal Sp
( (
IOobject IOobject
( (
@ -1070,7 +1070,7 @@ void Foam::multiphaseMixtureThermo::solveAlphas
dimensionedScalar("Sp", alpha.dgdt().dimensions(), 0.0) dimensionedScalar("Sp", alpha.dgdt().dimensions(), 0.0)
); );
volScalarField::DimensionedInternalField Su volScalarField::Internal Su
( (
IOobject IOobject
( (

View File

@ -218,7 +218,7 @@ void Foam::multiphaseSystem::solveAlphas()
surfaceScalarField& alphaPhic = alphaPhiCorrs[phasei]; surfaceScalarField& alphaPhic = alphaPhiCorrs[phasei];
alphaPhic += upwind<scalar>(mesh_, phi_).flux(phase); alphaPhic += upwind<scalar>(mesh_, phi_).flux(phase);
volScalarField::DimensionedInternalField Sp volScalarField::Internal Sp
( (
IOobject IOobject
( (
@ -230,7 +230,7 @@ void Foam::multiphaseSystem::solveAlphas()
dimensionedScalar("Sp", divU.dimensions(), 0.0) dimensionedScalar("Sp", divU.dimensions(), 0.0)
); );
volScalarField::DimensionedInternalField Su volScalarField::Internal Su
( (
IOobject IOobject
( (

View File

@ -206,7 +206,7 @@ void Foam::twoPhaseSystem::solve()
const surfaceScalarField& phi2 = phase2_.phi(); const surfaceScalarField& phi2 = phase2_.phi();
// Construct the dilatation rate source term // Construct the dilatation rate source term
tmp<volScalarField::DimensionedInternalField> tdgdt; tmp<volScalarField::Internal> tdgdt;
if (phase1_.divU().valid() && phase2_.divU().valid()) if (phase1_.divU().valid() && phase2_.divU().valid())
{ {
@ -257,7 +257,7 @@ void Foam::twoPhaseSystem::solve()
for (int acorr=0; acorr<nAlphaCorr; acorr++) for (int acorr=0; acorr<nAlphaCorr; acorr++)
{ {
volScalarField::DimensionedInternalField Sp volScalarField::Internal Sp
( (
IOobject IOobject
( (
@ -269,7 +269,7 @@ void Foam::twoPhaseSystem::solve()
dimensionedScalar("Sp", dimless/dimTime, 0.0) dimensionedScalar("Sp", dimless/dimTime, 0.0)
); );
volScalarField::DimensionedInternalField Su volScalarField::Internal Su
( (
IOobject IOobject
( (

View File

@ -392,7 +392,7 @@ void Foam::twoPhaseSystem::solve()
for (int acorr=0; acorr<nAlphaCorr; acorr++) for (int acorr=0; acorr<nAlphaCorr; acorr++)
{ {
volScalarField::DimensionedInternalField Sp volScalarField::Internal Sp
( (
IOobject IOobject
( (
@ -404,7 +404,7 @@ void Foam::twoPhaseSystem::solve()
dimensionedScalar("Sp", dgdt_.dimensions(), 0.0) dimensionedScalar("Sp", dgdt_.dimensions(), 0.0)
); );
volScalarField::DimensionedInternalField Su volScalarField::Internal Su
( (
IOobject IOobject
( (

View File

@ -148,8 +148,7 @@ void Foam::backgroundMeshDecomposition::initialRefinement()
decompositionMethod& decomposer = decomposerPtr_(); decompositionMethod& decomposer = decomposerPtr_();
volScalarField::InternalField& icellWeights = cellWeights.internalField(); volScalarField::Internal& icellWeights = cellWeights;
// For each cell in the mesh has it been determined if it is fully // For each cell in the mesh has it been determined if it is fully
// inside, outside, or overlaps the surface // inside, outside, or overlaps the surface
@ -632,7 +631,7 @@ Foam::labelList Foam::backgroundMeshDecomposition::selectRefinementCells
volScalarField& cellWeights volScalarField& cellWeights
) const ) const
{ {
volScalarField::InternalField& icellWeights = cellWeights.internalField(); volScalarField::Internal& icellWeights = cellWeights;
labelHashSet cellsToRefine; labelHashSet cellsToRefine;
@ -873,7 +872,7 @@ Foam::backgroundMeshDecomposition::distribute
mesh_.write(); mesh_.write();
} }
volScalarField::InternalField& icellWeights = cellWeights.internalField(); volScalarField::Internal& icellWeights = cellWeights;
while (true) while (true)
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -175,19 +175,19 @@ void calc
// Read vol-internal fields. // Read vol-internal fields.
PtrList<volScalarField::DimensionedInternalField> vsiFlds; PtrList<volScalarField::Internal> vsiFlds;
ReadFields(mesh, objects, vsiFlds); ReadFields(mesh, objects, vsiFlds);
PtrList<volVectorField::DimensionedInternalField> vviFlds; PtrList<volVectorField::Internal> vviFlds;
ReadFields(mesh, objects, vviFlds); ReadFields(mesh, objects, vviFlds);
PtrList<volSphericalTensorField::DimensionedInternalField> vstiFlds; PtrList<volSphericalTensorField::Internal> vstiFlds;
ReadFields(mesh, objects, vstiFlds); ReadFields(mesh, objects, vstiFlds);
PtrList<volSymmTensorField::DimensionedInternalField> vsymtiFlds; PtrList<volSymmTensorField::Internal> vsymtiFlds;
ReadFields(mesh, objects, vsymtiFlds); ReadFields(mesh, objects, vsymtiFlds);
PtrList<volTensorField::DimensionedInternalField> vtiFlds; PtrList<volTensorField::Internal> vtiFlds;
ReadFields(mesh, objects, vtiFlds); ReadFields(mesh, objects, vtiFlds);
// Read surface fields. // Read surface fields.

View File

@ -683,19 +683,19 @@ DebugSwitches
pointIndexHitList 0; pointIndexHitList 0;
pointPatchField 0; pointPatchField 0;
pointScalarField 0; pointScalarField 0;
pointScalarField::DimensionedInternalField 0; pointScalarField::Internal 0;
pointSet 0; pointSet 0;
pointSphericalTensorField 0; pointSphericalTensorField 0;
pointSphericalTensorField::DimensionedInternalField 0; pointSphericalTensorField::Internal 0;
pointSymmTensorField 0; pointSymmTensorField 0;
pointSymmTensorField::DimensionedInternalField 0; pointSymmTensorField::Internal 0;
pointTensorField 0; pointTensorField 0;
pointTensorField::DimensionedInternalField 0; pointTensorField::Internal 0;
pointToCell 0; pointToCell 0;
pointToFace 0; pointToFace 0;
pointToPoint 0; pointToPoint 0;
pointVectorField 0; pointVectorField 0;
pointVectorField::DimensionedInternalField 0; pointVectorField::Internal 0;
pointZone 0; pointZone 0;
polyBoundaryMesh 0; polyBoundaryMesh 0;
polyMesh 0; polyMesh 0;
@ -798,18 +798,18 @@ DebugSwitches
surfacePatch 0; surfacePatch 0;
surfacePatchIOList 0; surfacePatchIOList 0;
surfaceScalarField 0; surfaceScalarField 0;
surfaceScalarField::DimensionedInternalField 0; surfaceScalarField::Internal 0;
surfaceSlipDisplacement 0; surfaceSlipDisplacement 0;
surfaceSphericalTensorField 0; surfaceSphericalTensorField 0;
surfaceSphericalTensorField::DimensionedInternalField 0; surfaceSphericalTensorField::Internal 0;
surfaceSymmTensorField 0; surfaceSymmTensorField 0;
surfaceSymmTensorField::DimensionedInternalField 0; surfaceSymmTensorField::Internal 0;
surfaceTensorField 0; surfaceTensorField 0;
surfaceTensorField::DimensionedInternalField 0; surfaceTensorField::Internal 0;
surfaceToCell 0; surfaceToCell 0;
surfaceToPoint 0; surfaceToPoint 0;
surfaceVectorField 0; surfaceVectorField 0;
surfaceVectorField::DimensionedInternalField 0; surfaceVectorField::Internal 0;
surfaceWriter 0; surfaceWriter 0;
surfaces 0; surfaces 0;
swirlInjector 0; swirlInjector 0;
@ -876,15 +876,15 @@ DebugSwitches
viscosityModel 0; viscosityModel 0;
volPointInterpolation 0; volPointInterpolation 0;
volScalarField 0; volScalarField 0;
volScalarField::DimensionedInternalField 0; volScalarField::Internal 0;
volSphericalTensorField 0; volSphericalTensorField 0;
volSphericalTensorField::DimensionedInternalField 0; volSphericalTensorField::Internal 0;
volSymmTensorField 0; volSymmTensorField 0;
volSymmTensorField::DimensionedInternalField 0; volSymmTensorField::Internal 0;
volTensorField 0; volTensorField 0;
volTensorField::DimensionedInternalField 0; volTensorField::Internal 0;
volVectorField 0; volVectorField 0;
volVectorField::DimensionedInternalField 0; volVectorField::Internal 0;
vtk 0; vtk 0;
walkPatch 0; walkPatch 0;
wall 0; wall 0;

View File

@ -79,7 +79,13 @@ public:
// Public typedefs // Public typedefs
//- Type of mesh on which this DimensionedField is instantiated
typedef typename GeoMesh::Mesh Mesh; typedef typename GeoMesh::Mesh Mesh;
//- Type of the field from which this DimensionedField is derived
typedef Field<Type> FieldType;
//- Component type of the elements of the field
typedef typename Field<Type>::cmptType cmptType; typedef typename Field<Type>::cmptType cmptType;

View File

@ -55,6 +55,11 @@ class oneField
public: public:
// Public typedefs
typedef oneField FieldType;
// Constructors // Constructors
//- Construct null //- Construct null

View File

@ -689,7 +689,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::~GeometricField()
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
typename typename
Foam::GeometricField<Type, PatchField, GeoMesh>::DimensionedInternalField& Foam::GeometricField<Type, PatchField, GeoMesh>::Internal&
Foam::GeometricField<Type, PatchField, GeoMesh>::dimensionedInternalFieldRef() Foam::GeometricField<Type, PatchField, GeoMesh>::dimensionedInternalFieldRef()
{ {
this->setUpToDate(); this->setUpToDate();
@ -700,7 +700,7 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::dimensionedInternalFieldRef()
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
typename typename
Foam::GeometricField<Type, PatchField, GeoMesh>::InternalField& Foam::GeometricField<Type, PatchField, GeoMesh>::Internal::FieldType&
Foam::GeometricField<Type, PatchField, GeoMesh>::internalField() Foam::GeometricField<Type, PatchField, GeoMesh>::internalField()
{ {
this->setUpToDate(); this->setUpToDate();

View File

@ -95,12 +95,19 @@ public:
// Public typedefs // Public typedefs
//- Type of mesh on which this GeometricField is instantiated
typedef typename GeoMesh::Mesh Mesh; typedef typename GeoMesh::Mesh Mesh;
//- Type of boundary mesh on which this
// GeometricField::GeometricBoundaryField is instantiated
typedef typename GeoMesh::BoundaryMesh BoundaryMesh; typedef typename GeoMesh::BoundaryMesh BoundaryMesh;
typedef DimensionedField<Type, GeoMesh> DimensionedInternalField; //- Type of the internal field from which this GeometricField is derived
typedef Field<Type> InternalField; typedef DimensionedField<Type, GeoMesh> Internal;
typedef PatchField<Type> PatchFieldType;
//- Type of the patch field of which the
// GeometricField::GeometricBoundaryField is composed
typedef PatchField<Type> Patch;
class GeometricBoundaryField class GeometricBoundaryField
@ -126,7 +133,7 @@ public:
GeometricBoundaryField GeometricBoundaryField
( (
const BoundaryMesh&, const BoundaryMesh&,
const DimensionedInternalField&, const Internal&,
const word& const word&
); );
@ -137,7 +144,7 @@ public:
GeometricBoundaryField GeometricBoundaryField
( (
const BoundaryMesh&, const BoundaryMesh&,
const DimensionedInternalField&, const Internal&,
const wordList& wantedPatchTypes, const wordList& wantedPatchTypes,
const wordList& actualPatchTypes = wordList() const wordList& actualPatchTypes = wordList()
); );
@ -148,14 +155,14 @@ public:
GeometricBoundaryField GeometricBoundaryField
( (
const BoundaryMesh&, const BoundaryMesh&,
const DimensionedInternalField&, const Internal&,
const PtrList<PatchField<Type>>& const PtrList<PatchField<Type>>&
); );
//- Construct as copy setting the reference to the internal field //- Construct as copy setting the reference to the internal field
GeometricBoundaryField GeometricBoundaryField
( (
const DimensionedInternalField&, const Internal&,
const GeometricBoundaryField& const GeometricBoundaryField&
); );
@ -173,7 +180,7 @@ public:
GeometricBoundaryField GeometricBoundaryField
( (
const BoundaryMesh&, const BoundaryMesh&,
const DimensionedInternalField&, const Internal&,
const dictionary& const dictionary&
); );
@ -432,23 +439,23 @@ public:
//- Return a reference to the dimensioned internal field //- Return a reference to the dimensioned internal field
// Note: this increments the event counter and checks the // Note: this increments the event counter and checks the
// old-time fields; avoid in loops. // old-time fields; avoid in loops.
DimensionedInternalField& dimensionedInternalFieldRef(); Internal& dimensionedInternalFieldRef();
//- Return a const-reference to the dimensioned internal field //- Return a const-reference to the dimensioned internal field
inline const DimensionedInternalField& dimensionedInternalField() const; inline const Internal& dimensionedInternalField() const;
//- Return a const-reference to the dimensioned internal field //- Return a const-reference to the dimensioned internal field
// of a "vol" field. Useful in the formulation of source-terms // of a "vol" field. Useful in the formulation of source-terms
// for FV equations // for FV equations
inline const DimensionedInternalField& v() const; inline const Internal& v() const;
//- Return a reference to the internal field //- Return a reference to the internal field
// Note: this increments the event counter and checks the // Note: this increments the event counter and checks the
// old-time fields; avoid in loops. // old-time fields; avoid in loops.
InternalField& internalField(); typename Internal::FieldType& internalField();
//- Return a const-reference to the internal field //- Return a const-reference to the internal field
inline const InternalField& internalField() const; inline const typename Internal::FieldType& internalField() const;
//- Return a reference to the boundary field //- Return a reference to the boundary field
// Note: this increments the event counter and checks the // Note: this increments the event counter and checks the
@ -570,9 +577,8 @@ public:
// Member operators // Member operators
//- Return a const-reference to the dimensioned internal field //- Return a const-reference to the dimensioned internal field
// of a "vol" field. Useful in the formulation of source-terms // Useful in the formulation of source-terms for FV equations
// for FV equations inline const Internal& operator()() const;
inline const DimensionedInternalField& operator~() const;
void operator=(const GeometricField<Type, PatchField, GeoMesh>&); void operator=(const GeometricField<Type, PatchField, GeoMesh>&);
void operator=(const tmp<GeometricField<Type, PatchField, GeoMesh>>&); void operator=(const tmp<GeometricField<Type, PatchField, GeoMesh>>&);

View File

@ -36,7 +36,18 @@ Foam::GeometricField<Type, PatchField, GeoMesh>::null()
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
inline inline
const typename const typename
Foam::GeometricField<Type, PatchField, GeoMesh>::DimensionedInternalField& Foam::GeometricField<Type, PatchField, GeoMesh>::Internal&
Foam::GeometricField<Type, PatchField, GeoMesh>::
operator()() const
{
return *this;
}
template<class Type, template<class> class PatchField, class GeoMesh>
inline
const typename
Foam::GeometricField<Type, PatchField, GeoMesh>::Internal&
Foam::GeometricField<Type, PatchField, GeoMesh>:: Foam::GeometricField<Type, PatchField, GeoMesh>::
dimensionedInternalField() const dimensionedInternalField() const
{ {
@ -47,7 +58,7 @@ dimensionedInternalField() const
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
inline inline
const typename const typename
Foam::GeometricField<Type, PatchField, GeoMesh>::InternalField& Foam::GeometricField<Type, PatchField, GeoMesh>::Internal::FieldType&
Foam::GeometricField<Type, PatchField, GeoMesh>::internalField() const Foam::GeometricField<Type, PatchField, GeoMesh>::internalField() const
{ {
return *this; return *this;

View File

@ -176,7 +176,7 @@ template
class GeoMesh class GeoMesh
> >
Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>:: Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
DimensionedInternalField::DimensionedInternalField Internal::Internal
( (
const IOobject& io, const IOobject& io,
const Mesh& mesh, const Mesh& mesh,
@ -364,7 +364,7 @@ template
class GeoMesh class GeoMesh
> >
Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>:: Foam::SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
DimensionedInternalField::~DimensionedInternalField() Internal::~Internal()
{ {
// Set the internalField storage pointer to NULL before its destruction // Set the internalField storage pointer to NULL before its destruction
// to protect the field it a slice of. // to protect the field it a slice of.

View File

@ -70,7 +70,7 @@ public:
typedef typename GeoMesh::Mesh Mesh; typedef typename GeoMesh::Mesh Mesh;
typedef typename GeoMesh::BoundaryMesh BoundaryMesh; typedef typename GeoMesh::BoundaryMesh BoundaryMesh;
class DimensionedInternalField; class Internal;
private: private:
@ -172,7 +172,7 @@ public:
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class SlicedGeometricField::DimensionedInternalField Declaration Class SlicedGeometricField::Internal Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
//- The internalField of a SlicedGeometricField //- The internalField of a SlicedGeometricField
@ -184,9 +184,9 @@ template
class GeoMesh class GeoMesh
> >
class SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>:: class SlicedGeometricField<Type, PatchField, SlicedPatchField, GeoMesh>::
DimensionedInternalField Internal
: :
public GeometricField<Type, PatchField, GeoMesh>::DimensionedInternalField public GeometricField<Type, PatchField, GeoMesh>::Internal
{ {
public: public:
@ -194,7 +194,7 @@ public:
// Constructors // Constructors
//- Construct from components and field to slice //- Construct from components and field to slice
DimensionedInternalField Internal
( (
const IOobject&, const IOobject&,
const Mesh&, const Mesh&,
@ -204,7 +204,7 @@ public:
//- Destructor //- Destructor
~DimensionedInternalField(); ~Internal();
}; };

View File

@ -59,9 +59,8 @@ public:
// Public typedefs // Public typedefs
typedef oneField DimensionedInternalField; typedef oneField Internal;
typedef oneField InternalField; typedef oneField Patch;
typedef oneField PatchFieldType;
typedef oneFieldField GeometricBoundaryField; typedef oneFieldField GeometricBoundaryField;
typedef one cmptType; typedef one cmptType;
@ -82,9 +81,11 @@ public:
inline oneField oldTime() const; inline oneField oldTime() const;
inline InternalField internalField() const; inline Internal operator()() const;
inline DimensionedInternalField v() const; inline Internal v() const;
inline typename Internal::FieldType internalField() const;
inline GeometricBoundaryField boundaryField() const; inline GeometricBoundaryField boundaryField() const;
}; };
@ -96,16 +97,16 @@ inline const geometricOneField& operator*
const geometricOneField& const geometricOneField&
); );
inline const geometricOneField::DimensionedInternalField& operator* inline const geometricOneField::Internal& operator*
( (
const geometricOneField::DimensionedInternalField&, const geometricOneField::Internal&,
const geometricOneField& const geometricOneField&
); );
inline const geometricOneField::DimensionedInternalField& operator* inline const geometricOneField::Internal& operator*
( (
const geometricOneField&, const geometricOneField&,
const geometricOneField::DimensionedInternalField& const geometricOneField::Internal&
); );
inline const geometricOneField& operator/ inline const geometricOneField& operator/
@ -114,16 +115,16 @@ inline const geometricOneField& operator/
const geometricOneField& const geometricOneField&
); );
inline const geometricOneField::DimensionedInternalField& operator/ inline const geometricOneField::Internal& operator/
( (
const geometricOneField::DimensionedInternalField&, const geometricOneField::Internal&,
const geometricOneField& const geometricOneField&
); );
inline const geometricOneField::DimensionedInternalField& operator/ inline const geometricOneField::Internal& operator/
( (
const geometricOneField&, const geometricOneField&,
const geometricOneField::DimensionedInternalField& const geometricOneField::Internal&
); );

View File

@ -51,17 +51,24 @@ inline Foam::oneField Foam::geometricOneField::oldTime() const
} }
inline Foam::geometricOneField::InternalField inline Foam::geometricOneField::Internal
Foam::geometricOneField::internalField() const Foam::geometricOneField::operator()() const
{ {
return InternalField(); return Internal();
} }
inline Foam::geometricOneField::DimensionedInternalField inline Foam::geometricOneField::Internal
Foam::geometricOneField::v() const Foam::geometricOneField::v() const
{ {
return DimensionedInternalField(); return Internal();
}
inline typename Foam::geometricOneField::Internal::FieldType
Foam::geometricOneField::internalField() const
{
return typename Internal::FieldType();
} }
@ -82,9 +89,9 @@ inline const Foam::geometricOneField& Foam::operator*
} }
inline const Foam::geometricOneField::DimensionedInternalField& Foam::operator* inline const Foam::geometricOneField::Internal& Foam::operator*
( (
const geometricOneField::DimensionedInternalField& of, const geometricOneField::Internal& of,
const geometricOneField& const geometricOneField&
) )
{ {
@ -92,10 +99,10 @@ inline const Foam::geometricOneField::DimensionedInternalField& Foam::operator*
} }
inline const Foam::geometricOneField::DimensionedInternalField& Foam::operator* inline const Foam::geometricOneField::Internal& Foam::operator*
( (
const geometricOneField&, const geometricOneField&,
const geometricOneField::DimensionedInternalField& of const geometricOneField::Internal& of
) )
{ {
return of; return of;
@ -112,9 +119,9 @@ inline const Foam::geometricOneField& Foam::operator/
} }
inline const Foam::geometricOneField::DimensionedInternalField& Foam::operator/ inline const Foam::geometricOneField::Internal& Foam::operator/
( (
const geometricOneField::DimensionedInternalField& of, const geometricOneField::Internal& of,
const geometricOneField& const geometricOneField&
) )
{ {
@ -122,10 +129,10 @@ inline const Foam::geometricOneField::DimensionedInternalField& Foam::operator/
} }
inline const Foam::geometricOneField::DimensionedInternalField& Foam::operator/ inline const Foam::geometricOneField::Internal& Foam::operator/
( (
const geometricOneField&, const geometricOneField&,
const geometricOneField::DimensionedInternalField& of const geometricOneField::Internal& of
) )
{ {
return of; return of;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -33,19 +33,19 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTemplate2TypeNameAndDebug(pointScalarField::DimensionedInternalField, 0); defineTemplate2TypeNameAndDebug(pointScalarField::Internal, 0);
defineTemplate2TypeNameAndDebug(pointVectorField::DimensionedInternalField, 0); defineTemplate2TypeNameAndDebug(pointVectorField::Internal, 0);
defineTemplate2TypeNameAndDebug defineTemplate2TypeNameAndDebug
( (
pointSphericalTensorField::DimensionedInternalField, pointSphericalTensorField::Internal,
0 0
); );
defineTemplate2TypeNameAndDebug defineTemplate2TypeNameAndDebug
( (
pointSymmTensorField::DimensionedInternalField, pointSymmTensorField::Internal,
0 0
); );
defineTemplate2TypeNameAndDebug(pointTensorField::DimensionedInternalField, 0); defineTemplate2TypeNameAndDebug(pointTensorField::Internal, 0);
defineTemplateTypeNameAndDebug(pointScalarField, 0); defineTemplateTypeNameAndDebug(pointScalarField, 0);

View File

@ -235,10 +235,17 @@ void kEpsilon<BasicTurbulenceModel>::correct()
eddyViscosity<RASModel<BasicTurbulenceModel>>::correct(); eddyViscosity<RASModel<BasicTurbulenceModel>>::correct();
volScalarField divU(fvc::div(fvc::absolute(this->phi(), U))); volScalarField::Internal divU
(
fvc::div(fvc::absolute(this->phi(), U))().v()
);
tmp<volTensorField> tgradU = fvc::grad(U); tmp<volTensorField> tgradU = fvc::grad(U);
volScalarField G(this->GName(), nut*(dev(twoSymm(tgradU())) && tgradU())); volScalarField::Internal G
(
this->GName(),
nut.v()*(dev(twoSymm(tgradU().v())) && tgradU().v())
);
tgradU.clear(); tgradU.clear();
// Update epsilon and G at the wall // Update epsilon and G at the wall
@ -251,9 +258,9 @@ void kEpsilon<BasicTurbulenceModel>::correct()
+ fvm::div(alphaRhoPhi, epsilon_) + fvm::div(alphaRhoPhi, epsilon_)
- fvm::laplacian(alpha*rho*DepsilonEff(), epsilon_) - fvm::laplacian(alpha*rho*DepsilonEff(), epsilon_)
== ==
C1_*alpha*rho*G*epsilon_/k_ C1_*alpha()*rho()*G*epsilon_()/k_()
- fvm::SuSp(((2.0/3.0)*C1_ + C3_)*alpha*rho*divU, epsilon_) - fvm::SuSp(((2.0/3.0)*C1_ + C3_)*alpha()*rho()*divU, epsilon_)
- fvm::Sp(C2_*alpha*rho*epsilon_/k_, epsilon_) - fvm::Sp(C2_*alpha()*rho()*epsilon_()/k_(), epsilon_)
+ epsilonSource() + epsilonSource()
+ fvOptions(alpha, rho, epsilon_) + fvOptions(alpha, rho, epsilon_)
); );
@ -272,9 +279,9 @@ void kEpsilon<BasicTurbulenceModel>::correct()
+ fvm::div(alphaRhoPhi, k_) + fvm::div(alphaRhoPhi, k_)
- fvm::laplacian(alpha*rho*DkEff(), k_) - fvm::laplacian(alpha*rho*DkEff(), k_)
== ==
alpha*rho*G alpha()*rho()*G
- fvm::SuSp((2.0/3.0)*alpha*rho*divU, k_) - fvm::SuSp((2.0/3.0)*alpha()*rho()*divU, k_)
- fvm::Sp(alpha*rho*epsilon_/k_, k_) - fvm::Sp(alpha()*rho()*epsilon_()/k_(), k_)
+ kSource() + kSource()
+ fvOptions(alpha, rho, k_) + fvOptions(alpha, rho, k_)
); );

View File

@ -104,7 +104,7 @@ Foam::tmp<Foam::volScalarField> Foam::consumptionSpeed::omega0Sigma
volScalarField& omega0 = tomega0.ref(); volScalarField& omega0 = tomega0.ref();
volScalarField::InternalField& iomega0 = omega0.internalField(); volScalarField::Internal& iomega0 = omega0;
forAll(iomega0, celli) forAll(iomega0, celli)
{ {

View File

@ -58,7 +58,7 @@ void Foam::fvMeshTools::addPatchFields
bfld.set bfld.set
( (
sz, sz,
GeoField::PatchFieldType::New GeoField::Patch::New
( (
mesh.boundary()[sz], mesh.boundary()[sz],
fld.dimensionedInternalField(), fld.dimensionedInternalField(),
@ -71,7 +71,7 @@ void Foam::fvMeshTools::addPatchFields
bfld.set bfld.set
( (
sz, sz,
GeoField::PatchFieldType::New GeoField::Patch::New
( (
defaultPatchFieldType, defaultPatchFieldType,
mesh.boundary()[sz], mesh.boundary()[sz],
@ -109,7 +109,7 @@ void Foam::fvMeshTools::setPatchFields
bfld.set bfld.set
( (
patchi, patchi,
GeoField::PatchFieldType::New GeoField::Patch::New
( (
mesh.boundary()[patchi], mesh.boundary()[patchi],
fld.dimensionedInternalField(), fld.dimensionedInternalField(),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -34,27 +34,27 @@ namespace Foam
defineTemplate2TypeNameAndDebug defineTemplate2TypeNameAndDebug
( (
surfaceScalarField::DimensionedInternalField, surfaceScalarField::Internal,
0 0
); );
defineTemplate2TypeNameAndDebug defineTemplate2TypeNameAndDebug
( (
surfaceVectorField::DimensionedInternalField, surfaceVectorField::Internal,
0 0
); );
defineTemplate2TypeNameAndDebug defineTemplate2TypeNameAndDebug
( (
surfaceSphericalTensorField::DimensionedInternalField, surfaceSphericalTensorField::Internal,
0 0
); );
defineTemplate2TypeNameAndDebug defineTemplate2TypeNameAndDebug
( (
surfaceSymmTensorField::DimensionedInternalField, surfaceSymmTensorField::Internal,
0 0
); );
defineTemplate2TypeNameAndDebug defineTemplate2TypeNameAndDebug
( (
surfaceTensorField::DimensionedInternalField, surfaceTensorField::Internal,
0 0
); );

View File

@ -32,19 +32,19 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTemplate2TypeNameAndDebug(volScalarField::DimensionedInternalField, 0); defineTemplate2TypeNameAndDebug(volScalarField::Internal, 0);
defineTemplate2TypeNameAndDebug(volVectorField::DimensionedInternalField, 0); defineTemplate2TypeNameAndDebug(volVectorField::Internal, 0);
defineTemplate2TypeNameAndDebug defineTemplate2TypeNameAndDebug
( (
volSphericalTensorField::DimensionedInternalField, volSphericalTensorField::Internal,
0 0
); );
defineTemplate2TypeNameAndDebug defineTemplate2TypeNameAndDebug
( (
volSymmTensorField::DimensionedInternalField, volSymmTensorField::Internal,
0 0
); );
defineTemplate2TypeNameAndDebug(volTensorField::DimensionedInternalField, 0); defineTemplate2TypeNameAndDebug(volTensorField::Internal, 0);
defineTemplateTypeNameAndDebug(volScalarField, 0); defineTemplateTypeNameAndDebug(volScalarField, 0);
defineTemplateTypeNameAndDebug(volVectorField, 0); defineTemplateTypeNameAndDebug(volVectorField, 0);

View File

@ -26,7 +26,7 @@ License
template<class Type, template<class> class PatchField, class GeoMesh> template<class Type, template<class> class PatchField, class GeoMesh>
inline inline
const typename const typename
Foam::GeometricField<Type, PatchField, GeoMesh>::DimensionedInternalField& Foam::GeometricField<Type, PatchField, GeoMesh>::Internal&
Foam::GeometricField<Type, PatchField, GeoMesh>:: Foam::GeometricField<Type, PatchField, GeoMesh>::
v() const v() const
{ {
@ -35,16 +35,4 @@ v() const
} }
template<class Type, template<class> class PatchField, class GeoMesh>
inline
const typename
Foam::GeometricField<Type, PatchField, GeoMesh>::DimensionedInternalField&
Foam::GeometricField<Type, PatchField, GeoMesh>::
operator~() const
{
static_assert(isVolMesh<GeoMesh>::value, "Only valid for volFields");
return *this;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -168,7 +168,7 @@ void Foam::MULES::limiterCorr
const labelUList& owner = mesh.owner(); const labelUList& owner = mesh.owner();
const labelUList& neighb = mesh.neighbour(); const labelUList& neighb = mesh.neighbour();
tmp<volScalarField::DimensionedInternalField> tVsc = mesh.Vsc(); tmp<volScalarField::Internal> tVsc = mesh.Vsc();
const scalarField& V = tVsc(); const scalarField& V = tVsc();
const surfaceScalarField::GeometricBoundaryField& phiBf = const surfaceScalarField::GeometricBoundaryField& phiBf =

View File

@ -199,7 +199,7 @@ void Foam::MULES::limiter
const labelUList& owner = mesh.owner(); const labelUList& owner = mesh.owner();
const labelUList& neighb = mesh.neighbour(); const labelUList& neighb = mesh.neighbour();
tmp<volScalarField::DimensionedInternalField> tVsc = mesh.Vsc(); tmp<volScalarField::Internal> tVsc = mesh.Vsc();
const scalarField& V = tVsc(); const scalarField& V = tVsc();
const scalarField& phiBDIf = phiBD; const scalarField& phiBDIf = phiBD;
@ -330,7 +330,7 @@ void Foam::MULES::limiter
if (mesh.moving()) if (mesh.moving())
{ {
tmp<volScalarField::DimensionedInternalField> V0 = mesh.Vsc0(); tmp<volScalarField::Internal> V0 = mesh.Vsc0();
psiMaxn = psiMaxn =
V V

View File

@ -63,8 +63,8 @@ void Foam::fvMesh::clearGeomNotOldVol()
MoveableMeshObject MoveableMeshObject
>(*this); >(*this);
slicedVolScalarField::DimensionedInternalField* VPtr = slicedVolScalarField::Internal* VPtr =
static_cast<slicedVolScalarField::DimensionedInternalField*>(VPtr_); static_cast<slicedVolScalarField::Internal*>(VPtr_);
deleteDemandDrivenData(VPtr); deleteDemandDrivenData(VPtr);
VPtr_ = NULL; VPtr_ = NULL;

View File

@ -183,7 +183,7 @@ void Foam::fvMesh::makeCf() const
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::volScalarField::DimensionedInternalField& Foam::fvMesh::V() const const Foam::volScalarField::Internal& Foam::fvMesh::V() const
{ {
if (!VPtr_) if (!VPtr_)
{ {
@ -193,7 +193,7 @@ const Foam::volScalarField::DimensionedInternalField& Foam::fvMesh::V() const
<< "Constructing from primitiveMesh::cellVolumes()" << endl; << "Constructing from primitiveMesh::cellVolumes()" << endl;
} }
VPtr_ = new slicedVolScalarField::DimensionedInternalField VPtr_ = new slicedVolScalarField::Internal
( (
IOobject IOobject
( (
@ -210,11 +210,11 @@ const Foam::volScalarField::DimensionedInternalField& Foam::fvMesh::V() const
); );
} }
return *static_cast<slicedVolScalarField::DimensionedInternalField*>(VPtr_); return *static_cast<slicedVolScalarField::Internal*>(VPtr_);
} }
const Foam::volScalarField::DimensionedInternalField& Foam::fvMesh::V0() const const Foam::volScalarField::Internal& Foam::fvMesh::V0() const
{ {
if (!V0Ptr_) if (!V0Ptr_)
{ {
@ -227,7 +227,7 @@ const Foam::volScalarField::DimensionedInternalField& Foam::fvMesh::V0() const
} }
Foam::volScalarField::DimensionedInternalField& Foam::fvMesh::setV0() Foam::volScalarField::Internal& Foam::fvMesh::setV0()
{ {
if (!V0Ptr_) if (!V0Ptr_)
{ {
@ -240,7 +240,7 @@ Foam::volScalarField::DimensionedInternalField& Foam::fvMesh::setV0()
} }
const Foam::volScalarField::DimensionedInternalField& Foam::fvMesh::V00() const const Foam::volScalarField::Internal& Foam::fvMesh::V00() const
{ {
if (!V00Ptr_) if (!V00Ptr_)
{ {
@ -271,7 +271,7 @@ const Foam::volScalarField::DimensionedInternalField& Foam::fvMesh::V00() const
} }
Foam::tmp<Foam::volScalarField::DimensionedInternalField> Foam::tmp<Foam::volScalarField::Internal>
Foam::fvMesh::Vsc() const Foam::fvMesh::Vsc() const
{ {
if (moving() && time().subCycling()) if (moving() && time().subCycling())
@ -300,7 +300,7 @@ Foam::fvMesh::Vsc() const
} }
Foam::tmp<Foam::volScalarField::DimensionedInternalField> Foam::tmp<Foam::volScalarField::Internal>
Foam::fvMesh::Vsc0() const Foam::fvMesh::Vsc0() const
{ {
if (moving() && time().subCycling()) if (moving() && time().subCycling())

View File

@ -245,7 +245,7 @@ public:
//- Return the corresponding patchField of the named field //- Return the corresponding patchField of the named field
template<class GeometricField, class Type> template<class GeometricField, class Type>
const typename GeometricField::PatchFieldType& patchField const typename GeometricField::Patch& patchField
( (
const GeometricField& const GeometricField&
) const; ) const;
@ -256,7 +256,7 @@ public:
// instantiated within a templated function to avoid a bug in gcc. // instantiated within a templated function to avoid a bug in gcc.
// See inletOutletFvPatchField.C and outletInletFvPatchField.C // See inletOutletFvPatchField.C and outletInletFvPatchField.C
template<class GeometricField, class Type> template<class GeometricField, class Type>
const typename GeometricField::PatchFieldType& lookupPatchField const typename GeometricField::Patch& lookupPatchField
( (
const word& name, const word& name,
const GeometricField* = NULL, const GeometricField* = NULL,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -28,7 +28,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class GeometricField, class Type> template<class GeometricField, class Type>
const typename GeometricField::PatchFieldType& Foam::fvPatch::lookupPatchField const typename GeometricField::Patch& Foam::fvPatch::lookupPatchField
( (
const word& name, const word& name,
const GeometricField*, const GeometricField*,

View File

@ -66,7 +66,7 @@ void Foam::fvPatch::patchInternalField
template<class GeometricField, class Type> template<class GeometricField, class Type>
const typename GeometricField::PatchFieldType& Foam::fvPatch::patchField const typename GeometricField::Patch& Foam::fvPatch::patchField
( (
const GeometricField& gf const GeometricField& gf
) const ) const

View File

@ -276,7 +276,7 @@ Foam::surfaceInterpolationScheme<Type>::dotInterpolate
Field<RetType>& sfi = sf.internalField(); Field<RetType>& sfi = sf.internalField();
const typename SFType::InternalField& Sfi = Sf.internalField(); const typename SFType::Internal& Sfi = Sf();
for (label fi=0; fi<P.size(); fi++) for (label fi=0; fi<P.size(); fi++)
{ {
@ -291,7 +291,7 @@ Foam::surfaceInterpolationScheme<Type>::dotInterpolate
forAll(lambdas.boundaryField(), pi) forAll(lambdas.boundaryField(), pi)
{ {
const fvsPatchScalarField& pLambda = lambdas.boundaryField()[pi]; const fvsPatchScalarField& pLambda = lambdas.boundaryField()[pi];
const typename SFType::PatchFieldType& pSf = Sf.boundaryField()[pi]; const typename SFType::Patch& pSf = Sf.boundaryField()[pi];
fvsPatchField<RetType>& psf = sfbf[pi]; fvsPatchField<RetType>& psf = sfbf[pi];
if (vf.boundaryField()[pi].coupled()) if (vf.boundaryField()[pi].coupled())

View File

@ -76,8 +76,7 @@ if (runTime.outputTime())
} }
} }
volVectorField::InternalField& itotalVelocity = volVectorField::Internal& itotalVelocity = totalVelocity;
totalVelocity.internalField();
forAll(itotalVelocity, tV) forAll(itotalVelocity, tV)
{ {
@ -150,8 +149,8 @@ if (runTime.outputTime())
} }
} }
volScalarField::InternalField& itotalTemperature = volScalarField::Internal& itotalTemperature =
totalTemperature.internalField(); totalTemperature;
forAll(itotalTemperature, tT) forAll(itotalTemperature, tT)
{ {
@ -209,7 +208,7 @@ if (runTime.outputTime())
} }
} }
volScalarField::InternalField& itotalMeanKE = totalMeanKE.internalField(); volScalarField::Internal& itotalMeanKE = totalMeanKE;
forAll(itotalMeanKE, tMKE) forAll(itotalMeanKE, tMKE)
{ {

View File

@ -222,7 +222,7 @@ void Foam::meshRefinement::addPatchFields
fldBf.set fldBf.set
( (
sz, sz,
GeoField::PatchFieldType::New GeoField::Patch::New
( (
patchFieldType, patchFieldType,
mesh.boundary()[sz], mesh.boundary()[sz],

View File

@ -38,10 +38,10 @@ namespace Foam
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField::DimensionedInternalField> Foam::tmp<Foam::volScalarField::Internal>
Foam::CourantNo::byRho Foam::CourantNo::byRho
( (
const tmp<volScalarField::DimensionedInternalField>& Co const tmp<volScalarField::Internal>& Co
) const ) const
{ {
if (Co().dimensions() == dimDensity) if (Co().dimensions() == dimDensity)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -81,9 +81,9 @@ class CourantNo
// Private Member Functions // Private Member Functions
//- Divide Co by rho if required //- Divide Co by rho if required
tmp<volScalarField::DimensionedInternalField> byRho tmp<volScalarField::Internal> byRho
( (
const tmp<volScalarField::DimensionedInternalField>& Co const tmp<volScalarField::Internal>& Co
) const; ) const;
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct

View File

@ -637,7 +637,7 @@ Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::gasHs
) )
); );
volScalarField::InternalField& gasHs = tHs.ref().internalField(); volScalarField::Internal& gasHs = tHs.ref();
const GasThermo& mixture = gasThermo_[index]; const GasThermo& mixture = gasThermo_[index];