Removed unneeded lib dependency from mdInitialise
[foam-extend-3.2.git] / applications / solvers / DNS / dnsFoam / dnsFoam.C
blob704d969dcb0ee037b22f18da8c5ef069307c63b8
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Application
26     dnsFoam
28 Description
29     Direct numerical simulation solver for boxes of isotropic turbulence
31 \*---------------------------------------------------------------------------*/
33 #include "fvCFD.H"
34 #include "Kmesh.H"
35 #include "UOprocess.H"
36 #include "fft.H"
37 #include "calcEk.H"
38 #include "graph.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 int main(int argc, char *argv[])
44     #include "setRootCase.H"
46     #include "createTime.H"
47     #include "createMeshNoClear.H"
48     #include "readTransportProperties.H"
49     #include "createFields.H"
50     #include "readTurbulenceProperties.H"
51     #include "initContinuityErrs.H"
53     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55     Info<< nl << "Starting time loop" << endl;
57     while (runTime.loop())
58     {
59         Info<< "Time = " << runTime.timeName() << nl << endl;
61         #include "readPISOControls.H"
63         force.internalField() = ReImSum
64         (
65             fft::reverseTransform
66             (
67                 K/(mag(K) + 1.0e-6) ^ forceGen.newField(), K.nn()
68             )
69         );
71         #include "globalProperties.H"
73         fvVectorMatrix UEqn
74         (
75             fvm::ddt(U)
76           + fvm::div(phi, U)
77           - fvm::laplacian(nu, U)
78          ==
79             force
80         );
82         solve(UEqn == -fvc::grad(p));
85         // --- PISO loop
87         for (int corr=1; corr<=1; corr++)
88         {
89             volScalarField rUA = 1.0/UEqn.A();
91             U = rUA*UEqn.H();
92             phi = (fvc::interpolate(U) & mesh.Sf())
93                 + fvc::ddtPhiCorr(rUA, U, phi);
95             fvScalarMatrix pEqn
96             (
97                 fvm::laplacian(rUA, p) == fvc::div(phi)
98             );
100             pEqn.solve();
102             phi -= pEqn.flux();
104 #           include "continuityErrs.H"
106             U -= rUA*fvc::grad(p);
107             U.correctBoundaryConditions();
108         }
110         runTime.write();
112         if (runTime.outputTime())
113         {
114             calcEk(U, K).write(runTime.timePath()/"Ek", runTime.graphFormat());
115         }
117         Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
118             << "  ClockTime = " << runTime.elapsedClockTime() << " s"
119             << nl << endl;
120     }
122     Info<< "End\n" << endl;
124     return 0;
128 // ************************************************************************* //