Commit 7209a42e authored by Andrew Heather's avatar Andrew Heather
Browse files

changed add new parcel functionality - now sets properties instead

parent 73374a5f
......@@ -34,39 +34,6 @@ License
#include "PostProcessingModel.H"
#include "WallInteractionModel.H"
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::addNewParcel
(
const vector& position,
const label cellId,
const scalar d,
const vector& U,
const scalar nParticles,
const scalar lagrangianDt
)
{
ParcelType* pPtr = new ParcelType
(
*this,
position,
cellId,
parcelTypeId_,
nParticles,
d,
U,
constProps_
);
scalar continuousDt = this->db().time().deltaT().value();
pPtr->stepFraction() = (continuousDt - lagrangianDt)/continuousDt;
addParticle(pPtr);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
......@@ -181,6 +148,24 @@ Foam::KinematicCloud<ParcelType>::~KinematicCloud()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::checkParcelProperties
(
ParcelType* pPtr,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
if (!fullyDescribed)
{
pPtr->rho() = constProps_.rho0();
}
scalar carrierDt = this->db().time().deltaT().value();
pPtr->stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
}
template<class ParcelType>
void Foam::KinematicCloud<ParcelType>::resetSourceTerms()
{
......
......@@ -87,7 +87,18 @@ class KinematicCloud
public Cloud<ParcelType>,
public kinematicCloud
{
// Private data
// Private Member Functions
//- Disallow default bitwise copy construct
KinematicCloud(const KinematicCloud&);
//- Disallow default bitwise assignment
void operator=(const KinematicCloud&);
protected:
// Protected data
//- References to the mesh and time databases
const fvMesh& mesh_;
......@@ -173,15 +184,6 @@ class KinematicCloud
DimensionedField<vector, volMesh> UTrans_;
// Private Member Functions
//- Disallow default bitwise copy construct
KinematicCloud(const KinematicCloud&);
//- Disallow default bitwise assignment
void operator=(const KinematicCloud&);
public:
// Constructors
......@@ -350,15 +352,12 @@ public:
// Cloud evolution functions
//- Add new parcel
void addNewParcel
//- Check parcel properties
void checkParcelProperties
(
const vector& position,
const label cellId,
const scalar d,
const vector& U,
const scalar nParticles,
const scalar lagrangianDt
ParcelType* pPtr,
const scalar lagrangianDt,
const bool fullyDescribed
);
//- Reset the spray source terms
......
......@@ -32,33 +32,29 @@ License
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::addNewParcel
void Foam::ReactingCloud<ParcelType>::checkSuppliedComposition
(
const vector& position,
const label cellId,
const scalar d,
const vector& U,
const scalar nParticles,
const scalar lagrangianDt
const scalarField& YSupplied,
const scalarField& Y,
const word& YName
)
{
ParcelType* pPtr = new ParcelType
(
*this,
position,
cellId,
this->parcelTypeId(),
nParticles,
d,
U,
composition().YMixture0(),
constProps_
);
scalar continuousDt = this->db().time().deltaT().value();
pPtr->stepFraction() = (continuousDt - lagrangianDt)/continuousDt;
addParticle(pPtr);
if (YSupplied.size() != Y.size())
{
FatalErrorIn
(
"ReactingCloud<ParcelType>::checkSuppliedComposition"
"("
"const scalarField&, "
"const scalarField&, "
"const word&"
")"
) << YName << " supplied, but size is not compatible with "
<< "parcel composition: " << nl << " "
<< YName << "(" << YSupplied.size() << ") vs required composition "
<< YName << "(" << Y.size() << ")" << nl
<< abort(FatalError);
}
}
......@@ -135,6 +131,40 @@ Foam::ReactingCloud<ParcelType>::~ReactingCloud()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::checkParcelProperties
(
ParcelType* pPtr,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
ThermoCloud<ParcelType>::checkParcelProperties
(
pPtr,
lagrangianDt,
fullyDescribed
);
if (!fullyDescribed)
{
pPtr->Y() = composition().YMixture0();
}
else
{
checkSuppliedComposition
(
pPtr->Y(),
composition().YMixture0(),
"YMixture"
);
}
// derived information - store initial mass
pPtr->mass0() = pPtr->mass();
}
template<class ParcelType>
void Foam::ReactingCloud<ParcelType>::resetSourceTerms()
{
......
......@@ -72,7 +72,18 @@ class ReactingCloud
public ThermoCloud<ParcelType>,
public reactingCloud
{
// Private data
// Private Member Functions
//- Disallow default bitwise copy construct
ReactingCloud(const ReactingCloud&);
//- Disallow default bitwise assignment
void operator=(const ReactingCloud&);
protected:
// Protected data
//- Parcel constant properties
typename ParcelType::constantProperties constProps_;
......@@ -107,13 +118,17 @@ class ReactingCloud
scalar dMassPhaseChange_;
// Private Member Functions
// Protected Member Functions
//- Disallow default bitwise copy construct
ReactingCloud(const ReactingCloud&);
// New parcel helper functions
//- Disallow default bitwise assignment
void operator=(const ReactingCloud&);
//- Check that size of a composition field is valid
void checkSuppliedComposition
(
const scalarField& YSupplied,
const scalarField& Y,
const word& YName
);
public:
......@@ -201,15 +216,12 @@ public:
// Cloud evolution functions
//- Add new parcel
void addNewParcel
//- Check parcel properties
void checkParcelProperties
(
const vector& position,
const label cellId,
const scalar d,
const vector& U,
const scalar nParticles,
const scalar lagrangianDt
ParcelType* pPtr,
const scalar lagrangianDt,
const bool fullyDescribed
);
//- Reset the spray source terms
......
......@@ -29,46 +29,6 @@ License
#include "DevolatilisationModel.H"
#include "SurfaceReactionModel.H"
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::addNewParcel
(
const vector& position,
const label cellId,
const scalar d,
const vector& U,
const scalar nParticles,
const scalar lagrangianDt
)
{
label idGas = this->composition().idGas();
label idLiquid = this->composition().idLiquid();
label idSolid = this->composition().idSolid();
ParcelType* pPtr = new ParcelType
(
*this,
position,
cellId,
this->parcelTypeId(),
nParticles,
d,
U,
this->composition().YMixture0(),
this->composition().Y0(idGas),
this->composition().Y0(idLiquid),
this->composition().Y0(idSolid),
constProps_
);
scalar continuousDt = this->db().time().deltaT().value();
pPtr->stepFraction() = (continuousDt - lagrangianDt)/continuousDt;
addParticle(pPtr);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
......@@ -114,6 +74,55 @@ Foam::ReactingMultiphaseCloud<ParcelType>::~ReactingMultiphaseCloud()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::checkParcelProperties
(
ParcelType* pPtr,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
ReactingCloud<ParcelType>::checkParcelProperties
(
pPtr,
lagrangianDt,
fullyDescribed
);
label idGas = this->composition().idGas();
label idLiquid = this->composition().idLiquid();
label idSolid = this->composition().idSolid();
if (!fullyDescribed)
{
pPtr->YGas() = this->composition().Y0(idGas);
pPtr->YLiquid() = this->composition().Y0(idLiquid);
pPtr->YSolid() = this->composition().Y0(idSolid);
}
else
{
this->checkSuppliedComposition
(
pPtr->YGas(),
this->composition().Y0(idGas),
"YGas"
);
this->checkSuppliedComposition
(
pPtr->YLiquid(),
this->composition().Y0(idLiquid),
"YLiquid"
);
this->checkSuppliedComposition
(
pPtr->YSolid(),
this->composition().Y0(idSolid),
"YSolid"
);
}
}
template<class ParcelType>
void Foam::ReactingMultiphaseCloud<ParcelType>::resetSourceTerms()
{
......
......@@ -68,7 +68,18 @@ class ReactingMultiphaseCloud
public ReactingCloud<ParcelType>,
public reactingMultiphaseCloud
{
// Private data
// Private Member Functions
//- Disallow default bitwise copy construct
ReactingMultiphaseCloud(const ReactingMultiphaseCloud&);
//- Disallow default bitwise assignment
void operator=(const ReactingMultiphaseCloud&);
protected:
// Protected data
//- Parcel constant properties
typename ParcelType::constantProperties constProps_;
......@@ -101,15 +112,6 @@ class ReactingMultiphaseCloud
scalar dMassSurfaceReaction_;
// Private Member Functions
//- Disallow default bitwise copy construct
ReactingMultiphaseCloud(const ReactingMultiphaseCloud&);
//- Disallow default bitwise assignment
void operator=(const ReactingMultiphaseCloud&);
public:
// Constructors
......@@ -174,15 +176,12 @@ public:
// Cloud evolution functions
//- Add new parcel
void addNewParcel
//- Check parcel properties
void checkParcelProperties
(
const vector& position,
const label cellId,
const scalar d,
const vector& U,
const scalar nParticles,
const scalar lagrangianDt
ParcelType* pPtr,
const scalar lagrangianDt,
const bool fullyDescribed
);
//- Reset the spray source terms
......
......@@ -30,38 +30,6 @@ License
#include "HeatTransferModel.H"
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::addNewParcel
(
const vector& position,
const label cellId,
const scalar d,
const vector& U,
const scalar nParticles,
const scalar lagrangianDt
)
{
ParcelType* pPtr = new ParcelType
(
*this,
position,
cellId,
this->parcelTypeId(),
nParticles,
d,
U,
constProps_
);
scalar continuousDt = this->db().time().deltaT().value();
pPtr->stepFraction() = (continuousDt - lagrangianDt)/continuousDt;
addParticle(pPtr);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParcelType>
......@@ -142,6 +110,29 @@ Foam::ThermoCloud<ParcelType>::~ThermoCloud()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::checkParcelProperties
(
ParcelType* pPtr,
const scalar lagrangianDt,
const bool fullyDescribed
)
{
KinematicCloud<ParcelType>::checkParcelProperties
(
pPtr,
lagrangianDt,
fullyDescribed
);
if (!fullyDescribed)
{
pPtr->T() = constProps_.T0();
pPtr->cp() = constProps_.cp0();
}
}
template<class ParcelType>
void Foam::ThermoCloud<ParcelType>::resetSourceTerms()
{
......
......@@ -46,7 +46,6 @@ SourceFiles
#include "KinematicCloud.H"
#include "thermoCloud.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
......@@ -67,7 +66,18 @@ class ThermoCloud
public KinematicCloud<ParcelType>,
public thermoCloud
{
// Private data
// Private Member Functions
//- Disallow default bitwise copy construct
ThermoCloud(const ThermoCloud&);
//- Disallow default bitwise assignment
void operator=(const ThermoCloud&);
protected:
// Protected data
//- Thermo parcel constant properties
typename ParcelType::constantProperties constProps_;
......@@ -110,15 +120,6 @@ class ThermoCloud
DimensionedField<scalar, volMesh> hcTrans_;
// Private Member Functions
//- Disallow default bitwise copy construct
ThermoCloud(const ThermoCloud&);
//- Disallow default bitwise assignment
void operator=(const ThermoCloud&);
public:
// Constructors
......@@ -216,15 +217,12 @@ public:
// Cloud evolution functions
//- Add new parcel
void addNewParcel
//- Check parcel properties
void checkParcelProperties
(
const vector& position,
const label cellId,
const scalar d,
const vector& U,
const scalar nParticles,
const scalar lagrangianDt
ParcelType* pPtr,
const scalar lagrangianDt,
const bool fullyDescribed
);
//- Reset the spray source terms
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment