Mach.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #include "calc.H"
00037 #include "basicPsiThermo.H"
00038
00039
00040 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
00041 {
00042 bool writeResults = !args.optionFound("noWrite");
00043
00044 IOobject Uheader
00045 (
00046 "U",
00047 runTime.timeName(),
00048 mesh,
00049 IOobject::MUST_READ
00050 );
00051
00052 IOobject Theader
00053 (
00054 "T",
00055 runTime.timeName(),
00056 mesh,
00057 IOobject::MUST_READ
00058 );
00059
00060
00061 if (Uheader.headerOk() && Theader.headerOk())
00062 {
00063 autoPtr<volScalarField> MachPtr;
00064
00065 volVectorField U(Uheader, mesh);
00066
00067 if (isFile(runTime.constantPath()/"thermophysicalProperties"))
00068 {
00069
00070 autoPtr<basicPsiThermo> thermo
00071 (
00072 basicPsiThermo::New(mesh)
00073 );
00074
00075 volScalarField Cp = thermo->Cp();
00076 volScalarField Cv = thermo->Cv();
00077
00078 MachPtr.set
00079 (
00080 new volScalarField
00081 (
00082 IOobject
00083 (
00084 "Ma",
00085 runTime.timeName(),
00086 mesh
00087 ),
00088 mag(U)/(sqrt((Cp/Cv)*(Cp - Cv)*thermo->T()))
00089 )
00090 );
00091 }
00092 else
00093 {
00094
00095 IOdictionary thermoProps
00096 (
00097 IOobject
00098 (
00099 "thermodynamicProperties",
00100 runTime.constant(),
00101 mesh,
00102 IOobject::MUST_READ,
00103 IOobject::NO_WRITE
00104 )
00105 );
00106
00107 dimensionedScalar R(thermoProps.lookup("R"));
00108 dimensionedScalar Cv(thermoProps.lookup("Cv"));
00109
00110 volScalarField T(Theader, mesh);
00111
00112 MachPtr.set
00113 (
00114 new volScalarField
00115 (
00116 IOobject
00117 (
00118 "Ma",
00119 runTime.timeName(),
00120 mesh
00121 ),
00122 mag(U)/(sqrt(((Cv + R)/Cv)*R*T))
00123 )
00124 );
00125 }
00126
00127 Info<< "Mach max : " << max(MachPtr()).value() << endl;
00128
00129 if (writeResults)
00130 {
00131 MachPtr().write();
00132 }
00133 }
00134 else
00135 {
00136 Info<< " Missing U or T" << endl;
00137 }
00138
00139 Info<< "\nEnd\n" << endl;
00140 }
00141
00142
00143
Copyright © 2000-2009 OpenCFD Ltd