fvcReconstruct.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "fvcReconstruct.H"
27 #include "fvMesh.H"
28 #include "volFields.H"
29 #include "surfaceFields.H"
30 #include "fvcSurfaceIntegrate.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
40 namespace fvc
41 {
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 template<class Type>
46 tmp
47 <
48  GeometricField
49  <
50  typename outerProduct<vector,Type>::type, fvPatchField, volMesh
51  >
52 >
54 (
56 )
57 {
58  typedef typename outerProduct<vector, Type>::type GradType;
59 
60  const fvMesh& mesh = ssf.mesh();
61 
62  surfaceVectorField SfHat(mesh.Sf()/mesh.magSf());
63 
65  (
67  (
68  IOobject
69  (
70  "volIntegrate("+ssf.name()+')',
71  ssf.instance(),
72  mesh,
75  ),
76  inv(surfaceSum(SfHat*mesh.Sf()))&surfaceSum(SfHat*ssf),
78  )
79  );
80 
81  treconField().correctBoundaryConditions();
82 
83  return treconField;
84 }
85 
86 
87 template<class Type>
88 tmp
89 <
91  <
92  typename outerProduct<vector, Type>::type, fvPatchField, volMesh
93  >
94 >
96 (
98 )
99 {
100  typedef typename outerProduct<vector, Type>::type GradType;
102  (
103  fvc::reconstruct(tssf())
104  );
105  tssf.clear();
106  return tvf;
107 }
108 
109 
110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
111 
112 } // End namespace fvc
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 } // End namespace Foam
117 
118 // ************************************************************************* //
Mesh data needed to do the Finite Volume discretisation.
Definition: volMesh.H:47
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Foam::surfaceFields.
const surfaceVectorField & Sf() const
Return cell face area vectors.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
tmp< GeometricField< Type, fvPatchField, volMesh > > surfaceSum(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
const fileName & instance() const
Definition: IOobject.H:337
const Mesh & mesh() const
Return mesh.
dynamicFvMesh & mesh
Namespace for OpenFOAM.
This boundary condition applies a zero-gradient condition from the patch internal field onto the patc...
typeOfRank< typename pTraits< arg1 >::cmptType, int(pTraits< arg1 >::rank)+int(pTraits< arg2 >::rank) >::type type
Definition: products.H:72
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField...
Reconstruct volField from a face flux field.
const word & name() const
Return name.
Definition: IOobject.H:260
Generic GeometricField class.
A class for managing temporary objects.
Definition: PtrList.H:118