mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
better treatment for 'none' option
- added new constructor to base classes read/write injector props to uniform for clean restarts
This commit is contained in:
@ -26,7 +26,7 @@ Class
|
||||
Foam::NoDrag
|
||||
|
||||
Description
|
||||
Dummy drag model for 'no drag'
|
||||
Dummy drag model for 'none'
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -51,7 +51,7 @@ class NoDrag
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("NoDrag");
|
||||
TypeName("none");
|
||||
|
||||
|
||||
// Constructors
|
||||
@ -59,8 +59,8 @@ public:
|
||||
//- Construct from dictionary
|
||||
NoDrag
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
const dictionary&,
|
||||
CloudType&
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -29,6 +29,61 @@ License
|
||||
|
||||
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::InjectionModel<CloudType>::readProps()
|
||||
{
|
||||
IOobject propsDictHeader
|
||||
(
|
||||
"injectionProperties",
|
||||
owner_.db().time().timeName(),
|
||||
"uniform/Lagrangian"/owner_.name(),
|
||||
owner_.db(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
|
||||
if (propsDictHeader.headerOk())
|
||||
{
|
||||
const IOdictionary propsDict(propsDictHeader);
|
||||
|
||||
propsDict.readIfPresent("massInjected", massInjected_);
|
||||
propsDict.readIfPresent("nInjections", nInjections_);
|
||||
propsDict.readIfPresent("parcelsAddedTotal", parcelsAddedTotal_);
|
||||
propsDict.readIfPresent("timeStep0", timeStep0_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::InjectionModel<CloudType>::writeProps()
|
||||
{
|
||||
if (owner_.db().time().outputTime())
|
||||
{
|
||||
IOdictionary propsDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"injectionProperties",
|
||||
owner_.db().time().timeName(),
|
||||
"uniform/Lagrangian"/owner_.name(),
|
||||
owner_.db(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
propsDict.add("massInjected", massInjected_);
|
||||
propsDict.add("nInjections", nInjections_);
|
||||
propsDict.add("parcelsAddedTotal", parcelsAddedTotal_);
|
||||
propsDict.add("timeStep0", timeStep0_);
|
||||
|
||||
propsDict.regIOobject::write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::InjectionModel<CloudType>::prepareForNextTimeStep
|
||||
(
|
||||
@ -114,7 +169,7 @@ void Foam::InjectionModel<CloudType>::findCellAtPosition
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::InjectionModel<CloudType>::findCellAtPosition"
|
||||
"Foam::InjectionModel<CloudType>::findCellAtPosition\n"
|
||||
"(\n"
|
||||
" label&,\n"
|
||||
" vector&\n"
|
||||
@ -156,7 +211,7 @@ Foam::scalar Foam::InjectionModel<CloudType>::setNumberOfParticles
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::scalar "
|
||||
"Foam::InjectionModel<CloudType>::setNumberOfParticles"
|
||||
"Foam::InjectionModel<CloudType>::setNumberOfParticles\n"
|
||||
"(\n"
|
||||
" const label,\n"
|
||||
" const scalar,\n"
|
||||
@ -186,19 +241,42 @@ void Foam::InjectionModel<CloudType>::postInjectCheck()
|
||||
// Increment total number of parcels added
|
||||
parcelsAddedTotal_ += parcelsAdded_;
|
||||
|
||||
// Reset parcel counters
|
||||
parcelsAdded_ = 0;
|
||||
|
||||
// Update time for start of next injection
|
||||
time0_ = owner_.db().time().value();
|
||||
|
||||
// Increment number of injections
|
||||
nInjections_++;
|
||||
|
||||
// Reset added parcels counter
|
||||
parcelsAdded_ = 0;
|
||||
|
||||
writeProps();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::InjectionModel<CloudType>::InjectionModel(CloudType& owner)
|
||||
:
|
||||
dict_(dictionary::null),
|
||||
owner_(owner),
|
||||
coeffDict_(dictionary::null),
|
||||
SOI_(0.0),
|
||||
volumeTotal_(0.0),
|
||||
massTotal_(0.0),
|
||||
massInjected_(0.0),
|
||||
nInjections_(0),
|
||||
parcelsAdded_(0),
|
||||
parcelsAddedTotal_(0),
|
||||
parcelBasis_(pbNumber),
|
||||
time0_(0.0),
|
||||
timeStep0_(0.0)
|
||||
{
|
||||
readProps();
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::InjectionModel<CloudType>::InjectionModel
|
||||
(
|
||||
@ -206,7 +284,8 @@ Foam::InjectionModel<CloudType>::InjectionModel
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
)
|
||||
: dict_(dict),
|
||||
:
|
||||
dict_(dict),
|
||||
owner_(owner),
|
||||
coeffDict_(dict.subDict(type + "Coeffs")),
|
||||
SOI_(readScalar(coeffDict_.lookup("SOI"))),
|
||||
@ -216,16 +295,16 @@ Foam::InjectionModel<CloudType>::InjectionModel
|
||||
nInjections_(0),
|
||||
parcelsAdded_(0),
|
||||
parcelsAddedTotal_(0),
|
||||
parcelBasisType_(coeffDict_.lookup("parcelBasisType")),
|
||||
parcelBasis_(pbNumber),
|
||||
time0_(owner.db().time().value()),
|
||||
timeStep0_(0.0)
|
||||
{
|
||||
if (parcelBasisType_ == "mass")
|
||||
word parcelBasisType = coeffDict_.lookup("parcelBasisType");
|
||||
if (parcelBasisType == "mass")
|
||||
{
|
||||
parcelBasis_ = pbMass;
|
||||
}
|
||||
else if (parcelBasisType_ == "number")
|
||||
else if (parcelBasisType == "number")
|
||||
{
|
||||
parcelBasis_ = pbNumber;
|
||||
}
|
||||
@ -233,7 +312,7 @@ Foam::InjectionModel<CloudType>::InjectionModel
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::InjectionModel<CloudType>::InjectionModel"
|
||||
"Foam::InjectionModel<CloudType>::InjectionModel\n"
|
||||
"(\n"
|
||||
" const dictionary&,\n"
|
||||
" CloudType&,\n"
|
||||
@ -242,6 +321,8 @@ Foam::InjectionModel<CloudType>::InjectionModel
|
||||
)<< "parcelBasisType must be either 'number' or 'mass'" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
readProps();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -80,6 +80,15 @@ private:
|
||||
const dictionary coeffDict_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Read injector properties from previous run (if applicable)
|
||||
void readProps();
|
||||
|
||||
//- Write injector properties
|
||||
void writeProps();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
@ -114,13 +123,8 @@ protected:
|
||||
|
||||
// Injection properties per Lagrangian time step
|
||||
|
||||
// Parcel basis
|
||||
|
||||
//- Parcel basis name
|
||||
const word parcelBasisType_;
|
||||
|
||||
//- Parcel basis enumeration
|
||||
parcelBasis parcelBasis_;
|
||||
//- Parcel basis enumeration
|
||||
parcelBasis parcelBasis_;
|
||||
|
||||
//- Continuous phase time at start of injection time step [s]
|
||||
scalar time0_;
|
||||
@ -147,7 +151,7 @@ protected:
|
||||
|
||||
|
||||
//- Determine properties for next time step/injection interval
|
||||
void prepareForNextTimeStep
|
||||
virtual void prepareForNextTimeStep
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1,
|
||||
@ -161,7 +165,7 @@ protected:
|
||||
virtual void findCellAtPosition(label& cellI, vector& position);
|
||||
|
||||
//- Set number of particles to inject given parcel properties
|
||||
scalar setNumberOfParticles
|
||||
virtual scalar setNumberOfParticles
|
||||
(
|
||||
const label parcels,
|
||||
const scalar volume,
|
||||
@ -171,7 +175,7 @@ protected:
|
||||
);
|
||||
|
||||
//- Post injection checks
|
||||
void postInjectCheck();
|
||||
virtual void postInjectCheck();
|
||||
|
||||
|
||||
public:
|
||||
@ -195,6 +199,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from owner
|
||||
InjectionModel(CloudType& owner);
|
||||
|
||||
//- Construct from dictionary
|
||||
InjectionModel
|
||||
(
|
||||
|
||||
@ -56,11 +56,11 @@ Foam::scalar Foam::NoInjection<CloudType>::volumeToInject
|
||||
template<class CloudType>
|
||||
Foam::NoInjection<CloudType>::NoInjection
|
||||
(
|
||||
const dictionary& dict,
|
||||
const dictionary&,
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
InjectionModel<CloudType>(dict, owner, typeName)
|
||||
InjectionModel<CloudType>(owner)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ Class
|
||||
Foam::NoInjection
|
||||
|
||||
Description
|
||||
Place holder for 'no injection' option
|
||||
Place holder for 'none' option
|
||||
|
||||
SourceFiles
|
||||
NoInjection.C
|
||||
@ -44,7 +44,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class NoInjection Declaration
|
||||
Class NoInjection Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CloudType>
|
||||
@ -74,7 +74,7 @@ protected:
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("NoInjection");
|
||||
TypeName("none");
|
||||
|
||||
|
||||
// Constructors
|
||||
@ -82,8 +82,8 @@ public:
|
||||
//- Construct from components
|
||||
NoInjection
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
const dictionary&,
|
||||
CloudType&
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -31,11 +31,11 @@ License
|
||||
template <class CloudType>
|
||||
Foam::NoPhaseChange<CloudType>::NoPhaseChange
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& cloud
|
||||
const dictionary&,
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
PhaseChangeModel<CloudType>(dict, cloud, typeName)
|
||||
PhaseChangeModel<CloudType>(owner)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ Class
|
||||
Foam::NoPhaseChange
|
||||
|
||||
Description
|
||||
Dummy phase change model for 'no phase change'
|
||||
Dummy phase change model for 'none'
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -51,17 +51,13 @@ class NoPhaseChange
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("NoPhaseChange");
|
||||
TypeName("none");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
NoPhaseChange
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& cloud
|
||||
);
|
||||
NoPhaseChange(const dictionary&, CloudType&);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -28,6 +28,17 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
|
||||
(
|
||||
CloudType& owner
|
||||
)
|
||||
: dict_(dictionary::null),
|
||||
owner_(owner),
|
||||
coeffDict_(dictionary::null)
|
||||
{}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
|
||||
(
|
||||
|
||||
@ -94,6 +94,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from owner
|
||||
PhaseChangeModel(CloudType& owner);
|
||||
|
||||
//- Construct from dictionary
|
||||
PhaseChangeModel
|
||||
(
|
||||
|
||||
@ -26,7 +26,7 @@ Class
|
||||
Foam::NoSurfaceReaction
|
||||
|
||||
Description
|
||||
Dummy Devolatisation model for 'no devolatisation'
|
||||
Dummy surface reaction model for 'none'
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -51,7 +51,7 @@ class NoSurfaceReaction
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("NoSurfaceReaction");
|
||||
TypeName("none");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -28,6 +28,18 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::SurfaceReactionModel<CloudType>::SurfaceReactionModel
|
||||
(
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
dict_(dictionary::null),
|
||||
owner_(owner),
|
||||
coeffDict_(dictionary::null)
|
||||
{}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::SurfaceReactionModel<CloudType>::SurfaceReactionModel
|
||||
(
|
||||
@ -35,7 +47,8 @@ Foam::SurfaceReactionModel<CloudType>::SurfaceReactionModel
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
)
|
||||
: dict_(dict),
|
||||
:
|
||||
dict_(dict),
|
||||
owner_(owner),
|
||||
coeffDict_(dict.subDict(type + "Coeffs"))
|
||||
{}
|
||||
|
||||
@ -91,6 +91,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from owner
|
||||
SurfaceReactionModel(CloudType& owner);
|
||||
|
||||
//- Construct from dictionary
|
||||
SurfaceReactionModel
|
||||
(
|
||||
|
||||
@ -28,6 +28,18 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::DevolatilisationModel<CloudType>::DevolatilisationModel
|
||||
(
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
dict_(dictionary::null),
|
||||
owner_(owner),
|
||||
coeffDict_(dictionary::null)
|
||||
{}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::DevolatilisationModel<CloudType>::DevolatilisationModel
|
||||
(
|
||||
@ -35,7 +47,8 @@ Foam::DevolatilisationModel<CloudType>::DevolatilisationModel
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
)
|
||||
: dict_(dict),
|
||||
:
|
||||
dict_(dict),
|
||||
owner_(owner),
|
||||
coeffDict_(dict.subDict(type + "Coeffs"))
|
||||
{}
|
||||
|
||||
@ -88,6 +88,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from owner
|
||||
DevolatilisationModel(CloudType& owner);
|
||||
|
||||
//- Construct from dictionary
|
||||
DevolatilisationModel
|
||||
(
|
||||
|
||||
@ -31,11 +31,11 @@ License
|
||||
template <class CloudType>
|
||||
Foam::NoDevolatilisation<CloudType>::NoDevolatilisation
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& cloud
|
||||
const dictionary&,
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
DevolatilisationModel<CloudType>(dict, cloud, typeName)
|
||||
DevolatilisationModel<CloudType>(owner)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ Class
|
||||
Foam::NoDevolatilisation
|
||||
|
||||
Description
|
||||
Dummy devolatilisation model for 'no devolatilisation'
|
||||
Dummy devolatilisation model for 'none'
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -52,17 +52,13 @@ class NoDevolatilisation
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("NoDevolatilisation");
|
||||
TypeName("none");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
NoDevolatilisation
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& cloud
|
||||
);
|
||||
NoDevolatilisation(const dictionary&, CloudType& owner);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -28,6 +28,15 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::HeatTransferModel<CloudType>::HeatTransferModel(CloudType& owner)
|
||||
:
|
||||
dict_(dictionary::null),
|
||||
owner_(owner),
|
||||
coeffDict_(dictionary::null)
|
||||
{}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::HeatTransferModel<CloudType>::HeatTransferModel
|
||||
(
|
||||
|
||||
@ -86,6 +86,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from owner
|
||||
HeatTransferModel(CloudType& owner);
|
||||
|
||||
//- Construct from dictionary
|
||||
HeatTransferModel
|
||||
(
|
||||
|
||||
@ -31,11 +31,11 @@ License
|
||||
template <class CloudType>
|
||||
Foam::NoHeatTransfer<CloudType>::NoHeatTransfer
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& cloud
|
||||
const dictionary&,
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
HeatTransferModel<CloudType>(dict, cloud, typeName)
|
||||
HeatTransferModel<CloudType>(owner)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -26,7 +26,7 @@ Class
|
||||
Foam::NoHeatTransfer
|
||||
|
||||
Description
|
||||
Dummy heat transfer model for 'no heat transfer'
|
||||
Dummy heat transfer model for 'none'
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -40,7 +40,7 @@ Description
|
||||
namespace Foam
|
||||
{
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class NoHeatTransfer Declaration
|
||||
Class NoHeatTransfer Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CloudType>
|
||||
@ -51,17 +51,13 @@ class NoHeatTransfer
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("NoHeatTransfer");
|
||||
TypeName("none");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
NoHeatTransfer
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& cloud
|
||||
);
|
||||
NoHeatTransfer(const dictionary&, CloudType& owner);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
Reference in New Issue
Block a user