@@ -386,7 +386,7 @@ void GeneralRateModelDG::consistentInitialState(const SimulationTime& simTime, d
386386 active* const localAdY = adJac.adY ? adJac.adY + localOffsetToParticle + localOffsetInParticle : nullptr ;
387387
388388 // r (particle) coordinate of current node
389- const double r = _parDiffOp.relativeCoordinate (type, node);
389+ const double r = _parDiffOp[type] .relativeCoordinate (node);
390390 const ColumnPosition colPos{ z, 0.0 , r };
391391
392392 // Determine whether nonlinear solver is required
@@ -397,8 +397,8 @@ void GeneralRateModelDG::consistentInitialState(const SimulationTime& simTime, d
397397 linalg::selectVectorSubset (qShell - _disc.nComp , mask, solution);
398398
399399 // Save values of conserved moieties
400- const double epsQ = 1.0 - static_cast <double >(_parDiffOp. _parPorosity [type]);
401- linalg::conservedMoietiesFromPartitionedMask (mask, _disc.nBound + type * _disc.nComp , _disc.nComp , qShell - _disc.nComp , conservedQuants, static_cast <double >(_parDiffOp. _parPorosity [type]), epsQ);
400+ const double epsQ = 1.0 - static_cast <double >(_parDiffOp[type]. _parPorosity );
401+ linalg::conservedMoietiesFromPartitionedMask (mask, _disc.nBound + type * _disc.nComp , _disc.nComp , qShell - _disc.nComp , conservedQuants, static_cast <double >(_parDiffOp[type]. _parPorosity ), epsQ);
402402
403403 std::function<bool (double const * const , linalg::detail::DenseMatrixBase&)> jacFunc;
404404
@@ -477,7 +477,7 @@ void GeneralRateModelDG::consistentInitialState(const SimulationTime& simTime, d
477477 continue ;
478478 }
479479
480- mat.native (rIdx, rIdx) = static_cast <double >(_parDiffOp. _parPorosity [type]);
480+ mat.native (rIdx, rIdx) = static_cast <double >(_parDiffOp[type]. _parPorosity );
481481
482482 for (unsigned int bnd = 0 ; bnd < _disc.nBound [_disc.nComp * type + comp]; ++bnd, ++bndIdx)
483483 {
@@ -525,7 +525,7 @@ void GeneralRateModelDG::consistentInitialState(const SimulationTime& simTime, d
525525 continue ;
526526 }
527527
528- mat.native (rIdx, rIdx) = static_cast <double >(_parDiffOp. _parPorosity [type]);
528+ mat.native (rIdx, rIdx) = static_cast <double >(_parDiffOp[type]. _parPorosity );
529529
530530 for (unsigned int bnd = 0 ; bnd < _disc.nBound [_disc.nComp * type + comp]; ++bnd, ++bndIdx)
531531 {
@@ -572,7 +572,7 @@ void GeneralRateModelDG::consistentInitialState(const SimulationTime& simTime, d
572572 continue ;
573573 }
574574
575- r[rIdx] = static_cast <double >(_parDiffOp. _parPorosity [type]) * x[rIdx] - conservedQuants[rIdx];
575+ r[rIdx] = static_cast <double >(_parDiffOp[type]. _parPorosity ) * x[rIdx] - conservedQuants[rIdx];
576576
577577 for (unsigned int bnd = 0 ; bnd < _disc.nBound [_disc.nComp * type + comp]; ++bnd, ++bndIdx)
578578 {
@@ -713,7 +713,7 @@ void GeneralRateModelDG::consistentInitialTimeDerivative(const SimulationTime& s
713713 if (_binding[type]->dependsOnTime ())
714714 {
715715 // r (particle) coordinate of current node (particle radius normed to 1) - needed in externally dependent adsorption kinetic
716- const double r = _parDiffOp.relativeCoordinate (type, j);
716+ const double r = _parDiffOp[type] .relativeCoordinate (j);
717717
718718 _binding[type]->timeDerivativeQuasiStationaryFluxes (simTime.t , simTime.secIdx ,
719719 ColumnPosition{ z, 0.0 , r },
@@ -797,10 +797,13 @@ void GeneralRateModelDG::consistentInitialTimeDerivative(const SimulationTime& s
797797 */
798798void GeneralRateModelDG::leanConsistentInitialState (const SimulationTime& simTime, double * const vecStateY, const AdJacobianParams& adJac, double errorTol, util::ThreadLocalStorage& threadLocalMem)
799799{
800- if (isSectionDependent (_parDiffOp._parDiffusionMode ) || isSectionDependent (_parDiffOp._parSurfDiffusionMode ))
801- LOG (Warning) << " Lean consistent initialization is not appropriate for section-dependent pore and surface diffusion" ;
800+ for (int parType = 0 ; parType < _disc.nParType ; parType++)
801+ {
802+ if (isSectionDependent (_parDiffOp[parType]._parDiffusionMode ) || isSectionDependent (_parDiffOp[parType]._parSurfDiffusionMode ))
803+ LOG (Warning) << " Lean consistent initialization is not appropriate for section-dependent pore and surface diffusion" ;
802804
803- BENCH_SCOPE (_timerConsistentInit);
805+ BENCH_SCOPE (_timerConsistentInit);
806+ }
804807
805808 Indexer idxr (_disc);
806809
@@ -830,7 +833,7 @@ void GeneralRateModelDG::leanConsistentInitialState(const SimulationTime& simTim
830833 const int localOffsetInParticle = static_cast <int >(shell) * idxr.strideParNode (type) + idxr.strideParLiquid ();
831834 double * const qShell = vecStateY + localOffsetToParticle + localOffsetInParticle;
832835 // r (particle) coordinate of current node
833- const double r = _parDiffOp.relativeCoordinate (type, shell);
836+ const double r = _parDiffOp[type] .relativeCoordinate (shell);
834837 const ColumnPosition colPos{ z, 0.0 , r};
835838
836839 // Perform consistent initialization that does not require a full fledged nonlinear solver (that may fail or damage the current state vector)
@@ -885,8 +888,13 @@ void GeneralRateModelDG::leanConsistentInitialState(const SimulationTime& simTim
885888 */
886889void GeneralRateModelDG::leanConsistentInitialTimeDerivative (double t, double const * const vecStateY, double * const vecStateYdot, double * const res, util::ThreadLocalStorage& threadLocalMem)
887890{
888- if (isSectionDependent (_parDiffOp._parDiffusionMode ) || isSectionDependent (_parDiffOp._parSurfDiffusionMode ))
889- LOG (Warning) << " Lean consistent initialization is not appropriate for section-dependent pore and surface diffusion" ;
891+ for (int parType = 0 ; parType < _disc.nParType ; parType++)
892+ {
893+ if (isSectionDependent (_parDiffOp[parType]._parDiffusionMode ) || isSectionDependent (_parDiffOp[parType]._parSurfDiffusionMode ))
894+ LOG (Warning) << " Lean consistent initialization is not appropriate for section-dependent pore and surface diffusion" ;
895+
896+ BENCH_SCOPE (_timerConsistentInit);
897+ }
890898
891899 BENCH_SCOPE (_timerConsistentInit);
892900
@@ -1268,8 +1276,13 @@ void GeneralRateModelDG::solveBulkTimeDerivativeSystem(const SimulationTime& sim
12681276void GeneralRateModelDG::leanConsistentInitialSensitivity (const SimulationTime& simTime, const ConstSimulationState& simState,
12691277 std::vector<double *>& vecSensY, std::vector<double *>& vecSensYdot, active const * const adRes, util::ThreadLocalStorage& threadLocalMem)
12701278{
1271- if (isSectionDependent (_parDiffOp._parDiffusionMode ) || isSectionDependent (_parDiffOp._parSurfDiffusionMode ))
1272- LOG (Warning) << " Lean consistent initialization is not appropriate for section-dependent pore and surface diffusion" ;
1279+ for (int parType = 0 ; parType < _disc.nParType ; parType++)
1280+ {
1281+ if (isSectionDependent (_parDiffOp[parType]._parDiffusionMode ) || isSectionDependent (_parDiffOp[parType]._parSurfDiffusionMode ))
1282+ LOG (Warning) << " Lean consistent initialization is not appropriate for section-dependent pore and surface diffusion" ;
1283+
1284+ BENCH_SCOPE (_timerConsistentInit);
1285+ }
12731286
12741287 BENCH_SCOPE (_timerConsistentInit);
12751288
0 commit comments