ClimaLand.jl icon indicating copy to clipboard operation
ClimaLand.jl copied to clipboard

Add implicit tendency for canopy temperature

Open kmdeck opened this issue 8 months ago • 0 comments

Purpose

Add implicit tendency for canopy temperature Address #696

There are two things I dont understand about this change:

  • there seem to be some times during the simultation where the error is always large, and a smaller dt doesnt help. For example, the 99th percentile error curve is almost flat. But most of the time, the error is small (the iterations converge within max_iters).
  • the derivative of SHF with respect to temperature is correct to a few percent, but the derivative of LHF with respect to temeperature is ~30% wrong. This is partly due to d_qsat/d_T errors (but Ive double checked that I entered the formula correct), but seems like it is also due to d_LHF/d_qsat. I think I have followed CLM exactly. Not sure why the error is large.

Results

With an explicit stepper, RK4, a test script at the Ozark site with the canopy alone permits dt = 60 [ac_canopy = 1e3]. Time to solution = 114 seconds - see kd/canopy_explicit_tests branch. Using dt = 180 fails. With an implicit stepper ARS111, updated jacobian every newton iteration, max_iters = 6, the same simulation can be run with dt=3600. Time to solution = 16 seconds. Using only a single iteration failed.

Accuracy as a function of timestep (ref solution = dt = 6, implicit solver) errors

In the global long run, on this branch: kd/canopy_explicit_global_nans I just changed the value of ac_canopy but left everything else the same as #main - i.e. using an explicit solver. The resulting map is almost entirely NaN [ look at time 86400]

On the implicit branch (this PR), we have no NaNs after one day. [ look at time 86400]

To-do

[X] Merge ClimaCore Branch [X] Test timestep improvement [X]Cleanup [X]Unit test Jacobian []Review

Content

  • Adds canopy temp to the list of implicitly stepped variables
  • Adds the canopy jacobian
  • Adds the canopy implicit tendency
  • updates scripts and some timesteps
  • adds a script testing timestep convergence, adds to buildkite
  • update docs Manifest to ClimaCore 0.14.11

  • [x] I have read and checked the items on the review checklist.

kmdeck avatar Jun 24 '24 23:06 kmdeck