FreeFOAM The Cross-Platform CFD Toolkit
calculateAutoCorrelationFunctions.H
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) 2008-2010 OpenCFD Ltd.
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 if (mesh.time().timeIndex() % vacf.sampleSteps() == 0)
27 {
28  IDLList<molecule>::iterator mol(molecules.begin());
29 
30  Field<vector> uVals(molecules.size());
31 
32  label uV = 0;
33 
34  for
35  (
36  mol = molecules.begin();
37  mol != molecules.end();
38  ++mol, uV++
39  )
40  {
41  uVals[uV] = mol().U();
42  }
43 
44  vacf.calculateCorrelationFunction(uVals);
45 }
46 
47 if (mesh.time().timeIndex() % pacf.sampleSteps() == 0)
48 {
49  IDLList<molecule>::iterator mol(molecules.begin());
50 
51  vector p = vector::zero;
52 
53  for
54  (
55  mol = molecules.begin();
56  mol != molecules.end();
57  ++mol
58  )
59  {
60  p.x() +=
61  mol().mass() * mol().U().y() * mol().U().z()
62  + 0.5*mol().rf().yz();
63 
64  p.y() +=
65  mol().mass() * mol().U().z() * mol().U().x()
66  + 0.5*mol().rf().zx();
67 
68  p.z() +=
69  mol().mass() * mol().U().x() * mol().U().y()
70  + 0.5*mol().rf().xy();
71  }
72 
73  pacf.calculateCorrelationFunction(p);
74 }
75 
76 if (mesh.time().timeIndex() % hfacf.sampleSteps() == 0)
77 {
78 
79  IDLList<molecule>::iterator mol(molecules.begin());
80 
81  vector s = vector::zero;
82 
83  for
84  (
85  mol = molecules.begin();
86  mol != molecules.end();
87  ++mol
88  )
89  {
90  s +=
91  (
92  0.5*mol().mass()*magSqr(mol().U())
93  + mol().potentialEnergy()
94  )*mol().U()
95  + 0.5*(mol().rf() & mol().U());
96  }
97 
98  hfacf.calculateCorrelationFunction(s);
99 }
100 
101 // ************************ vim: set sw=4 sts=4 et: ************************ //