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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 if (mesh.time().timeIndex() % vacf.sampleSteps() == 0)
30 {
31  Field<vector> uVals(molecules.size());
32 
33  label uV = 0;
34 
35  for (const molecule& mol : molecules)
36  {
37  uVals[uV] = mol.U();
38 
39  ++uV;
40  }
41 
42  vacf.calculateCorrelationFunction(uVals);
43 }
44 
45 if (mesh.time().timeIndex() % pacf.sampleSteps() == 0)
46 {
47  vector p = Zero;
48 
49  for (const molecule& mol : molecules)
50  {
51  p.x() +=
52  mol.mass() * mol.U().y() * mol.U().z()
53  + 0.5*mol.rf().yz();
54 
55  p.y() +=
56  mol.mass() * mol.U().z() * mol.U().x()
57  + 0.5*mol.rf().zx();
58 
59  p.z() +=
60  mol.mass() * mol.U().x() * mol.U().y()
61  + 0.5*mol.rf().xy();
62  }
63 
64  pacf.calculateCorrelationFunction(p);
65 }
66 
67 if (mesh.time().timeIndex() % hfacf.sampleSteps() == 0)
68 {
69  vector s = Zero;
70 
71  for (const molecule& mol : molecules)
72  {
73  s +=
74  (
75  0.5*mol.mass()*magSqr(mol.U())
76  + mol.potentialEnergy()
77  )*mol.U()
78  + 0.5*(mol.rf() & mol.U());
79  }
80 
81  hfacf.calculateCorrelationFunction(s);
82 }
p
volScalarField & p
Definition: createFieldRefs.H:8
s
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Definition: gmvOutputSpray.H:25
Foam::Zero
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:131
pacf
Info<< tab<< "pressure"<< endl;const dictionary &pressureACFDict(autocorrelationFunctionDict.subDict("pressure"));correlationFunction< vector > pacf(mesh, pressureACFDict, 1)
Pressure autocorrelation function.
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
hfacf
Info<< tab<< "heat flux"<< endl;const dictionary &heatFluxACFDict(autocorrelationFunctionDict.subDict("heatFlux"));correlationFunction< vector > hfacf(mesh, heatFluxACFDict, 1)
Heat flux autocorrelation function.
vacf
Info<< nl<< "Creating autocorrelation functions."<< endl;IOdictionary mdTransportProperitesDict(IOobject("mdTransportProperitesDict", mesh.time().system(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE, false));const dictionary &autocorrelationFunctionDict(mdTransportProperitesDict.subDict("autocorrelationFunctions"));Info<< tab<< "velocty"<< endl;const dictionary &velocityACFDict(autocorrelationFunctionDict.subDict("velocity"));correlationFunction< vector > vacf(mesh, velocityACFDict, molecules.size())