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

transport.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 "transport.H"
00028 #include "addToRunTimeSelectionTable.H"
00029 
00030 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
00031 
00032 namespace Foam
00033 {
00034 namespace XiModels
00035 {
00036     defineTypeNameAndDebug(transport, 0);
00037     addToRunTimeSelectionTable(XiModel, transport, dictionary);
00038 };
00039 };
00040 
00041 
00042 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
00043 
00044 Foam::XiModels::transport::transport
00045 (
00046     const dictionary& XiProperties,
00047     const hhuCombustionThermo& thermo,
00048     const compressible::RASModel& turbulence,
00049     const volScalarField& Su,
00050     const volScalarField& rho,
00051     const volScalarField& b,
00052     const surfaceScalarField& phi
00053 )
00054 :
00055     XiModel(XiProperties, thermo, turbulence, Su, rho, b, phi),
00056     XiShapeCoef(readScalar(XiModelCoeffs_.lookup("XiShapeCoef"))),
00057     XiEqModel_(XiEqModel::New(XiProperties, thermo, turbulence, Su)),
00058     XiGModel_(XiGModel::New(XiProperties, thermo, turbulence, Su))
00059 {}
00060 
00061 
00062 // * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
00063 
00064 Foam::XiModels::transport::~transport()
00065 {}
00066 
00067 
00068 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
00069 
00070 Foam::tmp<Foam::volScalarField> Foam::XiModels::transport::Db() const
00071 {
00072     return XiGModel_->Db();
00073 }
00074 
00075 
00076 void Foam::XiModels::transport::correct
00077 (
00078     const fv::convectionScheme<scalar>& mvConvection
00079 )
00080 {
00081     volScalarField XiEqEta = XiEqModel_->XiEq();
00082     volScalarField GEta = XiGModel_->G();
00083 
00084     volScalarField R = GEta*XiEqEta/(XiEqEta - 0.999);
00085 
00086     volScalarField XiEqStar = R/(R - GEta);
00087 
00088     volScalarField XiEq =
00089         1.0 + (1.0 + (2*XiShapeCoef)*(0.5 - b_))*(XiEqStar - 1.0);
00090 
00091     volScalarField G = R*(XiEq - 1.0)/XiEq;
00092 
00093     const objectRegistry& db = b_.db();
00094     const volScalarField& betav = db.lookupObject<volScalarField>("betav");
00095     const volScalarField& mgb = db.lookupObject<volScalarField>("mgb");
00096     const surfaceScalarField& phiSt =
00097         db.lookupObject<surfaceScalarField>("phiSt");
00098     const volScalarField& Db = db.lookupObject<volScalarField>("Db");
00099     const surfaceScalarField& nf = db.lookupObject<surfaceScalarField>("nf");
00100 
00101     surfaceScalarField phiXi
00102     (
00103         "phiXi",
00104         phiSt
00105       + (
00106           - fvc::interpolate(fvc::laplacian(Db, b_)/mgb)*nf
00107           + fvc::interpolate(rho_)*fvc::interpolate(Su_*(1.0/Xi_ - Xi_))*nf
00108         )
00109     );
00110 
00111     solve
00112     (
00113         betav*fvm::ddt(rho_, Xi_)
00114       + mvConvection.fvmDiv(phi_, Xi_)
00115       + fvm::div(phiXi, Xi_)
00116       - fvm::Sp(fvc::div(phiXi), Xi_)
00117      ==
00118         betav*rho_*R
00119       - fvm::Sp(betav*rho_*(R - G), Xi_)
00120     );
00121 
00122     // Correct boundedness of Xi
00123     // ~~~~~~~~~~~~~~~~~~~~~~~~~
00124     Xi_.max(1.0);
00125     Xi_ = min(Xi_, 2.0*XiEq);
00126 }
00127 
00128 
00129 bool Foam::XiModels::transport::read(const dictionary& XiProperties)
00130 {
00131     XiModel::read(XiProperties);
00132 
00133     XiModelCoeffs_.lookup("XiShapeCoef") >> XiShapeCoef;
00134 
00135     return true;
00136 }
00137 
00138 
00139 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd