LESModel.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 #include "LESModel.H"
00028 #include "addToRunTimeSelectionTable.H"
00029
00030
00031
00032 namespace Foam
00033 {
00034 namespace compressible
00035 {
00036
00037
00038
00039 defineTypeNameAndDebug(LESModel, 0);
00040 defineRunTimeSelectionTable(LESModel, dictionary);
00041 addToRunTimeSelectionTable(turbulenceModel, LESModel, turbulenceModel);
00042
00043
00044
00045 void LESModel::printCoeffs()
00046 {
00047 if (printCoeffs_)
00048 {
00049 Info<< type() << "Coeffs" << coeffDict_ << endl;
00050 }
00051 }
00052
00053
00054
00055
00056 LESModel::LESModel
00057 (
00058 const word& type,
00059 const volScalarField& rho,
00060 const volVectorField& U,
00061 const surfaceScalarField& phi,
00062 const basicThermo& thermoPhysicalModel
00063 )
00064 :
00065 turbulenceModel(rho, U, phi, thermoPhysicalModel),
00066
00067 IOdictionary
00068 (
00069 IOobject
00070 (
00071 "LESProperties",
00072 U.time().constant(),
00073 U.db(),
00074 IOobject::MUST_READ,
00075 IOobject::NO_WRITE
00076 )
00077 ),
00078
00079 printCoeffs_(lookupOrDefault<Switch>("printCoeffs", false)),
00080 coeffDict_(subDictPtr(type + "Coeffs")),
00081
00082 k0_("k0", dimVelocity*dimVelocity, SMALL),
00083
00084 delta_(LESdelta::New("delta", U.mesh(), *this))
00085 {
00086 readIfPresent("k0", k0_);
00087 }
00088
00089
00090
00091
00092 autoPtr<LESModel> LESModel::New
00093 (
00094 const volScalarField& rho,
00095 const volVectorField& U,
00096 const surfaceScalarField& phi,
00097 const basicThermo& thermoPhysicalModel
00098 )
00099 {
00100 word modelName;
00101
00102
00103
00104
00105 {
00106 IOdictionary dict
00107 (
00108 IOobject
00109 (
00110 "LESProperties",
00111 U.time().constant(),
00112 U.db(),
00113 IOobject::MUST_READ,
00114 IOobject::NO_WRITE
00115 )
00116 );
00117
00118 dict.lookup("LESModel") >> modelName;
00119 }
00120
00121 Info<< "Selecting LES turbulence model " << modelName << endl;
00122
00123 dictionaryConstructorTable::iterator cstrIter =
00124 dictionaryConstructorTablePtr_->find(modelName);
00125
00126 if (cstrIter == dictionaryConstructorTablePtr_->end())
00127 {
00128 FatalErrorIn
00129 (
00130 "LESModel::New(const volVectorField& U, const "
00131 "surfaceScalarField& phi, const basicThermo&)"
00132 ) << "Unknown LESModel type " << modelName
00133 << endl << endl
00134 << "Valid LESModel types are :" << endl
00135 << dictionaryConstructorTablePtr_->toc()
00136 << exit(FatalError);
00137 }
00138
00139 return autoPtr<LESModel>(cstrIter()(rho, U, phi, thermoPhysicalModel));
00140 }
00141
00142
00143
00144
00145 void LESModel::correct(const tmp<volTensorField>&)
00146 {
00147 delta_().correct();
00148 }
00149
00150
00151 void LESModel::correct()
00152 {
00153 correct(fvc::grad(U_));
00154 }
00155
00156
00157 bool LESModel::read()
00158 {
00159 if (regIOobject::read())
00160 {
00161 if (const dictionary* dictPtr = subDictPtr(type() + "Coeffs"))
00162 {
00163 coeffDict_ <<= *dictPtr;
00164 }
00165
00166 readIfPresent("k0", k0_);
00167
00168 delta_().read(*this);
00169
00170 return true;
00171 }
00172 else
00173 {
00174 return false;
00175 }
00176 }
00177
00178
00179
00180
00181 }
00182 }
00183
00184
Copyright © 2000-2009 OpenCFD Ltd