OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

basicXiSubXiEq.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 \*---------------------------------------------------------------------------*/
00026 
00027 #include "basicXiSubXiEq.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 
00030 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 namespace XiEqModels
00035 {
00036     defineTypeNameAndDebug(basicSubGrid, 0);
00037     addToRunTimeSelectionTable(XiEqModel, basicSubGrid, dictionary);
00038 };
00039 };
00040 
00041 
00042 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00043 
00044 Foam::XiEqModels::basicSubGrid::basicSubGrid
00045 (
00046     const dictionary& XiEqProperties,
00047     const hhuCombustionThermo& thermo,
00048     const compressible::RASModel& turbulence,
00049     const volScalarField& Su
00050 )
00051 :
00052     XiEqModel(XiEqProperties, thermo, turbulence, Su),
00053 
00054     N_
00055     (
00056         IOobject
00057         (
00058             "N",
00059             Su.mesh().time().findInstance(polyMesh::meshSubDir, "N"),
00060             polyMesh::meshSubDir,
00061             Su.mesh(),
00062             IOobject::MUST_READ,
00063             IOobject::NO_WRITE
00064         ),
00065         Su.mesh()
00066     ),
00067 
00068     ns_
00069     (
00070         IOobject
00071         (
00072             "ns",
00073             Su.mesh().time().findInstance(polyMesh::meshSubDir, "ns"),
00074             polyMesh::meshSubDir,
00075             Su.mesh(),
00076             IOobject::MUST_READ,
00077             IOobject::NO_WRITE
00078         ),
00079         Su.mesh()
00080     ),
00081 
00082     B_
00083     (
00084         IOobject
00085         (
00086             "B",
00087             Su.mesh().time().findInstance(polyMesh::meshSubDir, "B"),
00088             polyMesh::meshSubDir,
00089             Su.mesh(),
00090             IOobject::MUST_READ,
00091             IOobject::NO_WRITE
00092         ),
00093         Su.mesh()
00094     ),
00095 
00096     Lobs_
00097     (
00098         IOobject
00099         (
00100             "Lobs",
00101             Su.mesh().time().findInstance(polyMesh::meshSubDir, "Lobs"),
00102             polyMesh::meshSubDir,
00103             Su.mesh(),
00104             IOobject::MUST_READ,
00105             IOobject::NO_WRITE
00106         ),
00107         Su.mesh()
00108     ),
00109 
00110     XiEqModel_(XiEqModel::New(XiEqModelCoeffs_, thermo, turbulence, Su))
00111 {}
00112 
00113 
00114 // * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
00115 
00116 Foam::XiEqModels::basicSubGrid::~basicSubGrid()
00117 {}
00118 
00119 
00120 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
00121 
00122 Foam::tmp<Foam::volScalarField> Foam::XiEqModels::basicSubGrid::XiEq() const
00123 {
00124     const objectRegistry& db = Su_.db();
00125     const volVectorField& U = db.lookupObject<volVectorField>("U");
00126 
00127     volScalarField magU = mag(U);
00128     volVectorField Uhat =
00129     U/(mag(U) + dimensionedScalar("Usmall", U.dimensions(), 1e-4));
00130 
00131     volScalarField n = max(N_ - (Uhat & ns_ & Uhat), scalar(1e-4));
00132 
00133     volScalarField b = (Uhat & B_ & Uhat)/n;
00134 
00135     volScalarField up = sqrt((2.0/3.0)*turbulence_.k());
00136 
00137     volScalarField XiSubEq =
00138         scalar(1)
00139       + max(2.2*sqrt(b), min(0.34*magU/up, scalar(1.6)))
00140        *min(0.25*n, scalar(1));
00141 
00142     return XiSubEq*XiEqModel_->XiEq();
00143 }
00144 
00145 
00146 bool Foam::XiEqModels::basicSubGrid::read(const dictionary& XiEqProperties)
00147 {
00148     XiEqModel::read(XiEqProperties);
00149 
00150     return XiEqModel_->read(XiEqModelCoeffs_);
00151 }
00152 
00153 
00154 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd