/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2011-2021 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 . \*---------------------------------------------------------------------------*/ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // inline Foam::pressureDependentArrheniusReactionRate::pressureDependentArrheniusReactionRate ( Function1s::Table A, Function1s::Table beta, Function1s::Table Ta ) : A_(A), beta_(beta), Ta_(Ta) {} inline Foam::pressureDependentArrheniusReactionRate::pressureDependentArrheniusReactionRate ( const speciesTable& species, const dictionary& dict ) : A_("A", dict), beta_("beta", dict), Ta_("Ta", dict) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // inline void Foam::pressureDependentArrheniusReactionRate::preEvaluate() const {} inline void Foam::pressureDependentArrheniusReactionRate::postEvaluate() const {} inline Foam::scalar Foam::pressureDependentArrheniusReactionRate::operator() ( const scalar p, const scalar T, const scalarField&, const label ) const { const scalar logP = log(p); scalar ak = exp(A_.value(logP)); if (mag(beta_.value(logP)) > vSmall) { ak *= pow(T, beta_.value(logP)); } if (mag(Ta_.value(logP)) > vSmall) { ak *= exp(-Ta_.value(logP)/T); } return ak; } inline Foam::scalar Foam::pressureDependentArrheniusReactionRate::ddT ( const scalar p, const scalar T, const scalarField&, const label ) const { const scalar logP = log(p); scalar ak = exp(A_.value(logP)); if (mag(beta_.value(logP)) > vSmall) { ak *= pow(T, beta_.value(logP)); } if (mag(Ta_.value(logP)) > vSmall) { ak *= exp(-Ta_.value(logP)/T); } return ak*(beta_.value(logP)+Ta_.value(logP)/T)/T; } inline const Foam::List>& Foam::pressureDependentArrheniusReactionRate::beta() const { return NullObjectRef>>(); } inline void Foam::pressureDependentArrheniusReactionRate::dcidc ( const scalar p, const scalar T, const scalarField& c, const label li, scalarField& dcidc ) const {} inline Foam::scalar Foam::pressureDependentArrheniusReactionRate::dcidT ( const scalar p, const scalar T, const scalarField& c, const label li ) const { return 0; } inline void Foam::pressureDependentArrheniusReactionRate::write(Ostream& os) const { //convert to scalarFields to be able to loop over values scalarField pressureTable(A_.x()); scalarField ATable(A_.y()); scalarField betaTable(beta_.y()); scalarField TATable(Ta_.y()); os << indent << "A table (" << nl ; os << incrIndent; forAll(pressureTable, i) { os << indent << " (" << pressureTable[i] << " " << ATable[i] << " )" << nl; } os << indent << ");" << nl << decrIndent << indent << "beta table (" << nl; os << incrIndent; forAll(pressureTable, i) { os << indent << " (" << pressureTable[i] << " " << betaTable[i] << " )" << nl; } os << indent << ");" << nl << decrIndent << indent << "Ta table (" << nl; os << incrIndent; forAll(pressureTable, i) { os << indent << " (" << pressureTable[i] << " " << TATable[i] << " )" << nl; } os << indent << ");" << nl << decrIndent; } inline Foam::Ostream& Foam::operator<< ( Ostream& os, const pressureDependentArrheniusReactionRate& arr ) { arr.write(os); return os; } // ************************************************************************* //