diff --git a/applications/solvers/lagrangian/interactingKinematicParcelFoam/Make/files b/applications/solvers/lagrangian/interactingKinematicParcelFoam/Make/files new file mode 100644 index 0000000000..e4c51df442 --- /dev/null +++ b/applications/solvers/lagrangian/interactingKinematicParcelFoam/Make/files @@ -0,0 +1,3 @@ +interactingKinematicParcelFoam.C + +EXE = $(FOAM_APPBIN)/interactingKinematicParcelFoam diff --git a/applications/solvers/lagrangian/interactingKinematicParcelFoam/Make/options b/applications/solvers/lagrangian/interactingKinematicParcelFoam/Make/options new file mode 100644 index 0000000000..83ef9251c5 --- /dev/null +++ b/applications/solvers/lagrangian/interactingKinematicParcelFoam/Make/options @@ -0,0 +1,22 @@ +EXE_INC = \ + -I$(LIB_SRC)/lagrangian/basic/lnInclude \ + -I$(LIB_SRC)/lagrangian/intermediate/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ + -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude \ + +EXE_LIBS = \ + -llagrangian \ + -llagrangianIntermediate \ + -lthermophysicalFunctions \ + -lbasicThermophysicalModels \ + -lspecie \ + -lradiation \ + -lcompressibleRASModels \ + -lcompressibleLESModels \ + -lfiniteVolume \ + -lmeshTools diff --git a/applications/solvers/lagrangian/interactingKinematicParcelFoam/createFields.H b/applications/solvers/lagrangian/interactingKinematicParcelFoam/createFields.H new file mode 100644 index 0000000000..1899a13e41 --- /dev/null +++ b/applications/solvers/lagrangian/interactingKinematicParcelFoam/createFields.H @@ -0,0 +1,63 @@ + Info<< "Reading thermophysical properties\n" << endl; + + autoPtr pThermo + ( + basicPsiThermo::New(mesh) + ); + basicPsiThermo& thermo = pThermo(); + + volScalarField rho + ( + IOobject + ( + "rho", + runTime.timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + thermo.rho() + ); + + Info<< "\nReading field U\n" << endl; + volVectorField U + ( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ); + + #include "compressibleCreatePhi.H" + + Info<< "Creating turbulence model\n" << endl; + autoPtr turbulence + ( + compressible::turbulenceModel::New + ( + rho, + U, + phi, + thermo + ) + ); + + word interactingKinematicCloudName("interactingKinematicCloud"); + args.optionReadIfPresent("cloudName", interactingKinematicCloudName); + + Info<< "Constructing interactingKinematicCloud " + << interactingKinematicCloudName << endl; + + basicInteractingKinematicCloud interactingKinematicCloud + ( + interactingKinematicCloudName, + rho, + U, + thermo.mu(), + g + ); diff --git a/applications/solvers/lagrangian/interactingKinematicParcelFoam/interactingKinematicParcelFoam.C b/applications/solvers/lagrangian/interactingKinematicParcelFoam/interactingKinematicParcelFoam.C new file mode 100644 index 0000000000..7267f70c0e --- /dev/null +++ b/applications/solvers/lagrangian/interactingKinematicParcelFoam/interactingKinematicParcelFoam.C @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-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 + +Application + interactingKinematicParcelFoam + +Description + Transient solver for the passive transport of a single interactingKinematic + particle could, where the particles interact. + + Uses a pre- calculated velocity field to evolve the cloud. + +\*---------------------------------------------------------------------------*/ + +#include "fvCFD.H" +#include "basicPsiThermo.H" +#include "turbulenceModel.H" +#include "basicInteractingKinematicCloud.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +int main(int argc, char *argv[]) +{ + argList::validOptions.insert("cloudName", "cloud name"); + + #include "setRootCase.H" + #include "createTime.H" + #include "createMesh.H" + #include "readGravitationalAcceleration.H" + #include "createFields.H" + #include "compressibleCourantNo.H" + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + Info<< "\nStarting time loop\n" << endl; + + while (runTime.loop()) + { + Info<< "Time = " << runTime.timeName() << nl << endl; + + Info<< "Evolving " << interactingKinematicCloud.name() << endl; + interactingKinematicCloud.evolve(); + interactingKinematicCloud.info(); + + runTime.write(); + + Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" + << " ClockTime = " << runTime.elapsedClockTime() << " s" + << nl << endl; + } + + Info<< "End\n" << endl; + + return 0; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/Make/files b/src/lagrangian/intermediate/Make/files index 7911383146..d3974a9cdd 100644 --- a/src/lagrangian/intermediate/Make/files +++ b/src/lagrangian/intermediate/Make/files @@ -19,17 +19,25 @@ $(BASECLOUDS)/reactingMultiphaseCloud/reactingMultiphaseCloud.C /* Cloud container/injection mechanisms */ -$(DERIVEDCLOUDS)/basicKinematicCloud/basicKinematicCloud.C +//$(DERIVEDCLOUDS)/basicKinematicCloud/basicKinematicCloud.C +$(DERIVEDCLOUDS)/basicInteractingKinematicCloud/basicInteractingKinematicCloud.C $(DERIVEDCLOUDS)/basicThermoCloud/basicThermoCloud.C $(DERIVEDCLOUDS)/BasicReactingCloud/defineBasicReactingCloud.C $(DERIVEDCLOUDS)/BasicReactingMultiphaseCloud/defineBasicReactingMultiphaseCloud.C /* kinematic parcel sub-models */ -KINEMATICPARCEL=$(DERIVEDPARCELS)/basicKinematicParcel -$(KINEMATICPARCEL)/basicKinematicParcel.C -$(KINEMATICPARCEL)/defineBasicKinematicParcel.C -$(KINEMATICPARCEL)/makeBasicKinematicParcelSubmodels.C +// 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 /* thermo parcel sub-models */ diff --git a/src/lagrangian/intermediate/clouds/Templates/InteractingKinematicCloud/InteractingKinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/InteractingKinematicCloud/InteractingKinematicCloud.C new file mode 100644 index 0000000000..a2002d6285 --- /dev/null +++ b/src/lagrangian/intermediate/clouds/Templates/InteractingKinematicCloud/InteractingKinematicCloud.C @@ -0,0 +1,265 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "DispersionModel.H" +#include "DragModel.H" +#include "InjectionModel.H" +#include "PatchInteractionModel.H" +#include "PostProcessingModel.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::InteractingKinematicCloud::InteractingKinematicCloud +( + const word& cloudName, + const volScalarField& rho, + const volVectorField& U, + const volScalarField& mu, + const dimensionedVector& g +) +: + Cloud(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 >::New + ( + particleProperties_, + *this + ) + ), + dragModel_ + ( + DragModel >::New + ( + particleProperties_, + *this + ) + ), + injectionModel_ + ( + InjectionModel >::New + ( + particleProperties_, + *this + ) + ), + patchInteractionModel_ + ( + PatchInteractionModel >::New + ( + particleProperties_, + *this + ) + ), + postProcessingModel_ + ( + PostProcessingModel >::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) + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::InteractingKinematicCloud::~InteractingKinematicCloud() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::InteractingKinematicCloud::checkParcelProperties +( + ParcelType& parcel, + const scalar lagrangianDt, + const bool fullyDescribed +) +{ + if (!fullyDescribed) + { + parcel.rho() = constProps_.rho0(); + } + + scalar carrierDt = this->db().time().deltaT().value(); + parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt; +} + + +template +void Foam::InteractingKinematicCloud::resetSourceTerms() +{ + UTrans_.field() = vector::zero; +} + + +template +void Foam::InteractingKinematicCloud::preEvolve() +{ + this->dispersion().cacheFields(true); + forces_.cacheFields(true); +} + + +template +void Foam::InteractingKinematicCloud::postEvolve() +{ + if (debug) + { + this->writePositions(); + } + + this->dispersion().cacheFields(false); + forces_.cacheFields(false); + + this->postProcessing().post(); +} + + +template +void Foam::InteractingKinematicCloud::evolve() +{ + preEvolve(); + + autoPtr > rhoInterpolator = + interpolation::New + ( + interpolationSchemes_, + rho_ + ); + + autoPtr > UInterpolator = + interpolation::New + ( + interpolationSchemes_, + U_ + ); + + autoPtr > muInterpolator = + interpolation::New + ( + interpolationSchemes_, + mu_ + ); + + typename ParcelType::trackData td + ( + *this, + constProps_, + rhoInterpolator(), + UInterpolator(), + muInterpolator(), + g_.value() + ); + + this->injection().inject(td); + + if (coupled_) + { + resetSourceTerms(); + } + + Cloud::move(td); + + postEvolve(); +} + + +template +void Foam::InteractingKinematicCloud::info() const +{ + Info<< "Cloud: " << this->name() << nl + << " Total number of parcels added = " + << returnReduce(this->injection().parcelsAddedTotal(), sumOp