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

Set thermo state iteration params #785

Closed
wants to merge 2 commits into from
Closed

Conversation

charleskawczynski
Copy link
Member

This PR changes our thermodynamic state iteration parameters to use

  • a maximum of 1 iteration
  • a tolerance of 3 K

@bischtob
Copy link
Contributor

bischtob commented Sep 2, 2022

are we ready? :)

@bischtob bischtob requested a review from szy21 September 2, 2022 21:54
Copy link
Contributor

@tapios tapios left a comment

Choose a reason for hiding this comment

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

LGTM if it passes tests. (And if it passes, can we make the tolerance even smaller, e.g., 2 K?)

@charleskawczynski
Copy link
Member Author

LGTM if it passes tests. (And if it passes, can we make the tolerance even smaller, e.g., 2 K?)

It's not passing / working with some experiments. The following break:

  • held suarez (ρe_tot) equilmoist topography
  • baroclinic wave (ρe_tot) equilmoist topography
  • Compresible single column EDMF DYCOMS_RF01

There are some behavioral changes in other examples, but those are non-blocking

@tapios
Copy link
Contributor

tapios commented Sep 2, 2022

LGTM if it passes tests. (And if it passes, can we make the tolerance even smaller, e.g., 2 K?)

It's not passing / working with some experiments. The following break:

  • held suarez (ρe_tot) equilmoist topography
  • baroclinic wave (ρe_tot) equilmoist topography
  • Compresible single column EDMF DYCOMS_RF01

There are some behavioral changes in other examples, but those are non-blocking

What does "break" mean here? (There may be small changes in those, of course. We do not have exact solutions for them.)

@charleskawczynski
Copy link
Member Author

What does "break" mean here? (There may be small changes in those, of course. We do not have exact solutions for them.)

We error in saturation adjustment, so the solution at the end of the iteration is larger than 3 K. Here's one example:

  | maxiter reached in saturation_adjustment:
  | Method=NewtonsMethod, e_int=28262.293520894877, ρ=1.134188857091223, q_tot=0.009, T=283.80521815319395, maxiter=1, tol=2152.518070462876
  | ERROR: LoadError: TaskFailedException
...

Our options seem to be:

  • Try further increasing the temperature tolerance
  • Try increasing maxiter
  • Thread these parameters throughout the model and expose them to the command line args and make them job dependent (we'd probably want to make these non-optional arguments so that we don't accidentally have inconsistent parameters)

That said, I suspect fixing #795 will give us a bigger performance gain than reducing the number of iterations alone. Are we sure that now is the best time to make this performance/accuracy trade-off? My recommendation would be to make these changes after things are a bit more stable--especially if twiddling this parameter impacts stability (which, IIRC, it did back when experimenting with this in TC, cc @yairchn)

@tapios
Copy link
Contributor

tapios commented Sep 2, 2022

  • Try further increasing the temperature tolerance
  • Try increasing maxiter
  • Thread these parameters throughout the model and expose them to the command line args and make them job dependent (we'd probably want to make these non-optional arguments so that we don't accidentally have inconsistent parameters)

Try to see if maxiter = 2 resolves this. If not, increase temperature tolerance.

That said, I suspect fixing #795 will give us a bigger performance gain than reducing the number of iterations alone. Are we sure that now is the best time to make this performance/accuracy trade-off?

The best time to make this change was a year ago; second best time is now. At high resolution, all will be waiting for the point with the slowest convergence...

@tapios
Copy link
Contributor

tapios commented Sep 2, 2022

A slightly bigger issue, which may affect accuracy, is that there's a term missing in the derivative of the saturation specific humidity. I'll add it sometime soon.

@tapios
Copy link
Contributor

tapios commented Sep 2, 2022

And one more point: The way this is usually done (and what we really should be doing) is to use the temperature at the previous time step as the initial condition for the iterations. I mentioned this a few times, and it got into the purity of code design. But is there any serious reason why we cannot pass in an initial guess for the iterations as an input argument, and use the previous time step temperature as that initial guess.

I guarantee with that we'll be fine with 1 iteration.

@charleskawczynski
Copy link
Member Author

And one more point: The way this is usually done (and what we really should be doing) is to use the temperature at the previous time step as the initial condition for the iterations. I mentioned this a few times, and it got into the purity of code design. But is there any serious reason why we cannot pass in an initial guess for the iterations as an input argument, and use the previous time step temperature as that initial guess.

I guarantee with that we'll be fine with 1 iteration.

We have an issue for it, I think it's just not been prioritized

@tapios
Copy link
Contributor

tapios commented Sep 2, 2022

Would be good to do. Given how much time we've spent discussing convergence issues, it'll probably pay quickly to get it done.

@trontrytel
Copy link
Member

This has gone a little stale. Do we still want those changes? @szy21 @charleskawczynski

@szy21
Copy link
Member

szy21 commented May 4, 2023

I think we want it but it just didn't work :(

@tapios
Copy link
Contributor

tapios commented May 5, 2023

We want maxiter = 1 in regular GCM runs. Are we still not doing this? If so, we should get to the bottom of it and finish it (with the previous stage/time step as initial guess). Again, this works in all other GCMs I know and should work for us.

@szy21
Copy link
Member

szy21 commented May 5, 2023

We want maxiter = 1 in regular GCM runs. Are we still not doing this? If so, we should get to the bottom of it and finish it (with the previous stage/time step as initial guess). Again, this works in all other GCMs I know and should work for us.

No, we are not doing this. I can look into it when I have some more time, unless someone else wants to.

@trontrytel
Copy link
Member

I can take this on. Since I have unearthed the Thermodynamics PRs

@szy21
Copy link
Member

szy21 commented May 5, 2023

I can take this on. Since I have unearthed the Thermodynamics PRs

haha, thanks!

@szy21 szy21 mentioned this pull request May 5, 2023
5 tasks
@charleskawczynski
Copy link
Member Author

Superseded by #1648

@charleskawczynski charleskawczynski deleted the ck/thermo_maxiter branch November 1, 2023 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants