Skip to content

Update solver in CTSM #2422

Open
0 of 1 issue completed
Open

Description

@ekluzek

We need to update the decades old quadratic solver used in CTSM.

@briandobbins

Definition of Done:

  • Change the solver out in FATES (use code freely availble from the Navy)
  • Remove the LUNA instance of quadratic, to use Quadratic under utils
  • Update the solver code in quadratic so that it's independent of copyrighted solutions
  • Also handle the tridiagonal solver
  • Handle the Brent solver

Activity

  1. added
    enhancementnew capability or improved behavior of existing capability
    code healthimproving internal code structure to make easier to maintain (sustainability)
    on Mar 14, 2024
  2. added this to the CESM3 milestone on Mar 14, 2024
  3. ekluzek commented on Mar 14, 2024

    @ekluzek
    ContributorAuthor

    In ctsm5.1.dev173, a new Navy solver was brought in. We might as well use it for both FATES and non-FATES.

    See here...

    https://github.com/NGEET/fates/blob/main/main/FatesUtilsMod.F90

  4. added
    nextthis should get some attention in the next week or two. Normally each Thursday SE meeting.
    on Mar 14, 2024
  5. ekluzek commented on Mar 14, 2024

    @ekluzek
    ContributorAuthor

    In discussion this morning, we thought a better solution would be to copy the code to the CESM share code.

    If we have CTSM use FATES we end up with a double dependency in both directions which is bad. In this case it's a simple utility layer of FATES, so not as intertwined into FATES as other FATES layers.

    The problem here is that fates_log() is being used as part of FatesGlobals, so we could NOT use it directly in CTSM.

  6. removed
    nextthis should get some attention in the next week or two. Normally each Thursday SE meeting.
    on Mar 14, 2024
  7. ekluzek commented on Mar 14, 2024

    @ekluzek
    ContributorAuthor

    @rgknox our plan right now is to copy it to share code and then have a CTSM update that points to the new share version with it in it. Let us know thoughts on that.

  8. rgknox commented on Mar 15, 2024

    @rgknox
    Contributor

    hmmm, I'm sure there is some way to make this work. If we call these routines in FATES from the share, than this needs to be in the shared code for ELM and NORESM as well.

  9. ekluzek commented on Mar 15, 2024

    @ekluzek
    ContributorAuthor

    Yes exactly. We weren't sure if they use the same share version or not. I'm guessing that ELM likely has their own version of share? But, we thought NORESMF might use the same one as CESM. Could you check?

  10. ekluzek commented on Mar 15, 2024

    @ekluzek
    ContributorAuthor

    In order to get this to work so that we'd share it from FATES, we'd need to do something like have a directory under FATES for a utility layer that doesn't allow use of ANY other FATES code. So for example here, the use of fates_log() would be replaced by passing the log unit into the subroutine. The rule for that directory would be that anything in that directory is completely independent of FATES.

    We do always build with FATES -- we just don't always initialize FATES -- so we can't be using higher level FATES subroutines and objects in non-FATES CTSM. So we'd need a directory that's independent.

    The other way to do it would be to have a new share external that all FATES models would use. That would also work, but would be adding in something new, that would take a bit of organizing around.

    @adrifoster what do you think about this idea?

  11. mvdebolskiy commented on Mar 15, 2024

    @mvdebolskiy
    Contributor

    @rgknox we are checking out a fork of the CESM_share in NORESM. So there is no problem to pull from the upstream for us.

  12. added theissue type on Feb 18, 2026
  13. added
    nextthis should get some attention in the next week or two. Normally each Thursday SE meeting.
    on Feb 18, 2026
  14. ekluzek commented on Feb 18, 2026

    @ekluzek
    ContributorAuthor

    Bringing this up again, as we want to make sure the update won't change answers. If it does change answers we'll want it in right away.

  15. 1 remaining item

  16. samsrabin commented on Feb 19, 2026

    @samsrabin
    Member

    Per SE meeting today, this doesn't change answers.

  17. removed
    nextthis should get some attention in the next week or two. Normally each Thursday SE meeting.
    on Feb 19, 2026
  18. wwieder commented on Oct 1, 2026

    @wwieder
    Contributor

    There's no PR for this. @briandobbins and @ekluzek what is the last acceptable deadline for this?

  19. ekluzek commented on Oct 1, 2026

    @ekluzek
    ContributorAuthor

    This is something that just makes lawyers happy, and it sounds like @briandobbins wanted it in for the cesm3_0_release. So that we don't have it visible in one of our big model releases.

  20. wwieder commented on Oct 2, 2026

    @wwieder
    Contributor

    OK, do we have a PR that we can test and slot in quickly?

  21. ekluzek commented on Oct 10, 2026

    @ekluzek
    ContributorAuthor

    I started some work on this Thursday, and have a PR now for this. It turns out the Quadratic formulation wasn't written up as code in NR, and the math isn't copyrightable. From Claude (and others) it looks like merely changing comments and variable names isn't sufficient, you have to do a more substantial rewrite. But, using the same alogrithm and formulas there's only so much that can be done to show the code is different.

  22. ekluzek commented on Oct 10, 2026

    @ekluzek
    ContributorAuthor

    In looking for references for this, I realized that the Tridiagonal solver is also from NR. So it needs to be handled as well.

  23. ekluzek commented on Oct 10, 2026

    @ekluzek
    ContributorAuthor

    And it looks like the Brent solver in Photosynthesis is likely from NR, so may need to be handled. The version we have is highly customized for CLM, so will take some evaluation to determine if it's OK or not.

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

Metadata

Metadata

Assignees

Labels

code healthimproving internal code structure to make easier to maintain (sustainability)enhancementnew capability or improved behavior of existing capability

Type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions