Forward compatibility: flex
[foam-extend-3.2.git] / applications / utilities / postProcessing / velocityField / Mach / thermophysicalMach.H
blob0bce8f98b5277dcbbf8180ac9fd7f8dc206a353a
1     for (label i=startTime; i<endTime; i++)
2     {
3         runTime.setTime(Times[i], i);
5         Info<< "Time = " << runTime.timeName() << endl;
7         mesh.readUpdate();
9         IOobject Uheader
10         (
11             "U",
12             runTime.timeName(),
13             mesh,
14             IOobject::MUST_READ
15         );
17         if (Uheader.headerOk())
18         {
19             volVectorField U(Uheader, mesh);
21             autoPtr<basicPsiThermo> thermo
22             (
23                 basicPsiThermo::New(mesh)
24             );
26             volScalarField Cp = thermo->Cp();
27             volScalarField Cv = thermo->Cv();
29             volScalarField Ma
30             (
31                 IOobject
32                 (
33                     "Ma",
34                     runTime.timeName(),
35                     mesh
36                 ),
37                 mag(U)/(sqrt((Cp/Cv)*(Cp - Cv)*thermo->T()))
38             );
40             Info << "Max Mach number: " << max(Ma.internalField()) << endl;
41             Ma.write();
42         }
43         else
44         {
45             Info<< "    No U" << endl;
46         }
47     }