mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: minor code style changes + move template funcs into separate files
This commit is contained in:
@ -34,10 +34,8 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
defineTypeNameAndDebug(actuationDiskSource, 0);
|
||||||
defineTypeNameAndDebug(actuationDiskSource, 0);
|
addToRunTimeSelectionTable(basicSource, actuationDiskSource, dictionary);
|
||||||
addToRunTimeSelectionTable(basicSource, actuationDiskSource, dictionary);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -45,20 +43,22 @@ addToRunTimeSelectionTable(basicSource, actuationDiskSource, dictionary);
|
|||||||
|
|
||||||
void Foam::actuationDiskSource::checkData()
|
void Foam::actuationDiskSource::checkData()
|
||||||
{
|
{
|
||||||
if
|
if (magSqr(diskArea_) <= VSMALL)
|
||||||
(
|
|
||||||
magSqr(diskArea_) <= VSMALL
|
|
||||||
|| Cp_ <= VSMALL
|
|
||||||
|| Ct_ <= VSMALL
|
|
||||||
|| diskDir_ == vector::zero
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
FatalIOErrorIn
|
FatalErrorIn("Foam::actuationDiskSource::checkData()")
|
||||||
(
|
<< "diskArea is approximately zero"
|
||||||
"Foam::actuationDiskSource::checkData()",
|
<< exit(FatalIOError);
|
||||||
dict_
|
}
|
||||||
) << "diskArea, Cp or Ct is small "
|
if (Cp_ <= VSMALL || Ct_ <= VSMALL)
|
||||||
<< "or disk direction not specified"
|
{
|
||||||
|
FatalErrorIn("Foam::actuationDiskSource::checkData()")
|
||||||
|
<< "Cp and Ct must be greater than zero"
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
if (mag(diskDir_) < VSMALL)
|
||||||
|
{
|
||||||
|
FatalErrorIn("Foam::actuationDiskSource::checkData()")
|
||||||
|
<< "disk direction vector is approximately zero"
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,11 +75,11 @@ Foam::actuationDiskSource::actuationDiskSource
|
|||||||
:
|
:
|
||||||
basicSource(name, dict, mesh),
|
basicSource(name, dict, mesh),
|
||||||
cellZoneID_(mesh.cellZones().findZoneID(this->cellSetName())),
|
cellZoneID_(mesh.cellZones().findZoneID(this->cellSetName())),
|
||||||
diskDir_(vector::zero),
|
dict_(dict.subDict(typeName + "Coeffs")),
|
||||||
Cp_(0),
|
diskDir_(dict_.lookup("diskDir")),
|
||||||
Ct_(0),
|
Cp_(readScalar(dict_.lookup("Cp"))),
|
||||||
diskArea_(0),
|
Ct_(readScalar(dict_.lookup("Ct"))),
|
||||||
dict_(dict.subDict(typeName + "Coeffs"))
|
diskArea_(readScalar(dict_.lookup("diskArea")))
|
||||||
{
|
{
|
||||||
Info<< " - creating actuation disk zone: "
|
Info<< " - creating actuation disk zone: "
|
||||||
<< this->name() << endl;
|
<< this->name() << endl;
|
||||||
@ -98,11 +98,6 @@ Foam::actuationDiskSource::actuationDiskSource
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
dict_.readIfPresent("diskDir", diskDir_);
|
|
||||||
dict_.readIfPresent("Cp", Cp_);
|
|
||||||
dict_.readIfPresent("Ct", Ct_);
|
|
||||||
dict_.readIfPresent("diskArea", diskArea_);
|
|
||||||
|
|
||||||
checkData();
|
checkData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +127,7 @@ void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
|||||||
addActuationDiskAxialInertialResistance
|
addActuationDiskAxialInertialResistance
|
||||||
(
|
(
|
||||||
Usource,
|
Usource,
|
||||||
cells,//this->cells(),
|
cells,
|
||||||
V,
|
V,
|
||||||
this->mesh().lookupObject<volScalarField>("rho"),
|
this->mesh().lookupObject<volScalarField>("rho"),
|
||||||
U
|
U
|
||||||
@ -143,7 +138,7 @@ void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
|||||||
addActuationDiskAxialInertialResistance
|
addActuationDiskAxialInertialResistance
|
||||||
(
|
(
|
||||||
Usource,
|
Usource,
|
||||||
cells,//this->cells(),
|
cells,
|
||||||
V,
|
V,
|
||||||
geometricOneField(),
|
geometricOneField(),
|
||||||
U
|
U
|
||||||
|
|||||||
@ -62,7 +62,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class actuationDiskSource Declaration
|
Class actuationDiskSource Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class actuationDiskSource
|
class actuationDiskSource
|
||||||
@ -74,6 +74,9 @@ class actuationDiskSource
|
|||||||
//- Cell zone ID
|
//- Cell zone ID
|
||||||
label cellZoneID_;
|
label cellZoneID_;
|
||||||
|
|
||||||
|
//- Sub dictionary with actuationDisk information
|
||||||
|
const dictionary& dict_;
|
||||||
|
|
||||||
//- Disk area normal
|
//- Disk area normal
|
||||||
vector diskDir_;
|
vector diskDir_;
|
||||||
|
|
||||||
@ -86,9 +89,6 @@ class actuationDiskSource
|
|||||||
//- Disk area
|
//- Disk area
|
||||||
scalar diskArea_;
|
scalar diskArea_;
|
||||||
|
|
||||||
//- Sub dictionary with actuationDisk information
|
|
||||||
const dictionary& dict_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
|
|||||||
@ -61,4 +61,5 @@ void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -58,10 +58,7 @@ private:
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
IObasicSourceList
|
IObasicSourceList(const IObasicSourceList&);
|
||||||
(
|
|
||||||
const IObasicSourceList&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const IObasicSourceList&);
|
void operator=(const IObasicSourceList&);
|
||||||
@ -72,18 +69,15 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components with list of field names
|
//- Construct from components with list of field names
|
||||||
IObasicSourceList
|
IObasicSourceList(const fvMesh& mesh);
|
||||||
(
|
|
||||||
const fvMesh& mesh
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
//- Destructor
|
||||||
virtual ~IObasicSourceList()
|
virtual ~IObasicSourceList()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
//- Read dictionary
|
//- Read dictionary
|
||||||
virtual bool read();
|
virtual bool read();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -39,8 +39,7 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::wordList Foam::basicSource::
|
const Foam::wordList Foam::basicSource::selectionModeTypeNames_
|
||||||
selectionModeTypeNames_
|
|
||||||
(
|
(
|
||||||
IStringStream("(points cellSet cellZone all)")()
|
IStringStream("(points cellSet cellZone all)")()
|
||||||
);
|
);
|
||||||
@ -48,8 +47,7 @@ selectionModeTypeNames_
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::basicSource::selectionModeType
|
Foam::basicSource::selectionModeType Foam::basicSource::wordToSelectionModeType
|
||||||
Foam::basicSource::wordToSelectionModeType
|
|
||||||
(
|
(
|
||||||
const word& smtName
|
const word& smtName
|
||||||
) const
|
) const
|
||||||
@ -93,16 +91,13 @@ Foam::word Foam::basicSource::selectionModeTypeToWord
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::basicSource::setSelection
|
void Foam::basicSource::setSelection(const dictionary& dict)
|
||||||
(
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
switch (selectionMode_)
|
switch (selectionMode_)
|
||||||
{
|
{
|
||||||
case smPoints:
|
case smPoints:
|
||||||
{
|
{
|
||||||
//Do nothing. It should be sorted out by derived class//
|
// Do nothing. It should be sorted out by derived class
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case smCellSet:
|
case smCellSet:
|
||||||
@ -236,11 +231,7 @@ Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
word typeModel;
|
word typeModel(dict.lookup("typeModel"));
|
||||||
|
|
||||||
{
|
|
||||||
dict.lookup("typeModel") >> typeModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
Info<< "Selecting model type " << typeModel << endl;
|
Info<< "Selecting model type " << typeModel << endl;
|
||||||
|
|
||||||
@ -254,9 +245,9 @@ Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
|
|||||||
"basicSource::New(const volVectorField&, "
|
"basicSource::New(const volVectorField&, "
|
||||||
"const surfaceScalarField&, transportModel&)"
|
"const surfaceScalarField&, transportModel&)"
|
||||||
) << "Unknown Model type " << typeModel
|
) << "Unknown Model type " << typeModel
|
||||||
<< endl << endl
|
<< nl << nl
|
||||||
<< "Valid model types are :" << endl
|
<< "Valid model types are :" << nl
|
||||||
<< dictionaryConstructorTablePtr_->toc()
|
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,6 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::word& Foam::basicSource::name() const
|
inline const Foam::word& Foam::basicSource::name() const
|
||||||
{
|
{
|
||||||
return name_;
|
return name_;
|
||||||
@ -75,8 +74,7 @@ Foam::basicSource::selectionMode() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::word&
|
inline const Foam::word& Foam::basicSource::cellSetName() const
|
||||||
Foam::basicSource::cellSetName() const
|
|
||||||
{
|
{
|
||||||
return cellSetName_;
|
return cellSetName_;
|
||||||
}
|
}
|
||||||
@ -88,8 +86,7 @@ inline Foam::scalar Foam::basicSource::V() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::labelList&
|
inline const Foam::labelList& Foam::basicSource::cells() const
|
||||||
Foam::basicSource::cells() const
|
|
||||||
{
|
{
|
||||||
return cells_;
|
return cells_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,7 +27,6 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
void Foam::basicSource::writeData(Ostream& os) const
|
void Foam::basicSource::writeData(Ostream& os) const
|
||||||
{
|
{
|
||||||
os << indent << name_ << nl
|
os << indent << name_ << nl
|
||||||
|
|||||||
@ -61,6 +61,7 @@ Foam::basicSourceList::basicSourceList
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
@ -177,4 +178,5 @@ Foam::Ostream& Foam::operator<<
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -63,10 +63,7 @@ private:
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
basicSourceList
|
basicSourceList(const basicSourceList&);
|
||||||
(
|
|
||||||
const basicSourceList&
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const basicSourceList&);
|
void operator=(const basicSourceList&);
|
||||||
@ -77,14 +74,10 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components with list of field names
|
//- Construct from components with list of field names
|
||||||
basicSourceList
|
basicSourceList(const fvMesh& mesh, const dictionary& dict);
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
const dictionary& dict
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
//- Destructor
|
||||||
virtual ~basicSourceList()
|
virtual ~basicSourceList()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@ -66,12 +66,9 @@ void Foam::explicitSource::setSelectedCellsFromPoints()
|
|||||||
|
|
||||||
if (globalCellI < 0)
|
if (globalCellI < 0)
|
||||||
{
|
{
|
||||||
WarningIn
|
WarningIn("explicitSource::setSelectedCellsFromPoints()")
|
||||||
(
|
<< "Unable to find owner cell for point " << points_[i]
|
||||||
"explicitSource::setSelectedCellsFromPoints()"
|
<< endl;
|
||||||
)
|
|
||||||
<< "Unable to find owner cell for point " << points_[i]
|
|
||||||
<< endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,20 +76,6 @@ void Foam::explicitSource::setSelectedCellsFromPoints()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
void Foam::explicitSource::addSources
|
|
||||||
(
|
|
||||||
Field<Type>& fieldSource,
|
|
||||||
Type& data
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
forAll(this->cells(), i)
|
|
||||||
{
|
|
||||||
fieldSource[this->cells()[i]] = data/volSource_[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::explicitSource::volumeModeType
|
Foam::explicitSource::volumeModeType
|
||||||
@ -136,49 +119,8 @@ Foam::word Foam::explicitSource::volumeModeTypeToWord
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class Type>
|
|
||||||
void Foam::explicitSource::addField
|
|
||||||
(
|
|
||||||
HashTable<Type>& fields,
|
|
||||||
const wordList& fieldTypes,
|
|
||||||
const wordList& fieldNames,
|
|
||||||
const dictionary& fieldDataDict
|
|
||||||
)
|
|
||||||
{
|
|
||||||
forAll (fieldTypes, fieldI)
|
|
||||||
{
|
|
||||||
word fieldName = fieldNames[fieldI];
|
|
||||||
word fieldType = fieldTypes[fieldI];
|
|
||||||
|
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> geometricField;
|
void Foam::explicitSource::setFieldData(const dictionary& dict)
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSource::setFieldData
|
|
||||||
(
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
scalarFields_.clear();
|
scalarFields_.clear();
|
||||||
vectorFields_.clear();
|
vectorFields_.clear();
|
||||||
@ -271,10 +213,7 @@ Foam::explicitSource::explicitSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSource::addSu
|
void Foam::explicitSource::addSu(fvMatrix<scalar>& Eqn)
|
||||||
(
|
|
||||||
fvMatrix<scalar>& Eqn
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
Field<scalar>& source = Eqn.source();
|
Field<scalar>& source = Eqn.source();
|
||||||
scalar data = scalarFields_[Eqn.psi().name()];
|
scalar data = scalarFields_[Eqn.psi().name()];
|
||||||
@ -282,10 +221,7 @@ void Foam::explicitSource::addSu
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSource::addSu
|
void Foam::explicitSource::addSu(fvMatrix<vector>& Eqn)
|
||||||
(
|
|
||||||
fvMatrix<vector>& Eqn
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
Field<vector>& source = Eqn.source();
|
Field<vector>& source = Eqn.source();
|
||||||
vector data = vectorFields_[Eqn.psi().name()];
|
vector data = vectorFields_[Eqn.psi().name()];
|
||||||
@ -293,29 +229,25 @@ void Foam::explicitSource::addSu
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSource::addSu
|
void Foam::explicitSource::addSu(DimensionedField<scalar, volMesh>& field)
|
||||||
(
|
|
||||||
DimensionedField<scalar, volMesh>& field
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
scalar data = scalarFields_[field.name()];
|
scalar data = scalarFields_[field.name()];
|
||||||
addSources<scalar>(field, data);
|
addSources<scalar>(field, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSource::addSu
|
void Foam::explicitSource::addSu(DimensionedField<vector, volMesh>& field)
|
||||||
(
|
|
||||||
DimensionedField<vector, volMesh>& field
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
vector data = vectorFields_[field.name()];
|
vector data = vectorFields_[field.name()];
|
||||||
addSources<vector>(field, data);
|
addSources<vector>(field, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSource::addExplicitSources()
|
void Foam::explicitSource::addExplicitSources()
|
||||||
{
|
{
|
||||||
scalarFields_.applySources();
|
scalarFields_.applySources();
|
||||||
vectorFields_.applySources();
|
vectorFields_.applySources();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -284,6 +284,12 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "explicitSourceTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -69,11 +69,7 @@ bool Foam::explicitSource::read(const dictionary& dict)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<
|
Foam::Ostream& Foam::operator<<(Ostream& os, const explicitSource& source)
|
||||||
(
|
|
||||||
Ostream& os,
|
|
||||||
const explicitSource& source
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
source.writeData(os);
|
source.writeData(os);
|
||||||
return os;
|
return os;
|
||||||
|
|||||||
@ -0,0 +1,79 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 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::addSources
|
||||||
|
(
|
||||||
|
Field<Type>& fieldSource,
|
||||||
|
Type& data
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
forAll(this->cells(), i)
|
||||||
|
{
|
||||||
|
fieldSource[this->cells()[i]] = data/volSource_[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -68,19 +68,19 @@ class cylindricalInletVelocityFvPatchVectorField
|
|||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Axial velocity
|
//- Axial velocity
|
||||||
scalar axialVelocity_;
|
const scalar axialVelocity_;
|
||||||
|
|
||||||
//- Central point
|
//- Central point
|
||||||
vector centre_;
|
const vector centre_;
|
||||||
|
|
||||||
//- Axis
|
//- Axis
|
||||||
vector axis_;
|
const vector axis_;
|
||||||
|
|
||||||
//- RPM
|
//- RPM
|
||||||
scalar rpm_;
|
const scalar rpm_;
|
||||||
|
|
||||||
//- Radial velocity
|
//- Radial velocity
|
||||||
scalar radialVelocity_;
|
const scalar radialVelocity_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@ -508,10 +508,7 @@ Foam::ODEChemistryModel<CompType, ThermoType>::tc() const
|
|||||||
{
|
{
|
||||||
const Reaction<ThermoType>& R = reactions_[i];
|
const Reaction<ThermoType>& R = reactions_[i];
|
||||||
|
|
||||||
omega
|
omega(R, c, Ti, pi, pf, cf, lRef, pr, cr, rRef);
|
||||||
(
|
|
||||||
R, c, Ti, pi, pf, cf, lRef, pr, cr, rRef
|
|
||||||
);
|
|
||||||
|
|
||||||
forAll(R.rhs(), s)
|
forAll(R.rhs(), s)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -91,7 +91,7 @@ protected:
|
|||||||
//- Chemistry solver
|
//- Chemistry solver
|
||||||
autoPtr<chemistrySolver<CompType, ThermoType> > solver_;
|
autoPtr<chemistrySolver<CompType, ThermoType> > solver_;
|
||||||
|
|
||||||
//- Chemical source term [kg/m3/s]
|
//- List of reaction rate per specie [kg/m3/s]
|
||||||
PtrList<scalarField> RR_;
|
PtrList<scalarField> RR_;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -138,11 +138,11 @@ void dynLagrangian::correct(const tmp<volTensorField>& gradU)
|
|||||||
|
|
||||||
fvScalarMatrix flmEqn
|
fvScalarMatrix flmEqn
|
||||||
(
|
(
|
||||||
fvm::ddt(flm_)
|
fvm::ddt(flm_)
|
||||||
+ fvm::div(phi(), flm_)
|
+ fvm::div(phi(), flm_)
|
||||||
==
|
==
|
||||||
invT*LM
|
invT*LM
|
||||||
- fvm::Sp(invT, flm_)
|
- fvm::Sp(invT, flm_)
|
||||||
);
|
);
|
||||||
|
|
||||||
flmEqn.relax();
|
flmEqn.relax();
|
||||||
@ -154,11 +154,11 @@ void dynLagrangian::correct(const tmp<volTensorField>& gradU)
|
|||||||
|
|
||||||
fvScalarMatrix fmmEqn
|
fvScalarMatrix fmmEqn
|
||||||
(
|
(
|
||||||
fvm::ddt(fmm_)
|
fvm::ddt(fmm_)
|
||||||
+ fvm::div(phi(), fmm_)
|
+ fvm::div(phi(), fmm_)
|
||||||
==
|
==
|
||||||
invT*MM
|
invT*MM
|
||||||
- fvm::Sp(invT, fmm_)
|
- fvm::Sp(invT, fmm_)
|
||||||
);
|
);
|
||||||
|
|
||||||
fmmEqn.relax();
|
fmmEqn.relax();
|
||||||
|
|||||||
@ -84,7 +84,7 @@ namespace LESModels
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class dynLagrangian Declaration
|
Class dynLagrangian Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class dynLagrangian
|
class dynLagrangian
|
||||||
@ -104,6 +104,8 @@ class dynLagrangian
|
|||||||
|
|
||||||
dimensionedScalar flm0_;
|
dimensionedScalar flm0_;
|
||||||
dimensionedScalar fmm0_;
|
dimensionedScalar fmm0_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Update sub-grid scale fields
|
//- Update sub-grid scale fields
|
||||||
@ -141,14 +143,13 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return SGS kinetic energy
|
//- Return SGS kinetic energy
|
||||||
|
|
||||||
tmp<volScalarField> k(const tmp<volTensorField>& gradU) const
|
tmp<volScalarField> k(const tmp<volTensorField>& gradU) const
|
||||||
{
|
{
|
||||||
return 2.0*sqr(delta())*magSqr(dev(symm(gradU)));
|
return 2.0*sqr(delta())*magSqr(dev(symm(gradU)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Return SGS kinetic energy
|
//- Return SGS kinetic energy
|
||||||
virtual tmp<volScalarField> k() const
|
virtual tmp<volScalarField> k() const
|
||||||
{
|
{
|
||||||
return k(fvc::grad(U()));
|
return k(fvc::grad(U()));
|
||||||
|
|||||||
@ -90,8 +90,16 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
|
|||||||
{
|
{
|
||||||
if (mag(z_) < SMALL)
|
if (mag(z_) < SMALL)
|
||||||
{
|
{
|
||||||
FatalErrorIn("atmBoundaryLayerInletEpsilonFvPatchScalarField(dict)")
|
FatalErrorIn
|
||||||
<< "z is not correct"
|
(
|
||||||
|
"atmBoundaryLayerInletEpsilonFvPatchScalarField"
|
||||||
|
"("
|
||||||
|
"const fvPatch&, "
|
||||||
|
"const DimensionedField<scalar, volMesh>&, "
|
||||||
|
"const dictionary&"
|
||||||
|
")"
|
||||||
|
)
|
||||||
|
<< "magnitude of z vector must be greater than zero"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,16 +112,16 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField
|
|||||||
atmBoundaryLayerInletEpsilonFvPatchScalarField::
|
atmBoundaryLayerInletEpsilonFvPatchScalarField::
|
||||||
atmBoundaryLayerInletEpsilonFvPatchScalarField
|
atmBoundaryLayerInletEpsilonFvPatchScalarField
|
||||||
(
|
(
|
||||||
const atmBoundaryLayerInletEpsilonFvPatchScalarField& fcvpvf,
|
const atmBoundaryLayerInletEpsilonFvPatchScalarField& blpsf,
|
||||||
const DimensionedField<scalar, volMesh>& iF
|
const DimensionedField<scalar, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchScalarField(fcvpvf, iF),
|
fixedValueFvPatchScalarField(blpsf, iF),
|
||||||
Ustar_(fcvpvf.Ustar_),
|
Ustar_(blpsf.Ustar_),
|
||||||
z_(fcvpvf.z_),
|
z_(blpsf.z_),
|
||||||
z0_(fcvpvf.z0_),
|
z0_(blpsf.z0_),
|
||||||
kappa_(fcvpvf.kappa_),
|
kappa_(blpsf.kappa_),
|
||||||
zGround_(fcvpvf.zGround_)
|
zGround_(blpsf.zGround_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -123,11 +131,10 @@ void atmBoundaryLayerInletEpsilonFvPatchScalarField::updateCoeffs()
|
|||||||
{
|
{
|
||||||
const vectorField& c = patch().Cf();
|
const vectorField& c = patch().Cf();
|
||||||
scalarField coord = (c & z_);
|
scalarField coord = (c & z_);
|
||||||
scalarField::operator=(pow(Ustar_, 3.0)/(kappa_*(coord - zGround_ + z0_)));
|
scalarField::operator=(pow3(Ustar_)/(kappa_*(coord - zGround_ + z0_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write
|
|
||||||
void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const
|
void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
fvPatchScalarField::write(os);
|
fvPatchScalarField::write(os);
|
||||||
|
|||||||
@ -92,6 +92,7 @@ class atmBoundaryLayerInletEpsilonFvPatchScalarField
|
|||||||
//- Minimum corrdinate value in z direction
|
//- Minimum corrdinate value in z direction
|
||||||
scalar zGround_;
|
scalar zGround_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
|
|||||||
@ -99,8 +99,16 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
|
|||||||
{
|
{
|
||||||
if (mag(n_) < SMALL || mag(z_) < SMALL || mag(z0_) < SMALL)
|
if (mag(n_) < SMALL || mag(z_) < SMALL || mag(z0_) < SMALL)
|
||||||
{
|
{
|
||||||
FatalErrorIn("atmBoundaryLayerInletVelocityFvPatchVectorField(dict)")
|
FatalErrorIn
|
||||||
<< "n, z or z0 given are close to zero is not correct"
|
(
|
||||||
|
"atmBoundaryLayerInletVelocityFvPatchVectorField"
|
||||||
|
"("
|
||||||
|
"const fvPatch&, "
|
||||||
|
"const DimensionedField<vector, volMesh>&, "
|
||||||
|
"onst dictionary&"
|
||||||
|
")"
|
||||||
|
)
|
||||||
|
<< "magnitude of n, z and z0 vectors must be greater than zero"
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,19 +124,19 @@ atmBoundaryLayerInletVelocityFvPatchVectorField
|
|||||||
atmBoundaryLayerInletVelocityFvPatchVectorField::
|
atmBoundaryLayerInletVelocityFvPatchVectorField::
|
||||||
atmBoundaryLayerInletVelocityFvPatchVectorField
|
atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const atmBoundaryLayerInletVelocityFvPatchVectorField& fcvpvf,
|
const atmBoundaryLayerInletVelocityFvPatchVectorField& blpvf,
|
||||||
const DimensionedField<vector, volMesh>& iF
|
const DimensionedField<vector, volMesh>& iF
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedValueFvPatchVectorField(fcvpvf, iF),
|
fixedValueFvPatchVectorField(blpvf, iF),
|
||||||
Ustar_(fcvpvf.Ustar_),
|
Ustar_(blpvf.Ustar_),
|
||||||
n_(fcvpvf.n_),
|
n_(blpvf.n_),
|
||||||
z_(fcvpvf.z_),
|
z_(blpvf.z_),
|
||||||
z0_(fcvpvf.z0_),
|
z0_(blpvf.z0_),
|
||||||
kappa_(fcvpvf.kappa_),
|
kappa_(blpvf.kappa_),
|
||||||
Uref_(fcvpvf.Uref_),
|
Uref_(blpvf.Uref_),
|
||||||
Href_(fcvpvf.Href_),
|
Href_(blpvf.Href_),
|
||||||
zGround_(fcvpvf.zGround_)
|
zGround_(blpvf.zGround_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -158,7 +166,6 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::updateCoeffs()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write
|
|
||||||
void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const
|
void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
fvPatchVectorField::write(os);
|
fvPatchVectorField::write(os);
|
||||||
|
|||||||
@ -115,6 +115,7 @@ class atmBoundaryLayerInletVelocityFvPatchVectorField
|
|||||||
//- Minimum corrdinate value in z direction
|
//- Minimum corrdinate value in z direction
|
||||||
scalar zGround_;
|
scalar zGround_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Runtime type information
|
//- Runtime type information
|
||||||
@ -138,8 +139,8 @@ public:
|
|||||||
const dictionary&
|
const dictionary&
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct by mapping given atmBoundaryLayerInletVelocityFvPatchVectorField
|
//- Construct by mapping given
|
||||||
// onto a new patch
|
// atmBoundaryLayerInletVelocityFvPatchVectorField onto a new patch
|
||||||
atmBoundaryLayerInletVelocityFvPatchVectorField
|
atmBoundaryLayerInletVelocityFvPatchVectorField
|
||||||
(
|
(
|
||||||
const atmBoundaryLayerInletVelocityFvPatchVectorField&,
|
const atmBoundaryLayerInletVelocityFvPatchVectorField&,
|
||||||
|
|||||||
Reference in New Issue
Block a user