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

Implement energy and water checker for YOG #53

Open
wants to merge 12 commits into
base: CAM-ML
Choose a base branch
from

Conversation

MarionBWeinzierl
Copy link
Collaborator

@MarionBWeinzierl MarionBWeinzierl commented Dec 11, 2024

This PR is an implementation of a water and energy conservation checker to investigate the conservation errors observed in #34 .

The implementation is based on lines 404ff in check_energy.F09.

The checker should be called at various places in nn_interface_cam.F90->n_convection_flux_CAM.

The output can be found in the atm.log.***.gz files.

@MarionBWeinzierl MarionBWeinzierl self-assigned this Dec 11, 2024
@MarionBWeinzierl MarionBWeinzierl marked this pull request as draft December 11, 2024 10:47
@MarionBWeinzierl
Copy link
Collaborator Author

MarionBWeinzierl commented Dec 20, 2024

The code runs through and gives the expected outputs, but both the energy and water sum for SAM seems to be off by a factor 100:
image

Might be an error in the parameters I hand in?

@MarionBWeinzierl MarionBWeinzierl marked this pull request as ready for review December 20, 2024 16:09
@MarionBWeinzierl
Copy link
Collaborator Author

MarionBWeinzierl commented Jan 8, 2025

The output of the built-in energy checker (not the new implementation) is:

  • actual value (energy/water)
  • expected value
  • change (in static energy/total water)
  • tendency (from boundary fluxes)
  • expected tendency
  • relative error

@MarionBWeinzierl
Copy link
Collaborator Author

MarionBWeinzierl commented Jan 8, 2025

OK, this is where the factor 100 comes from:

pres_int_cam, in the "before the conversion" call is in Pa (see

!! interface pressure [Pa] from the CAM model
f).

presi, as used for the "after conversion" part, is in hPa, see

!= unit hPa :: pres, presi
. It is explicitly converted to hecto Pascal in SAM_sounding_init:
presi(:) = presi(:) / 100.0
.

@jatkinson1000 jatkinson1000 force-pushed the issue34_yog_conservation branch from 2eb7c73 to 0b9a7f1 Compare January 9, 2025 15:21
@jatkinson1000 jatkinson1000 force-pushed the issue34_yog_conservation branch from 0b9a7f1 to 34c0ab3 Compare January 9, 2025 15:33
@MarionBWeinzierl
Copy link
Collaborator Author

Last time step with @jatkinson1000 's new changes:
image

We loose energy (increasing from 0.04% in the first iteration to 0.168% in the last), and we can a bit of energy. :-/

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.

2 participants