Skip to content

Commit

Permalink
Fixed dynamic compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
moreff committed Feb 25, 2023
1 parent c677543 commit 1c137c9
Showing 1 changed file with 62 additions and 45 deletions.
107 changes: 62 additions & 45 deletions etc/codeTemplates/dynamicCode/basicChemistryModelTemplate.C
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
\\ / F ield | DLBFoam: Dynamic Load Balancing
\\ / O peration | for fast reactive simulations
\\ / A nd |
\\/ M anipulation | 2022, Aalto University, Finland
\\/ M anipulation | 2022-2023, Aalto University, Finland
-------------------------------------------------------------------------------
License
This file is part of DLBFoam library, derived from OpenFOAM.
Expand All @@ -25,20 +25,6 @@ License
\*---------------------------------------------------------------------------*/

#define chemistryModelCppTest 0
#define loadBalancedChemistryModelCppTest 1
#define loadBalanced_pyJacChemistryModelCppTest 2

#include "makeChemistrySolver.H"
#if ${method}ChemistryModelCppTest == loadBalancedChemistryModelCppTest
#include "${method}ChemistryModel.H"
#elif ${method}ChemistryModelCppTest == loadBalanced_pyJacChemistryModelCppTest
#include "${method}ChemistryModel.H"
#else
#include "${method}.H"
#endif
#include "${solver}.H"

#include "typedefThermo.H"

#include "${specie}.H"
Expand Down Expand Up @@ -94,7 +80,26 @@ namespace Foam
${equationOfState},
${specie}
);
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#define chemistryModelCppTest 0
#define loadBalancedChemistryModelCppTest 1
#define loadBalanced_pyJacChemistryModelCppTest 2

#include "makeChemistrySolver.H"
#if ${method}ChemistryModelCppTest == loadBalancedChemistryModelCppTest
#include "${method}ChemistryModel.H"
#elif ${method}ChemistryModelCppTest == loadBalanced_pyJacChemistryModelCppTest
#include "${method}ChemistryModel.H"
#else
#include "${method}.H"
#endif
#include "${solver}.H"

namespace Foam
{
#if ${method}ChemistryModelCppTest == loadBalanced_pyJacChemistryModelCppTest
defineChemistrySolver(chemistryModel, ThermoPhysics);
makeChemistrySolver(${solver}, chemistryModel, ThermoPhysics);
Expand All @@ -117,15 +122,13 @@ namespace Foam
}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#if ${method}CppTest == chemistryModelCppTest
#define chemistryModelMethod 0

#include "makeChemistryReductionMethod.H"
#if ${method}Method == chemistryModelMethod

namespace Foam
{
defineChemistryReductionMethod(nullArg, ThermoPhysics);
}
#include "makeChemistryReductionMethod.H"

#include "noChemistryReduction.H"
#include "DAC.H"
Expand All @@ -136,6 +139,8 @@ namespace Foam

namespace Foam
{
defineChemistryReductionMethod(nullArg, ThermoPhysics);

makeChemistryReductionMethod(none, ThermoPhysics);
makeChemistryReductionMethod(DAC, ThermoPhysics);
makeChemistryReductionMethod(DRG, ThermoPhysics);
Expand All @@ -149,6 +154,10 @@ namespace Foam

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

#define chemistryModelMethod 0

#if ${method}Method == chemistryModelMethod

#include "makeReaction.H"

#include "ArrheniusReactionRate.H"
Expand All @@ -158,92 +167,100 @@ namespace Foam
#include "JanevReactionRate.H"
#include "powerSeriesReactionRate.H"

#include "LangmuirHinshelwoodReactionRate.H"
#include "MichaelisMentenReactionRate.H"

#include "ChemicallyActivatedReactionRate.H"
#include "FallOffReactionRate.H"

#include "ChemicallyActivatedReactionRate.H"
#include "LindemannFallOffFunction.H"
#include "SRIFallOffFunction.H"
#include "TroeFallOffFunction.H"

#include "MichaelisMentenReactionRate.H"
#include "LangmuirHinshelwoodReactionRate.H"
#include "fluxLimitedLangmuirHinshelwoodReactionRate.H"
#include "surfaceArrheniusReactionRate.H"

namespace Foam
{
defineReaction(nullArg, ThermoPhysics);

// Irreversible/reversible/non-equilibrium-reversible reactions
makeIRNReactions(ArrheniusReactionRate, ThermoPhysics);
makeIRNReactions(LandauTellerReactionRate, ThermoPhysics);
makeIRNReactions(thirdBodyArrheniusReactionRate, ThermoPhysics);

// Irreversible/reversible reactions
makeIRReactions(JanevReactionRate, ThermoPhysics);
makeIRReactions(powerSeriesReactionRate, ThermoPhysics);

makeIRReactions(LangmuirHinshelwoodReactionRate, ThermoPhysics);
makeIReactions(MichaelisMentenReactionRate, ThermoPhysics);

makeIRRPressureDependentReactions
// Irreversible/reversible fall-off reactions
makeIRTemplate2Reactions
(
FallOffReactionRate,
ArrheniusReactionRate,
LindemannFallOffFunction,
ThermoPhysics
);

makeIRRPressureDependentReactions
makeIRTemplate2Reactions
(
FallOffReactionRate,
ArrheniusReactionRate,
TroeFallOffFunction,
ThermoPhysics
);

makeIRRPressureDependentReactions
makeIRTemplate2Reactions
(
FallOffReactionRate,
ArrheniusReactionRate,
SRIFallOffFunction,
ThermoPhysics
);

makeIRRPressureDependentReactions
// Irreversible/reversible chemically activated reactions
makeIRTemplate2Reactions
(
ChemicallyActivatedReactionRate,
ArrheniusReactionRate,
LindemannFallOffFunction,
ThermoPhysics
);

makeIRRPressureDependentReactions
makeIRTemplate2Reactions
(
ChemicallyActivatedReactionRate,
ArrheniusReactionRate,
TroeFallOffFunction,
ThermoPhysics
);

makeIRRPressureDependentReactions
makeIRTemplate2Reactions
(
ChemicallyActivatedReactionRate,
ArrheniusReactionRate,
SRIFallOffFunction,
ThermoPhysics
);
}


// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Michaelis-Menten Reactions
makeIReactions(MichaelisMentenReactionRate, ThermoPhysics);

#include "fluxLimitedLangmuirHinshelwoodReactionRate.H"
// Langmuir-Hinshelwood Reactions
makeIRReactions(LangmuirHinshelwoodReactionRate, ThermoPhysics);

namespace Foam
{
// Flux-limited Langmuir-Hinshelwood Reactions
makeGeneralReaction
(
IrreversibleReaction,
fluxLimitedLangmuirHinshelwoodReactionRate,
ThermoPhysics
);

// Surface-Arrhenius Reactions
makeGeneralReaction
(
IrreversibleReaction,
surfaceArrheniusReactionRate,
ThermoPhysics
);
}

#endif


// ************************************************************************* //

0 comments on commit 1c137c9

Please sign in to comment.