1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "DispersionRASModel.H"
27 #include "demandDrivenData.H"
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 template<class CloudType>
32 Foam::DispersionRASModel<CloudType>::DispersionRASModel
38 DispersionModel<CloudType>(owner),
41 owner.mesh().objectRegistry::template lookupObject
43 compressible::RASModel
56 template<class CloudType>
57 Foam::DispersionRASModel<CloudType>::DispersionRASModel
59 DispersionRASModel<CloudType>& dm
62 DispersionModel<CloudType>(dm),
63 turbulence_(dm.turbulence_),
66 epsilonPtr_(dm.epsilonPtr_),
67 ownEpsilon_(dm.ownEpsilon_)
70 dm.ownEpsilon_ = false;
74 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
76 template<class CloudType>
77 Foam::DispersionRASModel<CloudType>::~DispersionRASModel()
83 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
85 template<class CloudType>
86 void Foam::DispersionRASModel<CloudType>::cacheFields(const bool store)
90 tmp<volScalarField> tk = this->turbulence().k();
98 kPtr_ = tk.operator->();
102 tmp<volScalarField> tepsilon = this->turbulence().epsilon();
103 if (tepsilon.isTmp())
105 epsilonPtr_ = tepsilon.ptr();
110 epsilonPtr_ = tepsilon.operator->();
118 deleteDemandDrivenData(kPtr_);
121 if (ownEpsilon_ && epsilonPtr_)
123 deleteDemandDrivenData(epsilonPtr_);
130 template<class CloudType>
131 void Foam::DispersionRASModel<CloudType>::write(Ostream& os) const
133 DispersionModel<CloudType>::write(os);
135 os.writeKeyword("ownK") << ownK_ << token::END_STATEMENT << endl;
136 os.writeKeyword("ownEpsilon") << ownEpsilon_ << token::END_STATEMENT
141 // ************************************************************************* //