Skip to content

Conversation

@rrsettgast
Copy link
Member

@rrsettgast rrsettgast commented Dec 17, 2025

  • remove non-log(c) option
  • create aliases for log/exp
  • use aliases everywhere in the code
  • correct derivatives wrt log by multiplying by ln(10) when using base10, and 1 when using base_e

REAL_TYPE const speciesConcentration_i = exp( logPrimarySpeciesConcentrations[i] );
REAL_TYPE const speciesConcentration_i = logmath::exp( logPrimarySpeciesConcentrations[i] );
aggregatePrimarySpeciesConcentrations[i] = speciesConcentration_i;
dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, i ) = speciesConcentration_i;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be?
dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, i ) = logmath::dWrtLogConst() * speciesConcentration_i;

Copy link

@azibitsker azibitsker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went went through the changes and based on my current understanding of the framework, I think there is only one type of correction that I see in the derivative of aggregate wrt to log(C^primary) that should have a ln(10) factor in front of C_i.

aggregatePrimarySpeciesConcentrations[i] = speciesConcentration_i;
mobileAggregatePrimarySpeciesConcentrations[i] = speciesConcentration_i;
dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, i ) = speciesConcentration_i;
dMobileAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, i ) = speciesConcentration_i;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, should it be?
dAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, i ) = logmath::dWrtLogConst() * speciesConcentration_i;
dMobileAggregatePrimarySpeciesConcentrationsDerivatives_dLogPrimarySpeciesConcentrations( i, i ) = logmath::dWrtLogConst() * speciesConcentration_i;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants