This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/utilities/postProcessing/velocityField/Mach/thermophysicalMach.H

48 lines
1.1 KiB
C++
Raw Normal View History

for (label i=startTime; i<endTime; i++)
{
runTime.setTime(Times[i], i);
Info<< "Time = " << runTime.timeName() << endl;
mesh.readUpdate();
IOobject Uheader
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ
);
if (Uheader.headerOk())
{
volVectorField U(Uheader, mesh);
2010-08-26 14:22:03 +00:00
autoPtr<basicPsiThermo> thermo
(
2010-08-26 14:22:03 +00:00
basicPsiThermo::New(mesh)
);
volScalarField Cp = thermo->Cp();
volScalarField Cv = thermo->Cv();
volScalarField Ma
(
IOobject
(
"Ma",
runTime.timeName(),
mesh
),
mag(U)/(sqrt((Cp/Cv)*(Cp - Cv)*thermo->T()))
);
Info << "Max Mach number: " << max(Ma.internalField()) << endl;
Ma.write();
}
else
{
Info<< " No U" << endl;
}
}