@@ -66,7 +66,7 @@ int schurComplementMultiplierGRM(void* userData, double const* x, double* z)
66
66
67
67
template <typename ConvDispOperator>
68
68
GeneralRateModel<ConvDispOperator>::GeneralRateModel(UnitOpIdx unitOpIdx) : UnitOperationBase(unitOpIdx),
69
- _hasSurfaceDiffusion (0 , false ), _dynReactionBulk{ },
69
+ _hasSurfaceDiffusion (0 , false ),
70
70
_jacP(nullptr ), _jacPdisc(nullptr ), _jacPF(nullptr ), _jacFP(nullptr ), _jacInlet(), _hasParDepSurfDiffusion(false ),
71
71
_analyticJac(true ), _jacobianAdDirs(0 ), _factorizeJacobian(false ), _tempState(nullptr ),
72
72
_initC(0 ), _initCp(0 ), _initQ(0 ), _initState(0 ), _initStateDot(0 )
@@ -84,8 +84,6 @@ GeneralRateModel<ConvDispOperator>::~GeneralRateModel() CADET_NOEXCEPT
84
84
delete[] _jacP;
85
85
delete[] _jacPdisc;
86
86
87
- for (auto * reac : _dynReactionBulk) delete reac;
88
-
89
87
clearParDepSurfDiffusion ();
90
88
}
91
89
@@ -480,10 +478,16 @@ bool GeneralRateModel<ConvDispOperator>::configureModelDiscretization(IParameter
480
478
481
479
// ==== Construct and configure dynamic reaction model
482
480
bool reactionConfSuccess = true ;
483
- _dynReactionBulk.resize (1 , nullptr );
484
481
_dynReaction.resize (_disc.nParType , nullptr );
485
482
486
483
_reaction.clearDynamicReactionModels ();
484
+ _reaction.configureDimOfSetAndReacParType (_disc.nParType );
485
+
486
+ bool hasCrossPhaseReac = false ;
487
+ bool hasSolidReac = false ;
488
+ bool hasPoreReac = false ;
489
+ bool hasLiquidReac = false ;
490
+
487
491
if (paramProvider.exists (" particle_type_000" ) && _disc.nParType > 0 )
488
492
{
489
493
unsigned int totalReacCrossPhase = 0 ;
@@ -503,7 +507,7 @@ bool GeneralRateModel<ConvDispOperator>::configureModelDiscretization(IParameter
503
507
504
508
if (paramProvider.exists (" NREAC_CROSS_PHASE" ))
505
509
{
506
- _reaction. configureDimOfSetAndReacParType ( " cross_phase " , _disc. nParType ) ;
510
+ hasCrossPhaseReac = true ;
507
511
int nReactions = paramProvider.getInt (" NREAC_CROSS_PHASE" );
508
512
509
513
if (nReactions < 0 )
@@ -517,7 +521,7 @@ bool GeneralRateModel<ConvDispOperator>::configureModelDiscretization(IParameter
517
521
518
522
if (paramProvider.exists (" NREAC_PORE" ))
519
523
{
520
- _reaction. configureDimOfSetAndReacParType ( " pore " , _disc. nParType ) ;
524
+ hasPoreReac = true ;
521
525
int nReactions = paramProvider.getInt (" NREAC_PORE" );
522
526
523
527
if (nReactions < 0 )
@@ -530,7 +534,7 @@ bool GeneralRateModel<ConvDispOperator>::configureModelDiscretization(IParameter
530
534
}
531
535
if (paramProvider.exists (" NREAC_SOLID" ))
532
536
{
533
- _reaction. configureDimOfSetAndReacParType ( " solid " , _disc. nParType ) ;
537
+ hasSolidReac = true ;
534
538
int nReactions = paramProvider.getInt (" NREAC_SOLID" );
535
539
if (nReactions < 0 )
536
540
{
@@ -595,8 +599,9 @@ bool GeneralRateModel<ConvDispOperator>::configureModelDiscretization(IParameter
595
599
}
596
600
597
601
}
598
- else if (paramProvider.exists (" NREAC_BULK" ))
602
+ if (paramProvider.exists (" NREAC_BULK" ))
599
603
{
604
+ hasLiquidReac = true ;
600
605
int nReactions = paramProvider.getInt (" NREAC_BULK" );
601
606
reactionConfSuccess = _reaction.configureDiscretization (" bulk" ,
602
607
0 ,
@@ -607,9 +612,10 @@ bool GeneralRateModel<ConvDispOperator>::configureModelDiscretization(IParameter
607
612
paramProvider,
608
613
helper) && reactionConfSuccess;
609
614
}
610
- else
615
+
616
+ if (!hasLiquidReac && !hasCrossPhaseReac && !hasSolidReac && !hasPoreReac)
611
617
{
612
- _reaction.empty (); // todo das als construktor
618
+ _reaction.empty ();
613
619
}
614
620
615
621
@@ -947,15 +953,6 @@ unsigned int GeneralRateModel<ConvDispOperator>::threadLocalMemorySize() const C
947
953
// Handle all reactions
948
954
_reaction.setWorkspaceRequirements (lms, _disc.nComp );
949
955
950
-
951
-
952
- for (auto i = 0 ; i < _dynReactionBulk.size (); i++)
953
- {
954
- if (_dynReactionBulk[i] && _dynReactionBulk[i]->requiresWorkspace ())
955
- lms.fitBlock (_dynReactionBulk[i]->workspaceSize (_disc.nComp , 0 , nullptr ));
956
- }
957
-
958
-
959
956
const unsigned int maxStrideBound = *std::max_element (_disc.strideBound , _disc.strideBound + _disc.nParType );
960
957
lms.add <active>(_disc.nComp + maxStrideBound);
961
958
lms.add <double >((maxStrideBound + _disc.nComp ) * (maxStrideBound + _disc.nComp ));
@@ -1434,6 +1431,15 @@ int GeneralRateModel<ConvDispOperator>::residualParticle(double t, unsigned int
1434
1431
int const * const qsReaction = _binding[parType]->reactionQuasiStationarity ();
1435
1432
const parts::cell::CellParameters cellResParams = makeCellResidualParams (parType, qsReaction);
1436
1433
1434
+ // dim for reactions
1435
+ const int numReacCrossPhase = _reaction.getnReactionOfParType (" cross_phase" , parType);
1436
+ const int numReacParticle = _reaction.getnReactionOfParType (" pore" , parType);
1437
+ const int numReacSolid = _reaction.getnReactionOfParType (" solid" , parType);
1438
+
1439
+ const int offSetCrossPhase = _reaction.getOffsetForPhase (" cross_phase" , parType);
1440
+ const int offSetParticle = _reaction.getOffsetForPhase (" pore" , parType);
1441
+ const int offSetSolid = _reaction.getOffsetForPhase (" solid" , parType);
1442
+
1437
1443
// Loop over particle cells
1438
1444
for (unsigned int par = 0 ; par < _disc.nParCell [parType]; ++par)
1439
1445
{
@@ -1451,15 +1457,6 @@ int GeneralRateModel<ConvDispOperator>::residualParticle(double t, unsigned int
1451
1457
1452
1458
// We still need to handle transport and quasi-stationary reactions
1453
1459
1454
- const int numReacCrossPhase = _reaction.getnReactionOfParType (" cross_phase" , par);
1455
- const int numReacParticle = _reaction.getnReactionOfParType (" pore" , par);
1456
- const int numReacSolid = _reaction.getnReactionOfParType (" solid" , par);
1457
-
1458
- // todo: double check offset
1459
- const int offSetCrossPhase = _reaction.getOffsetForPhase (" cross_phase" , parType);
1460
- const int offSetParticle = _reaction.getOffsetForPhase (" pore" , parType);
1461
- const int offSetSolid = _reaction.getOffsetForPhase (" solid" , parType);
1462
-
1463
1460
if (numReacCrossPhase > 0 || numReacParticle > 0 || numReacSolid > 0 )
1464
1461
{
1465
1462
unsigned int const * nBound = _disc.nBound + _disc.nComp * parType;
0 commit comments