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 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050 
00051 
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 #include <postCalc/calc.H>
00073 #include <basicThermophysicalModels/basicPsiThermo.H>
00074 
00075 
00076 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
00077 {
00078     bool writeResults = !args.optionFound("noWrite");
00079 
00080     IOobject Uheader
00081     (
00082         "U",
00083         runTime.timeName(),
00084         mesh,
00085         IOobject::MUST_READ
00086     );
00087 
00088     IOobject Theader
00089     (
00090         "T",
00091         runTime.timeName(),
00092         mesh,
00093         IOobject::MUST_READ
00094     );
00095 
00096     
00097     if (Uheader.headerOk() && Theader.headerOk())
00098     {
00099         autoPtr<volScalarField> MachPtr;
00100 
00101         volVectorField U(Uheader, mesh);
00102 
00103         if
00104         (
00105             IOobject
00106             (
00107                 "thermophysicalProperties",
00108                 runTime.constant(),
00109                 mesh
00110             ).headerOk()
00111         )
00112         {
00113             
00114             autoPtr<basicPsiThermo> thermo
00115             (
00116                 basicPsiThermo::New(mesh)
00117             );
00118 
00119             volScalarField Cp = thermo->Cp();
00120             volScalarField Cv = thermo->Cv();
00121 
00122             MachPtr.set
00123             (
00124                 new volScalarField
00125                 (
00126                     IOobject
00127                     (
00128                         "Ma",
00129                         runTime.timeName(),
00130                         mesh
00131                     ),
00132                     mag(U)/(sqrt((Cp/Cv)*(Cp - Cv)*thermo->T()))
00133                 )
00134             );
00135         }
00136         else
00137         {
00138             
00139             IOdictionary thermoProps
00140             (
00141                 IOobject
00142                 (
00143                     "thermodynamicProperties",
00144                     runTime.constant(),
00145                     mesh,
00146                     IOobject::MUST_READ,
00147                     IOobject::NO_WRITE
00148                 )
00149             );
00150 
00151             dimensionedScalar R(thermoProps.lookup("R"));
00152             dimensionedScalar Cv(thermoProps.lookup("Cv"));
00153 
00154             volScalarField T(Theader, mesh);
00155 
00156             MachPtr.set
00157             (
00158                 new volScalarField
00159                 (
00160                     IOobject
00161                     (
00162                         "Ma",
00163                         runTime.timeName(),
00164                         mesh
00165                     ),
00166                     mag(U)/(sqrt(((Cv + R)/Cv)*R*T))
00167                 )
00168             );
00169         }
00170 
00171         Info<< "Mach max : " << max(MachPtr()).value() << endl;
00172 
00173         if (writeResults)
00174         {
00175             MachPtr().write();
00176         }
00177     }
00178     else
00179     {
00180         Info<< "    Missing U or T" << endl;
00181     }
00182 
00183     Info<< "\nEnd\n" << endl;
00184 }
00185 
00186 
00187