Skip to content

Better support for zenith angle in Insolation process objects#235

Merged
brian-rose merged 21 commits intoclimlab:mainfrom
brian-rose:more-coszen
Feb 27, 2025
Merged

Better support for zenith angle in Insolation process objects#235
brian-rose merged 21 commits intoclimlab:mainfrom
brian-rose:more-coszen

Conversation

@brian-rose
Copy link
Copy Markdown
Collaborator

Finishes closing #208

@brian-rose brian-rose linked an issue Jan 17, 2025 that may be closed by this pull request
@brian-rose
Copy link
Copy Markdown
Collaborator Author

brian-rose commented Jan 17, 2025

Still to do:

@brian-rose
Copy link
Copy Markdown
Collaborator Author

Realized that to fully support the different averaging options for coszen, we will need to modify climlab-rrtmg. The reason is that RRTMG_SW only supports scalar values for its equivalent of the irradiance factor (called adjes in RRTMG_SW code).

@brian-rose
Copy link
Copy Markdown
Collaborator Author

climlab-rrtmg v0.3 with support for non-uniform irradiance factors has now been released on conda-forge.

@brian-rose
Copy link
Copy Markdown
Collaborator Author

972721e pins the build environment to climlab-rrtmg v0.3 until #240 is solved.

@brian-rose
Copy link
Copy Markdown
Collaborator Author

Now there are a lot of tests failing for a new reason that seems to be connected to the implicit diffusion solver. I think this is a numpy v2 issue.

@brian-rose
Copy link
Copy Markdown
Collaborator Author

Lots of tests fail at one particular point: line 428 of climlab.dynamics.adv_diff_numerics which is the call to numpy.linalg.solve.

The error looks like variations on this:

ValueError: solve: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (m,m),(m,n)->(m,n) (size 1 is different from 90)

Something must have changed in the broadcasting rules for numpy.linalg.solve.

@brian-rose
Copy link
Copy Markdown
Collaborator Author

On this doc page I found

Changed in version 2.0: The b array is only treated as a shape (M,) column vector if it is exactly 1-dimensional. In all other instances it is treated as a stack of (M, K) matrices. Previously b would be treated as a stack of (M,) vectors if b.ndim was equal to a.ndim - 1.

@brian-rose
Copy link
Copy Markdown
Collaborator Author

One test climlab.tests.test_cam3rad.test_rce_radiative_forcing was failing mysteriously with an apparent energy imbalance. Some investigation revealed that a single-column RCE model with CAM3 radiation and Manabe water vapor was falling into a numerical oscillation of the temperature and moisture that led to a few W/m2 differences in the OLR at each timestep.

I haven't been able to understand why this oscillation suddenly appears in this PR, when this PR doesn't touch any of the relevant code. But simply cutting the timestep in half from 24 hours to 12 hours in that set of tests makes the problem go away, so that's what we're doing now.

Down to one single failing test about coszen stuff.

@brian-rose brian-rose merged commit deba7ec into climlab:main Feb 27, 2025
1 of 7 checks passed
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.

Can't independently specify insolation and solar zenith angle

1 participant