facAverage.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-------------------------------------------------------------------------------
10License
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 "facAverage.H"
29#include "facEdgeIntegrate.H"
30#include "faMesh.H"
31
32// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33
34namespace Foam
35{
36
37// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
38
39namespace fac
40{
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44template<class Type>
47(
49)
50{
51 const faMesh& mesh = ssf.mesh();
52
54 (
56 (
58 (
59 "average("+ssf.name()+')',
60 ssf.instance(),
61 mesh(),
64 ),
65 mesh,
66 ssf.dimensions()
67 )
68 );
69
71
72 av.ref() =
73 (
74 edgeSum(mesh.magLe()*ssf)/edgeSum(mesh.magLe())
75 )().internalField();
76
77 forAll(av.boundaryField(), patchi)
78 {
79 av.boundaryFieldRef()[patchi] = ssf.boundaryField()[patchi];
80 }
81
83
84 return taverage;
85}
86
87
88template<class Type>
91(
93)
94{
96 (
97 fac::average(tssf())
98 );
99 tssf.clear();
100 return taverage;
101}
102
103
104template<class Type>
107(
109)
110{
112}
113
114
115template<class Type>
118(
120)
121{
123 (
124 fac::average(tvtf())
125 );
126 tvtf.clear();
127 return taverage;
128}
129
130
131// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132
133} // End namespace fac
134
135// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136
137} // End namespace Foam
138
139// ************************************************************************* //
const dimensionSet & dimensions() const
Return dimensions.
const Mesh & mesh() const
Return mesh.
Generic GeometricField class.
Boundary & boundaryFieldRef(const bool updateAccessTime=true)
Return a reference to the boundary field.
Internal & ref(const bool updateAccessTime=true)
Return a reference to the dimensioned internal field.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
void correctBoundaryConditions()
Correct boundary field.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Definition: IOobject.H:170
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:65
const fileName & instance() const noexcept
Read access to instance path component.
Definition: IOobjectI.H:196
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:100
A class for managing temporary objects.
Definition: tmp.H:65
T & ref() const
Definition: tmpI.H:227
dynamicFvMesh & mesh
Edge-weighted average a edgeField creating a areaField.
Edge integrate edgeField creating a areaField. Edge sum a edgeField creating a areaField.
tmp< GeometricField< Type, faPatchField, areaMesh > > edgeSum(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
tmp< GeometricField< Type, faPatchField, areaMesh > > average(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
Area-weighted average a edgeField creating a areaField.
Definition: facAverage.C:47
Namespace for OpenFOAM.
tmp< GeometricField< Type, faePatchField, edgeMesh > > linearEdgeInterpolate(const GeometricField< Type, faPatchField, areaMesh > &vf)
Calculate the second temporal derivative.
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:333