mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Aligned finite volume sources - now all derived from basicSource
This commit is contained in:
@ -378,19 +378,20 @@ $(SRF)/SRFModel/rpm/rpm.C
|
|||||||
$(SRF)/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
|
$(SRF)/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVectorField.C
|
||||||
$(SRF)/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C
|
$(SRF)/derivedFvPatchFields/SRFFreestreamVelocityFvPatchVectorField/SRFFreestreamVelocityFvPatchVectorField.C
|
||||||
|
|
||||||
fieldSources = $(general)/fieldSources
|
|
||||||
$(fieldSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C
|
|
||||||
$(fieldSources)/timeActivatedExplicitSource/timeActivatedExplicitSource.C
|
|
||||||
|
|
||||||
basicSource = $(general)/fieldSources/basicSource
|
basicSource = $(general)/fieldSources/basicSource
|
||||||
$(basicSource)/basicSource/basicSource.C
|
$(basicSource)/basicSource/basicSource.C
|
||||||
$(basicSource)/basicSource/basicSourceIO.C
|
$(basicSource)/basicSource/basicSourceIO.C
|
||||||
$(basicSource)/basicSource/basicSourceList.C
|
$(basicSource)/basicSource/basicSourceList.C
|
||||||
$(basicSource)/basicSource/IObasicSourceList.C
|
$(basicSource)/basicSource/IObasicSourceList.C
|
||||||
$(basicSource)/actuationDiskSource/actuationDiskSource.C
|
|
||||||
$(basicSource)/radialActuationDiskSource/radialActuationDiskSource.C
|
$(basicSource)/pressureGradientExplicitSource/pressureGradientExplicitSource.C
|
||||||
|
$(basicSource)/pressureGradientExplicitSource/pressureGradientExplicitSourceIO.C
|
||||||
|
|
||||||
$(basicSource)/explicitSource/explicitSource.C
|
$(basicSource)/explicitSource/explicitSource.C
|
||||||
|
|
||||||
$(basicSource)/explicitSetValue/explicitSetValue.C
|
$(basicSource)/explicitSetValue/explicitSetValue.C
|
||||||
|
$(basicSource)/explicitSetValue/explicitSetValueIO.C
|
||||||
|
|
||||||
$(basicSource)/rotorDiskSource/rotorDiskSource.C
|
$(basicSource)/rotorDiskSource/rotorDiskSource.C
|
||||||
$(basicSource)/rotorDiskSource/bladeModel/bladeModel.C
|
$(basicSource)/rotorDiskSource/bladeModel/bladeModel.C
|
||||||
$(basicSource)/rotorDiskSource/profileModel/profileModel.C
|
$(basicSource)/rotorDiskSource/profileModel/profileModel.C
|
||||||
@ -398,5 +399,7 @@ $(basicSource)/rotorDiskSource/profileModel/profileModelList.C
|
|||||||
$(basicSource)/rotorDiskSource/profileModel/lookup/lookupProfile.C
|
$(basicSource)/rotorDiskSource/profileModel/lookup/lookupProfile.C
|
||||||
$(basicSource)/rotorDiskSource/profileModel/series/seriesProfile.C
|
$(basicSource)/rotorDiskSource/profileModel/series/seriesProfile.C
|
||||||
|
|
||||||
|
$(basicSource)/actuationDiskSource/actuationDiskSource.C
|
||||||
|
$(basicSource)/radialActuationDiskSource/radialActuationDiskSource.C
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libfiniteVolume
|
LIB = $(FOAM_LIBBIN)/libfiniteVolume
|
||||||
|
|||||||
@ -35,7 +35,12 @@ License
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(actuationDiskSource, 0);
|
defineTypeNameAndDebug(actuationDiskSource, 0);
|
||||||
addToRunTimeSelectionTable(basicSource, actuationDiskSource, dictionary);
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
basicSource,
|
||||||
|
actuationDiskSource,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -75,7 +80,6 @@ Foam::actuationDiskSource::actuationDiskSource
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
basicSource(name, modelType, dict, mesh),
|
basicSource(name, modelType, dict, mesh),
|
||||||
coeffs_(dict.subDict(modelType + "Coeffs")),
|
|
||||||
diskDir_(coeffs_.lookup("diskDir")),
|
diskDir_(coeffs_.lookup("diskDir")),
|
||||||
Cp_(readScalar(coeffs_.lookup("Cp"))),
|
Cp_(readScalar(coeffs_.lookup("Cp"))),
|
||||||
Ct_(readScalar(coeffs_.lookup("Ct"))),
|
Ct_(readScalar(coeffs_.lookup("Ct"))),
|
||||||
@ -90,17 +94,35 @@ Foam::actuationDiskSource::actuationDiskSource
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
Foam::label Foam::actuationDiskSource::applyToField
|
||||||
|
(
|
||||||
|
const word& fieldName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (fieldName == fieldName_)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::actuationDiskSource::addSup
|
||||||
|
(
|
||||||
|
fvMatrix<vector>& eqn,
|
||||||
|
const label
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool compressible = false;
|
bool compressible = false;
|
||||||
if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
|
if (eqn.dimensions() == dimForce)
|
||||||
{
|
{
|
||||||
compressible = true;
|
compressible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalarField& cellsV = this->mesh().V();
|
const scalarField& cellsV = mesh_.V();
|
||||||
vectorField& Usource = UEqn.source();
|
vectorField& Usource = eqn.source();
|
||||||
const vectorField& U = UEqn.psi();
|
const vectorField& U = eqn.psi();
|
||||||
|
|
||||||
if (V() > VSMALL)
|
if (V() > VSMALL)
|
||||||
{
|
{
|
||||||
@ -111,7 +133,7 @@ void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
|||||||
Usource,
|
Usource,
|
||||||
cells_,
|
cells_,
|
||||||
cellsV,
|
cellsV,
|
||||||
this->mesh().lookupObject<volScalarField>("rho"),
|
mesh_.lookupObject<volScalarField>("rho"),
|
||||||
U
|
U
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -133,7 +155,7 @@ void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
|||||||
void Foam::actuationDiskSource::writeData(Ostream& os) const
|
void Foam::actuationDiskSource::writeData(Ostream& os) const
|
||||||
{
|
{
|
||||||
os << indent << name_ << endl;
|
os << indent << name_ << endl;
|
||||||
dict_.write(os);
|
coeffs_.write(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -141,7 +163,6 @@ bool Foam::actuationDiskSource::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (basicSource::read(dict))
|
if (basicSource::read(dict))
|
||||||
{
|
{
|
||||||
coeffs_ = dict.subDict(typeName + "Coeffs");
|
|
||||||
coeffs_.readIfPresent("diskDir", diskDir_);
|
coeffs_.readIfPresent("diskDir", diskDir_);
|
||||||
coeffs_.readIfPresent("Cp", Cp_);
|
coeffs_.readIfPresent("Cp", Cp_);
|
||||||
coeffs_.readIfPresent("Ct", Ct_);
|
coeffs_.readIfPresent("Ct", Ct_);
|
||||||
|
|||||||
@ -74,8 +74,8 @@ protected:
|
|||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Coefficients dictionary
|
//- Name of field to apply source upon
|
||||||
dictionary coeffs_;
|
word fieldName_;
|
||||||
|
|
||||||
//- Disk area normal
|
//- Disk area normal
|
||||||
vector diskDir_;
|
vector diskDir_;
|
||||||
@ -140,6 +140,12 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
// Check
|
||||||
|
|
||||||
|
//- Return index of field name if found in fieldNames list
|
||||||
|
virtual label applyToField(const word& fieldName) const;
|
||||||
|
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return Cp
|
//- Return Cp
|
||||||
@ -169,11 +175,8 @@ public:
|
|||||||
|
|
||||||
// Public Functions
|
// Public Functions
|
||||||
|
|
||||||
//-Source term to fvMatrix<vector>
|
//- Source term to fvMatrix<vector>
|
||||||
virtual void addSu(fvMatrix<vector>& UEqn);
|
virtual void addSup(fvMatrix<vector>& eqn, const label fieldI);
|
||||||
|
|
||||||
//-Source term to fvMatrix<scalar>
|
|
||||||
virtual void addSu(fvMatrix<scalar>& UEqn){}
|
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
|
|||||||
@ -118,7 +118,7 @@ void Foam::basicSource::setCellSet()
|
|||||||
{
|
{
|
||||||
WarningIn
|
WarningIn
|
||||||
(
|
(
|
||||||
"TimeActivatedExplicitSource<Type>::setCellIds()"
|
"basicSource::setCellIds()"
|
||||||
)
|
)
|
||||||
<< "Unable to find owner cell for point " << points_[i]
|
<< "Unable to find owner cell for point " << points_[i]
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -148,7 +148,7 @@ void Foam::basicSource::setCellSet()
|
|||||||
label zoneID = mesh_.cellZones().findZoneID(cellSetName_);
|
label zoneID = mesh_.cellZones().findZoneID(cellSetName_);
|
||||||
if (zoneID == -1)
|
if (zoneID == -1)
|
||||||
{
|
{
|
||||||
FatalErrorIn("basicSource<Type>::setCellIds()")
|
FatalErrorIn("basicSource::setCellIds()")
|
||||||
<< "Cannot find cellZone " << cellSetName_ << endl
|
<< "Cannot find cellZone " << cellSetName_ << endl
|
||||||
<< "Valid cellZones are " << mesh_.cellZones().names()
|
<< "Valid cellZones are " << mesh_.cellZones().names()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
@ -166,7 +166,7 @@ void Foam::basicSource::setCellSet()
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
FatalErrorIn("basicSource<Type>::setCellIds()")
|
FatalErrorIn("basicSource::setCellIds()")
|
||||||
<< "Unknown selectionMode "
|
<< "Unknown selectionMode "
|
||||||
<< selectionModeTypeNames_[selectionMode_]
|
<< selectionModeTypeNames_[selectionMode_]
|
||||||
<< ". Valid selectionMode types are" << selectionModeTypeNames_
|
<< ". Valid selectionMode types are" << selectionModeTypeNames_
|
||||||
@ -194,24 +194,24 @@ Foam::basicSource::basicSource
|
|||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const word& modelType,
|
const word& modelType,
|
||||||
const dictionary& dict,
|
const dictionary& coeffs,
|
||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
name_(name),
|
||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
dict_(dict),
|
coeffs_(coeffs),
|
||||||
active_(readBool(dict_.lookup("active"))),
|
active_(readBool(coeffs_.lookup("active"))),
|
||||||
timeStart_(readScalar(dict_.lookup("timeStart"))),
|
timeStart_(readScalar(coeffs_.lookup("timeStart"))),
|
||||||
duration_(readScalar(dict_.lookup("duration"))),
|
duration_(readScalar(coeffs_.lookup("duration"))),
|
||||||
selectionMode_
|
selectionMode_
|
||||||
(
|
(
|
||||||
selectionModeTypeNames_.read(dict_.lookup("selectionMode"))
|
selectionModeTypeNames_.read(coeffs_.lookup("selectionMode"))
|
||||||
),
|
),
|
||||||
cellSetName_("none"),
|
cellSetName_("none"),
|
||||||
V_(0.0)
|
V_(0.0)
|
||||||
{
|
{
|
||||||
setSelection(dict_);
|
setSelection(coeffs_);
|
||||||
|
|
||||||
setCellSet();
|
setCellSet();
|
||||||
}
|
}
|
||||||
@ -222,11 +222,11 @@ Foam::basicSource::basicSource
|
|||||||
Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
|
Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const dictionary& dict,
|
const dictionary& coeffs,
|
||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
word modelType(dict.lookup("type"));
|
word modelType(coeffs.lookup("type"));
|
||||||
|
|
||||||
Info<< "Selecting model type " << modelType << endl;
|
Info<< "Selecting model type " << modelType << endl;
|
||||||
|
|
||||||
@ -237,16 +237,16 @@ Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"basicSource::New(const volVectorField&, "
|
"basicSource::New"
|
||||||
"const surfaceScalarField&, transportModel&)"
|
"(const name&, const dictionary&, const fvMesh&)"
|
||||||
) << "Unknown Model type " << modelType
|
) << "Unknown Model type " << modelType
|
||||||
<< nl << nl
|
<< nl << nl
|
||||||
<< "Valid model types are :" << nl
|
<< "Valid model types are:" << nl
|
||||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoPtr<basicSource>(cstrIter()(name, modelType, dict, mesh));
|
return autoPtr<basicSource>(cstrIter()(name, modelType, coeffs, mesh));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -275,21 +275,75 @@ bool Foam::basicSource::isActive()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::basicSource::addSu(Foam::fvMatrix<vector>& Eqn)
|
void Foam::basicSource::addSup(fvMatrix<scalar>& eqn, const label fieldI)
|
||||||
{
|
{
|
||||||
notImplemented("Foam::basicSource addSu(Foam::fvMatrix<vector>& Eqn)");
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::basicSource::addSu(Foam::fvMatrix<scalar>& Eqn)
|
void Foam::basicSource::addSup(fvMatrix<vector>& eqn, const label fieldI)
|
||||||
{
|
{
|
||||||
notImplemented("Foam::basicSource addSu(Foam::fvMatrix<scalar>& Eqn)");
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::basicSource::setValue(Foam::fvMatrix<scalar>& Eqn)
|
void Foam::basicSource::addSup
|
||||||
|
(
|
||||||
|
fvMatrix<sphericalTensor>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
)
|
||||||
{
|
{
|
||||||
notImplemented("Foam::basicSource setValue(Foam::fvMatrix<scalar>& Eqn)");
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::basicSource::addSup(fvMatrix<symmTensor>& eqn, const label fieldI)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::basicSource::addSup(fvMatrix<tensor>& eqn, const label fieldI)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::basicSource::setValue(fvMatrix<scalar>& eqn, const label fieldI)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::basicSource::setValue(fvMatrix<vector>& eqn, const label fieldI)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::basicSource::setValue
|
||||||
|
(
|
||||||
|
fvMatrix<sphericalTensor>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::basicSource::setValue
|
||||||
|
(
|
||||||
|
fvMatrix<symmTensor>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::basicSource::setValue(fvMatrix<tensor>& eqn, const label fieldI)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -129,11 +129,14 @@ protected:
|
|||||||
const fvMesh& mesh_;
|
const fvMesh& mesh_;
|
||||||
|
|
||||||
//- Dictionary containing the data of the source
|
//- Dictionary containing the data of the source
|
||||||
const dictionary& dict_;
|
dictionary coeffs_;
|
||||||
|
|
||||||
//- Source active flag
|
//- Source active flag
|
||||||
bool active_;
|
bool active_;
|
||||||
|
|
||||||
|
//- Flag to indicate whether or not the source has been applied
|
||||||
|
// bool applied_; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
//- Time start
|
//- Time start
|
||||||
scalar timeStart_;
|
scalar timeStart_;
|
||||||
|
|
||||||
@ -271,7 +274,7 @@ public:
|
|||||||
inline const fvMesh& mesh() const;
|
inline const fvMesh& mesh() const;
|
||||||
|
|
||||||
//- Return dictionary
|
//- Return dictionary
|
||||||
inline const dictionary& dictCoeffs() const;
|
inline const dictionary& coeffs() const;
|
||||||
|
|
||||||
//- Return const access to the source active flag
|
//- Return const access to the source active flag
|
||||||
inline bool active() const;
|
inline bool active() const;
|
||||||
@ -316,18 +319,86 @@ public:
|
|||||||
//- Is the source active?
|
//- Is the source active?
|
||||||
bool isActive();
|
bool isActive();
|
||||||
|
|
||||||
|
//- Return index of field name if found in fieldNames list
|
||||||
|
virtual label applyToField(const word& fieldName) const = 0;
|
||||||
|
|
||||||
|
|
||||||
// Evaluation
|
// Evaluation
|
||||||
|
|
||||||
//- Add source term to vector fvMatrix
|
// Add explicit and implicit contributions
|
||||||
virtual void addSu(fvMatrix<vector>& Eqn);
|
|
||||||
|
|
||||||
//- Add source term to scalar fvMatrix
|
//- Scalar
|
||||||
virtual void addSu(fvMatrix<scalar>& Eqn);
|
virtual void addSup
|
||||||
|
(
|
||||||
|
fvMatrix<scalar>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
);
|
||||||
|
|
||||||
//- Set constant value on field
|
//- Vector
|
||||||
virtual void setValue(fvMatrix<scalar>& Eq);
|
virtual void addSup
|
||||||
|
(
|
||||||
|
fvMatrix<vector>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Spherical tensor
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
fvMatrix<symmTensor>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Symmetric tensor
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
fvMatrix<sphericalTensor>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Tensor
|
||||||
|
virtual void addSup
|
||||||
|
(
|
||||||
|
fvMatrix<tensor>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Set values directly
|
||||||
|
|
||||||
|
//- Scalar
|
||||||
|
virtual void setValue
|
||||||
|
(
|
||||||
|
fvMatrix<scalar>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Vector
|
||||||
|
virtual void setValue
|
||||||
|
(
|
||||||
|
fvMatrix<vector>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Spherical tensor
|
||||||
|
virtual void setValue
|
||||||
|
(
|
||||||
|
fvMatrix<sphericalTensor>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Symmetric tensor
|
||||||
|
virtual void setValue
|
||||||
|
(
|
||||||
|
fvMatrix<symmTensor>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Tensor
|
||||||
|
virtual void setValue
|
||||||
|
(
|
||||||
|
fvMatrix<tensor>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
|
|||||||
@ -38,11 +38,13 @@ inline const Foam::fvMesh& Foam::basicSource::mesh() const
|
|||||||
return mesh_;
|
return mesh_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const Foam::dictionary& Foam::basicSource::dictCoeffs() const
|
|
||||||
|
inline const Foam::dictionary& Foam::basicSource::coeffs() const
|
||||||
{
|
{
|
||||||
return dict_;
|
return coeffs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::basicSource::active() const
|
inline bool Foam::basicSource::active() const
|
||||||
{
|
{
|
||||||
return active_;
|
return active_;
|
||||||
|
|||||||
@ -24,6 +24,14 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "basicSourceList.H"
|
#include "basicSourceList.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(basicSourceList, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -50,59 +58,23 @@ Foam::basicSourceList::basicSourceList
|
|||||||
label i = 0;
|
label i = 0;
|
||||||
forAllConstIter(dictionary, dict, iter)
|
forAllConstIter(dictionary, dict, iter)
|
||||||
{
|
{
|
||||||
const word& name = iter().keyword();
|
if (iter().isDict())
|
||||||
const dictionary& sourceDict = iter().dict();
|
{
|
||||||
|
const word& name = iter().keyword();
|
||||||
|
const dictionary& sourceDict = iter().dict();
|
||||||
|
|
||||||
this->set
|
this->set
|
||||||
(
|
(
|
||||||
i++,
|
i++,
|
||||||
basicSource::New(name, sourceDict, mesh)
|
basicSource::New(name, sourceDict, mesh)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
void Foam::basicSourceList::addSu(fvMatrix<scalar>& Eqn)
|
|
||||||
{
|
|
||||||
forAll(*this, i)
|
|
||||||
{
|
|
||||||
if (this->operator[](i).isActive())
|
|
||||||
{
|
|
||||||
this->operator[](i).addSu(Eqn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::basicSourceList::addSu(fvMatrix<vector>& Eqn)
|
|
||||||
{
|
|
||||||
|
|
||||||
forAll(*this, i)
|
|
||||||
{
|
|
||||||
if (this->operator[](i).isActive())
|
|
||||||
{
|
|
||||||
this->operator[](i).addSu(Eqn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::basicSourceList::setValue(fvMatrix<scalar>& Eqn)
|
|
||||||
{
|
|
||||||
|
|
||||||
forAll(*this, i)
|
|
||||||
{
|
|
||||||
if (this->operator[](i).isActive())
|
|
||||||
{
|
|
||||||
this->operator[](i).setValue(Eqn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::basicSourceList::read(const dictionary& dict)
|
bool Foam::basicSourceList::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
bool allOk = true;
|
bool allOk = true;
|
||||||
|
|||||||
@ -71,6 +71,10 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("basicSourceList");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components with list of field names
|
//- Construct from components with list of field names
|
||||||
@ -86,14 +90,8 @@ public:
|
|||||||
|
|
||||||
// Evaluation
|
// Evaluation
|
||||||
|
|
||||||
//- Add source terms to scalar fvMatrix
|
template<class Type>
|
||||||
void addSu(fvMatrix<scalar>& Eq);
|
void apply(fvMatrix<Type>& eqn);
|
||||||
|
|
||||||
//- Add source terms to vector fvMatrix
|
|
||||||
void addSu(fvMatrix<vector>& Eq);
|
|
||||||
|
|
||||||
//- Set constant value on field
|
|
||||||
void setValue(fvMatrix<scalar>& Eq);
|
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
@ -119,6 +117,12 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
#include "basicSourceListTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -23,38 +23,31 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "explicitSource.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::explicitSource::writeData(Ostream& os) const
|
template<class Type>
|
||||||
|
void Foam::basicSourceList::apply(fvMatrix<Type>& eqn)
|
||||||
{
|
{
|
||||||
os << indent << name_ << endl;
|
const word& fieldName = eqn.psi().name();
|
||||||
dict_.write(os);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
forAll(*this, i)
|
||||||
bool Foam::explicitSource::read(const dictionary& dict)
|
|
||||||
{
|
|
||||||
if (basicSource::read(dict))
|
|
||||||
{
|
{
|
||||||
coeffs_ = dict.subDict(typeName + "Coeffs");
|
basicSource& source = this->operator[](i);
|
||||||
setFieldData(coeffs_.subDict("fieldData"));
|
|
||||||
return true;
|
label fieldI = source.applyToField(fieldName);
|
||||||
|
|
||||||
|
if (source.isActive() && (fieldI != -1))
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "Applying source " << source.name() << " to field "
|
||||||
|
<< fieldName << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
source.addSup(eqn, fieldI);
|
||||||
|
source.setValue(eqn, fieldI);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const explicitSource& source)
|
|
||||||
{
|
|
||||||
source.writeData(os);
|
|
||||||
return os;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ void Foam::explicitSetValue::setFieldData(const dictionary& dict)
|
|||||||
fieldName,
|
fieldName,
|
||||||
this->mesh().time().timeName(),
|
this->mesh().time().timeName(),
|
||||||
this->mesh(),
|
this->mesh(),
|
||||||
IOobject::NO_READ,
|
IOobject::MUST_READ,
|
||||||
IOobject::NO_WRITE,
|
IOobject::NO_WRITE,
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
@ -93,22 +93,40 @@ Foam::explicitSetValue::explicitSetValue
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
basicSource(name, modelType, dict, mesh),
|
basicSource(name, modelType, dict, mesh)
|
||||||
coeffs_(dict.subDict(modelType + "Coeffs"))
|
|
||||||
{
|
{
|
||||||
setFieldData(coeffs_.subDict("fieldData"));
|
setFieldData(coeffs_.subDict("fieldData"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSetValue::setValue(fvMatrix<scalar>& Eqn)
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::label Foam::explicitSetValue::applyToField
|
||||||
|
(
|
||||||
|
const word& fieldName
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
setFieldValue(Eqn, scalarFields_[Eqn.psi().name()]);
|
notImplemented("Foam::explicitSetValue::applyToField(const word&)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSetValue::setValue(fvMatrix<vector>& Eqn)
|
void Foam::explicitSetValue::setValue
|
||||||
|
(
|
||||||
|
fvMatrix<scalar>& eqn,
|
||||||
|
const label
|
||||||
|
)
|
||||||
{
|
{
|
||||||
setFieldValue(Eqn, vectorFields_[Eqn.psi().name()]);
|
setFieldValue(eqn, scalarFields_[eqn.psi().name()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::explicitSetValue::setValue
|
||||||
|
(
|
||||||
|
fvMatrix<vector>& eqn,
|
||||||
|
const label
|
||||||
|
)
|
||||||
|
{
|
||||||
|
setFieldValue(eqn, vectorFields_[eqn.psi().name()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -87,12 +87,6 @@ class explicitSetValue
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
|
||||||
|
|
||||||
//- Coefficients dictionary
|
|
||||||
dictionary coeffs_;
|
|
||||||
|
|
||||||
|
|
||||||
// Protected functions
|
// Protected functions
|
||||||
|
|
||||||
//- Set the local field data
|
//- Set the local field data
|
||||||
@ -126,20 +120,19 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
// Check
|
||||||
|
|
||||||
// Edit
|
//- Return index of field name if found in fieldNames list
|
||||||
|
virtual label applyToField(const word& fieldName) const;
|
||||||
//- Return points
|
|
||||||
inline const List<point>& points() const;
|
|
||||||
|
|
||||||
|
|
||||||
// Evaluation
|
// Evaluation
|
||||||
|
|
||||||
//- Set value on vector field
|
//- Set value on vector field
|
||||||
virtual void setValue(fvMatrix<vector>& UEqn);
|
virtual void setValue(fvMatrix<vector>& eqn, const label fieldI);
|
||||||
|
|
||||||
//- Set value on scalar field
|
//- Set value on scalar field
|
||||||
virtual void setValue(fvMatrix<scalar>& UEqn);
|
virtual void setValue(fvMatrix<scalar>& eqn, const label fieldI);
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
@ -147,15 +140,8 @@ public:
|
|||||||
//- Write the source properties
|
//- Write the source properties
|
||||||
virtual void writeData(Ostream&) const;
|
virtual void writeData(Ostream&) const;
|
||||||
|
|
||||||
//- Read fieldData in sub-dictionary
|
//- Read source dictionary
|
||||||
virtual bool read(const dictionary& dict);
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
//- Ostream operator
|
|
||||||
friend Ostream& operator<<
|
|
||||||
(
|
|
||||||
Ostream& os,
|
|
||||||
const explicitSetValue& source
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -165,11 +151,6 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "explicitSetValueIO.C"
|
|
||||||
#include "explicitSetValueI.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
# include "explicitSetValueTemplates.C"
|
# include "explicitSetValueTemplates.C"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -30,7 +30,7 @@ License
|
|||||||
void Foam::explicitSetValue::writeData(Ostream& os) const
|
void Foam::explicitSetValue::writeData(Ostream& os) const
|
||||||
{
|
{
|
||||||
os << indent << name_ << endl;
|
os << indent << name_ << endl;
|
||||||
dict_.write(os);
|
coeffs_.write(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +38,6 @@ bool Foam::explicitSetValue::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (basicSource::read(dict))
|
if (basicSource::read(dict))
|
||||||
{
|
{
|
||||||
coeffs_ = dict.subDict(typeName + "Coeffs");
|
|
||||||
setFieldData(coeffs_.subDict("fieldData"));
|
setFieldData(coeffs_.subDict("fieldData"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -49,13 +48,4 @@ bool Foam::explicitSetValue::read(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const explicitSetValue& source)
|
|
||||||
{
|
|
||||||
source.writeData(os);
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -52,14 +52,14 @@ void Foam::explicitSetValue::setFieldValue
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
List<Type> values(this->cells().size());
|
List<Type> values(cells_.size());
|
||||||
|
|
||||||
forAll (values, i)
|
forAll(values, i)
|
||||||
{
|
{
|
||||||
values[i] = data;
|
values[i] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Eqn.setValues(this->cells(), values);
|
Eqn.setValues(cells_, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,184 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||||
|
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "ExplicitSource.H"
|
||||||
|
#include "fvMesh.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "dimensionedType.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
const Foam::wordList Foam::ExplicitSource<Type>::
|
||||||
|
volumeModeTypeNames_
|
||||||
|
(
|
||||||
|
IStringStream("(absolute specific)")()
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
typename Foam::ExplicitSource<Type>::volumeModeType
|
||||||
|
Foam::ExplicitSource<Type>::wordToVolumeModeType
|
||||||
|
(
|
||||||
|
const word& vmtName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
forAll(volumeModeTypeNames_, i)
|
||||||
|
{
|
||||||
|
if (vmtName == volumeModeTypeNames_[i])
|
||||||
|
{
|
||||||
|
return volumeModeType(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"ExplicitSource<Type>::volumeModeType"
|
||||||
|
"ExplicitSource<Type>::wordToVolumeModeType(const word&)"
|
||||||
|
) << "Unknown volumeMode type " << vmtName
|
||||||
|
<< ". Valid volumeMode types are:" << nl << volumeModeTypeNames_
|
||||||
|
<< exit(FatalError);
|
||||||
|
|
||||||
|
return volumeModeType(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::word Foam::ExplicitSource<Type>::volumeModeTypeToWord
|
||||||
|
(
|
||||||
|
const volumeModeType& vmtType
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
if (vmtType > volumeModeTypeNames_.size())
|
||||||
|
{
|
||||||
|
return "UNKNOWN";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return volumeModeTypeNames_[vmtType];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::ExplicitSource<Type>::ExplicitSource
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& coeffs,
|
||||||
|
const fvMesh& mesh
|
||||||
|
)
|
||||||
|
:
|
||||||
|
basicSource(name, modelType, coeffs, mesh),
|
||||||
|
volumeMode_(wordToVolumeModeType(coeffs_.lookup("volumeMode"))),
|
||||||
|
VDash_(1.0),
|
||||||
|
fieldData_()
|
||||||
|
{
|
||||||
|
const dictionary& fieldDict(coeffs_.subDict("fieldData"));
|
||||||
|
fieldData_.setSize(fieldDict.toc().size());
|
||||||
|
label i = 0;
|
||||||
|
forAllConstIter(dictionary, fieldDict, iter)
|
||||||
|
{
|
||||||
|
fieldData_[i].first() = iter().keyword();
|
||||||
|
fieldDict.lookup(iter().keyword()) >> fieldData_[i].second();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set volume normalisation
|
||||||
|
if (volumeMode_ == vmAbsolute)
|
||||||
|
{
|
||||||
|
VDash_ = V_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Foam::label Foam::ExplicitSource<Type>::applyToField
|
||||||
|
(
|
||||||
|
const word& fieldName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
forAll(fieldData_, i)
|
||||||
|
{
|
||||||
|
if (fieldData_[i].first() == fieldName)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::ExplicitSource<Type>::addSup
|
||||||
|
(
|
||||||
|
fvMatrix<Type>& eqn,
|
||||||
|
const label fieldI
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< "ExplicitSource<"<< pTraits<Type>::typeName
|
||||||
|
<< ">::addSup for source " << name_ << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
DimensionedField<Type, volMesh> Su
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
name_ + fieldData_[fieldI].first() + "Sup",
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensioned<Type>
|
||||||
|
(
|
||||||
|
"zero",
|
||||||
|
eqn.dimensions()/dimVolume,
|
||||||
|
pTraits<Type>::zero
|
||||||
|
),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(cells_, i)
|
||||||
|
{
|
||||||
|
Su[cells_[i]] = fieldData_[fieldI].second()/VDash_;
|
||||||
|
}
|
||||||
|
|
||||||
|
eqn -= Su;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -22,37 +22,45 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::explicitSource
|
Foam::ExplicitSource
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Explicit source.
|
Time activated explicit source.
|
||||||
|
|
||||||
Sources described by:
|
Sources described by:
|
||||||
|
|
||||||
explicitSourceCoeffs
|
|
||||||
{
|
{
|
||||||
points // list of points when selectionMode = points
|
active true; // on/off switch
|
||||||
|
timeStart 0.2; // start time
|
||||||
|
duration 2.0; // duration
|
||||||
|
selectionMode points; // cellSet/cellZone/all
|
||||||
|
volumeMode absolute; // specific
|
||||||
|
|
||||||
|
fieldData // field data - usage for multiple fields
|
||||||
(
|
(
|
||||||
(-0.088 0.007 -0.02)
|
(H2O 0.005)
|
||||||
(-0.028 0.007 -0.02)
|
|
||||||
);
|
);
|
||||||
volumeMode specific; //absolute
|
|
||||||
fieldData // field data - usage for multiple fields
|
fieldData 0.005; // field data - usage for single field
|
||||||
{
|
|
||||||
k 30.7;
|
points // list of points when selectionMode = points
|
||||||
epsilon 1.5;
|
(
|
||||||
}
|
(2.75 0.5 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
cellSet c0; // cellSet name when selectionMode=cellSet
|
||||||
|
cellZone c0; // cellZone name when selectionMode=cellZone
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
explicitSource.C
|
ExplicitSource.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef explicitSource_H
|
#ifndef ExplicitSource_H
|
||||||
#define explicitSource_H
|
#define ExplicitSource_H
|
||||||
|
|
||||||
#include "cellSet.H"
|
#include "Tuple2.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "DimensionedField.H"
|
#include "DimensionedField.H"
|
||||||
#include "basicSource.H"
|
#include "basicSource.H"
|
||||||
@ -62,35 +70,31 @@ SourceFiles
|
|||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
|
|
||||||
|
class fvMesh;
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
class ExplicitSource;
|
||||||
|
|
||||||
|
// Forward declaration of friend functions
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
Ostream& operator<<
|
||||||
|
(
|
||||||
|
Ostream&,
|
||||||
|
const ExplicitSource<Type>&
|
||||||
|
);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class explicitSource Declaration
|
Class ExplicitSource Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class explicitSource
|
template<class Type>
|
||||||
|
class ExplicitSource
|
||||||
:
|
:
|
||||||
public basicSource
|
public basicSource
|
||||||
{
|
{
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- List of field types
|
|
||||||
HashTable<scalar> scalarFields_;
|
|
||||||
HashTable<vector> vectorFields_;
|
|
||||||
|
|
||||||
//- Add source to matrix
|
|
||||||
template<class Type>
|
|
||||||
void addSource(fvMatrix<Type>&, const Type&) const;
|
|
||||||
|
|
||||||
//- Add field names and values to field table for types.
|
|
||||||
template<class Type>
|
|
||||||
void addField
|
|
||||||
(
|
|
||||||
HashTable<Type>& fields,
|
|
||||||
const wordList& fieldTypes,
|
|
||||||
const wordList& fieldNames,
|
|
||||||
const dictionary& dict
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Public data
|
// Public data
|
||||||
@ -103,36 +107,44 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//- Word list of volume mode type names
|
//- Word list of volume mode type names
|
||||||
static const NamedEnum<volumeModeType, 2> volumeModeTypeNames_;
|
static const wordList volumeModeTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Coefficients dictionary
|
typedef Tuple2<word, Type> fieldNameValuePair;
|
||||||
dictionary coeffs_;
|
|
||||||
|
|
||||||
//- Volume mode
|
//- Volume mode
|
||||||
volumeModeType volumeMode_;
|
volumeModeType volumeMode_;
|
||||||
|
|
||||||
|
//- Volume normalisation
|
||||||
|
scalar VDash_;
|
||||||
|
|
||||||
|
//- Source value per field
|
||||||
|
List<fieldNameValuePair> fieldData_;
|
||||||
|
|
||||||
|
|
||||||
// Protected functions
|
// Protected functions
|
||||||
|
|
||||||
//- Set the local field data
|
//- Helper function to convert from a word to a volumeModeType
|
||||||
void setFieldData(const dictionary& dict);
|
volumeModeType wordToVolumeModeType(const word& vtName) const;
|
||||||
|
|
||||||
|
//- Helper function to convert from a volumeModeType to a word
|
||||||
|
word volumeModeTypeToWord(const volumeModeType& vtType) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
TypeName("explicitSource");
|
TypeName("ExplicitSource");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
explicitSource
|
ExplicitSource
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const word& modelType,
|
const word& modelType,
|
||||||
@ -140,42 +152,37 @@ public:
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return clone
|
|
||||||
autoPtr<explicitSource> clone() const
|
|
||||||
{
|
|
||||||
notImplemented
|
|
||||||
(
|
|
||||||
"autoPtr<explicitSource> clone() const"
|
|
||||||
);
|
|
||||||
return autoPtr<explicitSource>(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
// Check
|
||||||
|
|
||||||
|
//- Return index of field name if found in fieldNames list
|
||||||
|
virtual label applyToField(const word& fieldName) const;
|
||||||
|
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return const access to the volume mode
|
//- Return const access to the volume mode
|
||||||
inline const volumeModeType& volumeMode() const;
|
inline const volumeModeType& volumeMode() const;
|
||||||
|
|
||||||
|
//- Return const access to the source field value
|
||||||
|
inline const Type& fieldData() const;
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
//- Return access to the volume mode
|
//- Return access to the volume mode
|
||||||
inline volumeModeType& volumeMode();
|
inline volumeModeType& volumeMode();
|
||||||
|
|
||||||
//- Return points
|
//- Return access to the source field value
|
||||||
inline const List<point>& points() const;
|
inline Type& fieldData();
|
||||||
|
|
||||||
|
|
||||||
// Evaluation
|
// Evaluation
|
||||||
|
|
||||||
//-Source term to fvMatrix<vector>
|
//- Add explicit contribution to equation
|
||||||
virtual void addSu(fvMatrix<vector>& UEqn);
|
virtual void addSup(fvMatrix<Type>& eqn, const label fieldI);
|
||||||
|
|
||||||
//-Source term to fvMatrix<scalar>
|
|
||||||
virtual void addSu(fvMatrix<scalar>& UEqn);
|
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
@ -183,15 +190,8 @@ public:
|
|||||||
//- Write the source properties
|
//- Write the source properties
|
||||||
virtual void writeData(Ostream&) const;
|
virtual void writeData(Ostream&) const;
|
||||||
|
|
||||||
//- Read fieldData in sub-dictionary
|
//- Read source dictionary
|
||||||
virtual bool read(const dictionary& dict);
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
//- Ostream operator
|
|
||||||
friend Ostream& operator<<
|
|
||||||
(
|
|
||||||
Ostream& os,
|
|
||||||
const explicitSource& source
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -201,14 +201,14 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#include "explicitSourceIO.C"
|
#ifdef NoRepository
|
||||||
#include "explicitSourceI.H"
|
# include "ExplicitSource.C"
|
||||||
|
# include "ExplicitSourceIO.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
#include "ExplicitSourceI.H"
|
||||||
# include "explicitSourceTemplates.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -23,14 +23,37 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "explicitSetValue.H"
|
#include "ExplicitSource.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline const Foam::List<Foam::point>&
|
template<class Type>
|
||||||
Foam::explicitSetValue::points() const
|
inline const typename Foam::ExplicitSource<Type>::volumeModeType&
|
||||||
|
Foam::ExplicitSource<Type>::volumeMode() const
|
||||||
{
|
{
|
||||||
return points_;
|
return volumeMode_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline const Type& Foam::ExplicitSource<Type>::fieldData() const
|
||||||
|
{
|
||||||
|
return fieldData_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline typename Foam::ExplicitSource<Type>::volumeModeType&
|
||||||
|
Foam::ExplicitSource<Type>::volumeMode()
|
||||||
|
{
|
||||||
|
return volumeMode_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
inline Type& Foam::ExplicitSource<Type>::fieldData()
|
||||||
|
{
|
||||||
|
return fieldData_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -23,28 +23,29 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "explicitSource.H"
|
#include "ExplicitSource.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline const Foam::explicitSource::volumeModeType&
|
template<class Type>
|
||||||
Foam::explicitSource::volumeMode() const
|
void Foam::ExplicitSource<Type>::writeData(Ostream& os) const
|
||||||
{
|
{
|
||||||
return volumeMode_;
|
notImplemented
|
||||||
|
(
|
||||||
|
"void Foam::ExplicitSource<Type>::read(Ostream&) const"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::explicitSource::volumeModeType&
|
template<class Type>
|
||||||
Foam::explicitSource::volumeMode()
|
bool Foam::ExplicitSource<Type>::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
return volumeMode_;
|
notImplemented
|
||||||
}
|
(
|
||||||
|
"bool Foam::ExplicitSource<Type>::read(const dictionary&)"
|
||||||
|
);
|
||||||
|
|
||||||
|
return false;
|
||||||
inline const Foam::List<Foam::point>&
|
|
||||||
Foam::explicitSource::points() const
|
|
||||||
{
|
|
||||||
return points_;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -23,111 +23,18 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "explicitSource.H"
|
#include "makeBasicSource.H"
|
||||||
#include "fvMesh.H"
|
#include "ExplicitSource.H"
|
||||||
#include "volFields.H"
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
#include "HashSet.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(explicitSource, 0);
|
makeBasicSource(ExplicitSource, scalar);
|
||||||
addToRunTimeSelectionTable
|
makeBasicSource(ExplicitSource, vector);
|
||||||
(
|
makeBasicSource(ExplicitSource, sphericalTensor);
|
||||||
basicSource,
|
makeBasicSource(ExplicitSource, symmTensor);
|
||||||
explicitSource,
|
makeBasicSource(ExplicitSource, tensor);
|
||||||
dictionary
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<> const char* NamedEnum
|
|
||||||
<
|
|
||||||
explicitSource::volumeModeType,
|
|
||||||
2
|
|
||||||
>::names[] =
|
|
||||||
{
|
|
||||||
"absolute",
|
|
||||||
"specific"
|
|
||||||
};
|
|
||||||
|
|
||||||
const NamedEnum<explicitSource::volumeModeType, 2>
|
|
||||||
explicitSource::volumeModeTypeNames_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::explicitSource::setFieldData(const dictionary& dict)
|
|
||||||
{
|
|
||||||
scalarFields_.clear();
|
|
||||||
vectorFields_.clear();
|
|
||||||
|
|
||||||
wordList fieldTypes(dict.toc().size());
|
|
||||||
wordList fieldNames(dict.toc().size());
|
|
||||||
|
|
||||||
forAll(dict.toc(), i)
|
|
||||||
{
|
|
||||||
const word& fieldName = dict.toc()[i];
|
|
||||||
IOobject io
|
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
this->mesh().time().timeName(),
|
|
||||||
this->mesh(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
if (io.headerOk())
|
|
||||||
{
|
|
||||||
fieldTypes[i] = io.headerClassName();
|
|
||||||
fieldNames[i] = dict.toc()[i];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"explicitSource::setFieldData"
|
|
||||||
) << "header not OK " << io.name()
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addField(scalarFields_, fieldTypes, fieldNames, dict);
|
|
||||||
addField(vectorFields_, fieldTypes, fieldNames, dict);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
Foam::explicitSource::explicitSource
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const word& modelType,
|
|
||||||
const dictionary& dict,
|
|
||||||
const fvMesh& mesh
|
|
||||||
)
|
|
||||||
:
|
|
||||||
basicSource(name, modelType, dict, mesh),
|
|
||||||
coeffs_(dict.subDict(modelType + "Coeffs")),
|
|
||||||
volumeMode_(volumeModeTypeNames_.read(coeffs_.lookup("volumeMode")))
|
|
||||||
{
|
|
||||||
setFieldData(dict_.subDict("fieldData"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSource::addSu(fvMatrix<scalar>& Eqn)
|
|
||||||
{
|
|
||||||
addSource(Eqn, scalarFields_[Eqn.psi().name()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSource::addSu(fvMatrix<vector>& Eqn)
|
|
||||||
{
|
|
||||||
addSource(Eqn, vectorFields_[Eqn.psi().name()]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,104 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
template <class Type>
|
|
||||||
void Foam::explicitSource::addSource
|
|
||||||
(
|
|
||||||
fvMatrix<Type>& Eqn,
|
|
||||||
const Type& sourceData
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
Type data = sourceData;
|
|
||||||
if (volumeMode_ == vmAbsolute)
|
|
||||||
{
|
|
||||||
// Convert to specific quantity
|
|
||||||
data /= V_;
|
|
||||||
}
|
|
||||||
|
|
||||||
DimensionedField<Type, volMesh> rhs
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"rhs",
|
|
||||||
Eqn.psi().mesh().time().timeName(),
|
|
||||||
Eqn.psi().mesh(),
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
Eqn.psi().mesh(),
|
|
||||||
dimensioned<Type>
|
|
||||||
(
|
|
||||||
"zero",
|
|
||||||
Eqn.dimensions()/dimVolume,
|
|
||||||
pTraits<Type>::zero
|
|
||||||
)
|
|
||||||
);
|
|
||||||
UIndirectList<Type>(rhs, this->cells()) = data;
|
|
||||||
|
|
||||||
Eqn -= rhs;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template <class Type>
|
|
||||||
void Foam::explicitSource::addField
|
|
||||||
(
|
|
||||||
HashTable<Type>& fields,
|
|
||||||
const wordList& fieldTypes,
|
|
||||||
const wordList& fieldNames,
|
|
||||||
const dictionary& fieldDataDict
|
|
||||||
)
|
|
||||||
{
|
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> geometricField;
|
|
||||||
|
|
||||||
forAll (fieldTypes, fieldI)
|
|
||||||
{
|
|
||||||
word fieldName = fieldNames[fieldI];
|
|
||||||
word fieldType = fieldTypes[fieldI];
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
(
|
|
||||||
fieldType
|
|
||||||
== GeometricField<Type, fvPatchField, volMesh>::typeName
|
|
||||||
) &&
|
|
||||||
(
|
|
||||||
this->mesh().foundObject<geometricField>(fieldName)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
Type fieldValue = fieldDataDict.lookupOrDefault<Type>
|
|
||||||
(
|
|
||||||
fieldName,
|
|
||||||
pTraits<Type>::zero
|
|
||||||
);
|
|
||||||
|
|
||||||
fields.insert(fieldName, fieldValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -21,43 +21,28 @@ License
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Typedef
|
|
||||||
Foam::timeActivatedExplicitSource
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef timeActivatedExplicitSource_H
|
#ifndef makeBasicSource_H
|
||||||
#define timeActivatedExplicitSource_H
|
#define makeBasicSource_H
|
||||||
|
|
||||||
#include "TimeActivatedExplicitSource.H"
|
#include "basicSource.H"
|
||||||
#include "TimeActivatedExplicitSourceList.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
#define makeBasicSource(Source, Type) \
|
||||||
{
|
\
|
||||||
typedef TimeActivatedExplicitSource<scalar>
|
defineTemplateTypeNameAndDebugWithName \
|
||||||
scalarTimeActivatedExplicitSource;
|
( \
|
||||||
typedef TimeActivatedExplicitSource<vector>
|
Source<Type>, \
|
||||||
vectorTimeActivatedExplicitSource;
|
#Type#Source, \
|
||||||
typedef TimeActivatedExplicitSource<sphericalTensor>
|
0 \
|
||||||
sphericalTensorTimeActivatedExplicitSource;
|
); \
|
||||||
typedef TimeActivatedExplicitSource<symmTensor>
|
\
|
||||||
symmTensorTimeActivatedExplicitSource;
|
basicSource::adddictionaryConstructorToTable<Source<Type> > \
|
||||||
typedef TimeActivatedExplicitSource<tensor>
|
add##Source##Type##dictionary##ConstructorTobasicSourceTable_
|
||||||
tensorTimeActivatedExplicitSource;
|
|
||||||
|
|
||||||
typedef TimeActivatedExplicitSourceList<scalar>
|
|
||||||
scalarTimeActivatedExplicitSourceList;
|
|
||||||
typedef TimeActivatedExplicitSourceList<vector>
|
|
||||||
vectorTimeActivatedExplicitSourceList;
|
|
||||||
typedef TimeActivatedExplicitSourceList<sphericalTensor>
|
|
||||||
sphericalTensorTimeActivatedExplicitSourceList;
|
|
||||||
typedef TimeActivatedExplicitSourceList<symmTensor>
|
|
||||||
symmTensorTimeActivatedExplicitSourceList;
|
|
||||||
typedef TimeActivatedExplicitSourceList<tensor>
|
|
||||||
tensorTimeActivatedExplicitSourceList;
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -26,10 +26,23 @@ License
|
|||||||
#include "pressureGradientExplicitSource.H"
|
#include "pressureGradientExplicitSource.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(pressureGradientExplicitSourceNew, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
basicSource,
|
||||||
|
pressureGradientExplicitSourceNew,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::pressureGradientExplicitSource::writeGradP() const
|
void Foam::pressureGradientExplicitSourceNew::writeGradP() const
|
||||||
{
|
{
|
||||||
// Only write on output time
|
// Only write on output time
|
||||||
if (mesh_.time().outputTime())
|
if (mesh_.time().outputTime())
|
||||||
@ -38,7 +51,7 @@ void Foam::pressureGradientExplicitSource::writeGradP() const
|
|||||||
(
|
(
|
||||||
IOobject
|
IOobject
|
||||||
(
|
(
|
||||||
sourceName_ + "Properties",
|
name_ + "Properties",
|
||||||
mesh_.time().timeName(),
|
mesh_.time().timeName(),
|
||||||
"uniform",
|
"uniform",
|
||||||
mesh_,
|
mesh_,
|
||||||
@ -52,65 +65,77 @@ void Foam::pressureGradientExplicitSource::writeGradP() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
void Foam::pressureGradientExplicitSourceNew::update()
|
||||||
|
|
||||||
Foam::pressureGradientExplicitSource::pressureGradientExplicitSource
|
|
||||||
(
|
|
||||||
const word& sourceName,
|
|
||||||
volVectorField& U
|
|
||||||
)
|
|
||||||
:
|
|
||||||
sourceName_(sourceName),
|
|
||||||
mesh_(U.mesh()),
|
|
||||||
U_(U),
|
|
||||||
dict_
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
sourceName + "Properties",
|
|
||||||
mesh_.time().constant(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::MUST_READ_IF_MODIFIED,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
)
|
|
||||||
),
|
|
||||||
Ubar_(dict_.lookup("Ubar")),
|
|
||||||
gradPini_(dict_.lookup("gradPini")),
|
|
||||||
gradP_(gradPini_),
|
|
||||||
flowDir_(Ubar_/mag(Ubar_)),
|
|
||||||
cellSource_(dict_.lookup("cellSource")),
|
|
||||||
cellSelector_
|
|
||||||
(
|
|
||||||
topoSetSource::New
|
|
||||||
(
|
|
||||||
cellSource_,
|
|
||||||
mesh_,
|
|
||||||
dict_.subDict(cellSource_ + "Coeffs")
|
|
||||||
)
|
|
||||||
),
|
|
||||||
selectedCellSet_
|
|
||||||
(
|
|
||||||
mesh_,
|
|
||||||
sourceName_ + "CellSet",
|
|
||||||
mesh_.nCells()/10 + 1 // Reasonable size estimate.
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// Create the cell set
|
volVectorField& U = const_cast<volVectorField&>
|
||||||
cellSelector_->applyToSet
|
|
||||||
(
|
(
|
||||||
topoSetSource::NEW,
|
mesh_.lookupObject<volVectorField>(UName_)
|
||||||
selectedCellSet_
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Give some feedback
|
const volScalarField& rAU =
|
||||||
Info<< " Selected "
|
mesh_.lookupObject<volScalarField>("(1|A(" + UName_ + "))");
|
||||||
<< returnReduce(selectedCellSet_.size(), sumOp<label>())
|
|
||||||
<< " cells" << endl;
|
|
||||||
|
|
||||||
|
// Integrate flow variables over cell set
|
||||||
|
scalar magUbarAve = 0.0;
|
||||||
|
scalar rAUave = 0.0;
|
||||||
|
const scalarField& cv = mesh_.V();
|
||||||
|
forAll(cells_, i)
|
||||||
|
{
|
||||||
|
label cellI = cells_[i];
|
||||||
|
scalar volCell = cv[cellI];
|
||||||
|
magUbarAve += (flowDir_ & U[cellI])*volCell;
|
||||||
|
rAUave += rAU[cellI]*volCell;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Collect across all processors
|
||||||
|
reduce(magUbarAve, sumOp<scalar>());
|
||||||
|
|
||||||
|
// Volume averages
|
||||||
|
magUbarAve /= V_;
|
||||||
|
rAUave /= V_;
|
||||||
|
|
||||||
|
// Calculate the pressure gradient increment needed to adjust the average
|
||||||
|
// flow-rate to the desired value
|
||||||
|
scalar gradPplus = (mag(Ubar_) - magUbarAve)/rAUave;
|
||||||
|
|
||||||
|
// Apply correction to velocity field
|
||||||
|
forAll(cells_, i)
|
||||||
|
{
|
||||||
|
label cellI = cells_[i];
|
||||||
|
U[cellI] += flowDir_*rAU[cellI]*gradPplus;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update pressure gradient
|
||||||
|
gradP_.value() += gradPplus;
|
||||||
|
|
||||||
|
Info<< "Uncorrected Ubar = " << magUbarAve << tab
|
||||||
|
<< "Pressure gradient = " << gradP_.value() << endl;
|
||||||
|
|
||||||
|
writeGradP();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::pressureGradientExplicitSourceNew::pressureGradientExplicitSourceNew
|
||||||
|
(
|
||||||
|
const word& sourceName,
|
||||||
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvMesh& mesh
|
||||||
|
)
|
||||||
|
:
|
||||||
|
basicSource(sourceName, modelType, dict, mesh),
|
||||||
|
UName_(coeffs_.lookupOrDefault<word>("UName", "U")),
|
||||||
|
Ubar_(coeffs_.lookup("Ubar")),
|
||||||
|
gradPini_(coeffs_.lookup("gradPini")),
|
||||||
|
gradP_(gradPini_),
|
||||||
|
flowDir_(Ubar_/mag(Ubar_))
|
||||||
|
{
|
||||||
// Read the initial pressure gradient from file if it exists
|
// Read the initial pressure gradient from file if it exists
|
||||||
IFstream propsFile
|
IFstream propsFile
|
||||||
(
|
(
|
||||||
mesh_.time().timeName()/"uniform"/(sourceName_ + "Properties")
|
mesh_.time().timeName()/"uniform"/(name_ + "Properties")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (propsFile.good())
|
if (propsFile.good())
|
||||||
@ -126,86 +151,47 @@ Foam::pressureGradientExplicitSource::pressureGradientExplicitSource
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh> >
|
Foam::label Foam::pressureGradientExplicitSourceNew::applyToField
|
||||||
Foam::pressureGradientExplicitSource::Su() const
|
(
|
||||||
|
const word& fieldName
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
tmp<DimensionedField<vector, volMesh> > tSource
|
if (fieldName == UName_)
|
||||||
(
|
|
||||||
new DimensionedField<vector, volMesh>
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
sourceName_,
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedVector("zero", gradP_.dimensions(), vector::zero)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
DimensionedField<vector, volMesh>& sourceField = tSource();
|
|
||||||
|
|
||||||
forAllConstIter(cellSet, selectedCellSet_, iter)
|
|
||||||
{
|
{
|
||||||
label cellI = iter.key();
|
return 0;
|
||||||
|
}
|
||||||
sourceField[cellI] = flowDir_*gradP_.value();
|
else
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tSource;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::pressureGradientExplicitSource::update()
|
void Foam::pressureGradientExplicitSourceNew::addSup
|
||||||
|
(
|
||||||
|
fvMatrix<vector>& eqn,
|
||||||
|
const label
|
||||||
|
)
|
||||||
{
|
{
|
||||||
const volScalarField& rAU =
|
update();
|
||||||
mesh_.lookupObject<volScalarField>("(1|A(" + U_.name() + "))");
|
|
||||||
|
|
||||||
// Integrate flow variables over cell set
|
DimensionedField<vector, volMesh> Su
|
||||||
scalar volTot = 0.0;
|
(
|
||||||
scalar magUbarAve = 0.0;
|
IOobject
|
||||||
scalar rAUave = 0.0;
|
(
|
||||||
forAllConstIter(cellSet, selectedCellSet_, iter)
|
name_ + UName_ + "Sup",
|
||||||
{
|
mesh_.time().timeName(),
|
||||||
label cellI = iter.key();
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedVector("zero", gradP_.dimensions(), vector::zero)
|
||||||
|
);
|
||||||
|
|
||||||
scalar volCell = mesh_.V()[cellI];
|
UIndirectList<vector>(Su, cells_) = flowDir_*gradP_.value();
|
||||||
volTot += volCell;
|
|
||||||
|
|
||||||
magUbarAve += (flowDir_ & U_[cellI])*volCell;
|
eqn -= Su;
|
||||||
rAUave += rAU[cellI]*volCell;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Collect across all processors
|
|
||||||
reduce(volTot, sumOp<scalar>());
|
|
||||||
reduce(magUbarAve, sumOp<scalar>());
|
|
||||||
reduce(rAUave, sumOp<scalar>());
|
|
||||||
|
|
||||||
// Volume averages
|
|
||||||
magUbarAve /= volTot;
|
|
||||||
rAUave /= volTot;
|
|
||||||
|
|
||||||
// Calculate the pressure gradient increment needed to adjust the average
|
|
||||||
// flow-rate to the desired value
|
|
||||||
scalar gradPplus = (mag(Ubar_) - magUbarAve)/rAUave;
|
|
||||||
|
|
||||||
// Apply correction to velocity field
|
|
||||||
forAllConstIter(cellSet, selectedCellSet_, iter)
|
|
||||||
{
|
|
||||||
label cellI = iter.key();
|
|
||||||
U_[cellI] += flowDir_*rAU[cellI]*gradPplus;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update pressure gradient
|
|
||||||
gradP_.value() += gradPplus;
|
|
||||||
|
|
||||||
Info<< "Uncorrected Ubar = " << magUbarAve << tab
|
|
||||||
<< "Pressure gradient = " << gradP_.value() << endl;
|
|
||||||
|
|
||||||
writeGradP();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::pressureGradientExplicitSource
|
Foam::pressureGradientExplicitSourceNew
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Creates a cell set pressure gradient source
|
Creates a cell set pressure gradient source
|
||||||
@ -30,18 +30,19 @@ Description
|
|||||||
Note: Currently only handles kinematic pressure
|
Note: Currently only handles kinematic pressure
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
pressureGradientExplicitSource.C
|
pressureGradientExplicitSourceNew.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef pressureGradientExplicitSource_H
|
#ifndef pressureGradientExplicitSourceNew_H
|
||||||
#define pressureGradientExplicitSource_H
|
#define pressureGradientExplicitSourceNew_H
|
||||||
|
|
||||||
#include "autoPtr.H"
|
#include "autoPtr.H"
|
||||||
#include "topoSetSource.H"
|
#include "topoSetSource.H"
|
||||||
#include "cellSet.H"
|
#include "cellSet.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
|
#include "basicSource.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -49,24 +50,17 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class pressureGradientExplicitSource Declaration
|
Class pressureGradientExplicitSourceNew Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class pressureGradientExplicitSource
|
class pressureGradientExplicitSourceNew
|
||||||
|
:
|
||||||
|
public basicSource
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of the source
|
//- Velocity field name
|
||||||
const word sourceName_;
|
word UName_;
|
||||||
|
|
||||||
//- Reference to the mesh
|
|
||||||
const fvMesh& mesh_;
|
|
||||||
|
|
||||||
//- Reference to the velocity field
|
|
||||||
volVectorField& U_;
|
|
||||||
|
|
||||||
//- Properties dictionary
|
|
||||||
IOdictionary dict_;
|
|
||||||
|
|
||||||
//- Average velocity
|
//- Average velocity
|
||||||
vector Ubar_;
|
vector Ubar_;
|
||||||
@ -80,50 +74,61 @@ class pressureGradientExplicitSource
|
|||||||
//- Flow direction
|
//- Flow direction
|
||||||
vector flowDir_;
|
vector flowDir_;
|
||||||
|
|
||||||
//- Name of cell source
|
|
||||||
word cellSource_;
|
|
||||||
|
|
||||||
//- The method by which the cells will be selected
|
|
||||||
autoPtr<topoSetSource> cellSelector_;
|
|
||||||
|
|
||||||
//- The set of selected cells
|
|
||||||
cellSet selectedCellSet_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Write the pressure gradient to file (for restarts etc)
|
//- Write the pressure gradient to file (for restarts etc)
|
||||||
void writeGradP() const;
|
void writeGradP() const;
|
||||||
|
|
||||||
|
//- Correct driving force for a constant mass flow rate
|
||||||
|
void update();
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
pressureGradientExplicitSource(const pressureGradientExplicitSource&);
|
pressureGradientExplicitSourceNew(const pressureGradientExplicitSourceNew&);
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const pressureGradientExplicitSource&);
|
void operator=(const pressureGradientExplicitSourceNew&);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("pressureGradientExplicitSource");
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from explicit source name and mesh
|
//- Construct from explicit source name and mesh
|
||||||
pressureGradientExplicitSource
|
pressureGradientExplicitSourceNew
|
||||||
(
|
(
|
||||||
const word& sourceName,
|
const word& sourceName,
|
||||||
volVectorField& U
|
const word& modelType,
|
||||||
|
const dictionary& dict,
|
||||||
|
const fvMesh& mesh
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
// Checks
|
||||||
|
|
||||||
|
//- Return index of field name if found in fieldNames list
|
||||||
|
virtual label applyToField(const word& fieldName) const;
|
||||||
|
|
||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return a tmp field of the source
|
//- Add explicit contribution to equation
|
||||||
tmp<DimensionedField<vector, volMesh> > Su() const;
|
virtual void addSup(fvMatrix<vector>& eqn, const label fieldI);
|
||||||
|
|
||||||
|
|
||||||
//- Correct driving force for a constant mass flow rate
|
// I-O
|
||||||
void update();
|
|
||||||
|
//- Write the source properties
|
||||||
|
virtual void writeData(Ostream&) const;
|
||||||
|
|
||||||
|
//- Read source dictionary
|
||||||
|
virtual bool read(const dictionary& dict);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -23,22 +23,34 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "timeActivatedExplicitSource.H"
|
#include "pressureGradientExplicitSource.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
void Foam::pressureGradientExplicitSourceNew::writeData(Ostream& os) const
|
||||||
{
|
{
|
||||||
defineTemplateTypeNameAndDebug
|
notImplemented
|
||||||
(
|
(
|
||||||
IOPtrList<scalarTimeActivatedExplicitSource>,
|
"void Foam::pressureGradientExplicitSourceNew::writeData"
|
||||||
0
|
"("
|
||||||
);
|
"Ostream&"
|
||||||
defineTemplateTypeNameAndDebug
|
") const"
|
||||||
(
|
|
||||||
IOPtrList<vectorTimeActivatedExplicitSource>,
|
|
||||||
0
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::pressureGradientExplicitSourceNew::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
notImplemented
|
||||||
|
(
|
||||||
|
"bool Foam::pressureGradientExplicitSourceNew::read"
|
||||||
|
"("
|
||||||
|
"const dictionary&"
|
||||||
|
") const"
|
||||||
|
);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -53,30 +53,31 @@ Foam::radialActuationDiskSource::radialActuationDiskSource
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
actuationDiskSource(name, modelType, dict, mesh),
|
actuationDiskSource(name, modelType, dict, mesh),
|
||||||
coeffsDict_(dict.subDict(modelType + "Coeffs")),
|
radialCoeffs_(coeffs_.lookup("coeffs"))
|
||||||
coeffs_()
|
|
||||||
{
|
{
|
||||||
coeffsDict_.lookup("coeffs") >> coeffs_;
|
Info<< " - creating radial actuation disk zone: " << name_ << endl;
|
||||||
Info<< " - creating radial actuation disk zone: "
|
|
||||||
<< this->name() << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::radialActuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
void Foam::radialActuationDiskSource::addSup
|
||||||
|
(
|
||||||
|
fvMatrix<vector>& eqn,
|
||||||
|
const label
|
||||||
|
)
|
||||||
{
|
{
|
||||||
bool compressible = false;
|
bool compressible = false;
|
||||||
if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
|
if (eqn.dimensions() == dimForce)
|
||||||
{
|
{
|
||||||
compressible = true;
|
compressible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalarField& cellsV = this->mesh().V();
|
const scalarField& cellsV = mesh_.V();
|
||||||
vectorField& Usource = UEqn.source();
|
vectorField& Usource = eqn.source();
|
||||||
const vectorField& U = UEqn.psi();
|
const vectorField& U = eqn.psi();
|
||||||
|
|
||||||
if (V() > VSMALL)
|
if (V_ > VSMALL)
|
||||||
{
|
{
|
||||||
if (compressible)
|
if (compressible)
|
||||||
{
|
{
|
||||||
@ -85,7 +86,7 @@ void Foam::radialActuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
|||||||
Usource,
|
Usource,
|
||||||
cells_,
|
cells_,
|
||||||
cellsV,
|
cellsV,
|
||||||
this->mesh().lookupObject<volScalarField>("rho"),
|
mesh_.lookupObject<volScalarField>("rho"),
|
||||||
U
|
U
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -114,12 +115,11 @@ bool Foam::radialActuationDiskSource::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (basicSource::read(dict))
|
if (basicSource::read(dict))
|
||||||
{
|
{
|
||||||
const dictionary& coeffsDict_ = dict.subDict(typeName + "Coeffs");
|
coeffs_.readIfPresent("diskDir", diskDir_);
|
||||||
coeffsDict_.readIfPresent("diskDir", diskDir_);
|
coeffs_.readIfPresent("Cp", Cp_);
|
||||||
coeffsDict_.readIfPresent("Cp", Cp_);
|
coeffs_.readIfPresent("Ct", Ct_);
|
||||||
coeffsDict_.readIfPresent("Ct", Ct_);
|
coeffs_.readIfPresent("diskArea", diskArea_);
|
||||||
coeffsDict_.readIfPresent("diskArea", diskArea_);
|
coeffs_.lookup("coeffs") >> radialCoeffs_;
|
||||||
coeffsDict_.lookup("coeffs") >> coeffs_;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -71,11 +71,8 @@ class radialActuationDiskSource
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Coefficients dictionary
|
|
||||||
dictionary coeffsDict_;
|
|
||||||
|
|
||||||
//- Coeffcients for the radial distribution
|
//- Coeffcients for the radial distribution
|
||||||
FixedList<scalar, 3> coeffs_;
|
FixedList<scalar, 3> radialCoeffs_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -124,7 +121,7 @@ public:
|
|||||||
// Public Functions
|
// Public Functions
|
||||||
|
|
||||||
//- Source term to fvMatrix<vector>
|
//- Source term to fvMatrix<vector>
|
||||||
virtual void addSu(fvMatrix<vector>& UEqn);
|
virtual void addSup(fvMatrix<vector>& eqn, const label fieldI);
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
|
|||||||
@ -61,24 +61,25 @@ addRadialActuationDiskAxialInertialResistance
|
|||||||
const scalar maxR = gMax(mag(zoneCellCentres - avgCentre));
|
const scalar maxR = gMax(mag(zoneCellCentres - avgCentre));
|
||||||
|
|
||||||
scalar intCoeffs =
|
scalar intCoeffs =
|
||||||
coeffs_[0]
|
radialCoeffs_[0]
|
||||||
+ coeffs_[1]*sqr(maxR)/2.0
|
+ radialCoeffs_[1]*sqr(maxR)/2.0
|
||||||
+ coeffs_[2]*pow4(maxR)/3.0;
|
+ radialCoeffs_[2]*pow4(maxR)/3.0;
|
||||||
|
|
||||||
forAll(cells, i)
|
forAll(cells, i)
|
||||||
{
|
{
|
||||||
T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U[cells[i]])*a/(1.0 - a);
|
T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U[cells[i]])*a/(1.0 - a);
|
||||||
|
|
||||||
scalar r = mag(mesh().cellCentres()[cells[i]] - avgCentre);
|
scalar r2 = magSqr(mesh().cellCentres()[cells[i]] - avgCentre);
|
||||||
|
|
||||||
Tr[i] =
|
Tr[i] =
|
||||||
T[i]*(coeffs_[0] + coeffs_[1]*sqr(r) + coeffs_[2]*pow4(r))
|
T[i]
|
||||||
|
*(radialCoeffs_[0] + radialCoeffs_[1]*r2 + radialCoeffs_[2]*sqr(r2))
|
||||||
/intCoeffs;
|
/intCoeffs;
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(cells, i)
|
forAll(cells, i)
|
||||||
{
|
{
|
||||||
Usource[cells[i]] += ((Vcells[cells[i]]/V())*Tr[i]*E) & U[cells[i]];
|
Usource[cells[i]] += ((Vcells[cells[i]]/V_)*Tr[i]*E) & U[cells[i]];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|||||||
@ -262,10 +262,8 @@ void Foam::rotorDiskSource::createCoordinateSystem()
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn("rotorDiskSource::createCoordinateSystem()")
|
||||||
(
|
<< "Unknown geometryMode " << geometryModeTypeNames_[gm]
|
||||||
"rotorDiskSource::createCoordinateSystem(const geometryMode&);"
|
|
||||||
) << "Unknown geometryMode " << geometryModeTypeNames_[gm]
|
|
||||||
<< ". Available geometry modes include "
|
<< ". Available geometry modes include "
|
||||||
<< geometryModeTypeNames_ << exit(FatalError);
|
<< geometryModeTypeNames_ << exit(FatalError);
|
||||||
}
|
}
|
||||||
@ -363,13 +361,13 @@ Foam::rotorDiskSource::rotorDiskSource
|
|||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const word& modelType,
|
const word& modelType,
|
||||||
const dictionary& dict,
|
const dictionary& coeffs,
|
||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
basicSource(name, modelType, dict, mesh),
|
basicSource(name, modelType, coeffs, mesh),
|
||||||
coeffs_(dict_.subDict(type() + "Coeffs")),
|
fieldName_(coeffs.lookup("fieldName")),
|
||||||
rhoName_("none"),
|
rhoName_("none"),
|
||||||
omega_(0.0),
|
omega_(0.0),
|
||||||
nBlades_(0),
|
nBlades_(0),
|
||||||
@ -387,7 +385,7 @@ Foam::rotorDiskSource::rotorDiskSource
|
|||||||
coordSys_(false),
|
coordSys_(false),
|
||||||
rMax_(0.0)
|
rMax_(0.0)
|
||||||
{
|
{
|
||||||
read(dict);
|
read(coeffs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -399,20 +397,33 @@ Foam::rotorDiskSource::~rotorDiskSource()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::rotorDiskSource::addSu(fvMatrix<vector>& UEqn)
|
Foam::label Foam::rotorDiskSource::applyToField(const word& fieldName) const
|
||||||
|
{
|
||||||
|
if (fieldName == fieldName_)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::rotorDiskSource::addSup(fvMatrix<vector>& eqn)
|
||||||
{
|
{
|
||||||
// add source to lhs of eqn
|
// add source to lhs of eqn
|
||||||
|
|
||||||
const volVectorField& U = UEqn.psi();
|
const volVectorField& U = eqn.psi();
|
||||||
|
|
||||||
if (UEqn.dimensions() == dimForce)
|
if (eqn.dimensions() == dimForce)
|
||||||
{
|
{
|
||||||
coeffs_.lookup("rhoName") >> rhoName_;
|
coeffs_.lookup("rhoName") >> rhoName_;
|
||||||
|
|
||||||
const volScalarField& rho =
|
const volScalarField& rho =
|
||||||
mesh_.lookupObject<volScalarField>(rhoName_);
|
mesh_.lookupObject<volScalarField>(rhoName_);
|
||||||
|
|
||||||
UEqn += calculateForces
|
eqn += calculateForces
|
||||||
(
|
(
|
||||||
rho.internalField(),
|
rho.internalField(),
|
||||||
inflowVelocity(U),
|
inflowVelocity(U),
|
||||||
@ -421,7 +432,7 @@ void Foam::rotorDiskSource::addSu(fvMatrix<vector>& UEqn)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UEqn += calculateForces
|
eqn += calculateForces
|
||||||
(
|
(
|
||||||
oneField(),
|
oneField(),
|
||||||
inflowVelocity(U),
|
inflowVelocity(U),
|
||||||
@ -431,16 +442,10 @@ void Foam::rotorDiskSource::addSu(fvMatrix<vector>& UEqn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::rotorDiskSource::addSu(fvMatrix<scalar>& UEqn)
|
|
||||||
{
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::rotorDiskSource::writeData(Ostream& os) const
|
void Foam::rotorDiskSource::writeData(Ostream& os) const
|
||||||
{
|
{
|
||||||
os << indent << name_ << endl;
|
os << indent << name_ << endl;
|
||||||
dict_.write(os);
|
coeffs_.write(os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -448,8 +453,6 @@ bool Foam::rotorDiskSource::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
if (basicSource::read(dict))
|
if (basicSource::read(dict))
|
||||||
{
|
{
|
||||||
coeffs_ = dict.subDict(type() + "Coeffs");
|
|
||||||
|
|
||||||
scalar rpm(readScalar(coeffs_.lookup("rpm")));
|
scalar rpm(readScalar(coeffs_.lookup("rpm")));
|
||||||
omega_ = rpm/60.0*mathematical::twoPi;
|
omega_ = rpm/60.0*mathematical::twoPi;
|
||||||
|
|
||||||
|
|||||||
@ -97,8 +97,8 @@ protected:
|
|||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Coefficients dictionary
|
//- Name of field on which to apply the source
|
||||||
dictionary coeffs_;
|
word fieldName_;
|
||||||
|
|
||||||
//- Name of density field
|
//- Name of density field
|
||||||
word rhoName_;
|
word rhoName_;
|
||||||
@ -212,13 +212,16 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
|
||||||
|
// Checks
|
||||||
|
|
||||||
|
//- Return index of field name if found in fieldNames list
|
||||||
|
virtual label applyToField(const word& fieldName) const;
|
||||||
|
|
||||||
|
|
||||||
// Source term addition
|
// Source term addition
|
||||||
|
|
||||||
//- Source term to fvMatrix<vector>
|
//- Source term to fvMatrix<vector>
|
||||||
virtual void addSu(fvMatrix<vector>& UEqn);
|
virtual void addSup(fvMatrix<vector>& eqn);
|
||||||
|
|
||||||
//- Source term to fvMatrix<scalar>
|
|
||||||
virtual void addSu(fvMatrix<scalar>& UEqn);
|
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
|
|||||||
@ -1,389 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "TimeActivatedExplicitSource.H"
|
|
||||||
#include "fvMesh.H"
|
|
||||||
#include "volFields.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
const Foam::wordList Foam::TimeActivatedExplicitSource<Type>::
|
|
||||||
selectionModeTypeNames_
|
|
||||||
(
|
|
||||||
IStringStream("(points cellSet cellZone all)")()
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
const Foam::wordList Foam::TimeActivatedExplicitSource<Type>::
|
|
||||||
volumeModeTypeNames_
|
|
||||||
(
|
|
||||||
IStringStream("(absolute specific)")()
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
typename Foam::TimeActivatedExplicitSource<Type>::selectionModeType
|
|
||||||
Foam::TimeActivatedExplicitSource<Type>::wordToSelectionModeType
|
|
||||||
(
|
|
||||||
const word& smtName
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
forAll(selectionModeTypeNames_, i)
|
|
||||||
{
|
|
||||||
if (smtName == selectionModeTypeNames_[i])
|
|
||||||
{
|
|
||||||
return selectionModeType(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"TimeActivatedExplicitSource<Type>::selectionModeType"
|
|
||||||
"TimeActivatedExplicitSource<Type>::wordToSelectionModeType"
|
|
||||||
"("
|
|
||||||
"const word&"
|
|
||||||
")"
|
|
||||||
) << "Unknown selectionMode type " << smtName
|
|
||||||
<< ". Valid selectionMode types are:" << nl << selectionModeTypeNames_
|
|
||||||
<< exit(FatalError);
|
|
||||||
|
|
||||||
return selectionModeType(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
typename Foam::TimeActivatedExplicitSource<Type>::volumeModeType
|
|
||||||
Foam::TimeActivatedExplicitSource<Type>::wordToVolumeModeType
|
|
||||||
(
|
|
||||||
const word& vmtName
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
forAll(volumeModeTypeNames_, i)
|
|
||||||
{
|
|
||||||
if (vmtName == volumeModeTypeNames_[i])
|
|
||||||
{
|
|
||||||
return volumeModeType(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"TimeActivatedExplicitSource<Type>::volumeModeType"
|
|
||||||
"TimeActivatedExplicitSource<Type>::wordToVolumeModeType(const word&)"
|
|
||||||
) << "Unknown volumeMode type " << vmtName
|
|
||||||
<< ". Valid volumeMode types are:" << nl << volumeModeTypeNames_
|
|
||||||
<< exit(FatalError);
|
|
||||||
|
|
||||||
return volumeModeType(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::word Foam::TimeActivatedExplicitSource<Type>::selectionModeTypeToWord
|
|
||||||
(
|
|
||||||
const selectionModeType& smtType
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (smtType > selectionModeTypeNames_.size())
|
|
||||||
{
|
|
||||||
return "UNKNOWN";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return selectionModeTypeNames_[smtType];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::word Foam::TimeActivatedExplicitSource<Type>::volumeModeTypeToWord
|
|
||||||
(
|
|
||||||
const volumeModeType& vmtType
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (vmtType > volumeModeTypeNames_.size())
|
|
||||||
{
|
|
||||||
return "UNKNOWN";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return volumeModeTypeNames_[vmtType];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::TimeActivatedExplicitSource<Type>::setSelection
|
|
||||||
(
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
{
|
|
||||||
switch (selectionMode_)
|
|
||||||
{
|
|
||||||
case smPoints:
|
|
||||||
{
|
|
||||||
dict.lookup("points") >> points_;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case smCellSet:
|
|
||||||
{
|
|
||||||
dict.lookup("cellSet") >> cellSetName_;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case smCellZone:
|
|
||||||
{
|
|
||||||
dict.lookup("cellZone") >> cellSetName_;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case smAll:
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"TimeActivatedExplicitSource::setSelection(const dictionary&)"
|
|
||||||
) << "Unknown selectionMode "
|
|
||||||
<< selectionModeTypeNames_[selectionMode_]
|
|
||||||
<< ". Valid selectionMode types are" << selectionModeTypeNames_
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::TimeActivatedExplicitSource<Type>::setFieldData
|
|
||||||
(
|
|
||||||
const dictionary& dict,
|
|
||||||
const wordList& fieldNames
|
|
||||||
)
|
|
||||||
{
|
|
||||||
dict.lookup("fieldData") >> fieldData_;
|
|
||||||
labelList localFieldIds(fieldData_.size(), -1);
|
|
||||||
forAll(fieldNames, i)
|
|
||||||
{
|
|
||||||
forAll(fieldData_, j)
|
|
||||||
{
|
|
||||||
const word& fdName = fieldData_[j].first();
|
|
||||||
if (fdName == fieldNames[i])
|
|
||||||
{
|
|
||||||
fieldIds_[i] = j;
|
|
||||||
localFieldIds[j] = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
forAll(localFieldIds, i)
|
|
||||||
{
|
|
||||||
if (localFieldIds[i] < 0)
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"TimeActivatedExplicitSource<Type>::setFieldData"
|
|
||||||
"("
|
|
||||||
"const dictionary&, "
|
|
||||||
"const wordList&"
|
|
||||||
")"
|
|
||||||
) << "Field " << fieldData_[i].first() << " not found in "
|
|
||||||
<< "field list. Available fields are: " << nl << fieldNames
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::TimeActivatedExplicitSource<Type>::setCellSet()
|
|
||||||
{
|
|
||||||
Info<< incrIndent << indent << "Source: " << name_ << endl;
|
|
||||||
switch (selectionMode_)
|
|
||||||
{
|
|
||||||
case smPoints:
|
|
||||||
{
|
|
||||||
Info<< indent << "- selecting cells using points" << endl;
|
|
||||||
|
|
||||||
labelHashSet selectedCells;
|
|
||||||
|
|
||||||
forAll(points_, i)
|
|
||||||
{
|
|
||||||
label cellI = mesh_.findCell(points_[i]);
|
|
||||||
if (cellI >= 0)
|
|
||||||
{
|
|
||||||
selectedCells.insert(cellI);
|
|
||||||
}
|
|
||||||
|
|
||||||
label globalCellI = returnReduce(cellI, maxOp<label>());
|
|
||||||
if (globalCellI < 0)
|
|
||||||
{
|
|
||||||
WarningIn("TimeActivatedExplicitSource<Type>::setCellIds()")
|
|
||||||
<< "Unable to find owner cell for point " << points_[i]
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cells_ = selectedCells.toc();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case smCellSet:
|
|
||||||
{
|
|
||||||
Info<< indent << "- selecting cells using cellSet "
|
|
||||||
<< cellSetName_ << endl;
|
|
||||||
|
|
||||||
cellSet selectedCells(mesh_, cellSetName_);
|
|
||||||
cells_ = selectedCells.toc();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case smCellZone:
|
|
||||||
{
|
|
||||||
Info<< indent << "- selecting cells using cellZone "
|
|
||||||
<< cellSetName_ << endl;
|
|
||||||
label zoneID = mesh_.cellZones().findZoneID(cellSetName_);
|
|
||||||
if (zoneID == -1)
|
|
||||||
{
|
|
||||||
FatalErrorIn("TimeActivatedExplicitSource<Type>::setCellIds()")
|
|
||||||
<< "Cannot find cellZone " << cellSetName_ << endl
|
|
||||||
<< "Valid cellZones are " << mesh_.cellZones().names()
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
cells_ = mesh_.cellZones()[zoneID];
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case smAll:
|
|
||||||
{
|
|
||||||
Info<< indent << "- selecting all cells" << endl;
|
|
||||||
cells_ = identity(mesh_.nCells());
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
FatalErrorIn("TimeActivatedExplicitSource<Type>::setCellIds()")
|
|
||||||
<< "Unknown selectionMode "
|
|
||||||
<< selectionModeTypeNames_[selectionMode_]
|
|
||||||
<< ". Valid selectionMode types are" << selectionModeTypeNames_
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set volume normalisation
|
|
||||||
if (volumeMode_ == vmAbsolute)
|
|
||||||
{
|
|
||||||
V_ = 0.0;
|
|
||||||
forAll(cells_, i)
|
|
||||||
{
|
|
||||||
V_ += mesh_.V()[cells_[i]];
|
|
||||||
}
|
|
||||||
reduce(V_, sumOp<scalar>());
|
|
||||||
}
|
|
||||||
|
|
||||||
Info<< indent << "- selected "
|
|
||||||
<< returnReduce(cells_.size(), sumOp<label>())
|
|
||||||
<< " cell(s) with volume " << V_ << nl << decrIndent << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::TimeActivatedExplicitSource<Type>::TimeActivatedExplicitSource
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const dictionary& dict,
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const wordList& fieldNames
|
|
||||||
)
|
|
||||||
:
|
|
||||||
name_(name),
|
|
||||||
mesh_(mesh),
|
|
||||||
active_(readBool(dict.lookup("active"))),
|
|
||||||
timeStart_(readScalar(dict.lookup("timeStart"))),
|
|
||||||
duration_(readScalar(dict.lookup("duration"))),
|
|
||||||
volumeMode_(wordToVolumeModeType(dict.lookup("volumeMode"))),
|
|
||||||
selectionMode_(wordToSelectionModeType(dict.lookup("selectionMode"))),
|
|
||||||
points_(),
|
|
||||||
cellSetName_("none"),
|
|
||||||
V_(1.0),
|
|
||||||
fieldData_(),
|
|
||||||
fieldIds_(fieldNames.size(), -1)
|
|
||||||
{
|
|
||||||
setSelection(dict);
|
|
||||||
|
|
||||||
if (fieldNames.size() == 1)
|
|
||||||
{
|
|
||||||
fieldData_.setSize(1);
|
|
||||||
fieldData_[0].first() = fieldNames[0];
|
|
||||||
dict.lookup("fieldData") >> fieldData_[0].second();
|
|
||||||
fieldIds_[0] = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setFieldData(dict, fieldNames);
|
|
||||||
}
|
|
||||||
|
|
||||||
setCellSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::TimeActivatedExplicitSource<Type>::addToField
|
|
||||||
(
|
|
||||||
DimensionedField<Type, volMesh>& Su,
|
|
||||||
const label fieldI
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const label fid = fieldIds_[fieldI];
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
active_
|
|
||||||
&& (fid >= 0)
|
|
||||||
&& (mesh_.time().value() >= timeStart_)
|
|
||||||
&& (mesh_.time().value() <= timeEnd())
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Update the cell set if the mesh is changing
|
|
||||||
if (mesh_.changing())
|
|
||||||
{
|
|
||||||
setCellSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
forAll(cells_, i)
|
|
||||||
{
|
|
||||||
Su[cells_[i]] = fieldData_[fid].second()/V_;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,392 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::TimeActivatedExplicitSource
|
|
||||||
|
|
||||||
Description
|
|
||||||
Time activated explicit source.
|
|
||||||
|
|
||||||
Sources described by:
|
|
||||||
|
|
||||||
{
|
|
||||||
active true; // on/off switch
|
|
||||||
timeStart 0.2; // start time
|
|
||||||
duration 2.0; // duration
|
|
||||||
selectionMode points; // cellSet/cellZone/all
|
|
||||||
volumeMode absolute; // specific
|
|
||||||
|
|
||||||
fieldData // field data - usage for multiple fields
|
|
||||||
(
|
|
||||||
(H2O 0.005)
|
|
||||||
);
|
|
||||||
|
|
||||||
fieldData 0.005; // field data - usage for single field
|
|
||||||
|
|
||||||
points // list of points when selectionMode = points
|
|
||||||
(
|
|
||||||
(2.75 0.5 0)
|
|
||||||
);
|
|
||||||
|
|
||||||
cellSet c0; // cellSet name when selectionMode=cellSet
|
|
||||||
cellZone c0; // cellZone name when selectionMode=cellZone
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
TimeActivatedExplicitSource.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef TimeActivatedExplicitSource_H
|
|
||||||
#define TimeActivatedExplicitSource_H
|
|
||||||
|
|
||||||
#include "Tuple2.H"
|
|
||||||
#include "cellSet.H"
|
|
||||||
#include "volFieldsFwd.H"
|
|
||||||
#include "DimensionedField.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
|
|
||||||
class fvMesh;
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class TimeActivatedExplicitSource;
|
|
||||||
|
|
||||||
// Forward declaration of friend functions
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Ostream& operator<<
|
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const TimeActivatedExplicitSource<Type>&
|
|
||||||
);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class TimeActivatedExplicitSource Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class TimeActivatedExplicitSource
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Public data
|
|
||||||
|
|
||||||
//- Enumeration for selection mode types
|
|
||||||
enum selectionModeType
|
|
||||||
{
|
|
||||||
smPoints,
|
|
||||||
smCellSet,
|
|
||||||
smCellZone,
|
|
||||||
smAll
|
|
||||||
};
|
|
||||||
|
|
||||||
//- Word list of selection mode type names
|
|
||||||
static const wordList selectionModeTypeNames_;
|
|
||||||
|
|
||||||
//- Enumeration for volume types
|
|
||||||
enum volumeModeType
|
|
||||||
{
|
|
||||||
vmAbsolute,
|
|
||||||
vmSpecific
|
|
||||||
};
|
|
||||||
|
|
||||||
//- Word list of volume mode type names
|
|
||||||
static const wordList volumeModeTypeNames_;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
// Protected data
|
|
||||||
|
|
||||||
typedef Tuple2<word, Type> fieldNameValuePair;
|
|
||||||
|
|
||||||
//- Source name
|
|
||||||
word name_;
|
|
||||||
|
|
||||||
//- Reference to the mesh database
|
|
||||||
const fvMesh& mesh_;
|
|
||||||
|
|
||||||
//- Source active flag
|
|
||||||
bool active_;
|
|
||||||
|
|
||||||
//- Time start
|
|
||||||
scalar timeStart_;
|
|
||||||
|
|
||||||
//- Duration
|
|
||||||
scalar duration_;
|
|
||||||
|
|
||||||
//- Volume mode
|
|
||||||
volumeModeType volumeMode_;
|
|
||||||
|
|
||||||
//- Cell selection mode
|
|
||||||
selectionModeType selectionMode_;
|
|
||||||
|
|
||||||
//- List of points for "points" selectionMode
|
|
||||||
List<point> points_;
|
|
||||||
|
|
||||||
//- Name of cell set for "cellSet" and "cellZone" selectionMode
|
|
||||||
word cellSetName_;
|
|
||||||
|
|
||||||
//- Set of cells to apply source to
|
|
||||||
labelList cells_;
|
|
||||||
|
|
||||||
//- Sum of cell volumes
|
|
||||||
scalar V_;
|
|
||||||
|
|
||||||
//- List of source field name vs value pairs
|
|
||||||
List<fieldNameValuePair> fieldData_;
|
|
||||||
|
|
||||||
//- Map of fields ids from supplied fields to local field source ids
|
|
||||||
labelList fieldIds_;
|
|
||||||
|
|
||||||
|
|
||||||
// Protected functions
|
|
||||||
|
|
||||||
//- Helper function to convert from a word to a selectionModeType
|
|
||||||
selectionModeType wordToSelectionModeType(const word& smtName) const;
|
|
||||||
|
|
||||||
//- Helper function to convert from a word to a volumeModeType
|
|
||||||
volumeModeType wordToVolumeModeType(const word& vtName) const;
|
|
||||||
|
|
||||||
//- Helper function to convert from a selectionModeType to a word
|
|
||||||
word selectionModeTypeToWord(const selectionModeType& smtType) const;
|
|
||||||
|
|
||||||
//- Helper function to convert from a volumeModeType to a word
|
|
||||||
word volumeModeTypeToWord(const volumeModeType& vtType) const;
|
|
||||||
|
|
||||||
//- Set the cellSet or points selection
|
|
||||||
void setSelection(const dictionary& dict);
|
|
||||||
|
|
||||||
//- Set the local field data
|
|
||||||
void setFieldData(const dictionary& dict, const wordList& fieldNames);
|
|
||||||
|
|
||||||
//- Set the cell set based on the user input selection mode
|
|
||||||
void setCellSet();
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
TimeActivatedExplicitSource
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const dictionary& dict,
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const wordList& fieldNames
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Return clone
|
|
||||||
autoPtr<TimeActivatedExplicitSource> clone() const
|
|
||||||
{
|
|
||||||
notImplemented
|
|
||||||
(
|
|
||||||
"autoPtr<TimeActivatedExplicitSource> clone() const"
|
|
||||||
);
|
|
||||||
return autoPtr<TimeActivatedExplicitSource>(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return pointer to new TimeActivatedExplicitSource object created
|
|
||||||
// on the freestore from an Istream
|
|
||||||
class iNew
|
|
||||||
{
|
|
||||||
//- Reference to the mesh database
|
|
||||||
const fvMesh& mesh_;
|
|
||||||
|
|
||||||
//- List of field names
|
|
||||||
const wordList& fieldNames_;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
iNew
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const wordList& fieldNames
|
|
||||||
)
|
|
||||||
:
|
|
||||||
mesh_(mesh),
|
|
||||||
fieldNames_(fieldNames)
|
|
||||||
{}
|
|
||||||
|
|
||||||
autoPtr<TimeActivatedExplicitSource> operator()(Istream& is) const
|
|
||||||
{
|
|
||||||
const word name(is);
|
|
||||||
const dictionary dict(is);
|
|
||||||
|
|
||||||
return autoPtr<TimeActivatedExplicitSource>
|
|
||||||
(
|
|
||||||
new TimeActivatedExplicitSource
|
|
||||||
(
|
|
||||||
name,
|
|
||||||
dict,
|
|
||||||
mesh_,
|
|
||||||
fieldNames_
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Return const access to the source name
|
|
||||||
inline const word& name() const;
|
|
||||||
|
|
||||||
//- Return const access to the mesh database
|
|
||||||
inline const fvMesh& mesh() const;
|
|
||||||
|
|
||||||
//- Return const access to the source active flag
|
|
||||||
inline bool active() const;
|
|
||||||
|
|
||||||
//- Return const access to the time start
|
|
||||||
inline scalar timeStart() const;
|
|
||||||
|
|
||||||
//- Return const access to the duration
|
|
||||||
inline scalar duration() const;
|
|
||||||
|
|
||||||
//- Return const access to the time end
|
|
||||||
inline scalar timeEnd() const;
|
|
||||||
|
|
||||||
//- Return const access to the volume mode
|
|
||||||
inline const volumeModeType& volumeMode() const;
|
|
||||||
|
|
||||||
//- Return const access to the cell selection mode
|
|
||||||
inline const selectionModeType& selectionMode() const;
|
|
||||||
|
|
||||||
//- Return const access to the list of points for "points"
|
|
||||||
// selectionMode
|
|
||||||
inline const List<point>& points() const;
|
|
||||||
|
|
||||||
//- Return const access to the name of cell set for "cellSet"
|
|
||||||
// selectionMode
|
|
||||||
inline const word& cellSetName() const;
|
|
||||||
|
|
||||||
//- Return const access to the total cell volume
|
|
||||||
inline scalar V() const;
|
|
||||||
|
|
||||||
//- Return const access to the cell set
|
|
||||||
inline const labelList& cells() const;
|
|
||||||
|
|
||||||
//- Return const access to the source field name vs value pairs
|
|
||||||
inline const List<fieldNameValuePair>& fieldData() const;
|
|
||||||
|
|
||||||
//- Return const access to the the map of fields ids from supplied
|
|
||||||
// fields to local field source ids
|
|
||||||
inline const labelList& fieldIds() const;
|
|
||||||
|
|
||||||
|
|
||||||
// Edit
|
|
||||||
|
|
||||||
//- Return access to the source name
|
|
||||||
inline word& name();
|
|
||||||
|
|
||||||
//- Return access to the source active flag
|
|
||||||
inline bool& active();
|
|
||||||
|
|
||||||
//- Return access to the time start
|
|
||||||
inline scalar& timeStart();
|
|
||||||
|
|
||||||
//- Return access to the duration
|
|
||||||
inline scalar& duration();
|
|
||||||
|
|
||||||
//- Return access to the volume mode
|
|
||||||
inline volumeModeType& volumeMode();
|
|
||||||
|
|
||||||
//- Return access to the cell selection mode
|
|
||||||
inline selectionModeType& selectionMode();
|
|
||||||
|
|
||||||
//- Return access to the list of points for "points" selectionMode
|
|
||||||
inline List<point>& points();
|
|
||||||
|
|
||||||
//- Return access to the name of cell set for "cellSet"
|
|
||||||
// selectionMode
|
|
||||||
inline word& cellSetName();
|
|
||||||
|
|
||||||
//- Return access to the total cell volume
|
|
||||||
inline scalar& V();
|
|
||||||
|
|
||||||
//- Return access to the cell set
|
|
||||||
inline labelList& cells();
|
|
||||||
|
|
||||||
//- Return access to the source field name vs value pairs
|
|
||||||
inline List<fieldNameValuePair>& fieldData();
|
|
||||||
|
|
||||||
//- Return access to the the map of fields ids from supplied
|
|
||||||
// fields to local field source ids
|
|
||||||
inline labelList& fieldIds();
|
|
||||||
|
|
||||||
|
|
||||||
// Evaluation
|
|
||||||
|
|
||||||
//- Add the source contribution to field Su
|
|
||||||
void addToField
|
|
||||||
(
|
|
||||||
DimensionedField<Type, volMesh>& Su,
|
|
||||||
const label fieldI
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
|
||||||
|
|
||||||
//- Write the source properties
|
|
||||||
void writeData(Ostream&) const;
|
|
||||||
|
|
||||||
//- Ostream operator
|
|
||||||
friend Ostream& operator<< <Type>
|
|
||||||
(
|
|
||||||
Ostream& os,
|
|
||||||
const TimeActivatedExplicitSource& source
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
# include "TimeActivatedExplicitSource.C"
|
|
||||||
# include "TimeActivatedExplicitSourceIO.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#include "TimeActivatedExplicitSourceI.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,228 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "TimeActivatedExplicitSource.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline const Foam::word& Foam::TimeActivatedExplicitSource<Type>::name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline const Foam::fvMesh& Foam::TimeActivatedExplicitSource<Type>::mesh() const
|
|
||||||
{
|
|
||||||
return mesh_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline bool Foam::TimeActivatedExplicitSource<Type>::active() const
|
|
||||||
{
|
|
||||||
return active_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline Foam::scalar Foam::TimeActivatedExplicitSource<Type>::timeStart() const
|
|
||||||
{
|
|
||||||
return timeStart_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline Foam::scalar Foam::TimeActivatedExplicitSource<Type>::duration() const
|
|
||||||
{
|
|
||||||
return duration_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline Foam::scalar Foam::TimeActivatedExplicitSource<Type>::timeEnd() const
|
|
||||||
{
|
|
||||||
return timeStart_ + duration_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline const typename Foam::TimeActivatedExplicitSource<Type>::volumeModeType&
|
|
||||||
Foam::TimeActivatedExplicitSource<Type>::volumeMode() const
|
|
||||||
{
|
|
||||||
return volumeMode_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline const typename Foam::TimeActivatedExplicitSource<Type>::
|
|
||||||
selectionModeType&
|
|
||||||
Foam::TimeActivatedExplicitSource<Type>::selectionMode() const
|
|
||||||
{
|
|
||||||
return selectionMode_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline const Foam::List<Foam::point>&
|
|
||||||
Foam::TimeActivatedExplicitSource<Type>::points() const
|
|
||||||
{
|
|
||||||
return points_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline const Foam::word&
|
|
||||||
Foam::TimeActivatedExplicitSource<Type>::cellSetName() const
|
|
||||||
{
|
|
||||||
return cellSetName_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline Foam::scalar Foam::TimeActivatedExplicitSource<Type>::V() const
|
|
||||||
{
|
|
||||||
return V_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline const Foam::labelList&
|
|
||||||
Foam::TimeActivatedExplicitSource<Type>::cells() const
|
|
||||||
{
|
|
||||||
return cells_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline const Foam::List<typename Foam::TimeActivatedExplicitSource<Type>::
|
|
||||||
fieldNameValuePair>&
|
|
||||||
Foam::TimeActivatedExplicitSource<Type>::fieldData() const
|
|
||||||
{
|
|
||||||
return fieldData_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline const Foam::labelList&
|
|
||||||
Foam::TimeActivatedExplicitSource<Type>::fieldIds() const
|
|
||||||
{
|
|
||||||
return fieldIds_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline Foam::word& Foam::TimeActivatedExplicitSource<Type>::name()
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline bool& Foam::TimeActivatedExplicitSource<Type>::active()
|
|
||||||
{
|
|
||||||
return active_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline Foam::scalar& Foam::TimeActivatedExplicitSource<Type>::timeStart()
|
|
||||||
{
|
|
||||||
return timeStart_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline Foam::scalar& Foam::TimeActivatedExplicitSource<Type>::duration()
|
|
||||||
{
|
|
||||||
return duration_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline typename Foam::TimeActivatedExplicitSource<Type>::volumeModeType&
|
|
||||||
Foam::TimeActivatedExplicitSource<Type>::volumeMode()
|
|
||||||
{
|
|
||||||
return volumeMode_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline typename Foam::TimeActivatedExplicitSource<Type>::selectionModeType&
|
|
||||||
Foam::TimeActivatedExplicitSource<Type>::selectionMode()
|
|
||||||
{
|
|
||||||
return selectionMode_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline Foam::List<Foam::point>&
|
|
||||||
Foam::TimeActivatedExplicitSource<Type>::points()
|
|
||||||
{
|
|
||||||
return points_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline Foam::word& Foam::TimeActivatedExplicitSource<Type>::cellSetName()
|
|
||||||
{
|
|
||||||
return cellSetName_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline Foam::scalar& Foam::TimeActivatedExplicitSource<Type>::V()
|
|
||||||
{
|
|
||||||
return V_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline Foam::labelList& Foam::TimeActivatedExplicitSource<Type>::cells()
|
|
||||||
{
|
|
||||||
return cells_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline Foam::List
|
|
||||||
<
|
|
||||||
typename Foam::TimeActivatedExplicitSource<Type>::fieldNameValuePair
|
|
||||||
>&
|
|
||||||
Foam::TimeActivatedExplicitSource<Type>::fieldData()
|
|
||||||
{
|
|
||||||
return fieldData_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
inline Foam::labelList& Foam::TimeActivatedExplicitSource<Type>::fieldIds()
|
|
||||||
{
|
|
||||||
return fieldIds_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,101 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "TimeActivatedExplicitSource.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::TimeActivatedExplicitSource<Type>::writeData(Ostream& os) const
|
|
||||||
{
|
|
||||||
os << indent << name_ << nl
|
|
||||||
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
|
||||||
|
|
||||||
os.writeKeyword("active") << active_ << token::END_STATEMENT << nl;
|
|
||||||
os.writeKeyword("timeStart") << timeStart_ << token::END_STATEMENT << nl;
|
|
||||||
os.writeKeyword("duration") << duration_ << token::END_STATEMENT << nl;
|
|
||||||
os.writeKeyword("selectionMode") << selectionModeTypeToWord(selectionMode_)
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
os.writeKeyword("volumeMode") << volumeModeTypeToWord(volumeMode_)
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
|
|
||||||
if (fieldIds_.size() == 1)
|
|
||||||
{
|
|
||||||
os.writeKeyword("fieldData") << fieldData_[0].second()
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
os.writeKeyword("fieldData") << fieldData_ << nl;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (selectionMode_)
|
|
||||||
{
|
|
||||||
case smPoints:
|
|
||||||
{
|
|
||||||
os.writeKeyword("points") << nl << indent << points_
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case smCellSet:
|
|
||||||
{
|
|
||||||
os.writeKeyword("cellSet") << cellSetName_
|
|
||||||
<< token::END_STATEMENT << nl;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"TimeActivatedExplicitSource<Type>::writeData"
|
|
||||||
"("
|
|
||||||
"Ostream&, "
|
|
||||||
"bool"
|
|
||||||
") const"
|
|
||||||
) << "Unknown selectionMode "
|
|
||||||
<< selectionModeTypeToWord(selectionMode_)
|
|
||||||
<< abort(FatalError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
os << decrIndent << indent << token::END_BLOCK << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::Ostream& Foam::operator<<
|
|
||||||
(
|
|
||||||
Ostream& os,
|
|
||||||
const TimeActivatedExplicitSource<Type>& source
|
|
||||||
)
|
|
||||||
{
|
|
||||||
source.writeData(os);
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,222 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "TimeActivatedExplicitSourceList.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::TimeActivatedExplicitSourceList<Type>::TimeActivatedExplicitSourceList
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const dimensionSet& dimensions,
|
|
||||||
const wordList& fieldNames
|
|
||||||
)
|
|
||||||
:
|
|
||||||
IOPtrList<TimeActivatedExplicitSource<Type> >
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
name + "SourceProperties",
|
|
||||||
mesh.time().constant(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
typename TimeActivatedExplicitSource<Type>::iNew(mesh, fieldNames)
|
|
||||||
),
|
|
||||||
name_(name),
|
|
||||||
mesh_(mesh),
|
|
||||||
dimensions_(dimensions),
|
|
||||||
fieldNames_(fieldNames)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::TimeActivatedExplicitSourceList<Type>::TimeActivatedExplicitSourceList
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const dimensionSet& dimensions,
|
|
||||||
const word& fieldName
|
|
||||||
)
|
|
||||||
:
|
|
||||||
IOPtrList<TimeActivatedExplicitSource<Type> >
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
name + "SourceProperties",
|
|
||||||
mesh.time().constant(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
typename TimeActivatedExplicitSource<Type>::iNew
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
IStringStream('(' + fieldName + ')')()
|
|
||||||
)
|
|
||||||
),
|
|
||||||
name_(name),
|
|
||||||
mesh_(mesh),
|
|
||||||
dimensions_(dimensions),
|
|
||||||
fieldNames_(1, fieldName)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh> >
|
|
||||||
Foam::TimeActivatedExplicitSourceList<Type>::Su(const label fieldI)
|
|
||||||
{
|
|
||||||
tmp<DimensionedField<Type, volMesh> > tSu
|
|
||||||
(
|
|
||||||
new DimensionedField<Type, volMesh>
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
name_ + "Source_" + fieldNames_[fieldI],
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensioned<Type>("zero", dimensions_, pTraits<Type>::zero)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
DimensionedField<Type, volMesh>& Su = tSu();
|
|
||||||
|
|
||||||
forAll(*this, i)
|
|
||||||
{
|
|
||||||
this->operator[](i).addToField(Su, fieldI);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tSu;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh> >
|
|
||||||
Foam::TimeActivatedExplicitSourceList<Type>::SuTot()
|
|
||||||
{
|
|
||||||
tmp<DimensionedField<Type, volMesh> > tSuTot
|
|
||||||
(
|
|
||||||
new DimensionedField<Type, volMesh>
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
name_ + "TotalSource",
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensioned<Type>("zero", dimensions_, pTraits<Type>::zero)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
DimensionedField<Type, volMesh>& SuTot = tSuTot();
|
|
||||||
|
|
||||||
forAll(fieldNames_, fieldI)
|
|
||||||
{
|
|
||||||
forAll(*this, sourceI)
|
|
||||||
{
|
|
||||||
this->operator[](sourceI).addToField(SuTot, fieldI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return tSuTot;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
bool Foam::TimeActivatedExplicitSourceList<Type>::readData(Istream& is)
|
|
||||||
{
|
|
||||||
this->clear();
|
|
||||||
|
|
||||||
IOPtrList<TimeActivatedExplicitSource<Type> > newSources
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
name_ + "TimeActivatedExplicitSource",
|
|
||||||
mesh_.time().constant(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
typename TimeActivatedExplicitSource<Type>::iNew(mesh_, fieldNames_)
|
|
||||||
);
|
|
||||||
|
|
||||||
this->transfer(newSources);
|
|
||||||
|
|
||||||
return is.good();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
bool Foam::TimeActivatedExplicitSourceList<Type>::writeData(Ostream& os) const
|
|
||||||
{
|
|
||||||
// Write size of list
|
|
||||||
os << nl << this->size();
|
|
||||||
|
|
||||||
// Write beginning of contents
|
|
||||||
os << nl << token::BEGIN_LIST;
|
|
||||||
|
|
||||||
// Write list contents
|
|
||||||
forAll(*this, i)
|
|
||||||
{
|
|
||||||
os << nl;
|
|
||||||
this->operator[](i).writeData(os);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write end of contents
|
|
||||||
os << token::END_LIST << token::END_STATEMENT << nl;
|
|
||||||
|
|
||||||
// Check state of IOstream
|
|
||||||
return os.good();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Foam::Ostream& Foam::operator<<
|
|
||||||
(
|
|
||||||
Ostream& os,
|
|
||||||
const TimeActivatedExplicitSourceList<Type>& sources
|
|
||||||
)
|
|
||||||
{
|
|
||||||
sources.writeData(os);
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,171 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::TimeActivatedExplicitSourceList
|
|
||||||
|
|
||||||
Description
|
|
||||||
List of time activeted explict sources
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
TimeActivatedExplicitSourceList.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef TimeActivatedExplicitSourceList_H
|
|
||||||
#define TimeActivatedExplicitSourceList_H
|
|
||||||
|
|
||||||
#include "IOPtrList.H"
|
|
||||||
#include "TimeActivatedExplicitSource.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class fvMesh;
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class TimeActivatedExplicitSource;
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class TimeActivatedExplicitSourceList;
|
|
||||||
|
|
||||||
// Forward declaration of friend functions
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
Ostream& operator<<
|
|
||||||
(
|
|
||||||
Ostream&,
|
|
||||||
const TimeActivatedExplicitSourceList<Type>&
|
|
||||||
);
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class TimeActivatedExplicitSourceList Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class TimeActivatedExplicitSourceList
|
|
||||||
:
|
|
||||||
public IOPtrList<TimeActivatedExplicitSource<Type> >
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Name of source properties list
|
|
||||||
word name_;
|
|
||||||
|
|
||||||
//- Reference to the mesh database
|
|
||||||
const fvMesh& mesh_;
|
|
||||||
|
|
||||||
//- Dimensions of source properties
|
|
||||||
dimensionSet dimensions_;
|
|
||||||
|
|
||||||
//- List of field names the source is working on
|
|
||||||
wordList fieldNames_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
TimeActivatedExplicitSourceList
|
|
||||||
(
|
|
||||||
const TimeActivatedExplicitSourceList<Type>&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const TimeActivatedExplicitSourceList<Type>&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components with list of field names
|
|
||||||
TimeActivatedExplicitSourceList
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const dimensionSet& dimensions,
|
|
||||||
const wordList& fieldNames
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Construct from components with single field name
|
|
||||||
TimeActivatedExplicitSourceList
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const dimensionSet& dimensions,
|
|
||||||
const word& fieldName
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
// Evaluation
|
|
||||||
|
|
||||||
//- Return the source for field, fieldI
|
|
||||||
tmp<DimensionedField<Type, volMesh> > Su
|
|
||||||
(
|
|
||||||
const label fieldI = 0
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Return the total source for all fields
|
|
||||||
tmp<DimensionedField<Type, volMesh> > SuTot();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
|
||||||
|
|
||||||
//- Read data from Istream
|
|
||||||
bool readData(Istream& is);
|
|
||||||
|
|
||||||
//- Write data to Istream
|
|
||||||
bool writeData(Ostream& os) const;
|
|
||||||
|
|
||||||
//- Ostream operator
|
|
||||||
friend Ostream& operator<< <Type>
|
|
||||||
(
|
|
||||||
Ostream& os,
|
|
||||||
const TimeActivatedExplicitSourceList& sources
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
# include "TimeActivatedExplicitSourceList.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
Reference in New Issue
Block a user