Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are we using Update_RCONST() correctly? #93

Closed
RolfSander opened this issue Dec 22, 2023 · 11 comments
Closed

Are we using Update_RCONST() correctly? #93

RolfSander opened this issue Dec 22, 2023 · 11 comments
Labels
integrators Related to numerical integrators question Further information is requested
Milestone

Comments

@RolfSander
Copy link
Contributor

Hello,

The switch ICNTRL(15) allows us to call Update_RCONST() several times
during the KPP sub-timesteps. Some of the rate constants depend on other
concentrations. In GEOS-Chem for example, k(IONO+BrSALA) depends on
C(ind_IONO).

Why is Update_RCONST() using concentrations from the C array, which
still has the old values before the integration started? Don't we have
to use the intermediate values from the YNEW arrray inside
Update_RCONST()?

@RolfSander RolfSander added question Further information is requested integrators Related to numerical integrators labels Dec 22, 2023
@RolfSander
Copy link
Contributor Author

@adrian-sandu: Can you help us with this question?

@adrian-sandu
Copy link

Hello,

This is from the legacy code design (one set of coefficients is fixed during each time step, except for the time dependent photolysis rates).

Perhaps we need a version Update_RCONST(Y) that takes current concentrations as argument, with
double precision,optional :: Y.

@RolfSander
Copy link
Contributor Author

Hello Adrian,

Thanks for confirming that we should use Y instead of C!

A colleague of mine (Simon Rosanka) has already written some code to
tackle this problem. It is currently implemented in the MECCA chemistry
module. After testing, I hope that we can transfer the changes to the
KPP repository so that they will be available in the next KPP release.

@RolfSander RolfSander mentioned this issue Jan 4, 2024
13 tasks
@RolfSander
Copy link
Contributor Author

Hello @adrian-sandu,

I have a related question: Is it correct that calling Update_RCONST()
several times during the KPP sub-timesteps only makes sense in the
non-autonomous mode?

If that is true, KPP should print a warning if a user sets the
questionable combination of ICNTRL(1)=1 and ICNTRL(15)>0.

@RolfSander
Copy link
Contributor Author

I've added @srosanka as an "Outside Collaborator" to our KPP repo. He
has written a patch to deal with this Update_RCONST problem, and he
offered to commit his code into a new branch here.

srosanka added a commit that referenced this issue Jul 11, 2024
Update_RCONST now uses variable concentrations for rate constants that
depend on species concentrations. To ensure backwards compatibility, YIN
is an optional input. If YIN is not passed to Update_RCONST,
concentrations from the global C array are used instead.
@yantosca yantosca added this to the 3.2.0 milestone Jul 11, 2024
@yantosca
Copy link
Contributor

Thanks @RolfSander @adrian-sandu @srosanka for looking into this. FYI, in GEOS-Chem, we only update rate constants before calling the integrator (otherwise it would be too time consuming) by setting ICNTRL(15) = -1. So this update wouldn't affect GEOS-Chem.

We can also get a sense of what impact this change would have by looking at the output of the C-I tests.

@srosanka
Copy link
Collaborator

Hi, I just pushed the required changed to the issue93 branch. In this commit I also updated all Rosenbrock integrator to take this modifications into account. Let me know if you agree to these changes and I will open a related pull request.

@srosanka
Copy link
Collaborator

@yantosca That is good to know. As far as I recall, the default option in MESSy also only updates all rate constants before calling the integrator. I think that this is a valid approach for most gas phase mechanisms, especially when considering the performance improvement in global model applications. However, when we implemented aqueous phase chemistry in deliquescent aerosols in MESSy (AERCHEM), we noticed that not updating rate constants that depend on variable species during the integration can significantly influence the predicted results.

@adrian-sandu
Copy link

Hi Bob, Rolf, Simon,

It makes sense to call Update_RCONST every time we call the function/Jacobian for non-autonomous systems. Perhaps very important for wet chemistry. The shortcut with calling it every operator split time step works well for gas phase, and it saves a ton of computations in 3D. So keeping both options is good.

Copy link
Contributor

Thanks @adrian-sandu. I think so too!

srosanka added a commit that referenced this issue Jul 23, 2024
@yantosca
Copy link
Contributor

yantosca commented Sep 6, 2024

We can now close this issue now that PR #106 has been merged.

@yantosca yantosca closed this as completed Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrators Related to numerical integrators question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants