Skip to content

Commit 0d6c8c4

Browse files
committed
fixup! rebase fix up
1 parent 9ae9247 commit 0d6c8c4

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

src/libcadet/model/reaction/ReactionSystem.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
// is available at http://www.gnu.org/licenses/gpl.html
1111
// =============================================================================
1212

13+
#pragma once
14+
1315
#include "model/reaction/ReactionModelBase.hpp"
1416
#include "model/ReactionModel.hpp"
1517
#include "cadet/Exceptions.hpp"

test/GeneralRateModel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ TEST_CASE("GRM multiple spatially dependent particle types flux Jacobian vs FD",
267267
cadet::test::particle::testArrowHeadJacobianSpatiallyMixedParticleTypes("GENERAL_RATE_MODEL", 1e-6, 1e-8, 1e-5);
268268
}
269269

270-
TEST_CASE("GRM dynamic reactions Jacobian vs AD bulk", "[GRM],[Jacobian],[AD],[ReactionModel],[CI]")
270+
TEST_CASE("GRM dynamic reactions Jacobian vs AD bulk", "[GRM],[Jacobian],[AD],[ReactionModel],[CI],[testHere]")
271271
{
272272
cadet::test::reaction::testUnitJacobianDynamicReactionsAD("GENERAL_RATE_MODEL", "FV", true, false, false);
273273
}

test/ReactionModelTests.cpp

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ namespace reaction
167167

168168
return 0;
169169
}
170-
171170
void extendModelWithDynamicReactions(cadet::JsonParameterProvider& jpp, UnitOpIdx unit, bool bulk, bool particle, bool particleModifiers)
172171
{
173172
auto gs = util::makeModelGroupScope(jpp, unit);
@@ -179,10 +178,12 @@ namespace reaction
179178

180179
if (!isLRM && bulk)
181180
{
182-
char const* const scopeName = "";
181+
char const* const scopeName = "liquid_reaction_000";
183182
jpp.addScope(scopeName);
184183
auto gs2 = util::makeGroupScope(jpp, scopeName);
185184

185+
jpp.set("TYPE", "MASS_ACTION_LAW");
186+
186187
const int nReactions = 4;
187188

188189
std::vector<double> stoichMat(nReactions * nComp, 0.0);
@@ -204,27 +205,27 @@ namespace reaction
204205
jpp.set("MAL_KBWD", rateBwd);
205206
}
206207

208+
if (!jpp.exists("NPARTYPE"))
209+
return;
210+
211+
const int nParType = jpp.getInt("NPARTYPE");
212+
207213
if ((!isLRM && particle) || (isLRM && bulk))
208214
{
209215
const int nReactions = 3;
210216

211217
for (int i = 0; i < nParType; ++i)
212218
{
213-
const int nBoundParType = std::accumulate(nBound.begin() + i * nComp, nBound.begin() + (i + 1) * nComp, 0);
219+
220+
jpp.pushScope("particle_type_" + std::string(3 - std::to_string(i).length(), '0') + std::to_string(i)); // particle_type_xxx
214221

215-
std::ostringstream oss;
216-
if (isLRM)
217-
oss << "reaction";
218-
else
219-
oss << "particle_type_" << std::setfill('0') << std::setw(3) << std::setprecision(0) << i;
220-
221-
jpp.addScope(oss.str());
222-
auto gs2 = util::makeGroupScope(jpp, oss.str());
222+
std::vector<int> nBound = jpp.getIntArray("NBOUND");
223+
const int nTotalBound = std::accumulate(nBound.begin(), nBound.end(), 0);
223224

224225
int nReac = 1;
225226
jpp.set("NREAC_CROSS_PHASE", nReac);
226227

227-
jpp.addScope("cross_phase_reaction_000");
228+
jpp.addScope("cross_phase_reaction_000"); // particle_type_xxx//cross_phase_reaction_000
228229
auto gs3 = util::makeGroupScope(jpp, "cross_phase_reaction_000");
229230

230231
jpp.set("TYPE", "MASS_ACTION_LAW_CROSS_PHASE");
@@ -235,9 +236,9 @@ namespace reaction
235236
std::vector<double> rateFwdLiquid(nReactions, 0.0);
236237
std::vector<double> rateBwdLiquid(nReactions, 0.0);
237238

238-
std::vector<double> stoichMatSolid(nReactions * nBoundParType, 0.0);
239-
std::vector<double> expFwdSolid(nReactions * nBoundParType, 0.0);
240-
std::vector<double> expBwdSolid(nReactions * nBoundParType, 0.0);
239+
std::vector<double> stoichMatSolid(nReactions * nTotalBound, 0.0);
240+
std::vector<double> expFwdSolid(nReactions * nTotalBound, 0.0);
241+
std::vector<double> expBwdSolid(nReactions * nTotalBound, 0.0);
241242
std::vector<double> rateFwdSolid(nReactions, 0.0);
242243
std::vector<double> rateBwdSolid(nReactions, 0.0);
243244

@@ -267,8 +268,8 @@ namespace reaction
267268

268269
if (particleModifiers)
269270
{
270-
std::vector<double> expFwdLiquidModSolid(nReactions * nBoundParType, 0.0);
271-
std::vector<double> expBwdLiquidModSolid(nReactions * nBoundParType, 0.0);
271+
std::vector<double> expFwdLiquidModSolid(nReactions * nTotalBound, 0.0);
272+
std::vector<double> expBwdLiquidModSolid(nReactions * nTotalBound, 0.0);
272273
std::vector<double> expFwdSolidModLiquid(nReactions * nComp, 0.0);
273274
std::vector<double> expBwdSolidModLiquid(nReactions * nComp, 0.0);
274275

@@ -282,6 +283,9 @@ namespace reaction
282283
jpp.set("MAL_EXPONENTS_SOLID_FWD_MODLIQUID", expFwdSolidModLiquid);
283284
jpp.set("MAL_EXPONENTS_SOLID_BWD_MODLIQUID", expBwdSolidModLiquid);
284285
}
286+
287+
if (!isCSTR)
288+
jpp.popScope();
285289
}
286290
}
287291
}

0 commit comments

Comments
 (0)