diff --git a/applications/solvers/combustion/chemFoam/createFields.H b/applications/solvers/combustion/chemFoam/createFields.H index 4a971492c9..b37a8818e3 100644 --- a/applications/solvers/combustion/chemFoam/createFields.H +++ b/applications/solvers/combustion/chemFoam/createFields.H @@ -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 diff --git a/applications/solvers/combustion/chemFoam/pEqn.H b/applications/solvers/combustion/chemFoam/pEqn.H index 28d240940b..13f3d603ae 100644 --- a/applications/solvers/combustion/chemFoam/pEqn.H +++ b/applications/solvers/combustion/chemFoam/pEqn.H @@ -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 +} diff --git a/applications/solvers/combustion/chemFoam/readInitialConditions.H b/applications/solvers/combustion/chemFoam/readInitialConditions.H index 6b26e5fc37..817ed264f9 100644 --- a/applications/solvers/combustion/chemFoam/readInitialConditions.H +++ b/applications/solvers/combustion/chemFoam/readInitialConditions.H @@ -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; diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 3bcd7b80d5..cc2f3e4225 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -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 diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C index 32a025d993..e7e996d1db 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C @@ -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& 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(); diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H index 8b54ac0871..cbe98ea4c8 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H @@ -74,8 +74,8 @@ protected: // Protected data - //- Sub dictionary with actuationDisk information - const dictionary& dict_; + //- Coefficients dictionary + dictionary coeffs_; //- Disk area normal vector diskDir_; diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C index 114e6e58cb..cd7394a173 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C @@ -277,28 +277,20 @@ bool Foam::basicSource::isActive() void Foam::basicSource::addSu(Foam::fvMatrix& Eqn) { - notImplemented - ( - "Foam::basicSource addSu(Foam::fvMatrix& Eqn)" - ); + notImplemented("Foam::basicSource addSu(Foam::fvMatrix& Eqn)"); } void Foam::basicSource::addSu(Foam::fvMatrix& Eqn) { - notImplemented - ( - "Foam::basicSource addSu(Foam::fvMatrix& Eqn)" - ); + notImplemented("Foam::basicSource addSu(Foam::fvMatrix& Eqn)"); } void Foam::basicSource::setValue(Foam::fvMatrix& Eqn) { - notImplemented - ( - "Foam::basicSource setValue(Foam::fvMatrix& Eqn)" - ); + notImplemented("Foam::basicSource setValue(Foam::fvMatrix& Eqn)"); } + // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H index 43c9e8bd47..9862282479 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H @@ -202,10 +202,7 @@ public: //- Return clone autoPtr clone() const { - notImplemented - ( - "autoPtr clone() const" - ); + notImplemented("autoPtr clone() const"); return autoPtr(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; - }; diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceIO.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceIO.C index 8b425cf91c..caec8b58cf 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceIO.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceIO.C @@ -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; } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C index e9827409c5..79af025143 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C @@ -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(); } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValue.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValue.C index 2a14b793a8..898f2c41c3 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValue.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValue.C @@ -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")); } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValue.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValue.H index 643e6b6182..df3d404f1a 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValue.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValue.H @@ -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 clone() const { - notImplemented - ( - "autoPtr clone() const" - ); + notImplemented("autoPtr clone() const"); return autoPtr(NULL); } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValueIO.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValueIO.C index dce0a53ddf..24e9205606 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValueIO.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSetValue/explicitSetValueIO.C @@ -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 diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C index de01ebb530..af5555f3fb 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C @@ -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")); } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.H index 9b88fac753..05c3782254 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.H @@ -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_; diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceIO.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceIO.C index 3b7b1b7c35..f97ad32906 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceIO.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceIO.C @@ -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 diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C index e01a2a5736..0444a9408b 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C @@ -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 diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H index 701e752ff4..245f002fa5 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H @@ -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 coeffs_; @@ -123,7 +123,7 @@ public: // Public Functions - //-Source term to fvMatrix + //- Source term to fvMatrix virtual void addSu(fvMatrix& UEqn); diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.C new file mode 100644 index 0000000000..a1f76d3e99 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.C @@ -0,0 +1,195 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +\*---------------------------------------------------------------------------*/ + +#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& 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_(), + profileID_(), + radius_(), + twist_(), + chord_(), + fName_(fileName::null) +{ + List > data; + if (readFromFile()) + { + IFstream is(fName_); + is >> data; + } + else + { + dict.lookup("data") >> data; + } + + + if (data.size() > 0) + { + profileName_.setSize(data.size()); + profileID_.setSize(data.size()); + radius_.setSize(data.size()); + twist_.setSize(data.size()); + chord_.setSize(data.size()); + + forAll(data, i) + { + profileName_[i] = data[i].first(); + profileID_[i] = -1; + radius_[i] = data[i].second()[0]; + twist_[i] = degToRad(data[i].second()[1]); + chord_[i] = data[i].second()[2]; + } + } + else + { + FatalErrorIn + ( + "Foam::bladeModel::bladeModel" + "(" + "const dictionary&, " + "const word&" + ")" + ) << "No blade data specified" << exit(FatalError); + } +} + +// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * // + +Foam::bladeModel::~bladeModel() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::List& Foam::bladeModel::profileName() const +{ + return profileName_; +} + + +const Foam::List& Foam::bladeModel::profileID() const +{ + return profileID_; +} + + +const Foam::List& Foam::bladeModel::radius() const +{ + return radius_; +} + + +const Foam::List& Foam::bladeModel::twist() const +{ + return twist_; +} + + +const Foam::List& Foam::bladeModel::chord() const +{ + return chord_; +} + + +Foam::List& Foam::bladeModel::profileID() +{ + return profileID_; +} + + +void Foam::bladeModel::interpolate +( + const scalar radius, + scalar& twist, + scalar& chord, + label& i1, + label& i2, + scalar& invDr +) const +{ + interpolateWeights(radius, radius_, i1, i2, invDr); + + twist = invDr*(twist_[i2] - twist_[i1]) + twist_[i1]; + chord = invDr*(chord_[i2] - chord_[i1]) + chord_[i1]; +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.H new file mode 100644 index 0000000000..df26e7bd40 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/rotorDiskSource/bladeModel/bladeModel.H @@ -0,0 +1,151 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 . + +Class + Foam::bladeModel + +Description + Blade model class + +SourceFiles + bladeModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef bladeModel_H +#define bladeModel_H + +#include "List.H" +#include "dictionary.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class bladeModel Declaration +\*---------------------------------------------------------------------------*/ + +class bladeModel +{ + +protected: + + // Protected data + + //- Corresponding profile name per section + List profileName_; + + //- Corresponding profile ID per section + List