diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C index 76a22ffe44..72e56bf884 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C @@ -156,18 +156,20 @@ Foam::CompositionModel::componentNames(const label phaseI) const template Foam::label Foam::CompositionModel::globalCarrierId ( - const word& cmptName + const word& cmptName, + const bool allowNotFound ) const { label id = thermo_.carrierId(cmptName); - if (id < 0) + if (id < 0 && !allowNotFound) { FatalErrorIn ( "Foam::label Foam::CompositionModel::globalCarrierId" "(" - "const word&" + "const word&, " + "const bool" ") const" ) << "Unable to determine global id for requested component " << cmptName << ". Available components are " << nl @@ -182,19 +184,21 @@ template Foam::label Foam::CompositionModel::globalId ( const label phaseI, - const word& cmptName + const word& cmptName, + const bool allowNotFound ) const { label id = phaseProps_[phaseI].globalId(cmptName); - if (id < 0) + if (id < 0 && !allowNotFound) { FatalErrorIn ( "Foam::label Foam::CompositionModel::globalId" "(" "const label, " - "const word&" + "const word&, " + "const bool" ") const" ) << "Unable to determine global id for requested component " << cmptName << abort(FatalError); @@ -218,19 +222,21 @@ template Foam::label Foam::CompositionModel::localId ( const label phaseI, - const word& cmptName + const word& cmptName, + const bool allowNotFound ) const { label id = phaseProps_[phaseI].id(cmptName); - if (id < 0) + if (id < 0 && !allowNotFound) { FatalErrorIn ( "Foam::label Foam::CompositionModel::localId" "(" "const label, " - "const word&" + "const word&, " + "const bool" ") const" ) << "Unable to determine local id for component " << cmptName << abort(FatalError); @@ -244,12 +250,13 @@ template Foam::label Foam::CompositionModel::localToGlobalCarrierId ( const label phaseI, - const label id + const label id, + const bool allowNotFound ) const { label gid = phaseProps_[phaseI].globalCarrierIds()[id]; - if (gid < 0) + if (gid < 0 && !allowNotFound) { FatalErrorIn ( @@ -257,7 +264,8 @@ Foam::label Foam::CompositionModel::localToGlobalCarrierId "Foam::CompositionModel::localToGlobalCarrierId" "(" "const label, " - "const label" + "const label, " + "const bool" ") const" ) << "Unable to determine global carrier id for phase " << phaseI << " with local id " << id diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H index 724354902c..cabdd91eac 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -166,22 +166,37 @@ public: const wordList& componentNames(const label phaseI) const; //- Return global id of component cmptName in carrier thermo - label globalCarrierId(const word& cmptName) const; + label globalCarrierId + ( + const word& cmptName, + const bool allowNotFound = false + ) const; //- Return global id of component cmptName in phase phaseI - label globalId(const label phaseI, const word& cmptName) const; + label globalId + ( + const label phaseI, + const word& cmptName, + const bool allowNotFound = false + ) const; //- Return global ids of for phase phaseI const labelList& globalIds(const label phaseI) const; //- Return local id of component cmptName in phase phaseI - label localId(const label phaseI, const word& cmptName) const; + label localId + ( + const label phaseI, + const word& cmptName, + const bool allowNotFound = false + ) const; //- Return global carrier id of component given local id label localToGlobalCarrierId ( const label phaseI, - const label id + const label id, + const bool allowNotFound = false ) const; //- Return the list of phase phaseI mass fractions