1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
28 Test cloud of passive particles.
30 \*---------------------------------------------------------------------------*/
33 #include "passiveParticleCloud.H"
35 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 int main(int argc, char *argv[])
39 argList::validArgs.append("cloudName");
40 #include "setRootCase.H"
41 #include "createTime.H"
42 #include "createMesh.H"
43 runTime.functionObjects().off();
45 const word cloudName = args[1];
48 // Start with empty cloud
49 passiveParticleCloud particles
53 IDLList<passiveParticle>()
55 Pout<< "Starting particles:" << particles.size() << endl;
57 Pout<< "Adding a particle." << endl;
58 particles.addParticle(new passiveParticle(mesh, vector::zero, -1));
60 forAllConstIter(passiveParticleCloud, particles, iter)
62 Pout<< " " << iter().position() << " cell:" << iter().cell()
63 << " origProc:" << iter().origProc()
64 << " origId:" << iter().origId()
68 Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
69 << " ClockTime = " << runTime.elapsedClockTime() << " s"
73 Pout<< "Writing particles to time " << runTime.timeName() << endl;
78 Pout<< "Rereading particles from time " << runTime.timeName()
80 passiveParticleCloud particles(mesh, cloudName);
81 Pout<< "Reread particles:" << particles.size() << endl;
83 forAllConstIter(passiveParticleCloud, particles, iter)
85 Pout<< " " << iter().position() << " cell:" << iter().cell()
86 << " origProc:" << iter().origProc()
87 << " origId:" << iter().origId()
93 Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
94 << " ClockTime = " << runTime.elapsedClockTime() << " s"
98 Info<< "End\n" << endl;
104 // ************************************************************************* //