/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Copyright (C) 2016-2026 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 "specieReactionRates.H" #include "chemistryModel.H" #include "fviDomainIntegrate.H" #include "polyTopoChangeMap.H" #include "polyMeshMap.H" #include "polyDistributionMap.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { namespace functionObjects { defineTypeNameAndDebug(specieReactionRates, 0); addToRunTimeSelectionTable ( functionObject, specieReactionRates, dictionary ); } } // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::functionObjects::specieReactionRates::writeFileHeader(const label i) { const chemistryModel& chemistry = mesh().lookupObject ( IOobject::groupName("chemistryProperties", phaseName_) ); writeHeader(file(), "Specie reaction rates"); zone_.writeFileHeader(*this, file()); writeHeaderValue(file(), "nSpecie", chemistry.nSpecie()); writeHeaderValue(file(), "nReaction", chemistry.nReaction()); writeCommented(file(), "Time"); writeTabbed(file(), "Reaction"); const wordList& speciesNames = chemistry.thermo().species(); forAll (speciesNames, si) { writeTabbed(file(), speciesNames[si]); } file() << endl; } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::functionObjects::specieReactionRates::specieReactionRates ( const word& name, const Time& runTime, const dictionary& dict ) : fvMeshFunctionObject(name, runTime, dict), logFiles(obr_, name), zone_(fvMeshFunctionObject::mesh_, dict), phaseName_(dict.lookupOrDefault("phase", word::null)), writeFields_(false) { read(dict); } // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::functionObjects::specieReactionRates::~specieReactionRates() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // bool Foam::functionObjects::specieReactionRates::read(const dictionary& dict) { fvMeshFunctionObject::read(dict); writeFields_ = dict.lookupOrDefault("writeFields", false); resetName("specieReactionRates"); return true; } bool Foam::functionObjects::specieReactionRates::execute() { return true; } bool Foam::functionObjects::specieReactionRates::write() { zone_.regenerate(); logFiles::write(); const chemistryModel& chemistry = mesh().lookupObject ( IOobject::groupName("chemistryProperties", phaseName_) ); const label nSpecie = chemistry.nSpecie(); const label nReaction = chemistry.nReaction(); // Region volume const scalar V = zone_.V(); for (label reactioni=0; reactioni RR ( chemistry.specieReactionRR(reactioni) ); // Compute the average rates and write them into the log file for (label speciei=0; specieimesh()) { zone_.movePoints(); } } void Foam::functionObjects::specieReactionRates::topoChange ( const polyTopoChangeMap& map ) { if (&map.mesh() == &mesh()) { zone_.topoChange(map); } } void Foam::functionObjects::specieReactionRates::mapMesh ( const polyMeshMap& map ) { if (&map.mesh() == &mesh()) { zone_.mapMesh(map); } } void Foam::functionObjects::specieReactionRates::distribute ( const polyDistributionMap& map ) { if (&map.mesh() == &mesh()) { zone_.distribute(map); } } // ************************************************************************* //