Skip to content
Snippets Groups Projects
Commit 34bca9ba authored by Andrew Heather's avatar Andrew Heather
Browse files

Added `active' switch to clouds

Provides a clean mechanism to run the lagrangian family of solvers without
a cloud
parent f04cdab2
Branches
Tags
No related merge requests found
Showing
with 366 additions and 292 deletions
......@@ -34,6 +34,76 @@ License
#include "PatchInteractionModel.H"
#include "PostProcessingModel.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::preEvolve()
{
this->dispersion().cacheFields(true);
forces_.cacheFields(true);
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::evolveCloud()
{
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();
}
Cloud<ParcelType>::move(td);
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::postEvolve()
{
if (debug)
{
this->writePositions();
}
this->dispersion().cacheFields(false);
forces_.cacheFields(false);
this->postProcessing().post();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
......@@ -62,6 +132,7 @@ Foam::KinematicCloud<ParcelType>::KinematicCloud
)
),
constProps_(particleProperties_),
active_(particleProperties_.lookup("active")),
parcelTypeId_(readLabel(particleProperties_.lookup("parcelTypeId"))),
coupled_(particleProperties_.lookup("coupled")),
cellValueSourceCorrection_
......@@ -179,75 +250,17 @@ void Foam::KinematicCloud<ParcelType>::resetSourceTerms()
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::preEvolve()
{
this->dispersion().cacheFields(true);
forces_.cacheFields(true);
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::postEvolve()
{
if (debug)
{
this->writePositions();
}
this->dispersion().cacheFields(false);
forces_.cacheFields(false);
this->postProcessing().post();
}
template<class ParcelType>
void Foam::KinematicCloud<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_)
if (active_)
{
resetSourceTerms();
}
preEvolve();
Cloud<ParcelType>::move(td);
evolveCloud();
postEvolve();
postEvolve();
}
}
......
......@@ -109,6 +109,9 @@ protected:
//- Parcel constant properties
typename ParcelType::constantProperties constProps_;
//- Cloud active flag
const Switch active_;
//- Parcel type id - used to flag the type of parcels issued by this
// cloud
const label parcelTypeId_;
......@@ -189,6 +192,9 @@ protected:
//- Pre-evolve
void preEvolve();
//- Evolve the cloud
void evolveCloud();
//- Post-evolve
void postEvolve();
......@@ -223,9 +229,6 @@ public:
// References to the mesh and databases
//- Return the parcel type id
inline label parcelTypeId() const;
//- Return refernce to the mesh
inline const fvMesh& mesh() const;
......@@ -237,14 +240,22 @@ public:
constProps() const;
//- Return coupled flag
inline const Switch coupled() const;
// Cloud data
//- Return the active flag
inline const Switch active() const;
//- Return the parcel type id
inline label parcelTypeId() const;
//- Return coupled flag
inline const Switch coupled() const;
//- Return cell value correction flag
inline const Switch cellValueSourceCorrection() const;
//- Return cell value correction flag
inline const Switch cellValueSourceCorrection() const;
//- Return refernce to the random object
inline Random& rndGen();
//- Return refernce to the random object
inline Random& rndGen();
// References to the carrier gas fields
......
......@@ -58,6 +58,13 @@ Foam::KinematicCloud<ParcelType>::constProps() const
}
template<class ParcelType>
inline const Foam::Switch Foam::KinematicCloud<ParcelType>::active() const
{
return active_;
}
template<class ParcelType>
inline const Foam::Switch Foam::KinematicCloud<ParcelType>::coupled() const
{
......
......@@ -58,6 +58,87 @@ void Foam::ReactingCloud<ParcelType>::checkSuppliedComposition
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::preEvolve()
{
ThermoCloud<ParcelType>::preEvolve();
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::evolveCloud()
{
const volScalarField& T = this->carrierThermo().T();
const volScalarField cp = this->carrierThermo().Cp();
const volScalarField& p = this->carrierThermo().p();
autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
this->rho()
);
autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
(
this->interpolationSchemes(),
this->U()
);
autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
this->mu()
);
autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
T
);
autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
cp
);
autoPtr<interpolation<scalar> > pInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
p
);
typename ParcelType::trackData td
(
*this,
constProps_,
rhoInterp(),
UInterp(),
muInterp(),
TInterp(),
cpInterp(),
pInterp(),
this->g().value()
);
this->injection().inject(td);
if (this->coupled())
{
resetSourceTerms();
}
Cloud<ParcelType>::move(td);
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::postEvolve()
{
ThermoCloud<ParcelType>::postEvolve();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
......@@ -181,88 +262,17 @@ void Foam::ReactingCloud<ParcelType>::resetSourceTerms()
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::preEvolve()
{
ThermoCloud<ParcelType>::preEvolve();
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::postEvolve()
{
ThermoCloud<ParcelType>::postEvolve();
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::evolve()
{
preEvolve();
const volScalarField& T = this->carrierThermo().T();
const volScalarField cp = this->carrierThermo().Cp();
const volScalarField& p = this->carrierThermo().p();
autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
this->rho()
);
autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
(
this->interpolationSchemes(),
this->U()
);
autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
this->mu()
);
autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
T
);
autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
cp
);
autoPtr<interpolation<scalar> > pInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
p
);
typename ParcelType::trackData td
(
*this,
constProps_,
rhoInterp(),
UInterp(),
muInterp(),
TInterp(),
cpInterp(),
pInterp(),
this->g().value()
);
this->injection().inject(td);
if (this->coupled())
if (this->active())
{
resetSourceTerms();
}
preEvolve();
Cloud<ParcelType>::move(td);
evolveCloud();
postEvolve();
postEvolve();
}
}
......
......@@ -137,6 +137,9 @@ protected:
//- Pre-evolve
void preEvolve();
//- Evolve the cloud
void evolveCloud();
//- Post-evolve
void postEvolve();
......
......@@ -29,6 +29,89 @@ License
#include "DevolatilisationModel.H"
#include "SurfaceReactionModel.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::preEvolve()
{
ReactingCloud<ParcelType>::preEvolve();
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::evolveCloud()
{
const volScalarField& T = this->carrierThermo().T();
const volScalarField cp = this->carrierThermo().Cp();
const volScalarField& p = this->carrierThermo().p();
autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
this->rho()
);
autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
(
this->interpolationSchemes(),
this->U()
);
autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
this->mu()
);
autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
T
);
autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
cp
);
autoPtr<interpolation<scalar> > pInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
p
);
typename ParcelType::trackData td
(
*this,
constProps_,
rhoInterp(),
UInterp(),
muInterp(),
TInterp(),
cpInterp(),
pInterp(),
this->g().value()
);
this->injection().inject(td);
if (this->coupled())
{
resetSourceTerms();
}
Cloud<ParcelType>::move(td);
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::postEvolve()
{
ReactingCloud<ParcelType>::postEvolve();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
......@@ -135,88 +218,17 @@ void Foam::ReactingMultiphaseCloud<ParcelType>::resetSourceTerms()
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::preEvolve()
{
ReactingCloud<ParcelType>::preEvolve();
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::postEvolve()
{
ReactingCloud<ParcelType>::postEvolve();
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::evolve()
{
preEvolve();
const volScalarField& T = this->carrierThermo().T();
const volScalarField cp = this->carrierThermo().Cp();
const volScalarField& p = this->carrierThermo().p();
autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
this->rho()
);
autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
(
this->interpolationSchemes(),
this->U()
);
autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
this->mu()
);
autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
T
);
autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
cp
);
autoPtr<interpolation<scalar> > pInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
p
);
typename ParcelType::trackData td
(
*this,
constProps_,
rhoInterp(),
UInterp(),
muInterp(),
TInterp(),
cpInterp(),
pInterp(),
this->g().value()
);
this->injection().inject(td);
if (this->coupled())
if (this->active())
{
resetSourceTerms();
}
preEvolve();
Cloud<ParcelType>::move(td);
evolveCloud();
postEvolve();
postEvolve();
}
}
......
......@@ -119,6 +119,9 @@ protected:
//- Pre-evolve
void preEvolve();
//- Evolve the cloud
void evolveCloud();
//- Post-evolve
void postEvolve();
......
......@@ -30,6 +30,81 @@ License
#include "HeatTransferModel.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::preEvolve()
{
KinematicCloud<ParcelType>::preEvolve();
}
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::evolveCloud()
{
const volScalarField& T = carrierThermo_.T();
const volScalarField cp = carrierThermo_.Cp();
autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
this->rho()
);
autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
(
this->interpolationSchemes(),
this->U()
);
autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
this->mu()
);
autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
T
);
autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
cp
);
typename ParcelType::trackData td
(
*this,
constProps_,
rhoInterp(),
UInterp(),
muInterp(),
TInterp(),
cpInterp(),
this->g().value()
);
this->injection().inject(td);
if (this->coupled())
{
resetSourceTerms();
}
Cloud<ParcelType>::move(td);
}
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::postEvolve()
{
KinematicCloud<ParcelType>::postEvolve();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
......@@ -149,80 +224,17 @@ void Foam::ThermoCloud<ParcelType>::resetSourceTerms()
}
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::preEvolve()
{
KinematicCloud<ParcelType>::preEvolve();
}
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::postEvolve()
{
KinematicCloud<ParcelType>::postEvolve();
}
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::evolve()
{
preEvolve();
const volScalarField& T = carrierThermo_.T();
const volScalarField cp = carrierThermo_.Cp();
autoPtr<interpolation<scalar> > rhoInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
this->rho()
);
autoPtr<interpolation<vector> > UInterp = interpolation<vector>::New
(
this->interpolationSchemes(),
this->U()
);
autoPtr<interpolation<scalar> > muInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
this->mu()
);
autoPtr<interpolation<scalar> > TInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
T
);
autoPtr<interpolation<scalar> > cpInterp = interpolation<scalar>::New
(
this->interpolationSchemes(),
cp
);
typename ParcelType::trackData td
(
*this,
constProps_,
rhoInterp(),
UInterp(),
muInterp(),
TInterp(),
cpInterp(),
this->g().value()
);
this->injection().inject(td);
if (this->coupled())
if (this->active())
{
resetSourceTerms();
}
preEvolve();
Cloud<ParcelType>::move(td);
evolveCloud();
postEvolve();
postEvolve();
}
}
......
......@@ -125,6 +125,9 @@ protected:
//- Pre-evolve
void preEvolve();
//- Evolve the cloud
void evolveCloud();
//- Post-evolve
void postEvolve();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment