Commit 6b0daf36 authored by graham's avatar graham
Browse files

EHN: lagrangian/intermediate. Merging InteractingKinematicParcel back

to KinematicParcel incorporating latest master branch changes.
parent 4084c6b3
......@@ -69,15 +69,15 @@
laminarTransport.nu()*rhoValue
);
word interactingKinematicCloudName("interactingKinematicCloud");
args.optionReadIfPresent("cloudName", interactingKinematicCloudName);
word kinematicCloudName("kinematicCloud");
args.optionReadIfPresent("cloudName", kinematicCloudName);
Info<< "Constructing interactingKinematicCloud "
<< interactingKinematicCloudName << endl;
Info<< "Constructing kinematicCloud "
<< kinematicCloudName << endl;
basicInteractingKinematicCloud interactingKinematicCloud
basicKinematicCloud kinematicCloud
(
interactingKinematicCloudName,
kinematicCloudName,
rho,
U,
mu,
......
......@@ -36,7 +36,7 @@ Description
#include "fvCFD.H"
#include "singlePhaseTransportModel.H"
#include "turbulenceModel.H"
#include "basicInteractingKinematicCloud.H"
#include "basicKinematicCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -58,9 +58,9 @@ int main(int argc, char *argv[])
{
Info<< "Time = " << runTime.timeName() << nl << endl;
Info<< "Evolving " << interactingKinematicCloud.name() << endl;
interactingKinematicCloud.evolve();
interactingKinematicCloud.info();
Info<< "Evolving " << kinematicCloud.name() << endl;
kinematicCloud.evolve();
kinematicCloud.info();
runTime.write();
......
......@@ -19,17 +19,10 @@ $(BASECLOUDS)/reactingMultiphaseCloud/reactingMultiphaseCloud.C
/* kinematic parcel sub-models */
// KINEMATICPARCEL=$(DERIVEDPARCELS)/basicKinematicParcel
// $(KINEMATICPARCEL)/basicKinematicParcel.C
// $(KINEMATICPARCEL)/defineBasicKinematicParcel.C
// $(KINEMATICPARCEL)/makeBasicKinematicParcelSubmodels.C
/* interactingKinematic parcel sub-models */
INTERACTINGKINEMATICPARCEL=$(DERIVEDPARCELS)/basicInteractingKinematicParcel
$(INTERACTINGKINEMATICPARCEL)/basicInteractingKinematicParcel.C
$(INTERACTINGKINEMATICPARCEL)/defineBasicInteractingKinematicParcel.C
$(INTERACTINGKINEMATICPARCEL)/makeBasicInteractingKinematicParcelSubmodels.C
KINEMATICPARCEL=$(DERIVEDPARCELS)/basicKinematicParcel
$(KINEMATICPARCEL)/basicKinematicParcel.C
$(KINEMATICPARCEL)/defineBasicKinematicParcel.C
$(KINEMATICPARCEL)/makeBasicKinematicParcelSubmodels.C
/* thermo parcel sub-models */
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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 "InteractingKinematicCloud.H"
#include "IntegrationScheme.H"
#include "interpolation.H"
#include "subCycleTime.H"
#include "DispersionModel.H"
#include "DragModel.H"
#include "InjectionModel.H"
#include "CollisionModel.H"
#include "PatchInteractionModel.H"
#include "PostProcessingModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::InteractingKinematicCloud<ParcelType>::InteractingKinematicCloud
(
const word& cloudName,
const volScalarField& rho,
const volVectorField& U,
const volScalarField& mu,
const dimensionedVector& g,
bool readFields
)
:
Cloud<ParcelType>(rho.mesh(), cloudName, false),
kinematicCloud(),
mesh_(rho.mesh()),
particleProperties_
(
IOobject
(
cloudName + "Properties",
rho.mesh().time().constant(),
rho.mesh(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
constProps_(particleProperties_),
parcelTypeId_(readLabel(particleProperties_.lookup("parcelTypeId"))),
coupled_(particleProperties_.lookup("coupled")),
cellValueSourceCorrection_
(
particleProperties_.lookup("cellValueSourceCorrection")
),
rndGen_(label(0)),
rho_(rho),
U_(U),
mu_(mu),
g_(g),
forces_(mesh_, particleProperties_, g_.value()),
interpolationSchemes_(particleProperties_.subDict("interpolationSchemes")),
dispersionModel_
(
DispersionModel<InteractingKinematicCloud<ParcelType> >::New
(
particleProperties_,
*this
)
),
dragModel_
(
DragModel<InteractingKinematicCloud<ParcelType> >::New
(
particleProperties_,
*this
)
),
injectionModel_
(
InjectionModel<InteractingKinematicCloud<ParcelType> >::New
(
particleProperties_,
*this
)
),
collisionModel_
(
CollisionModel<InteractingKinematicCloud<ParcelType> >::New
(
particleProperties_,
*this
)
),
patchInteractionModel_
(
PatchInteractionModel<InteractingKinematicCloud<ParcelType> >::New
(
particleProperties_,
*this
)
),
postProcessingModel_
(
PostProcessingModel<InteractingKinematicCloud<ParcelType> >::New
(
this->particleProperties_,
*this
)
),
UIntegrator_
(
vectorIntegrationScheme::New
(
"U",
particleProperties_.subDict("integrationSchemes")
)
),
UTrans_
(
IOobject
(
this->name() + "UTrans",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedVector("zero", dimMass*dimVelocity, vector::zero)
)
{
if (readFields)
{
ParcelType::readFields(*this);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ParcelType>
Foam::InteractingKinematicCloud<ParcelType>::~InteractingKinematicCloud()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
void Foam::InteractingKinematicCloud<ParcelType>::checkParcelProperties
(
ParcelType& parcel,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
if (!fullyDescribed)
{
parcel.rho() = constProps_.rho0();
}
scalar carrierDt = this->db().time().deltaTValue();
parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
}
template<class ParcelType>
void Foam::InteractingKinematicCloud<ParcelType>::resetSourceTerms()
{
UTrans_.field() = vector::zero;
}
template<class ParcelType>
void Foam::InteractingKinematicCloud<ParcelType>::preEvolve()
{
this->dispersion().cacheFields(true);
forces_.cacheFields(true);
}
template<class ParcelType>
void Foam::InteractingKinematicCloud<ParcelType>::postEvolve()
{
if (debug)
{
this->writePositions();
}
this->dispersion().cacheFields(false);
forces_.cacheFields(false);
this->postProcessing().post();
}
template<class ParcelType>
void Foam::InteractingKinematicCloud<ParcelType>::evolve()
{
preEvolve();
autoPtr<interpolation<scalar> > rhoInterpolator =
interpolation<scalar>::New
(
interpolationSchemes_,
rho_
);
autoPtr<interpolation<vector> > UInterpolator =
interpolation<vector>::New
(
interpolationSchemes_,
U_
);
autoPtr<interpolation<scalar> > muInterpolator =
interpolation<scalar>::New
(
interpolationSchemes_,
mu_
);
typename ParcelType::trackData td
(
*this,
constProps_,
rhoInterpolator(),
UInterpolator(),
muInterpolator(),
g_.value()
);
this->injection().inject(td);
if (coupled_)
{
resetSourceTerms();
}
// Sympletic leapfrog integration of particle forces:
// + apply half deltaV with stored force
// + move positions with new velocity
// + calculate forces in new position
// + apply half deltaV with new force
label nSubCycles = collision().nSubCycles();
if (nSubCycles > 1)
{
subCycleTime moveCollideSubCycle
(
const_cast<Time&>(this->db().time()),
nSubCycles
);
while(!(++moveCollideSubCycle).end())
{
Info<< "subCycle time = " << this->db().time().timeName() << endl;
moveCollide(td);
}
moveCollideSubCycle.endSubCycle();
}
else
{
moveCollide(td);
}
postEvolve();
}
template<class ParcelType>
void Foam::InteractingKinematicCloud<ParcelType>::moveCollide
(
typename ParcelType::trackData& td
)
{
td.part() = ParcelType::trackData::tpVelocityHalfStep;
Cloud<ParcelType>::move(td);
td.part() = ParcelType::trackData::tpLinearTrack;
Cloud<ParcelType>::move(td);
// td.part() = ParcelType::trackData::tpRotationalTrack;
// Cloud<ParcelType>::move(td);
this->collision().collide();
td.part() = ParcelType::trackData::tpVelocityHalfStep;
Cloud<ParcelType>::move(td);
}
template<class ParcelType>
void Foam::InteractingKinematicCloud<ParcelType>::info() const
{
vector linearMomentum = linearMomentumOfSystem();
reduce(linearMomentum, sumOp<vector>());
scalar linearKineticEnergy = linearKineticEnergyOfSystem();
reduce(linearKineticEnergy, sumOp<scalar>());
scalar rotationalKineticEnergy = rotationalKineticEnergyOfSystem();
reduce(rotationalKineticEnergy, sumOp<scalar>());
Info<< "Cloud: " << this->name() << nl
<< " Total number of parcels added = "
<< returnReduce(this->injection().parcelsAddedTotal(), sumOp<label>())
<< nl
<< " Total mass introduced = "
<< returnReduce(this->injection().massInjected(), sumOp<scalar>())
<< nl
<< " Current number of parcels = "
<< returnReduce(this->size(), sumOp<label>()) << nl
<< " Current mass in system = "
<< returnReduce(massInSystem(), sumOp<scalar>()) << nl
<< " Linear momentum = "
<< linearMomentum << nl
<< " |Linear momentum| = "
<< mag(linearMomentum) << nl
<< " Linear kinetic energy = "
<< linearKineticEnergy << nl
<< " Rotational kinetic energy = "
<< rotationalKineticEnergy << nl;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 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::InteractingKinematicCloud
Description
Templated base class for interactingKinematic cloud
- InteractingKinematic only
- Particle collisions
- Dispersion model
- Drag model
- Injection model
- Wall interaction model
SourceFiles
InteractingKinematicCloudI.H
InteractingKinematicCloud.C
\*---------------------------------------------------------------------------*/
#ifndef InteractingKinematicCloud_H
#define InteractingKinematicCloud_H
#include "Cloud.H"
#include "kinematicCloud.H"
#include "IOdictionary.H"
#include "autoPtr.H"
#include "Random.H"
#include "fvMesh.H"
#include "volFields.H"
#include "fvMatrices.H"
#include "particleForces.H"
#include "IntegrationSchemesFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
template<class CloudType>
class DispersionModel;
template<class CloudType>
class DragModel;
template<class CloudType>
class InjectionModel;
template<class CloudType>
class CollisionModel;
template<class CloudType>
class PostProcessingModel;
template<class CloudType>
class PatchInteractionModel;
/*---------------------------------------------------------------------------*\
Class InteractingKinematicCloud Declaration
\*---------------------------------------------------------------------------*/
template<class ParcelType>
class InteractingKinematicCloud
:
public Cloud<ParcelType>,
public kinematicCloud
{
// Private Member Functions
//- Disallow default bitwise copy construct
InteractingKinematicCloud(const InteractingKinematicCloud&);
//- Disallow default bitwise assignment
void operator=(const InteractingKinematicCloud&);
protected:
// Protected data
//- References to the mesh and time databases
const fvMesh& mesh_;
//- Dictionary of particle properties
IOdictionary particleProperties_;
//- Parcel constant properties
typename ParcelType::constantProperties constProps_;
//- Parcel type id - used to flag the type of parcels issued by this
// cloud
const label parcelTypeId_;
//- Flag to indicate whether parcels are coupled to the carrier phase
// i.e. whether or not to generate source terms for carrier phase
const Switch coupled_;
//- Flag to correct cell values with latest transfer information
// during the lagrangian timestep
const Switch cellValueSourceCorrection_;
//- Random number generator - used by some injection routines
Random rndGen_;
// References to the carrier gas fields
//- Density
const volScalarField& rho_;
//- Velocity
const volVectorField& U_;
//- Dynamic viscosity
const volScalarField& mu_;
// Environmental properties
//- Gravity
const dimensionedVector& g_;
//- Optional particle forces
particleForces forces_;
//- Interpolation schemes dictionary
dictionary interpolationSchemes_;
// References to the cloud sub-models
//- Dispersion model
autoPtr<DispersionModel<InteractingKinematicCloud<ParcelType> > >
dispersionModel_;