fvcReconstruct.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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  "volIntegrate("+ssf.name()+')',
69  mesh,
72  )
73  );
74 
75  if (!mesh.nGeometricD())
76  {
77  return treconField;
78  }
79 
80  treconField.ref() = inv(surfaceSum(SfHat*mesh.Sf()))&surfaceSum(SfHat*ssf),
81 
82  treconField.ref().correctBoundaryConditions();
83 
84  return treconField;
85 }
86 
87 
88 template<class Type>
89 tmp
90 <
92  <
93  typename outerProduct<vector, Type>::type, fvPatchField, volMesh
94  >
95 >
97 (
99 )
100 {
101  typedef typename outerProduct<vector, Type>::type GradType;
103  (
104  fvc::reconstruct(tssf())
105  );
106  tssf.clear();
107  return tvf;
108 }
109 
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 } // End namespace fvc
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 } // End namespace Foam
118 
119 // ************************************************************************* //
Foam::surfaceFields.
Surface integrate surfaceField creating a volField. Surface sum a surfaceField creating a volField...
const surfaceVectorField & Sf() const
Return cell face area vectors.
const word & name() const
Return name.
Definition: IOobject.H:303
T & ref() const
Return non-const reference or generate a fatal error.
Definition: tmpI.H:174
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
Reconstruct volField from a face flux field.
typeOfRank< typename pTraits< arg1 >::cmptType, direction(pTraits< arg1 >::rank)+direction(pTraits< arg2 >::rank) >::type type
Definition: products.H:90
Generic GeometricField class.
Generic dimensioned Type class.
label nGeometricD() const
Return the number of valid geometric dimensions in the mesh.
Definition: polyMesh.C:825
const dimensionSet & dimensions() const
Return dimensions.
Mesh data needed to do the Finite Volume discretisation.
Definition: volMesh.H:53
dynamicFvMesh & mesh
static const zero Zero
Definition: zero.H:97
This boundary condition applies a zero-gradient condition from the patch internal field onto the patc...
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
const Mesh & mesh() const
Return mesh.
tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh >> reconstruct(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
tmp< GeometricField< Type, fvPatchField, volMesh > > surfaceSum(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
A class for managing temporary objects.
Definition: PtrList.H:53
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:57
Namespace for OpenFOAM.