Skip to content

Commit 9acef98

Browse files
committed
fix incorrect derivative correction
1 parent 91e192b commit 9acef98

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/common/logMath.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ struct LogExp
3232
template< typename T >
3333
HPCREACT_HOST_DEVICE
3434
static constexpr inline
35-
T dLogConst()
35+
T dWrtLogConst()
3636
{
3737
if constexpr ( Base == LogBase::e ) { return T(1.0); }
38-
else { return T(1.0/ln10()); }
38+
else { return T(ln10()); }
3939
}
4040

4141

src/reactions/massActions/MassActions.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void calculateAggregatePrimaryConcentrationsWrtLogC( PARAMS_DATA const & params,
154154
aggregatePrimarySpeciesConcentrations[i] += params.stoichiometricMatrix( j, i+numSecondarySpecies ) * secondarySpeciesConcentrations_j;
155155
for( int k=0; k<numPrimarySpecies; ++k )
156156
{
157-
REAL_TYPE const dSecondarySpeciesConcentrations_dLogPrimarySpeciesConcentration = logmath::ln10() * params.stoichiometricMatrix( j, k+numSecondarySpecies ) * secondarySpeciesConcentrations_j;
157+
REAL_TYPE const dSecondarySpeciesConcentrations_dLogPrimarySpeciesConcentration = logmath::dWrtLogConst() * params.stoichiometricMatrix( j, k+numSecondarySpecies ) * secondarySpeciesConcentrations_j;
158158
dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, k ) += params.stoichiometricMatrix( j, i+numSecondarySpecies ) *
159159
dSecondarySpeciesConcentrations_dLogPrimarySpeciesConcentration;
160160
}
@@ -247,7 +247,7 @@ void calculateTotalAndMobileAggregatePrimaryConcentrationsWrtLogC( PARAMS_DATA c
247247
mobileAggregatePrimarySpeciesConcentrations[i] += params.stoichiometricMatrix( j, i+numSecondarySpecies ) * secondarySpeciesConcentrations_j * params.mobileSecondarySpeciesFlag( j );
248248
for( int k=0; k<numPrimarySpecies; ++k )
249249
{
250-
REAL_TYPE const dSecondarySpeciesConcentrations_dLogPrimarySpeciesConcentration = logmath::ln10() * params.stoichiometricMatrix( j, k+numSecondarySpecies ) * secondarySpeciesConcentrations_j;
250+
REAL_TYPE const dSecondarySpeciesConcentrations_dLogPrimarySpeciesConcentration = logmath::dWrtLogConst() * params.stoichiometricMatrix( j, k+numSecondarySpecies ) * secondarySpeciesConcentrations_j;
251251
dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, k ) += params.stoichiometricMatrix( j, i+numSecondarySpecies ) *
252252
dSecondarySpeciesConcentrations_dLogPrimarySpeciesConcentration;
253253

0 commit comments

Comments
 (0)