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