facEdgeIntegrate.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016-2017 Wikki Ltd
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "facEdgeIntegrate.H"
29 #include "faMesh.H"
31 
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38 
39 namespace fac
40 {
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 template<class Type>
45 tmp<GeometricField<Type, faPatchField, areaMesh>>
47 (
49 )
50 {
51  const faMesh& mesh = ssf.mesh();
52 
54  (
56  (
57  IOobject
58  (
59  "edgeIntegrate("+ssf.name()+')',
60  ssf.instance(),
61  ssf.db()
62  ),
63  mesh,
64  dimensioned<Type>(ssf.dimensions()/dimArea, Zero),
66  )
67  );
69 
70 
71  const labelUList& owner = mesh.owner();
72  const labelUList& neighbour = mesh.neighbour();
73 
74  forAll(owner, faceI)
75  {
76  vf[owner[faceI]] += ssf[faceI];
77  vf[neighbour[faceI]] -= ssf[faceI];
78  }
79 
80  forAll(mesh.boundary(), patchI)
81  {
82  const labelUList& pEdgeFaces =
83  mesh.boundary()[patchI].edgeFaces();
84 
85  const faePatchField<Type>& pssf = ssf.boundaryField()[patchI];
86 
87  forAll(mesh.boundary()[patchI], faceI)
88  {
89  vf[pEdgeFaces[faceI]] += pssf[faceI];
90  }
91  }
92 
93  vf.primitiveFieldRef() /= mesh.S();
94  vf.correctBoundaryConditions();
95 
96  return tvf;
97 }
98 
99 
100 template<class Type>
103 (
105 )
106 {
108  (
109  fac::edgeIntegrate(tssf())
110  );
111  tssf.clear();
112  return tvf;
113 }
114 
115 
116 template<class Type>
118 edgeSum
119 (
121 )
122 {
123  const faMesh& mesh = ssf.mesh();
124 
126  (
128  (
129  IOobject
130  (
131  "edgeSum("+ssf.name()+')',
132  ssf.instance(),
133  ssf.db()
134  ),
135  mesh,
136  dimensioned<Type>(ssf.dimensions(), Zero),
138  )
139  );
141 
142  const labelUList& owner = mesh.owner();
143  const labelUList& neighbour = mesh.neighbour();
144 
145  forAll(owner, faceI)
146  {
147  vf[owner[faceI]] += ssf[faceI];
148  vf[neighbour[faceI]] += ssf[faceI];
149  }
150 
151  forAll(mesh.boundary(), patchI)
152  {
153  const labelUList& pEdgeFaces =
154  mesh.boundary()[patchI].edgeFaces();
155 
156  const faePatchField<Type>& pssf = ssf.boundaryField()[patchI];
157 
158  forAll(mesh.boundary()[patchI], faceI)
159  {
160  vf[pEdgeFaces[faceI]] += pssf[faceI];
161  }
162  }
163 
164  vf.correctBoundaryConditions();
165 
166  return tvf;
167 }
168 
169 
170 template<class Type>
172 (
174 )
175 {
177  edgeSum(tssf());
178  tssf.clear();
179  return tvf;
180 }
181 
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 } // End namespace fac
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 } // End namespace Foam
190 
191 // ************************************************************************* //
Foam::zeroGradientFaPatchField
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
Definition: zeroGradientFaPatchField.H:55
Foam::IOobject
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:169
Foam::faePatchField
faePatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cove...
Definition: edgeFieldsFwd.H:49
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
faMesh.H
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
facEdgeIntegrate.H
Edge integrate edgeField creating a areaField. Edge sum a edgeField creating a areaField.
Foam::dimArea
const dimensionSet dimArea(sqr(dimLength))
Definition: dimensionSets.H:59
Foam::fac::edgeIntegrate
tmp< GeometricField< Type, faPatchField, areaMesh > > edgeIntegrate(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facEdgeIntegrate.C:47
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:42
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
fac
Calculate the second temporal derivative.
zeroGradientFaPatchFields.H
Foam::GeometricField::ref
Internal & ref(const bool updateAccessTime=true)
Return a reference to the dimensioned internal field.
Definition: GeometricField.C:749
Foam::fac::edgeSum
tmp< GeometricField< Type, faPatchField, areaMesh > > edgeSum(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Definition: facEdgeIntegrate.C:119
Foam::UList< label >
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:82
Foam::GeometricField
Generic GeometricField class.
Definition: areaFieldsFwd.H:53
Foam::GeometricField::boundaryField
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Definition: GeometricFieldI.H:62