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 #include "calc.H"
00039
00040 #include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
00041
00042 #include "incompressible/RAS/RASModel/RASModel.H"
00043 #include "incompressible/LES/LESModel/LESModel.H"
00044
00045 #include "basicPsiThermo.H"
00046 #include "compressible/RAS/RASModel/RASModel.H"
00047 #include "compressible/LES/LESModel/LESModel.H"
00048
00049
00050
00051
00052 namespace Foam
00053 {
00054 void execFlowFunctionObjects(const argList& args, const Time& runTime)
00055 {
00056 if (args.optionFound("dict"))
00057 {
00058 IOdictionary dict
00059 (
00060 IOobject
00061 (
00062 args.option("dict"),
00063 runTime.system(),
00064 runTime,
00065 IOobject::MUST_READ
00066 )
00067 );
00068
00069 functionObjectList fol(runTime, dict);
00070 fol.start();
00071 fol.execute();
00072 }
00073 else
00074 {
00075 functionObjectList fol(runTime);
00076 fol.start();
00077 fol.execute();
00078 }
00079 }
00080 }
00081
00082
00083
00084
00085 void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
00086 {
00087 Info<< " Reading phi" << endl;
00088 surfaceScalarField phi
00089 (
00090 IOobject
00091 (
00092 "phi",
00093 runTime.timeName(),
00094 mesh,
00095 IOobject::MUST_READ
00096 ),
00097 mesh
00098 );
00099
00100 Info<< " Reading U" << endl;
00101 volVectorField U
00102 (
00103 IOobject
00104 (
00105 "U",
00106 runTime.timeName(),
00107 mesh,
00108 IOobject::MUST_READ
00109 ),
00110 mesh
00111 );
00112
00113 Info<< " Reading p" << endl;
00114 volScalarField p
00115 (
00116 IOobject
00117 (
00118 "p",
00119 runTime.timeName(),
00120 mesh,
00121 IOobject::MUST_READ
00122 ),
00123 mesh
00124 );
00125
00126 if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
00127 {
00128 IOobject RASPropertiesHeader
00129 (
00130 "RASProperties",
00131 runTime.constant(),
00132 mesh,
00133 IOobject::MUST_READ,
00134 IOobject::NO_WRITE,
00135 false
00136 );
00137
00138 IOobject LESPropertiesHeader
00139 (
00140 "LESProperties",
00141 runTime.constant(),
00142 mesh,
00143 IOobject::MUST_READ,
00144 IOobject::NO_WRITE,
00145 false
00146 );
00147
00148 singlePhaseTransportModel laminarTransport(U, phi);
00149
00150 if (RASPropertiesHeader.headerOk())
00151 {
00152 IOdictionary RASProperties(RASPropertiesHeader);
00153
00154 autoPtr<incompressible::RASModel> RASModel
00155 (
00156 incompressible::RASModel::New
00157 (
00158 U,
00159 phi,
00160 laminarTransport
00161 )
00162 );
00163 execFlowFunctionObjects(args, runTime);
00164 }
00165 else if (LESPropertiesHeader.headerOk())
00166 {
00167 IOdictionary LESProperties(LESPropertiesHeader);
00168
00169 autoPtr<incompressible::LESModel> sgsModel
00170 (
00171 incompressible::LESModel::New(U, phi, laminarTransport)
00172 );
00173
00174 execFlowFunctionObjects(args, runTime);
00175 }
00176 else
00177 {
00178 IOdictionary transportProperties
00179 (
00180 IOobject
00181 (
00182 "transportProperties",
00183 runTime.constant(),
00184 mesh,
00185 IOobject::MUST_READ,
00186 IOobject::NO_WRITE
00187 )
00188 );
00189
00190 dimensionedScalar nu(transportProperties.lookup("nu"));
00191
00192 execFlowFunctionObjects(args, runTime);
00193 }
00194 }
00195 else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0))
00196 {
00197 autoPtr<basicPsiThermo> thermo(basicPsiThermo::New(mesh));
00198
00199 volScalarField rho
00200 (
00201 IOobject
00202 (
00203 "rho",
00204 runTime.timeName(),
00205 mesh
00206 ),
00207 thermo->rho()
00208 );
00209
00210 IOobject RASPropertiesHeader
00211 (
00212 "RASProperties",
00213 runTime.constant(),
00214 mesh,
00215 IOobject::MUST_READ,
00216 IOobject::NO_WRITE,
00217 false
00218 );
00219
00220 IOobject LESPropertiesHeader
00221 (
00222 "LESProperties",
00223 runTime.constant(),
00224 mesh,
00225 IOobject::MUST_READ,
00226 IOobject::NO_WRITE,
00227 false
00228 );
00229
00230 if (RASPropertiesHeader.headerOk())
00231 {
00232 IOdictionary RASProperties(RASPropertiesHeader);
00233
00234 autoPtr<compressible::RASModel> RASModel
00235 (
00236 compressible::RASModel::New
00237 (
00238 rho,
00239 U,
00240 phi,
00241 thermo()
00242 )
00243 );
00244
00245 execFlowFunctionObjects(args, runTime);
00246 }
00247 else if (LESPropertiesHeader.headerOk())
00248 {
00249 IOdictionary LESProperties(LESPropertiesHeader);
00250
00251 autoPtr<compressible::LESModel> sgsModel
00252 (
00253 compressible::LESModel::New(rho, U, phi, thermo())
00254 );
00255
00256 execFlowFunctionObjects(args, runTime);
00257 }
00258 else
00259 {
00260 IOdictionary transportProperties
00261 (
00262 IOobject
00263 (
00264 "transportProperties",
00265 runTime.constant(),
00266 mesh,
00267 IOobject::MUST_READ,
00268 IOobject::NO_WRITE
00269 )
00270 );
00271
00272 dimensionedScalar mu(transportProperties.lookup("mu"));
00273
00274 execFlowFunctionObjects(args, runTime);
00275 }
00276 }
00277 else
00278 {
00279 FatalErrorIn(args.executable())
00280 << "Incorrect dimensions of phi: " << phi.dimensions()
00281 << nl << exit(FatalError);
00282 }
00283 }
00284
00285
00286