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-2018 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  mesh,
79  )
80  );
81 
82  if (!mesh.nGeometricD())
83  {
84  return treconField;
85  }
86 
87  treconField.ref() = inv(surfaceSum(SfHat*mesh.Sf()))&surfaceSum(SfHat*ssf),
88 
89  treconField.ref().correctBoundaryConditions();
90 
91  return treconField;
92 }
93 
94 
95 template<class Type>
96 tmp
97 <
99  <
100  typename outerProduct<vector, Type>::type, fvPatchField, volMesh
101  >
102 >
104 (
106 )
107 {
108  typedef typename outerProduct<vector, Type>::type GradType;
110  (
111  fvc::reconstruct(tssf())
112  );
113  tssf.clear();
114  return tvf;
115 }
116 
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 } // End namespace fvc
121 
122 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
123 
124 } // End namespace Foam
125 
126 // ************************************************************************* //
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:297
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:818
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)
const fileName & instance() const
Definition: IOobject.H:392
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
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:57
Namespace for OpenFOAM.