Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2011-09-21 09:51:39 +01:00
10 changed files with 344 additions and 19 deletions

View File

@ -324,6 +324,8 @@ bool Foam::KinematicParcel<ParcelType>::move
}
p.age() += dt;
td.cloud().functions().postMove(p, cellI, dt);
}
return td.keepParticle;

View File

@ -31,6 +31,7 @@ License
#include "FacePostProcessing.H"
#include "ParticleTracks.H"
#include "PatchPostProcessing.H"
#include "VoidFraction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -40,7 +41,8 @@ License
\
makeCloudFunctionObjectType(FacePostProcessing, CloudType); \
makeCloudFunctionObjectType(ParticleTracks, CloudType); \
makeCloudFunctionObjectType(PatchPostProcessing, CloudType);
makeCloudFunctionObjectType(PatchPostProcessing, CloudType); \
makeCloudFunctionObjectType(VoidFraction, CloudType);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -91,6 +91,18 @@ void Foam::CloudFunctionObject<CloudType>::postEvolve()
}
template<class CloudType>
void Foam::CloudFunctionObject<CloudType>::postMove
(
const typename CloudType::parcelType&,
const label,
const scalar
)
{
// do nothing
}
template<class CloudType>
void Foam::CloudFunctionObject<CloudType>::postPatch
(
@ -98,14 +110,7 @@ void Foam::CloudFunctionObject<CloudType>::postPatch
const label
)
{
notImplemented
(
"void Foam::CloudFunctionObject<CloudType>::postPatch"
"("
"const typename CloudType::parcelType&,"
"const label"
")"
);
// do nothing
}
@ -115,13 +120,7 @@ void Foam::CloudFunctionObject<CloudType>::postFace
const typename CloudType::parcelType&
)
{
notImplemented
(
"void Foam::CloudFunctionObject<CloudType>::postFace"
"("
"const typename CloudType::parcelType&"
")"
);
// do nothing
}

View File

@ -129,6 +129,14 @@ public:
//- Post-evolve hook
virtual void postEvolve();
//- Post-move hook
virtual void postMove
(
const typename CloudType::parcelType& p,
const label cellI,
const scalar dt
);
//- Post-patch hook
virtual void postPatch
(

View File

@ -127,6 +127,21 @@ void Foam::CloudFunctionObjectList<CloudType>::postEvolve()
}
template<class CloudType>
void Foam::CloudFunctionObjectList<CloudType>::postMove
(
const typename CloudType::parcelType& p,
const label cellI,
const scalar dt
)
{
forAll(*this, i)
{
this->operator[](i).postMove(p, cellI, dt);
}
}
template<class CloudType>
void Foam::CloudFunctionObjectList<CloudType>::postPatch
(

View File

@ -109,6 +109,14 @@ public:
//- Post-evolve hook
virtual void postEvolve();
//- Post-move hook
virtual void postMove
(
const typename CloudType::parcelType& p,
const label cellI,
const scalar dt
);
//- Post-patch hook
virtual void postPatch
(

View File

@ -0,0 +1,137 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "VoidFraction.H"
#
// * * * * * * * * * * * * * Protectd Member Functions * * * * * * * * * * * //
template<class CloudType>
void Foam::VoidFraction<CloudType>::write()
{
if (thetaPtr_.valid())
{
thetaPtr_->write();
}
else
{
FatalErrorIn("void Foam::VoidFraction<CloudType>::write()")
<< "thetaPtr not valid" << abort(FatalError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::VoidFraction<CloudType>::VoidFraction
(
const dictionary& dict,
CloudType& owner
)
:
CloudFunctionObject<CloudType>(owner),
thetaPtr_(NULL)
{}
template<class CloudType>
Foam::VoidFraction<CloudType>::VoidFraction
(
const VoidFraction<CloudType>& vf
)
:
CloudFunctionObject<CloudType>(vf),
thetaPtr_(NULL)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::VoidFraction<CloudType>::~VoidFraction()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::VoidFraction<CloudType>::preEvolve()
{
if (thetaPtr_.valid())
{
thetaPtr_->internalField() = 0.0;
}
else
{
const fvMesh& mesh = this->owner().mesh();
thetaPtr_.reset
(
new volScalarField
(
IOobject
(
this->owner().name() + "Theta",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimless, 0.0)
)
);
}
}
template<class CloudType>
void Foam::VoidFraction<CloudType>::postEvolve()
{
volScalarField& theta = thetaPtr_();
const fvMesh& mesh = this->owner().mesh();
theta.internalField() /= mesh.time().deltaTValue()*mesh.V();
CloudFunctionObject<CloudType>::postEvolve();
}
template<class CloudType>
void Foam::VoidFraction<CloudType>::postMove
(
const parcelType& p,
const label cellI,
const scalar dt
)
{
volScalarField& theta = thetaPtr_();
theta[cellI] += dt*p.nParticle()*p.volume();
}
// ************************************************************************* //

View File

@ -0,0 +1,137 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::VoidFraction
Description
Creates particle void fraction field on carrier phase
SourceFiles
VoidFraction.C
\*---------------------------------------------------------------------------*/
#ifndef VoidFraction_H
#define VoidFraction_H
#include "CloudFunctionObject.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class VoidFraction Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class VoidFraction
:
public CloudFunctionObject<CloudType>
{
// Private Data
// Typedefs
//- Convenience typedef for parcel type
typedef typename CloudType::parcelType parcelType;
//- Void fraction field
autoPtr<volScalarField> thetaPtr_;
protected:
// Protected Member Functions
//- Write post-processing info
virtual void write();
public:
//- Runtime type information
TypeName("voidFraction");
// Constructors
//- Construct from dictionary
VoidFraction(const dictionary& dict, CloudType& owner);
//- Construct copy
VoidFraction(const VoidFraction<CloudType>& vf);
//- Construct and return a clone
virtual autoPtr<CloudFunctionObject<CloudType> > clone() const
{
return autoPtr<CloudFunctionObject<CloudType> >
(
new VoidFraction<CloudType>(*this)
);
}
//- Destructor
virtual ~VoidFraction();
// Member Functions
// Evaluation
//- Pre-evolve hook
virtual void preEvolve();
//- Post-evolve hook
virtual void postEvolve();
//- Post-move hook
virtual void postMove
(
const parcelType& p,
const label cellI,
const scalar dt
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "VoidFraction.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -220,11 +220,14 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
:
InjectionModel<CloudType>(im),
injectionMethod_(im.injectionMethod_),
flowType_(im.flowType_),
outerDiameter_(im.outerDiameter_),
innerDiameter_(im.innerDiameter_),
duration_(im.duration_),
position_(im.position_),
injectorCell_(im.injectorCell_),
tetFaceI_(im.tetFaceI_),
tetPtI_(im.tetPtI_),
direction_(im.direction_),
parcelsPerSecond_(im.parcelsPerSecond_),
flowRateProfile_(im.flowRateProfile_().clone().ptr()),
@ -235,9 +238,18 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
tanVec2_(im.tanVec1_),
normal_(im.normal_),
UMag_(im.UMag_),
Cd_(im.Cd_().clone().ptr()),
Pinj_(im.Pinj_().clone().ptr())
{}
Cd_(NULL),
Pinj_(NULL)
{
if (im.Cd_.valid())
{
Cd_.reset(im.Cd_().clone().ptr());
}
if (im.Pinj_.valid())
{
Pinj_.reset(im.Pinj_().clone().ptr());
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -110,6 +110,11 @@ Foam::SprayCloud<CloudType>::SprayCloud
Info << "Average parcel mass: " << averageParcelMass_ << endl;
}
if (this->solution().resetSourcesOnStartup())
{
CloudType::resetSourceTerms();
}
}