mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-2.0.0
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -41,7 +41,7 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::actuationDiskSource::checkData()
|
void Foam::actuationDiskSource::checkData() const
|
||||||
{
|
{
|
||||||
if (magSqr(diskArea_) <= VSMALL)
|
if (magSqr(diskArea_) <= VSMALL)
|
||||||
{
|
{
|
||||||
@ -74,7 +74,6 @@ Foam::actuationDiskSource::actuationDiskSource
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
basicSource(name, dict, mesh),
|
basicSource(name, dict, mesh),
|
||||||
cellZoneID_(mesh.cellZones().findZoneID(this->cellSetName())),
|
|
||||||
dict_(dict.subDict(typeName + "Coeffs")),
|
dict_(dict.subDict(typeName + "Coeffs")),
|
||||||
diskDir_(dict_.lookup("diskDir")),
|
diskDir_(dict_.lookup("diskDir")),
|
||||||
Cp_(readScalar(dict_.lookup("Cp"))),
|
Cp_(readScalar(dict_.lookup("Cp"))),
|
||||||
@ -84,20 +83,6 @@ Foam::actuationDiskSource::actuationDiskSource
|
|||||||
Info<< " - creating actuation disk zone: "
|
Info<< " - creating actuation disk zone: "
|
||||||
<< this->name() << endl;
|
<< this->name() << endl;
|
||||||
|
|
||||||
bool foundZone = (cellZoneID_ != -1);
|
|
||||||
|
|
||||||
reduce(foundZone, orOp<bool>());
|
|
||||||
|
|
||||||
if (!foundZone && Pstream::master())
|
|
||||||
{
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"Foam::actuationDiskSource::actuationDiskSource"
|
|
||||||
"(const word&, const dictionary&, const fvMesh&)"
|
|
||||||
) << "cannot find porous cellZone " << this->name()
|
|
||||||
<< exit(FatalError);
|
|
||||||
}
|
|
||||||
|
|
||||||
checkData();
|
checkData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,18 +91,12 @@ Foam::actuationDiskSource::actuationDiskSource
|
|||||||
|
|
||||||
void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
||||||
{
|
{
|
||||||
if (cellZoneID_ == -1)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool compressible = false;
|
bool compressible = false;
|
||||||
if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
|
if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
|
||||||
{
|
{
|
||||||
compressible = true;
|
compressible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const labelList& cells = mesh_.cellZones()[cellZoneID_];
|
|
||||||
const scalarField& V = this->mesh().V();
|
const scalarField& V = this->mesh().V();
|
||||||
vectorField& Usource = UEqn.source();
|
vectorField& Usource = UEqn.source();
|
||||||
const vectorField& U = UEqn.psi();
|
const vectorField& U = UEqn.psi();
|
||||||
@ -127,7 +106,7 @@ void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
|||||||
addActuationDiskAxialInertialResistance
|
addActuationDiskAxialInertialResistance
|
||||||
(
|
(
|
||||||
Usource,
|
Usource,
|
||||||
cells,
|
cells_,
|
||||||
V,
|
V,
|
||||||
this->mesh().lookupObject<volScalarField>("rho"),
|
this->mesh().lookupObject<volScalarField>("rho"),
|
||||||
U
|
U
|
||||||
@ -138,7 +117,7 @@ void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
|||||||
addActuationDiskAxialInertialResistance
|
addActuationDiskAxialInertialResistance
|
||||||
(
|
(
|
||||||
Usource,
|
Usource,
|
||||||
cells,
|
cells_,
|
||||||
V,
|
V,
|
||||||
geometricOneField(),
|
geometricOneField(),
|
||||||
U
|
U
|
||||||
@ -149,7 +128,6 @@ void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
|
|||||||
|
|
||||||
void Foam::actuationDiskSource::writeData(Ostream& os) const
|
void Foam::actuationDiskSource::writeData(Ostream& os) const
|
||||||
{
|
{
|
||||||
|
|
||||||
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
|
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||||
os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl;
|
os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -71,9 +71,6 @@ class actuationDiskSource
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Cell zone ID
|
|
||||||
label cellZoneID_;
|
|
||||||
|
|
||||||
//- Sub dictionary with actuationDisk information
|
//- Sub dictionary with actuationDisk information
|
||||||
const dictionary& dict_;
|
const dictionary& dict_;
|
||||||
|
|
||||||
@ -93,7 +90,7 @@ class actuationDiskSource
|
|||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Check data
|
//- Check data
|
||||||
void checkData();
|
void checkData() const;
|
||||||
|
|
||||||
//- Add resistance to the UEqn
|
//- Add resistance to the UEqn
|
||||||
template<class RhoFieldType>
|
template<class RhoFieldType>
|
||||||
@ -139,12 +136,6 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- cellZone number
|
|
||||||
label zoneId() const
|
|
||||||
{
|
|
||||||
return cellZoneID_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Return Cp
|
//- Return Cp
|
||||||
scalar Cp() const
|
scalar Cp() const
|
||||||
{
|
{
|
||||||
@ -178,15 +169,6 @@ public:
|
|||||||
//-Source term to fvMatrix<scalar>
|
//-Source term to fvMatrix<scalar>
|
||||||
virtual void addSu(fvMatrix<scalar>& UEqn){}
|
virtual void addSu(fvMatrix<scalar>& UEqn){}
|
||||||
|
|
||||||
//- Add all explicit source
|
|
||||||
virtual void addExplicitSources(){}
|
|
||||||
|
|
||||||
//- Add source to scalar field
|
|
||||||
virtual void addSu(DimensionedField<scalar, volMesh>& field){}
|
|
||||||
|
|
||||||
//- Add source to vector field
|
|
||||||
virtual void addSu(DimensionedField<vector, volMesh>& field){}
|
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -39,65 +39,32 @@ namespace Foam
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::wordList Foam::basicSource::selectionModeTypeNames_
|
template<> const char* Foam::NamedEnum
|
||||||
(
|
<
|
||||||
IStringStream("(points cellSet cellZone all)")()
|
Foam::basicSource::selectionModeType,
|
||||||
);
|
4
|
||||||
|
>::names[] =
|
||||||
|
{
|
||||||
|
"points",
|
||||||
|
"cellSet",
|
||||||
|
"cellZone",
|
||||||
|
"all"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::NamedEnum<Foam::basicSource::selectionModeType, 4>
|
||||||
|
Foam::basicSource::selectionModeTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::basicSource::selectionModeType Foam::basicSource::wordToSelectionModeType
|
|
||||||
(
|
|
||||||
const word& smtName
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
forAll(selectionModeTypeNames_, i)
|
|
||||||
{
|
|
||||||
if (smtName == selectionModeTypeNames_[i])
|
|
||||||
{
|
|
||||||
return selectionModeType(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FatalErrorIn
|
|
||||||
(
|
|
||||||
"basicSource::selectionModeType"
|
|
||||||
"basicSource::wordToSelectionModeType"
|
|
||||||
"("
|
|
||||||
"const word&"
|
|
||||||
")"
|
|
||||||
) << "Unknown selectionMode type " << smtName
|
|
||||||
<< ". Valid selectionMode types are:" << nl << selectionModeTypeNames_
|
|
||||||
<< exit(FatalError);
|
|
||||||
|
|
||||||
return selectionModeType(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::word Foam::basicSource::selectionModeTypeToWord
|
|
||||||
(
|
|
||||||
const selectionModeType& smtType
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (smtType > selectionModeTypeNames_.size())
|
|
||||||
{
|
|
||||||
return "UNKNOWN";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return selectionModeTypeNames_[smtType];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::basicSource::setSelection(const dictionary& dict)
|
void Foam::basicSource::setSelection(const dictionary& dict)
|
||||||
{
|
{
|
||||||
switch (selectionMode_)
|
switch (selectionMode_)
|
||||||
{
|
{
|
||||||
case smPoints:
|
case smPoints:
|
||||||
{
|
{
|
||||||
// Do nothing. It should be sorted out by derived class
|
dict.lookup("points") >> points_;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case smCellSet:
|
case smCellSet:
|
||||||
@ -135,6 +102,29 @@ void Foam::basicSource::setCellSet()
|
|||||||
{
|
{
|
||||||
case smPoints:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
case smCellSet:
|
case smCellSet:
|
||||||
@ -181,8 +171,6 @@ void Foam::basicSource::setCellSet()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set volume information
|
// Set volume information
|
||||||
if (selectionMode_ != smPoints)
|
|
||||||
{
|
|
||||||
V_ = 0.0;
|
V_ = 0.0;
|
||||||
forAll(cells_, i)
|
forAll(cells_, i)
|
||||||
{
|
{
|
||||||
@ -193,7 +181,6 @@ void Foam::basicSource::setCellSet()
|
|||||||
Info<< indent << "- selected "
|
Info<< indent << "- selected "
|
||||||
<< returnReduce(cells_.size(), sumOp<label>())
|
<< returnReduce(cells_.size(), sumOp<label>())
|
||||||
<< " cell(s) with volume " << V_ << nl << decrIndent << endl;
|
<< " cell(s) with volume " << V_ << nl << decrIndent << endl;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -212,9 +199,9 @@ Foam::basicSource::basicSource
|
|||||||
active_(readBool(dict_.lookup("active"))),
|
active_(readBool(dict_.lookup("active"))),
|
||||||
timeStart_(readScalar(dict_.lookup("timeStart"))),
|
timeStart_(readScalar(dict_.lookup("timeStart"))),
|
||||||
duration_(readScalar(dict_.lookup("duration"))),
|
duration_(readScalar(dict_.lookup("duration"))),
|
||||||
selectionMode_(wordToSelectionModeType(dict_.lookup("selectionMode"))),
|
selectionMode_(selectionModeTypeNames_.read(dict_.lookup("selectionMode"))),
|
||||||
cellSetName_("none"),
|
cellSetName_("none"),
|
||||||
V_(1.0)
|
V_(0.0)
|
||||||
{
|
{
|
||||||
setSelection(dict_);
|
setSelection(dict_);
|
||||||
|
|
||||||
@ -231,12 +218,12 @@ Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
|
|||||||
const fvMesh& mesh
|
const fvMesh& mesh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
word typeModel(dict.lookup("typeModel"));
|
word modelType(dict.lookup("type"));
|
||||||
|
|
||||||
Info<< "Selecting model type " << typeModel << endl;
|
Info<< "Selecting model type " << modelType << endl;
|
||||||
|
|
||||||
dictionaryConstructorTable::iterator cstrIter =
|
dictionaryConstructorTable::iterator cstrIter =
|
||||||
dictionaryConstructorTablePtr_->find(typeModel);
|
dictionaryConstructorTablePtr_->find(modelType);
|
||||||
|
|
||||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||||
{
|
{
|
||||||
@ -244,7 +231,7 @@ 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 " << modelType
|
||||||
<< nl << nl
|
<< nl << nl
|
||||||
<< "Valid model types are :" << nl
|
<< "Valid model types are :" << nl
|
||||||
<< dictionaryConstructorTablePtr_->sortedToc()
|
<< dictionaryConstructorTablePtr_->sortedToc()
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -31,7 +31,7 @@ Description
|
|||||||
|
|
||||||
source1
|
source1
|
||||||
{
|
{
|
||||||
typeModel actuationDiskSource; // explicitSource
|
type actuationDiskSource; // explicitSource
|
||||||
active on; // on/off switch
|
active on; // on/off switch
|
||||||
timeStart 0.0; // start time
|
timeStart 0.0; // start time
|
||||||
duration 1000.0; // duration
|
duration 1000.0; // duration
|
||||||
@ -49,7 +49,7 @@ Description
|
|||||||
|
|
||||||
source2
|
source2
|
||||||
{
|
{
|
||||||
typeModel explicitSource;
|
type explicitSource;
|
||||||
active on;
|
active on;
|
||||||
timeStart 0.0;
|
timeStart 0.0;
|
||||||
duration 1000.0;
|
duration 1000.0;
|
||||||
@ -115,7 +115,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//- Word list of selection mode type names
|
//- Word list of selection mode type names
|
||||||
static const wordList selectionModeTypeNames_;
|
static const NamedEnum<selectionModeType, 4> selectionModeTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -146,6 +146,9 @@ protected:
|
|||||||
//- Name of cell set for "cellSet" and "cellZone" selectionMode
|
//- Name of cell set for "cellSet" and "cellZone" selectionMode
|
||||||
word cellSetName_;
|
word cellSetName_;
|
||||||
|
|
||||||
|
//- List of points for "points" selectionMode
|
||||||
|
List<point> points_;
|
||||||
|
|
||||||
//- Set of cells to apply source to
|
//- Set of cells to apply source to
|
||||||
labelList cells_;
|
labelList cells_;
|
||||||
|
|
||||||
@ -155,12 +158,6 @@ protected:
|
|||||||
|
|
||||||
// Protected functions
|
// Protected functions
|
||||||
|
|
||||||
//- Helper function to convert from a word to a selectionModeType
|
|
||||||
selectionModeType wordToSelectionModeType(const word& smtName) const;
|
|
||||||
|
|
||||||
//- Helper function to convert from a selectionModeType to a word
|
|
||||||
word selectionModeTypeToWord(const selectionModeType& smtType) const;
|
|
||||||
|
|
||||||
//- Set the cellSet or points selection
|
//- Set the cellSet or points selection
|
||||||
void setSelection(const dictionary& dict);
|
void setSelection(const dictionary& dict);
|
||||||
|
|
||||||
@ -305,9 +302,6 @@ public:
|
|||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
|
|
||||||
//- Return access to the source name
|
|
||||||
inline word& name();
|
|
||||||
|
|
||||||
//- Return access to the source active flag
|
//- Return access to the source active flag
|
||||||
inline bool& active();
|
inline bool& active();
|
||||||
|
|
||||||
@ -317,22 +311,6 @@ public:
|
|||||||
//- Return access to the duration
|
//- Return access to the duration
|
||||||
inline scalar& duration();
|
inline scalar& duration();
|
||||||
|
|
||||||
//- 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();
|
|
||||||
|
|
||||||
|
|
||||||
// Checks
|
// Checks
|
||||||
|
|
||||||
@ -342,15 +320,6 @@ public:
|
|||||||
|
|
||||||
// Evaluation
|
// Evaluation
|
||||||
|
|
||||||
//- Add all explicit sources
|
|
||||||
virtual void addExplicitSources() = 0;
|
|
||||||
|
|
||||||
//- Add source to scalar field
|
|
||||||
virtual void addSu(DimensionedField<scalar, volMesh>& field) = 0;
|
|
||||||
|
|
||||||
//- Add source to vector field
|
|
||||||
virtual void addSu(DimensionedField<vector, volMesh>& field) = 0;
|
|
||||||
|
|
||||||
//- Add source term to vector fvMatrix
|
//- Add source term to vector fvMatrix
|
||||||
virtual void addSu(fvMatrix<vector>& Eqn) = 0;
|
virtual void addSu(fvMatrix<vector>& Eqn) = 0;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -92,12 +92,6 @@ inline const Foam::labelList& Foam::basicSource::cells() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::word& Foam::basicSource::name()
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline bool& Foam::basicSource::active()
|
inline bool& Foam::basicSource::active()
|
||||||
{
|
{
|
||||||
return active_;
|
return active_;
|
||||||
@ -116,29 +110,4 @@ inline Foam::scalar& Foam::basicSource::duration()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::word& Foam::basicSource::cellSetName()
|
|
||||||
{
|
|
||||||
return cellSetName_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline Foam::basicSource::selectionModeType&
|
|
||||||
Foam::basicSource::selectionMode()
|
|
||||||
{
|
|
||||||
return selectionMode_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline Foam::scalar& Foam::basicSource::V()
|
|
||||||
{
|
|
||||||
return V_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline Foam::labelList& Foam::basicSource::cells()
|
|
||||||
{
|
|
||||||
return cells_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -36,12 +36,14 @@ void Foam::basicSource::writeData(Ostream& os) const
|
|||||||
os.writeKeyword("timeStart") << timeStart_ << token::END_STATEMENT << nl;
|
os.writeKeyword("timeStart") << timeStart_ << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("duration") << duration_ << token::END_STATEMENT << nl;
|
os.writeKeyword("duration") << duration_ << token::END_STATEMENT << nl;
|
||||||
os.writeKeyword("selectionMode")
|
os.writeKeyword("selectionMode")
|
||||||
<< selectionModeTypeToWord(selectionMode_) << nl;
|
<< selectionModeTypeNames_[selectionMode_] << nl;
|
||||||
|
|
||||||
switch (selectionMode_)
|
switch (selectionMode_)
|
||||||
{
|
{
|
||||||
case smPoints:
|
case smPoints:
|
||||||
{
|
{
|
||||||
|
os.writeKeyword("points") << points_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case smCellSet:
|
case smCellSet:
|
||||||
@ -50,17 +52,21 @@ void Foam::basicSource::writeData(Ostream& os) const
|
|||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case smCellZone:
|
||||||
|
{
|
||||||
|
os.writeKeyword("cellZone") << cellSetName_
|
||||||
|
<< token::END_STATEMENT << nl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case smAll:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn("basicSource::writeData(Ostream&) const")
|
||||||
(
|
<< "Unknown selectionMode "
|
||||||
"basicSource::writeData"
|
<< selectionMode_
|
||||||
"("
|
|
||||||
"Ostream&, "
|
|
||||||
"bool"
|
|
||||||
") const"
|
|
||||||
) << "Unknown selectionMode "
|
|
||||||
<< selectionModeTypeToWord(selectionMode_)
|
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -90,56 +90,15 @@ void Foam::basicSourceList::addSu(fvMatrix<vector>& Eqn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::basicSourceList::addExplicitSources()
|
|
||||||
{
|
|
||||||
|
|
||||||
forAll(*this, i)
|
|
||||||
{
|
|
||||||
if (this->operator[](i).isActive())
|
|
||||||
{
|
|
||||||
this->operator[](i).addExplicitSources();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::basicSourceList::addSu
|
|
||||||
(
|
|
||||||
DimensionedField<scalar, volMesh>& field
|
|
||||||
)
|
|
||||||
{
|
|
||||||
forAll(*this, i)
|
|
||||||
{
|
|
||||||
if (this->operator[](i).isActive())
|
|
||||||
{
|
|
||||||
this->operator[](i).addSu(field);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::basicSourceList::addSu
|
|
||||||
(
|
|
||||||
DimensionedField<vector, volMesh>& field
|
|
||||||
)
|
|
||||||
{
|
|
||||||
forAll(*this, i)
|
|
||||||
{
|
|
||||||
if (this->operator[](i).isActive())
|
|
||||||
{
|
|
||||||
this->operator[](i).addSu(field);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool Foam::basicSourceList::read(const dictionary& dict)
|
bool Foam::basicSourceList::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
|
bool allOk = true;
|
||||||
forAll(*this, i)
|
forAll(*this, i)
|
||||||
{
|
{
|
||||||
this->operator[](i).read(dict);
|
bool ok = this->operator[](i).read(dict);
|
||||||
|
allOk = (allOk && ok);
|
||||||
}
|
}
|
||||||
return true;
|
return allOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -86,15 +86,6 @@ public:
|
|||||||
|
|
||||||
// Evaluation
|
// Evaluation
|
||||||
|
|
||||||
//- Add all explicit sources
|
|
||||||
void addExplicitSources();
|
|
||||||
|
|
||||||
//- Add source to scalar field
|
|
||||||
void addSu(DimensionedField<scalar, volMesh>& field);
|
|
||||||
|
|
||||||
//- Add source to vector field
|
|
||||||
void addSu(DimensionedField<vector, volMesh>& field);
|
|
||||||
|
|
||||||
//- Add source terms to scalar fvMatrix
|
//- Add source terms to scalar fvMatrix
|
||||||
void addSu(fvMatrix<scalar>& Eq);
|
void addSu(fvMatrix<scalar>& Eq);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -42,84 +42,23 @@ namespace Foam
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Foam::wordList Foam::explicitSource::volumeModeTypeNames_
|
template<> const char* Foam::NamedEnum
|
||||||
(
|
<
|
||||||
IStringStream("(absolute specific)")()
|
Foam::explicitSource::volumeModeType,
|
||||||
);
|
2
|
||||||
|
>::names[] =
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
|
||||||
|
|
||||||
void Foam::explicitSource::setSelectedCellsFromPoints()
|
|
||||||
{
|
{
|
||||||
labelHashSet selectedCells;
|
"absolute",
|
||||||
|
"specific"
|
||||||
|
};
|
||||||
|
|
||||||
forAll(points_, i)
|
|
||||||
{
|
|
||||||
label cellI = this->mesh().findCell(points_[i]);
|
|
||||||
if (cellI >= 0)
|
|
||||||
{
|
|
||||||
selectedCells.insert(cellI);
|
|
||||||
}
|
|
||||||
|
|
||||||
label globalCellI = returnReduce(cellI, maxOp<label>());
|
const Foam::NamedEnum<Foam::explicitSource::volumeModeType, 2>
|
||||||
|
Foam::explicitSource::volumeModeTypeNames_;
|
||||||
if (globalCellI < 0)
|
|
||||||
{
|
|
||||||
WarningIn("explicitSource::setSelectedCellsFromPoints()")
|
|
||||||
<< "Unable to find owner cell for point " << points_[i]
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this->cells() = selectedCells.toc();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::explicitSource::volumeModeType
|
|
||||||
Foam::explicitSource::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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::word Foam::explicitSource::volumeModeTypeToWord
|
|
||||||
(
|
|
||||||
const volumeModeType& vmtType
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
if (vmtType > volumeModeTypeNames_.size())
|
|
||||||
{
|
|
||||||
return "UNKNOWN";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return volumeModeTypeNames_[vmtType];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSource::setFieldData(const dictionary& dict)
|
void Foam::explicitSource::setFieldData(const dictionary& dict)
|
||||||
{
|
{
|
||||||
scalarFields_.clear();
|
scalarFields_.clear();
|
||||||
@ -170,83 +109,22 @@ Foam::explicitSource::explicitSource
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
basicSource(name, dict, mesh),
|
basicSource(name, dict, mesh),
|
||||||
scalarFields_(0, *this),
|
|
||||||
vectorFields_(0, *this),
|
|
||||||
dict_(dict.subDict(typeName + "Coeffs")),
|
dict_(dict.subDict(typeName + "Coeffs")),
|
||||||
volumeMode_(wordToVolumeModeType(dict_.lookup("volumeMode"))),
|
volumeMode_(volumeModeTypeNames_.read(dict_.lookup("volumeMode")))
|
||||||
points_(),
|
|
||||||
volSource_(this->cells().size(), 1.0)
|
|
||||||
{
|
{
|
||||||
setFieldData(dict_.subDict("fieldData"));
|
setFieldData(dict_.subDict("fieldData"));
|
||||||
|
|
||||||
// Set points if selectionMode is smPoints
|
|
||||||
if (this->selectionMode() == smPoints)
|
|
||||||
{
|
|
||||||
dict_.lookup("points") >> points_;
|
|
||||||
setSelectedCellsFromPoints();
|
|
||||||
volSource_.setSize(points_.size(), 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
const labelList& cellList = this->cells();
|
|
||||||
scalar V = 0.0;
|
|
||||||
if (volumeMode_ == vmAbsolute)
|
|
||||||
{
|
|
||||||
forAll(cellList, cellI)
|
|
||||||
{
|
|
||||||
volSource_[cellI] = mesh.V()[cellList[cellI]];
|
|
||||||
V += volSource_[cellI];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
forAll(cellList, cellI)
|
|
||||||
{
|
|
||||||
V += mesh.V()[cellList[cellI]];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
reduce(V, sumOp<scalar>());
|
|
||||||
|
|
||||||
Info<< "- selected " << returnReduce(cellList.size(), sumOp<label>())
|
|
||||||
<< " cell(s) with Volume: " << V << " in time activated sources "
|
|
||||||
<< endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSource::addSu(fvMatrix<scalar>& Eqn)
|
void Foam::explicitSource::addSu(fvMatrix<scalar>& Eqn)
|
||||||
{
|
{
|
||||||
Field<scalar>& source = Eqn.source();
|
addSource(Eqn, scalarFields_[Eqn.psi().name()]);
|
||||||
scalar data = scalarFields_[Eqn.psi().name()];
|
|
||||||
addSources<scalar>(source, data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSource::addSu(fvMatrix<vector>& Eqn)
|
void Foam::explicitSource::addSu(fvMatrix<vector>& Eqn)
|
||||||
{
|
{
|
||||||
Field<vector>& source = Eqn.source();
|
addSource(Eqn, vectorFields_[Eqn.psi().name()]);
|
||||||
vector data = vectorFields_[Eqn.psi().name()];
|
|
||||||
addSources<vector>(source, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSource::addSu(DimensionedField<scalar, volMesh>& field)
|
|
||||||
{
|
|
||||||
scalar data = scalarFields_[field.name()];
|
|
||||||
addSources<scalar>(field, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSource::addSu(DimensionedField<vector, volMesh>& field)
|
|
||||||
{
|
|
||||||
vector data = vectorFields_[field.name()];
|
|
||||||
addSources<vector>(field, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::explicitSource::addExplicitSources()
|
|
||||||
{
|
|
||||||
scalarFields_.applySources();
|
|
||||||
vectorFields_.applySources();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -70,60 +70,15 @@ class explicitSource
|
|||||||
:
|
:
|
||||||
public basicSource
|
public basicSource
|
||||||
{
|
{
|
||||||
// Private classes
|
// Private data
|
||||||
|
|
||||||
template<class Type>
|
|
||||||
class fieldList
|
|
||||||
:
|
|
||||||
public HashTable<Type>
|
|
||||||
{
|
|
||||||
|
|
||||||
explicitSource& OwnerPtr_;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- null Constructor
|
|
||||||
fieldList()
|
|
||||||
:
|
|
||||||
HashTable<Type>(0),
|
|
||||||
OwnerPtr_(*reinterpret_cast<explicitSource*>(0))
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
//- Constructor
|
|
||||||
fieldList(label size, explicitSource& ownerPtr)
|
|
||||||
:
|
|
||||||
HashTable<Type>(size),
|
|
||||||
OwnerPtr_(ownerPtr)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void applySources()
|
|
||||||
{
|
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh>
|
|
||||||
geometricField;
|
|
||||||
|
|
||||||
forAll(this->toc(), i)
|
|
||||||
{
|
|
||||||
geometricField& field = const_cast<geometricField&>
|
|
||||||
(
|
|
||||||
OwnerPtr_.mesh().template lookupObject<geometricField>
|
|
||||||
(this->toc()[i])
|
|
||||||
);
|
|
||||||
|
|
||||||
Type data = this->operator[](field.name());
|
|
||||||
OwnerPtr_.addSources<Type>(field.internalField(), data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// Private cdata
|
|
||||||
|
|
||||||
//- List of field types
|
//- List of field types
|
||||||
fieldList<scalar> scalarFields_;
|
HashTable<scalar> scalarFields_;
|
||||||
fieldList<vector> vectorFields_;
|
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.
|
//- Add field names and values to field table for types.
|
||||||
template<class Type>
|
template<class Type>
|
||||||
@ -132,22 +87,12 @@ private:
|
|||||||
HashTable<Type>& fields,
|
HashTable<Type>& fields,
|
||||||
const wordList& fieldTypes,
|
const wordList& fieldTypes,
|
||||||
const wordList& fieldNames,
|
const wordList& fieldNames,
|
||||||
const dictionary& dict_
|
const dictionary& dict
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Add data to field source
|
|
||||||
template<class Type>
|
|
||||||
void addSources
|
|
||||||
(
|
|
||||||
Field<Type>& fieldSource,
|
|
||||||
Type& data
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
||||||
// Public data
|
// Public data
|
||||||
|
|
||||||
//- Enumeration for volume types
|
//- Enumeration for volume types
|
||||||
@ -158,7 +103,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//- Word list of volume mode type names
|
//- Word list of volume mode type names
|
||||||
static const wordList volumeModeTypeNames_;
|
static const NamedEnum<volumeModeType, 2> volumeModeTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -171,27 +116,12 @@ protected:
|
|||||||
//- Volume mode
|
//- Volume mode
|
||||||
volumeModeType volumeMode_;
|
volumeModeType volumeMode_;
|
||||||
|
|
||||||
//- List of points for "points" selectionMode
|
|
||||||
List<point> points_;
|
|
||||||
|
|
||||||
//- Volume of the explicit source
|
|
||||||
scalarList volSource_;
|
|
||||||
|
|
||||||
|
|
||||||
// Protected functions
|
// Protected functions
|
||||||
|
|
||||||
//- Helper function to convert from a word to a volumeModeType
|
|
||||||
volumeModeType wordToVolumeModeType(const word& vtName) const;
|
|
||||||
|
|
||||||
//- Helper function to convert from a volumeModeType to a word
|
|
||||||
word volumeModeTypeToWord(const volumeModeType& vtType) const;
|
|
||||||
|
|
||||||
//- Set the local field data
|
//- Set the local field data
|
||||||
void setFieldData(const dictionary& dict);
|
void setFieldData(const dictionary& dict);
|
||||||
|
|
||||||
//- Set selected cells when smPoint is used
|
|
||||||
void setSelectedCellsFromPoints();
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -246,15 +176,6 @@ public:
|
|||||||
//-Source term to fvMatrix<scalar>
|
//-Source term to fvMatrix<scalar>
|
||||||
virtual void addSu(fvMatrix<scalar>& UEqn);
|
virtual void addSu(fvMatrix<scalar>& UEqn);
|
||||||
|
|
||||||
//- Add all explicit source
|
|
||||||
virtual void addExplicitSources();
|
|
||||||
|
|
||||||
//- Add source to scalar field
|
|
||||||
virtual void addSu(DimensionedField<vector, volMesh>& field);
|
|
||||||
|
|
||||||
//- Add source to vector field
|
|
||||||
virtual void addSu(DimensionedField<scalar, volMesh>& field);
|
|
||||||
|
|
||||||
|
|
||||||
// I-O
|
// I-O
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -46,4 +46,6 @@ Foam::explicitSource::points() const
|
|||||||
{
|
{
|
||||||
return points_;
|
return points_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -32,7 +32,7 @@ void Foam::explicitSource::writeData(Ostream& os) const
|
|||||||
os << indent << name_ << nl
|
os << indent << name_ << nl
|
||||||
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
|
||||||
|
|
||||||
os.writeKeyword("volumeMode") << volumeModeTypeToWord(volumeMode_)
|
os.writeKeyword("volumeMode") << volumeModeTypeNames_[volumeMode_]
|
||||||
<< token::END_STATEMENT << nl;
|
<< token::END_STATEMENT << nl;
|
||||||
|
|
||||||
if (scalarFields_.size() > 0)
|
if (scalarFields_.size() > 0)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -23,17 +23,42 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
template<class Type>
|
template <class Type>
|
||||||
void Foam::explicitSource::addSources
|
void Foam::explicitSource::addSource
|
||||||
(
|
(
|
||||||
Field<Type>& fieldSource,
|
fvMatrix<Type>& Eqn,
|
||||||
Type& data
|
const Type& sourceData
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
forAll(this->cells(), i)
|
Type data = sourceData;
|
||||||
|
if (volumeMode_ == vmAbsolute)
|
||||||
{
|
{
|
||||||
fieldSource[this->cells()[i]] = data/volSource_[i];
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -165,7 +165,7 @@ scalar RASModel::yPlusLam(const scalar kappa, const scalar E) const
|
|||||||
|
|
||||||
for (int i=0; i<10; i++)
|
for (int i=0; i<10; i++)
|
||||||
{
|
{
|
||||||
ypl = log(E*ypl)/kappa;
|
ypl = log(max(E*ypl, 1))/kappa;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ypl;
|
return ypl;
|
||||||
|
|||||||
@ -17,7 +17,7 @@ FoamFile
|
|||||||
|
|
||||||
disk1
|
disk1
|
||||||
{
|
{
|
||||||
typeModel actuationDiskSource;
|
type actuationDiskSource;
|
||||||
active on; //on/off switch
|
active on; //on/off switch
|
||||||
timeStart 0.0; //start time
|
timeStart 0.0; //start time
|
||||||
duration 1000.0; //duration
|
duration 1000.0; //duration
|
||||||
@ -36,7 +36,7 @@ disk1
|
|||||||
|
|
||||||
disk2
|
disk2
|
||||||
{
|
{
|
||||||
typeModel actuationDiskSource;
|
type actuationDiskSource;
|
||||||
active on;
|
active on;
|
||||||
timeStart 0.0;
|
timeStart 0.0;
|
||||||
duration 1000.0;
|
duration 1000.0;
|
||||||
|
|||||||
Reference in New Issue
Block a user