Commit 00bca478 authored by mattijs's avatar mattijs
Browse files

Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

parents 3829ca56 7e4ed0c0
......@@ -45,9 +45,29 @@
),
thermo.rho()
);
volScalarField& p = thermo.p();
volScalarField& hs = thermo.hs();
volScalarField Rspecific
(
IOobject
(
"Rspecific",
runTime.timeName(),
runTime,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar
(
"zero",
dimensionSet(dimEnergy/dimMass/dimTemperature),
0.0
)
);
volVectorField U
(
IOobject
......
......@@ -3,7 +3,15 @@
rho = thermo.rho();
if (constProp == "volume")
{
p[0] = rho0*R0*thermo.T()[0];
scalar invW = 0.0;
forAll(Y, i)
{
invW += Y[i][0]/specieData[i].W();
}
Rspecific[0] = 1000.0*constant::physicoChemical::R.value()*invW;
p[0] = rho0*Rspecific[0]*thermo.T()[0];
rho[0] = rho0;
}
}
\ No newline at end of file
}
......@@ -106,6 +106,7 @@
scalar rho0 = rho[0];
scalar u0 = hs0 - p0/rho0;
scalar R0 = p0/(rho0*T0);
Rspecific[0] = R0;
scalar integratedHeat = 0.0;
......@@ -390,6 +390,12 @@ $(basicSource)/actuationDiskSource/actuationDiskSource.C
$(basicSource)/radialActuationDiskSource/radialActuationDiskSource.C
$(basicSource)/explicitSource/explicitSource.C
$(basicSource)/explicitSetValue/explicitSetValue.C
$(basicSource)/rotorDiskSource/rotorDiskSource.C
$(basicSource)/rotorDiskSource/bladeModel/bladeModel.C
$(basicSource)/rotorDiskSource/profileModel/profileModel.C
$(basicSource)/rotorDiskSource/profileModel/profileModelList.C
$(basicSource)/rotorDiskSource/profileModel/lookup/lookupProfile.C
$(basicSource)/rotorDiskSource/profileModel/series/seriesProfile.C
LIB = $(FOAM_LIBBIN)/libfiniteVolume
......@@ -75,11 +75,11 @@ Foam::actuationDiskSource::actuationDiskSource
)
:
basicSource(name, modelType, dict, mesh),
dict_(dict.subDict(modelType + "Coeffs")),
diskDir_(dict_.lookup("diskDir")),
Cp_(readScalar(dict_.lookup("Cp"))),
Ct_(readScalar(dict_.lookup("Ct"))),
diskArea_(readScalar(dict_.lookup("diskArea")))
coeffs_(dict.subDict(modelType + "Coeffs")),
diskDir_(coeffs_.lookup("diskDir")),
Cp_(readScalar(coeffs_.lookup("Cp"))),
Ct_(readScalar(coeffs_.lookup("Ct"))),
diskArea_(readScalar(coeffs_.lookup("diskArea")))
{
Info<< " - creating actuation disk zone: "
<< this->name() << endl;
......@@ -132,20 +132,8 @@ 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;
if (dict_.found("note"))
{
os.writeKeyword("note") << string(dict_.lookup("note"))
<< token::END_STATEMENT << nl;
}
os << indent << "actuationDisk";
os << indent << name_ << endl;
dict_.write(os);
os << decrIndent << indent << token::END_BLOCK << endl;
}
......@@ -153,13 +141,11 @@ bool Foam::actuationDiskSource::read(const dictionary& dict)
{
if (basicSource::read(dict))
{
const dictionary& sourceDict = dict.subDict(name());
const dictionary& subDictCoeffs =
sourceDict.subDict(typeName + "Coeffs");
subDictCoeffs.readIfPresent("diskDir", diskDir_);
subDictCoeffs.readIfPresent("Cp", Cp_);
subDictCoeffs.readIfPresent("Ct", Ct_);
subDictCoeffs.readIfPresent("diskArea", diskArea_);
coeffs_ = dict.subDict(typeName + "Coeffs");
coeffs_.readIfPresent("diskDir", diskDir_);
coeffs_.readIfPresent("Cp", Cp_);
coeffs_.readIfPresent("Ct", Ct_);
coeffs_.readIfPresent("diskArea", diskArea_);
checkData();
......
......@@ -74,8 +74,8 @@ protected:
// Protected data
//- Sub dictionary with actuationDisk information
const dictionary& dict_;
//- Coefficients dictionary
dictionary coeffs_;
//- Disk area normal
vector diskDir_;
......
......@@ -277,28 +277,20 @@ bool Foam::basicSource::isActive()
void Foam::basicSource::addSu(Foam::fvMatrix<vector>& Eqn)
{
notImplemented
(
"Foam::basicSource addSu(Foam::fvMatrix<vector>& Eqn)"
);
notImplemented("Foam::basicSource addSu(Foam::fvMatrix<vector>& Eqn)");
}
void Foam::basicSource::addSu(Foam::fvMatrix<scalar>& Eqn)
{
notImplemented
(
"Foam::basicSource addSu(Foam::fvMatrix<scalar>& Eqn)"
);
notImplemented("Foam::basicSource addSu(Foam::fvMatrix<scalar>& Eqn)");
}
void Foam::basicSource::setValue(Foam::fvMatrix<scalar>& Eqn)
{
notImplemented
(
"Foam::basicSource setValue(Foam::fvMatrix<scalar>& Eqn)"
);
notImplemented("Foam::basicSource setValue(Foam::fvMatrix<scalar>& Eqn)");
}
// ************************************************************************* //
......@@ -202,10 +202,7 @@ public:
//- Return clone
autoPtr<basicSource> clone() const
{
notImplemented
(
"autoPtr<basicSource> clone() const"
);
notImplemented("autoPtr<basicSource> clone() const");
return autoPtr<basicSource>(NULL);
}
......@@ -273,7 +270,7 @@ public:
//- Return const access to the mesh database
inline const fvMesh& mesh() const;
//- Return dictionay
//- Return dictionary
inline const dictionary& dictCoeffs() const;
//- Return const access to the source active flag
......@@ -340,7 +337,6 @@ public:
//- Read source dictionary
virtual bool read(const dictionary& dict) = 0;
};
......
......@@ -77,10 +77,9 @@ void Foam::basicSource::writeData(Ostream& os) const
bool Foam::basicSource::read(const dictionary& dict)
{
const dictionary& sourceDict = dict.subDict(name_);
active_ = readBool(sourceDict.lookup("active"));
timeStart_ = readScalar(sourceDict.lookup("timeStart"));
duration_ = readScalar(sourceDict.lookup("duration"));
active_ = readBool(dict.lookup("active"));
timeStart_ = readScalar(dict.lookup("timeStart"));
duration_ = readScalar(dict.lookup("duration"));
return true;
}
......
......@@ -51,12 +51,12 @@ Foam::basicSourceList::basicSourceList
forAllConstIter(dictionary, dict, iter)
{
const word& name = iter().keyword();
const dictionary& dict = iter().dict();
const dictionary& sourceDict = iter().dict();
this->set
(
i++,
basicSource::New(name, dict, mesh)
basicSource::New(name, sourceDict, mesh)
);
}
}
......@@ -108,7 +108,8 @@ bool Foam::basicSourceList::read(const dictionary& dict)
bool allOk = true;
forAll(*this, i)
{
bool ok = this->operator[](i).read(dict);
basicSource& bs = this->operator[](i);
bool ok = bs.read(dict.subDict(bs.name()));
allOk = (allOk && ok);
}
return allOk;
......@@ -117,12 +118,6 @@ bool Foam::basicSourceList::read(const dictionary& dict)
bool Foam::basicSourceList::writeData(Ostream& os) const
{
// Write size of list
os << nl << this->size();
// Write beginning of contents
os << nl << token::BEGIN_LIST;
// Write list contents
forAll(*this, i)
{
......@@ -130,9 +125,6 @@ bool Foam::basicSourceList::writeData(Ostream& os) const
this->operator[](i).writeData(os);
}
// Write end of contents
os << token::END_LIST << token::END_STATEMENT << nl;
// Check state of IOstream
return os.good();
}
......
......@@ -72,11 +72,9 @@ void Foam::explicitSetValue::setFieldData(const dictionary& dict)
}
else
{
FatalErrorIn
(
"explicitSetValue::setFieldData"
) << "header not OK " << io.name()
<< exit(FatalError);
FatalErrorIn("explicitSetValue::setFieldData")
<< "header not OK for field " << io.name()
<< abort(FatalError);
}
}
......@@ -96,9 +94,9 @@ Foam::explicitSetValue::explicitSetValue
)
:
basicSource(name, modelType, dict, mesh),
dict_(dict.subDict(modelType + "Coeffs"))
coeffs_(dict.subDict(modelType + "Coeffs"))
{
setFieldData(dict_.subDict("fieldData"));
setFieldData(coeffs_.subDict("fieldData"));
}
......
......@@ -89,8 +89,8 @@ protected:
// Protected data
//- Sub dictionary for time activated explicit sources
const dictionary& dict_;
//- Coefficients dictionary
dictionary coeffs_;
// Protected functions
......@@ -119,10 +119,7 @@ public:
//- Return clone
autoPtr<explicitSetValue> clone() const
{
notImplemented
(
"autoPtr<explicitSetValue> clone() const"
);
notImplemented("autoPtr<explicitSetValue> clone() const");
return autoPtr<explicitSetValue>(NULL);
}
......
......@@ -29,22 +29,8 @@ License
void Foam::explicitSetValue::writeData(Ostream& os) const
{
os << indent << name_ << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
if (scalarFields_.size() > 0)
{
os.writeKeyword("scalarFields") << scalarFields_
<< token::END_STATEMENT << nl;
}
if (vectorFields_.size() > 0)
{
os.writeKeyword("vectorFields") << vectorFields_
<< token::END_STATEMENT << nl;
}
os << decrIndent << indent << token::END_BLOCK << endl;
os << indent << name_ << endl;
dict_.write(os);
}
......@@ -52,12 +38,8 @@ bool Foam::explicitSetValue::read(const dictionary& dict)
{
if (basicSource::read(dict))
{
const dictionary& sourceDict = dict.subDict(name());
const dictionary& subDictCoeffs = sourceDict.subDict
(
typeName + "Coeffs"
);
setFieldData(subDictCoeffs.subDict("fieldData"));
coeffs_ = dict.subDict(typeName + "Coeffs");
setFieldData(coeffs_.subDict("fieldData"));
return true;
}
else
......
......@@ -112,8 +112,8 @@ Foam::explicitSource::explicitSource
)
:
basicSource(name, modelType, dict, mesh),
dict_(dict.subDict(modelType + "Coeffs")),
volumeMode_(volumeModeTypeNames_.read(dict_.lookup("volumeMode")))
coeffs_(dict.subDict(modelType + "Coeffs")),
volumeMode_(volumeModeTypeNames_.read(coeffs_.lookup("volumeMode")))
{
setFieldData(dict_.subDict("fieldData"));
}
......
......@@ -110,8 +110,8 @@ protected:
// Protected data
//- Sub dictionary for time activated explicit sources
const dictionary& dict_;
//- Coefficients dictionary
dictionary coeffs_;
//- Volume mode
volumeModeType volumeMode_;
......
......@@ -29,25 +29,8 @@ License
void Foam::explicitSource::writeData(Ostream& os) const
{
os << indent << name_ << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("volumeMode") << volumeModeTypeNames_[volumeMode_]
<< token::END_STATEMENT << nl;
if (scalarFields_.size() > 0)
{
os.writeKeyword("scalarFields") << scalarFields_
<< token::END_STATEMENT << nl;
}
if (vectorFields_.size() > 0)
{
os.writeKeyword("vectorFields") << vectorFields_
<< token::END_STATEMENT << nl;
}
os << decrIndent << indent << token::END_BLOCK << endl;
os << indent << name_ << endl;
dict_.write(os);
}
......@@ -55,12 +38,8 @@ bool Foam::explicitSource::read(const dictionary& dict)
{
if (basicSource::read(dict))
{
const dictionary& sourceDict = dict.subDict(name());
const dictionary& subDictCoeffs = sourceDict.subDict
(
typeName + "Coeffs"
);
setFieldData(subDictCoeffs.subDict("fieldData"));
coeffs_ = dict.subDict(typeName + "Coeffs");
setFieldData(coeffs_.subDict("fieldData"));
return true;
}
else
......
......@@ -53,10 +53,10 @@ Foam::radialActuationDiskSource::radialActuationDiskSource
)
:
actuationDiskSource(name, modelType, dict, mesh),
dict_(dict.subDict(modelType + "Coeffs")),
coeffsDict_(dict.subDict(modelType + "Coeffs")),
coeffs_()
{
dict_.lookup("coeffs") >> coeffs_;
coeffsDict_.lookup("coeffs") >> coeffs_;
Info<< " - creating radial actuation disk zone: "
<< this->name() << endl;
}
......@@ -114,14 +114,12 @@ bool Foam::radialActuationDiskSource::read(const dictionary& dict)
{
if (basicSource::read(dict))
{
const dictionary& sourceDict = dict.subDict(name());
const dictionary& subDictCoeffs =
sourceDict.subDict(typeName + "Coeffs");
subDictCoeffs.readIfPresent("diskDir", diskDir_);
subDictCoeffs.readIfPresent("Cp", Cp_);
subDictCoeffs.readIfPresent("Ct", Ct_);
subDictCoeffs.readIfPresent("diskArea", diskArea_);
subDictCoeffs.lookup("coeffs") >> coeffs_;
const dictionary& coeffsDict_ = dict.subDict(typeName + "Coeffs");
coeffsDict_.readIfPresent("diskDir", diskDir_);
coeffsDict_.readIfPresent("Cp", Cp_);
coeffsDict_.readIfPresent("Ct", Ct_);
coeffsDict_.readIfPresent("diskArea", diskArea_);
coeffsDict_.lookup("coeffs") >> coeffs_;
return true;
}
else
......
......@@ -62,7 +62,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class radialActuationDiskSource Declaration
Class radialActuationDiskSource Declaration
\*---------------------------------------------------------------------------*/
class radialActuationDiskSource
......@@ -71,8 +71,8 @@ class radialActuationDiskSource
{
// Private data
//- Sub dictionary with model information
const dictionary& dict_;
//- Coefficients dictionary
dictionary coeffsDict_;
//- Coeffcients for the radial distribution
FixedList<scalar, 3> coeffs_;
......@@ -123,7 +123,7 @@ public:
// Public Functions
//-Source term to fvMatrix<vector>
//- Source term to fvMatrix<vector>
virtual void addSu(fvMatrix<vector>& UEqn);
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "bladeModel.H"
#include "unitConversion.H"
#include "Tuple2.H"
#include "vector.H"
#include "IFstream.H"
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
bool Foam::bladeModel::readFromFile() const
{
return fName_ != fileName::null;
}
void Foam::bladeModel::interpolateWeights
(
const scalar& xIn,
const List<scalar>& values,
label& i1,
label& i2,
scalar& ddx
) const
{
scalar x = -GREAT;
label nElem = values.size();
i2 = 0;
while ((x < xIn) && (i2 < nElem))
{
x = values[i2];
i2++;
}
if (i2 == 0)
{
i1 = i2;
ddx = 0.0;
return;
}
else if (i2 == values.size())
{
i2 = values.size() - 1;
i1 = i2;
ddx = 0.0;
return;
}
else
{
i1 = i2 - 1;
ddx = (xIn - values[i1])/(values[i2] - values[i1]);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::bladeModel::bladeModel(const dictionary& dict)
:
profileName_(),