1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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 "VoidFraction.H"
28 // * * * * * * * * * * * * * Protectd Member Functions * * * * * * * * * * * //
30 template<class CloudType>
31 void Foam::VoidFraction<CloudType>::write()
33 if (thetaPtr_.valid())
39 FatalErrorIn("void Foam::VoidFraction<CloudType>::write()")
40 << "thetaPtr not valid" << abort(FatalError);
45 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
47 template<class CloudType>
48 Foam::VoidFraction<CloudType>::VoidFraction
50 const dictionary& dict,
54 CloudFunctionObject<CloudType>(owner),
59 template<class CloudType>
60 Foam::VoidFraction<CloudType>::VoidFraction
62 const VoidFraction<CloudType>& vf
65 CloudFunctionObject<CloudType>(vf),
70 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
72 template<class CloudType>
73 Foam::VoidFraction<CloudType>::~VoidFraction()
77 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
79 template<class CloudType>
80 void Foam::VoidFraction<CloudType>::preEvolve()
82 if (thetaPtr_.valid())
84 thetaPtr_->internalField() = 0.0;
88 const fvMesh& mesh = this->owner().mesh();
96 this->owner().name() + "Theta",
97 mesh.time().timeName(),
103 dimensionedScalar("zero", dimless, 0.0)
110 template<class CloudType>
111 void Foam::VoidFraction<CloudType>::postEvolve()
113 volScalarField& theta = thetaPtr_();
115 const fvMesh& mesh = this->owner().mesh();
117 theta.internalField() /= mesh.time().deltaTValue()*mesh.V();
119 CloudFunctionObject<CloudType>::postEvolve();
123 template<class CloudType>
124 void Foam::VoidFraction<CloudType>::postMove
131 volScalarField& theta = thetaPtr_();
133 theta[cellI] += dt*p.nParticle()*p.volume();
137 // ************************************************************************* //