initial check-in of entrainment injection model

This commit is contained in:
andy 2009-03-03 18:46:53 +00:00
parent 295b0e7367
commit 5d3db386e7
6 changed files with 488 additions and 17 deletions

View File

@ -27,9 +27,10 @@ License
#include "basicKinematicParcel.H"
#include "KinematicCloud.H"
#include "NoInjection.H"
#include "ManualInjection.H"
#include "ConeInjection.H"
#include "EntrainmentInjection.H"
#include "ManualInjection.H"
#include "NoInjection.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -40,7 +41,13 @@ namespace Foam
// Add instances of injection model to the table
makeInjectionModelType
(
NoInjection,
ConeInjection,
KinematicCloud,
basicKinematicParcel
);
makeInjectionModelType
(
EntrainmentInjection,
KinematicCloud,
basicKinematicParcel
);
@ -52,7 +59,7 @@ namespace Foam
);
makeInjectionModelType
(
ConeInjection,
NoInjection,
KinematicCloud,
basicKinematicParcel
);

View File

@ -27,9 +27,10 @@ License
#include "basicReactingMultiphaseParcel.H"
#include "ReactingCloud.H"
#include "NoInjection.H"
#include "ManualInjection.H"
#include "ConeInjection.H"
#include "EntrainmentInjection.H"
#include "ManualInjection.H"
#include "NoInjection.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -40,7 +41,13 @@ namespace Foam
// Add instances of injection model to the table
makeInjectionModelType
(
NoInjection,
ConeInjection,
KinematicCloud,
basicReactingMultiphaseParcel
);
makeInjectionModelType
(
EntrainmentInjection,
KinematicCloud,
basicReactingMultiphaseParcel
);
@ -52,7 +59,7 @@ namespace Foam
);
makeInjectionModelType
(
ConeInjection,
NoInjection,
KinematicCloud,
basicReactingMultiphaseParcel
);

View File

@ -27,9 +27,10 @@ License
#include "basicReactingParcel.H"
#include "ReactingCloud.H"
#include "NoInjection.H"
#include "ManualInjection.H"
#include "ConeInjection.H"
#include "EntrainmentInjection.H"
#include "ManualInjection.H"
#include "NoInjection.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -40,7 +41,13 @@ namespace Foam
// Add instances of injection model to the table
makeInjectionModelType
(
NoInjection,
ConeInjection,
KinematicCloud,
basicReactingParcel
);
makeInjectionModelType
(
EntrainmentInjection,
KinematicCloud,
basicReactingParcel
);
@ -52,7 +59,7 @@ namespace Foam
);
makeInjectionModelType
(
ConeInjection,
NoInjection,
KinematicCloud,
basicReactingParcel
);

View File

@ -26,9 +26,11 @@ License
#include "basicThermoParcel.H"
#include "ThermoCloud.H"
#include "NoInjection.H"
#include "ManualInjection.H"
#include "ConeInjection.H"
#include "EntrainmentInjection.H"
#include "ManualInjection.H"
#include "NoInjection.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -37,11 +39,32 @@ namespace Foam
makeInjectionModel(KinematicCloud<basicThermoParcel>);
// Add instances of injection model to the table
makeInjectionModelType(NoInjection, KinematicCloud, basicThermoParcel);
makeInjectionModelType(ManualInjection, KinematicCloud, basicThermoParcel);
makeInjectionModelType
(
ConeInjection,
KinematicCloud,
basicThermoParcel
);
makeInjectionModelType
(
EntrainmentInjection,
KinematicCloud,
basicThermoParcel
);
makeInjectionModelType
(
ManualInjection,
KinematicCloud,
basicThermoParcel
);
makeInjectionModelType
(
NoInjection,
KinematicCloud,
basicThermoParcel
);
makeInjectionModelType(ConeInjection, KinematicCloud, basicThermoParcel);
};

View File

@ -0,0 +1,231 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "EntrainmentInjection.H"
#include "volFields.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class CloudType>
Foam::label Foam::EntrainmentInjection<CloudType>::parcelsToInject
(
const scalar time0,
const scalar time1
) const
{
if (sum(nParcelsInjected_) < nParcelsPerInjector_*positions_.size())
{
return positions_.size();
}
else
{
return 0;
}
}
template<class CloudType>
Foam::scalar Foam::EntrainmentInjection<CloudType>::volumeToInject
(
const scalar time0,
const scalar time1
) const
{
if (sum(nParcelsInjected_) < nParcelsPerInjector_*positions_.size())
{
return this->volumeTotal_/nParcelsPerInjector_;
}
else
{
return 0;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::EntrainmentInjection<CloudType>::EntrainmentInjection
(
const dictionary& dict,
CloudType& owner
)
:
InjectionModel<CloudType>(dict, owner, typeName),
c_(readScalar(this->coeffDict().lookup("c"))),
rhoc_
(
owner.db().objectRegistry::lookupObject<volScalarField>
(
this->coeffDict().lookup("rhoc")
)
),
rhol_
(
owner.db().objectRegistry::lookupObject<volScalarField>
(
this->coeffDict().lookup("rhol")
)
),
Uc_
(
owner.db().objectRegistry::lookupObject<volVectorField>
(
this->coeffDict().lookup("Uc")
)
),
positionsFile_(this->coeffDict().lookup("positionsFile")),
positions_
(
IOobject
(
positionsFile_,
owner.db().time().constant(),
owner.mesh(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
injectorCells_(positions_.size()),
nParcelsPerInjector_
(
readLabel(this->coeffDict().lookup("parcelsPerInjector"))
),
nParcelsInjected_(positions_.size(), 0),
U0_(this->coeffDict().lookup("U0")),
diameters_(positions_.size()),
parcelPDF_
(
pdf::New
(
this->coeffDict().subDict("parcelPDF"),
owner.rndGen()
)
)
{
// Construct parcel diameters - one per injector cell
forAll(diameters_, i)
{
diameters_[i] = parcelPDF_->sample();
}
// Determine total volume of particles to inject
this->volumeTotal_ =
nParcelsPerInjector_
*sum(pow3(diameters_))
*mathematicalConstant::pi/6.0;
// Set/cahce the injector cells
forAll(positions_, i)
{
this->findCellAtPosition
(
injectorCells_[i],
positions_[i]
);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::EntrainmentInjection<CloudType>::~EntrainmentInjection()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::EntrainmentInjection<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar Foam::EntrainmentInjection<CloudType>::timeEnd() const
{
return GREAT;
}
template<class CloudType>
void Foam::EntrainmentInjection<CloudType>::setPositionAndCell
(
const label parcelI,
const scalar,
vector& position,
label& cellOwner
)
{
position = positions_[parcelI];
cellOwner = injectorCells_[parcelI];
}
template<class CloudType>
Foam::vector Foam::EntrainmentInjection<CloudType>::velocity
(
const label,
const scalar
)
{
return U0_;
}
template<class CloudType>
Foam::scalar Foam::EntrainmentInjection<CloudType>::d0
(
const label parcelI,
const scalar
) const
{
return diameters_[parcelI];
}
template<class CloudType>
bool Foam::EntrainmentInjection<CloudType>::validInjection(const label parcelI)
{
const label cellI = injectorCells_[parcelI];
if
(
nParcelsInjected_[parcelI] < nParcelsPerInjector_
&& rhol_[cellI] < c_*0.5*rhoc_[cellI]*magSqr(Uc_[cellI])
)
{
nParcelsInjected_[parcelI]++;
return true;
}
return false;
}
// ************************************************************************* //

View File

@ -0,0 +1,196 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
\\/ 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::EntrainmentInjection
Description
SourceFiles
EntrainmentInjection.C
\*---------------------------------------------------------------------------*/
#ifndef EntrainmentInjection_H
#define EntrainmentInjection_H
#include "InjectionModel.H"
#include "pdf.H"
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class EntrainmentInjection Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class EntrainmentInjection
:
public InjectionModel<CloudType>
{
// Private data
// Model parameters
//- Injection permission: rhol <= c_*0.5*rho*|U|^2
const scalar c_;
//- Carrier phase density field
const volScalarField& rhoc_;
//- Lagrangian phase density field
const scalarField& rhol_;
//- Carrier phase velocity field
const vectorField& Uc_;
// Injector properties
//- Name of file containing positions data
const word positionsFile_;
//- Field of injector (x,y,z) positions
vectorIOField positions_;
//- Field of cell labels corresoponding to injector positions
labelField injectorCells_;
//- nParcels per injector
const label nParcelsPerInjector_;
//- Field of number of parcels injected for each injector
labelField nParcelsInjected_;
// Parcel properties
//- Initial parcel velocity
const vector U0_;
//- Field of parcel diameters
scalarField diameters_;
//- Parcel size PDF model
const autoPtr<pdf> parcelPDF_;
protected:
// Protected member functions
//- Number of parcels to introduce over the time step
label parcelsToInject
(
const scalar time0,
const scalar time1
) const;
//- Volume of parcels to introduce over the time step
scalar volumeToInject
(
const scalar time0,
const scalar time1
) const;
public:
//- Runtime type information
TypeName("EntrainmentInjection");
// Constructors
//- Construct from dictionary
EntrainmentInjection
(
const dictionary& dict,
CloudType& owner
);
// Destructor
virtual ~EntrainmentInjection();
// Member Functions
//- Flag to indicate whether model activates injection model
bool active() const;
//- Return the end-of-injection time
scalar timeEnd() const;
// Injection geometry
//- Set the injection position and owner cell
void setPositionAndCell
(
const label parcelI,
const scalar time,
vector& position,
label& cellOwner
);
//- Return the velocity of the parcel to introduce at a time
vector velocity
(
const label parcelI,
const scalar time
);
//- Return the diameter of the parcel to introduce at a time
scalar d0
(
const label parcelI,
const scalar time
) const;
//- Return flag to identify whether or not injection in cellI is
// permitted
bool validInjection(const label parcelI);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "EntrainmentInjection.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //