ENH: Added DimensionedField handling to volume/domain integrate

This commit is contained in:
andy
2012-08-14 14:26:11 +01:00
parent 69cc8d8ae7
commit af1437fd14
2 changed files with 75 additions and 4 deletions

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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,6 +49,7 @@ volumeIntegrate
return vf.mesh().V()*vf.internalField(); return vf.mesh().V()*vf.internalField();
} }
template<class Type> template<class Type>
tmp<Field<Type> > tmp<Field<Type> >
volumeIntegrate volumeIntegrate
@ -62,6 +63,23 @@ volumeIntegrate
} }
template<class Type>
tmp<Field<Type> > volumeIntegrate(const DimensionedField<Type, volMesh>& df)
{
return df.mesh().V()*df.field();
}
template<class Type>
tmp<Field<Type> >
volumeIntegrate(const tmp<DimensionedField<Type, volMesh> >& tdf)
{
tmp<Field<Type> > tdidf = tdf().mesh().V()*tdf().field();
tdf.clear();
return tdidf;
}
template<class Type> template<class Type>
dimensioned<Type> dimensioned<Type>
domainIntegrate domainIntegrate
@ -77,9 +95,9 @@ domainIntegrate
); );
} }
template<class Type> template<class Type>
dimensioned<Type> dimensioned<Type> domainIntegrate
domainIntegrate
( (
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
) )
@ -90,6 +108,33 @@ domainIntegrate
} }
template<class Type>
dimensioned<Type> domainIntegrate
(
const DimensionedField<Type, volMesh>& df
)
{
return dimensioned<Type>
(
"domainIntegrate(" + df.name() + ')',
dimVol*df.dimensions(),
gSum(fvc::volumeIntegrate(df))
);
}
template<class Type>
dimensioned<Type> domainIntegrate
(
const tmp<DimensionedField<Type, volMesh> >& tdf
)
{
dimensioned<Type> integral = domainIntegrate(tdf());
tdf.clear();
return integral;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fvc } // End namespace fvc

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-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -67,6 +67,19 @@ namespace fvc
); );
template<class Type>
tmp<Field<Type> > volumeIntegrate
(
const DimensionedField<Type, volMesh>&
);
template<class Type>
tmp<Field<Type> > volumeIntegrate
(
const tmp<DimensionedField<Type, volMesh> >&
);
template<class Type> template<class Type>
dimensioned<Type> domainIntegrate dimensioned<Type> domainIntegrate
( (
@ -78,6 +91,19 @@ namespace fvc
( (
const tmp<GeometricField<Type, fvPatchField, volMesh> >& const tmp<GeometricField<Type, fvPatchField, volMesh> >&
); );
template<class Type>
dimensioned<Type> domainIntegrate
(
const DimensionedField<Type, volMesh>&
);
template<class Type>
dimensioned<Type> domainIntegrate
(
const tmp<DimensionedField<Type, volMesh> >&
);
} }