Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-2.0.0

This commit is contained in:
Henry
2011-06-15 11:45:16 +01:00
15 changed files with 157 additions and 490 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -41,7 +41,7 @@ namespace Foam
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::actuationDiskSource::checkData()
void Foam::actuationDiskSource::checkData() const
{
if (magSqr(diskArea_) <= VSMALL)
{
@ -74,7 +74,6 @@ Foam::actuationDiskSource::actuationDiskSource
)
:
basicSource(name, dict, mesh),
cellZoneID_(mesh.cellZones().findZoneID(this->cellSetName())),
dict_(dict.subDict(typeName + "Coeffs")),
diskDir_(dict_.lookup("diskDir")),
Cp_(readScalar(dict_.lookup("Cp"))),
@ -84,20 +83,6 @@ Foam::actuationDiskSource::actuationDiskSource
Info<< " - creating actuation disk zone: "
<< 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();
}
@ -106,18 +91,12 @@ Foam::actuationDiskSource::actuationDiskSource
void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
{
if (cellZoneID_ == -1)
{
return;
}
bool compressible = false;
if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0))
{
compressible = true;
}
const labelList& cells = mesh_.cellZones()[cellZoneID_];
const scalarField& V = this->mesh().V();
vectorField& Usource = UEqn.source();
const vectorField& U = UEqn.psi();
@ -127,7 +106,7 @@ void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
addActuationDiskAxialInertialResistance
(
Usource,
cells,
cells_,
V,
this->mesh().lookupObject<volScalarField>("rho"),
U
@ -138,7 +117,7 @@ void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
addActuationDiskAxialInertialResistance
(
Usource,
cells,
cells_,
V,
geometricOneField(),
U
@ -149,7 +128,6 @@ void Foam::actuationDiskSource::addSu(fvMatrix<vector>& UEqn)
void Foam::actuationDiskSource::writeData(Ostream& os) const
{
os << indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("name") << this->name() << token::END_STATEMENT << nl;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -71,9 +71,6 @@ class actuationDiskSource
{
// Private data
//- Cell zone ID
label cellZoneID_;
//- Sub dictionary with actuationDisk information
const dictionary& dict_;
@ -93,7 +90,7 @@ class actuationDiskSource
// Private Member Functions
//- Check data
void checkData();
void checkData() const;
//- Add resistance to the UEqn
template<class RhoFieldType>
@ -139,12 +136,6 @@ public:
// Access
//- cellZone number
label zoneId() const
{
return cellZoneID_;
}
//- Return Cp
scalar Cp() const
{
@ -178,15 +169,6 @@ public:
//-Source term to fvMatrix<scalar>
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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -39,65 +39,32 @@ namespace Foam
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
const Foam::wordList Foam::basicSource::selectionModeTypeNames_
(
IStringStream("(points cellSet cellZone all)")()
);
template<> const char* Foam::NamedEnum
<
Foam::basicSource::selectionModeType,
4
>::names[] =
{
"points",
"cellSet",
"cellZone",
"all"
};
const Foam::NamedEnum<Foam::basicSource::selectionModeType, 4>
Foam::basicSource::selectionModeTypeNames_;
// * * * * * * * * * * * * 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)
{
switch (selectionMode_)
{
case smPoints:
{
// Do nothing. It should be sorted out by derived class
dict.lookup("points") >> points_;
break;
}
case smCellSet:
@ -135,6 +102,29 @@ void Foam::basicSource::setCellSet()
{
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:
@ -181,19 +171,16 @@ void Foam::basicSource::setCellSet()
}
// Set volume information
if (selectionMode_ != smPoints)
V_ = 0.0;
forAll(cells_, i)
{
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;
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;
}
@ -212,9 +199,9 @@ Foam::basicSource::basicSource
active_(readBool(dict_.lookup("active"))),
timeStart_(readScalar(dict_.lookup("timeStart"))),
duration_(readScalar(dict_.lookup("duration"))),
selectionMode_(wordToSelectionModeType(dict_.lookup("selectionMode"))),
selectionMode_(selectionModeTypeNames_.read(dict_.lookup("selectionMode"))),
cellSetName_("none"),
V_(1.0)
V_(0.0)
{
setSelection(dict_);
@ -231,12 +218,12 @@ Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
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 =
dictionaryConstructorTablePtr_->find(typeModel);
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
@ -244,7 +231,7 @@ Foam::autoPtr<Foam::basicSource> Foam::basicSource::New
(
"basicSource::New(const volVectorField&, "
"const surfaceScalarField&, transportModel&)"
) << "Unknown Model type " << typeModel
) << "Unknown Model type " << modelType
<< nl << nl
<< "Valid model types are :" << nl
<< dictionaryConstructorTablePtr_->sortedToc()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -31,7 +31,7 @@ Description
source1
{
typeModel actuationDiskSource; // explicitSource
type actuationDiskSource; // explicitSource
active on; // on/off switch
timeStart 0.0; // start time
duration 1000.0; // duration
@ -49,7 +49,7 @@ Description
source2
{
typeModel explicitSource;
type explicitSource;
active on;
timeStart 0.0;
duration 1000.0;
@ -115,7 +115,7 @@ public:
};
//- Word list of selection mode type names
static const wordList selectionModeTypeNames_;
static const NamedEnum<selectionModeType, 4> selectionModeTypeNames_;
protected:
@ -146,6 +146,9 @@ protected:
//- Name of cell set for "cellSet" and "cellZone" selectionMode
word cellSetName_;
//- List of points for "points" selectionMode
List<point> points_;
//- Set of cells to apply source to
labelList cells_;
@ -155,12 +158,6 @@ protected:
// 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
void setSelection(const dictionary& dict);
@ -305,9 +302,6 @@ public:
// Edit
//- Return access to the source name
inline word& name();
//- Return access to the source active flag
inline bool& active();
@ -317,22 +311,6 @@ public:
//- Return access to the 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
@ -342,15 +320,6 @@ public:
// 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
virtual void addSu(fvMatrix<vector>& Eqn) = 0;

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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()
{
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_;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -36,12 +36,14 @@ void Foam::basicSource::writeData(Ostream& os) const
os.writeKeyword("timeStart") << timeStart_ << token::END_STATEMENT << nl;
os.writeKeyword("duration") << duration_ << token::END_STATEMENT << nl;
os.writeKeyword("selectionMode")
<< selectionModeTypeToWord(selectionMode_) << nl;
<< selectionModeTypeNames_[selectionMode_] << nl;
switch (selectionMode_)
{
case smPoints:
{
os.writeKeyword("points") << points_
<< token::END_STATEMENT << nl;
break;
}
case smCellSet:
@ -50,17 +52,21 @@ void Foam::basicSource::writeData(Ostream& os) const
<< token::END_STATEMENT << nl;
break;
}
case smCellZone:
{
os.writeKeyword("cellZone") << cellSetName_
<< token::END_STATEMENT << nl;
break;
}
case smAll:
{
break;
}
default:
{
FatalErrorIn
(
"basicSource::writeData"
"("
"Ostream&, "
"bool"
") const"
) << "Unknown selectionMode "
<< selectionModeTypeToWord(selectionMode_)
FatalErrorIn("basicSource::writeData(Ostream&) const")
<< "Unknown selectionMode "
<< selectionMode_
<< abort(FatalError);
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
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 allOk = true;
forAll(*this, i)
{
this->operator[](i).read(dict);
bool ok = this->operator[](i).read(dict);
allOk = (allOk && ok);
}
return true;
return allOk;
}
@ -162,7 +121,7 @@ bool Foam::basicSourceList::writeData(Ostream& os) const
os << token::END_LIST << token::END_STATEMENT << nl;
// Check state of IOstream
return os.good();
return os.good();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -86,15 +86,6 @@ public:
// 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
void addSu(fvMatrix<scalar>& Eq);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -42,84 +42,23 @@ namespace Foam
);
}
const Foam::wordList Foam::explicitSource::volumeModeTypeNames_
(
IStringStream("(absolute specific)")()
);
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::explicitSource::setSelectedCellsFromPoints()
template<> const char* Foam::NamedEnum
<
Foam::explicitSource::volumeModeType,
2
>::names[] =
{
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>());
if (globalCellI < 0)
{
WarningIn("explicitSource::setSelectedCellsFromPoints()")
<< "Unable to find owner cell for point " << points_[i]
<< endl;
}
}
this->cells() = selectedCells.toc();
}
const Foam::NamedEnum<Foam::explicitSource::volumeModeType, 2>
Foam::explicitSource::volumeModeTypeNames_;
// * * * * * * * * * * * * 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)
{
scalarFields_.clear();
@ -170,83 +109,22 @@ Foam::explicitSource::explicitSource
)
:
basicSource(name, dict, mesh),
scalarFields_(0, *this),
vectorFields_(0, *this),
dict_(dict.subDict(typeName + "Coeffs")),
volumeMode_(wordToVolumeModeType(dict_.lookup("volumeMode"))),
points_(),
volSource_(this->cells().size(), 1.0)
volumeMode_(volumeModeTypeNames_.read(dict_.lookup("volumeMode")))
{
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)
{
Field<scalar>& source = Eqn.source();
scalar data = scalarFields_[Eqn.psi().name()];
addSources<scalar>(source, data);
addSource(Eqn, scalarFields_[Eqn.psi().name()]);
}
void Foam::explicitSource::addSu(fvMatrix<vector>& Eqn)
{
Field<vector>& source = Eqn.source();
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();
addSource(Eqn, vectorFields_[Eqn.psi().name()]);
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -70,60 +70,15 @@ class explicitSource
:
public basicSource
{
// Private classes
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
// Private data
//- List of field types
fieldList<scalar> scalarFields_;
fieldList<vector> vectorFields_;
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>
@ -132,22 +87,12 @@ private:
HashTable<Type>& fields,
const wordList& fieldTypes,
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 data
//- Enumeration for volume types
@ -158,7 +103,7 @@ public:
};
//- Word list of volume mode type names
static const wordList volumeModeTypeNames_;
static const NamedEnum<volumeModeType, 2> volumeModeTypeNames_;
protected:
@ -171,27 +116,12 @@ protected:
//- Volume mode
volumeModeType volumeMode_;
//- List of points for "points" selectionMode
List<point> points_;
//- Volume of the explicit source
scalarList volSource_;
// 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
void setFieldData(const dictionary& dict);
//- Set selected cells when smPoint is used
void setSelectedCellsFromPoints();
public:
@ -246,15 +176,6 @@ public:
//-Source term to fvMatrix<scalar>
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

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -46,4 +46,6 @@ Foam::explicitSource::points() const
{
return points_;
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -32,7 +32,7 @@ void Foam::explicitSource::writeData(Ostream& os) const
os << indent << name_ << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("volumeMode") << volumeModeTypeToWord(volumeMode_)
os.writeKeyword("volumeMode") << volumeModeTypeNames_[volumeMode_]
<< token::END_STATEMENT << nl;
if (scalarFields_.size() > 0)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,17 +23,42 @@ License
\*---------------------------------------------------------------------------*/
template<class Type>
void Foam::explicitSource::addSources
template <class Type>
void Foam::explicitSource::addSource
(
Field<Type>& fieldSource,
Type& data
fvMatrix<Type>& Eqn,
const Type& sourceData
) 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;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -165,7 +165,7 @@ scalar RASModel::yPlusLam(const scalar kappa, const scalar E) const
for (int i=0; i<10; i++)
{
ypl = log(E*ypl)/kappa;
ypl = log(max(E*ypl, 1))/kappa;
}
return ypl;

View File

@ -17,7 +17,7 @@ FoamFile
disk1
{
typeModel actuationDiskSource;
type actuationDiskSource;
active on; //on/off switch
timeStart 0.0; //start time
duration 1000.0; //duration
@ -36,7 +36,7 @@ disk1
disk2
{
typeModel actuationDiskSource;
type actuationDiskSource;
active on;
timeStart 0.0;
duration 1000.0;