BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / applications / solvers / DNS / dnsFoam / dnsFoam.C
blob8eabdce99f8f9fca9211fc59fefcc4ef826ace7a
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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/>.
24 Application
25     dnsFoam
27 Description
28     Direct numerical simulation solver for boxes of isotropic turbulence
30 \*---------------------------------------------------------------------------*/
32 #include "fvCFD.H"
33 #include "Kmesh.H"
34 #include "UOprocess.H"
35 #include "fft.H"
36 #include "calcEk.H"
37 #include "graph.H"
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 int main(int argc, char *argv[])
43     #include "setRootCase.H"
45     #include "createTime.H"
46     #include "createMeshNoClear.H"
47     #include "readTransportProperties.H"
48     #include "createFields.H"
49     #include "readTurbulenceProperties.H"
50     #include "initContinuityErrs.H"
52     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54     Info<< nl << "Starting time loop" << endl;
56     while (runTime.loop())
57     {
58         Info<< "Time = " << runTime.timeName() << nl << endl;
60         #include "readPISOControls.H"
62         force.internalField() = ReImSum
63         (
64             fft::reverseTransform
65             (
66                 K/(mag(K) + 1.0e-6) ^ forceGen.newField(), K.nn()
67             )
68         );
70         #include "globalProperties.H"
72         fvVectorMatrix UEqn
73         (
74             fvm::ddt(U)
75           + fvm::div(phi, U)
76           - fvm::laplacian(nu, U)
77          ==
78             force
79         );
81         solve(UEqn == -fvc::grad(p));
84         // --- PISO loop
86         for (int corr=1; corr<=1; corr++)
87         {
88             volScalarField rAU(1.0/UEqn.A());
90             U = rAU*UEqn.H();
91             phi = (fvc::interpolate(U) & mesh.Sf())
92                 + fvc::ddtPhiCorr(rAU, U, phi);
94             fvScalarMatrix pEqn
95             (
96                 fvm::laplacian(rAU, p) == fvc::div(phi)
97             );
99             pEqn.solve();
101             phi -= pEqn.flux();
103             #include "continuityErrs.H"
105             U -= rAU*fvc::grad(p);
106             U.correctBoundaryConditions();
107         }
109         runTime.write();
111         if (runTime.outputTime())
112         {
113             calcEk(U, K).write
114             (
115                 runTime.path()/"graphs"/runTime.timeName(),
116                 "Ek",
117                 runTime.graphFormat()
118             );
119         }
121         Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
122             << "  ClockTime = " << runTime.elapsedClockTime() << " s"
123             << nl << endl;
124     }
126     Info<< "End\n" << endl;
128     return 0;
132 // ************************************************************************* //