GeometricField, volFields: Added experimental member function ".v()" and perfix operator "~"
both of which return the dimensionedInternalField for volFields only. These will be useful in FV equation source term expressions which need not evaluate boundary conditions.
This commit is contained in:
@ -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
|
||||||
@ -52,6 +52,10 @@ int main(int argc, char *argv[])
|
|||||||
mesh
|
mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Info<< nl
|
||||||
|
<< "p.v().size(): "
|
||||||
|
<< p.v().size() << endl;
|
||||||
|
|
||||||
Info<< "Reading field U\n" << endl;
|
Info<< "Reading field U\n" << endl;
|
||||||
volVectorField U
|
volVectorField U
|
||||||
(
|
(
|
||||||
|
|||||||
@ -437,6 +437,11 @@ public:
|
|||||||
//- 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 DimensionedInternalField& dimensionedInternalField() const;
|
||||||
|
|
||||||
|
//- Return a const-reference to the dimensioned internal field
|
||||||
|
// of a "vol" field. Useful in the formulation of source-terms
|
||||||
|
// for FV equations
|
||||||
|
inline const DimensionedInternalField& 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.
|
||||||
@ -564,6 +569,11 @@ public:
|
|||||||
|
|
||||||
// Member operators
|
// Member operators
|
||||||
|
|
||||||
|
//- Return a const-reference to the dimensioned internal field
|
||||||
|
// of a "vol" field. Useful in the formulation of source-terms
|
||||||
|
// for FV equations
|
||||||
|
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>>&);
|
||||||
void operator=(const dimensioned<Type>&);
|
void operator=(const dimensioned<Type>&);
|
||||||
|
|||||||
@ -62,13 +62,16 @@ void GeometricField<scalar, fvPatchField, volMesh>::replace
|
|||||||
const GeometricField<scalar, fvPatchField, volMesh>& sf
|
const GeometricField<scalar, fvPatchField, volMesh>& sf
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#include "volFieldsI.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
50
src/finiteVolume/fields/volFields/volFieldsI.H
Normal file
50
src/finiteVolume/fields/volFields/volFieldsI.H
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class Type, template<class> class PatchField, class GeoMesh>
|
||||||
|
inline
|
||||||
|
const typename
|
||||||
|
Foam::GeometricField<Type, PatchField, GeoMesh>::DimensionedInternalField&
|
||||||
|
Foam::GeometricField<Type, PatchField, GeoMesh>::
|
||||||
|
v() const
|
||||||
|
{
|
||||||
|
static_assert(isVolMesh<GeoMesh>::value, "Only valid for volFields");
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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
|
||||||
@ -27,6 +27,12 @@ Class
|
|||||||
Description
|
Description
|
||||||
Mesh data needed to do the Finite Volume discretisation.
|
Mesh data needed to do the Finite Volume discretisation.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::isVolMesh
|
||||||
|
|
||||||
|
Description
|
||||||
|
Supports static assertion that a template argument is of type volMesh.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef volMesh_H
|
#ifndef volMesh_H
|
||||||
@ -35,6 +41,7 @@ Description
|
|||||||
#include "GeoMesh.H"
|
#include "GeoMesh.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "primitiveMesh.H"
|
#include "primitiveMesh.H"
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -83,6 +90,24 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class isVolMesh Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
template<class T>
|
||||||
|
class isVolMesh
|
||||||
|
:
|
||||||
|
public std::false_type
|
||||||
|
{};
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
class isVolMesh<volMesh>
|
||||||
|
:
|
||||||
|
public std::true_type
|
||||||
|
{};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|||||||
Reference in New Issue
Block a user