diff --git a/src/thermophysicalModels/combustion/chemistryReaders/chemkinReader/chemkinReader.C b/src/thermophysicalModels/combustion/chemistryReaders/chemkinReader/chemkinReader.C index 323acd574e5ed86ef9547d1a06428b3d178a49e7..944df6e3d57f2eb64812013b7a7da5931c1aa7a3 100644 --- a/src/thermophysicalModels/combustion/chemistryReaders/chemkinReader/chemkinReader.C +++ b/src/thermophysicalModels/combustion/chemistryReaders/chemkinReader/chemkinReader.C @@ -52,7 +52,7 @@ namespace Foam /* * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * */ -const char* Foam::chemkinReader::reactionTypeNames[4] = +const char* Foam::chemkinReader::reactionTypeNames[4] = { "irreversible", "reversible", @@ -154,7 +154,7 @@ void Foam::chemkinReader::checkCoeffs << " rate expression on line " << lineNo_-1 << ", should be " << nCoeffs << " but " << reactionCoeffs.size() << " supplied." << nl - << "Coefficients are " + << "Coefficients are " << reactionCoeffs << nl << exit(FatalError); } @@ -291,7 +291,7 @@ void Foam::chemkinReader::addPressureDependentReaction << "Wrong number of coefficients for Troe rate expression" " on line " << lineNo_-1 << ", should be 3 or 4 but " << TroeCoeffs.size() << " supplied." << nl - << "Coefficients are " + << "Coefficients are " << TroeCoeffs << nl << exit(FatalError); } @@ -347,7 +347,7 @@ void Foam::chemkinReader::addPressureDependentReaction << "Wrong number of coefficients for SRI rate expression" " on line " << lineNo_-1 << ", should be 3 or 5 but " << SRICoeffs.size() << " supplied." << nl - << "Coefficients are " + << "Coefficients are " << SRICoeffs << nl << exit(FatalError); } @@ -397,7 +397,7 @@ void Foam::chemkinReader::addPressureDependentReaction if (fofType < 4) { FatalErrorIn("chemkinReader::addPressureDependentReaction") - << "Fall-off function type " + << "Fall-off function type " << fallOffFunctionNames[fofType] << " on line " << lineNo_-1 << " not implemented" @@ -459,7 +459,7 @@ void Foam::chemkinReader::addReaction // Calculate the unit conversion factor for the A coefficient // for the change from mol/cm^3 to kmol/m^3 concentraction units - const scalar concFactor = 0.001; + const scalar concFactor = 0.001; scalar sumExp = 0.0; forAll (lhs, i) { @@ -868,21 +868,34 @@ Foam::chemkinReader::chemkinReader(const dictionary& thermoDict) specieNames_(10), speciesTable_(static_cast<const wordList&>(wordList())) { - fileName CHEMKINFileName + fileName chemkinFile ( fileName(thermoDict.lookup("CHEMKINFile")).expand() ); - fileName thermoFileName = fileName::null; - + fileName thermoFile = fileName::null; + if (thermoDict.found("CHEMKINThermoFile")) { - thermoFileName = - fileName(thermoDict.lookup("CHEMKINThermoFile")).expand(); + thermoFile = fileName(thermoDict.lookup("CHEMKINThermoFile")).expand(); } - read(CHEMKINFileName, thermoFileName); -} + // allow relative file names + fileName relPath = thermoDict.name().path(); + if (relPath.size()) + { + if (chemkinFile.size() && chemkinFile[0] != '/') + { + chemkinFile = relPath/chemkinFile; + } + if (thermoFile.size() && thermoFile[0] != '/') + { + thermoFile = relPath/thermoFile; + } + } + + read(chemkinFile, thermoFile); +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //