m2lines / convection-parameterization-in-CAM

Deployment of the convection parameterization scheme (previously from within SAM) deployed into the CAM model
MIT License
3 stars 2 forks source link

Regridding Tests #82

Open jatkinson1000 opened 1 month ago

jatkinson1000 commented 1 month ago

This is a sub-issue of #64 specifically focussing on the regridding tests.

A plan of action is to:

jatkinson1000 commented 1 month ago

The test test_interp_to_cam_match currently is a specialised test where the CAM and SAM grids are identical AND we use density of 1.0 across the entire column. We then test that all interpolated cells have a density of 1.0.

We could write a more generic test that takes cells with variable density, but checks that total mass is conserved between columns (by summing var_cam and var_sam across the height). This approach could be used in other subsequent tests as well.

jatkinson1000 commented 1 month ago

At the moment we always assume the CAM interface pressure is equal to the bottom pressure of the column. Can we test when this is not the case in a separate test perhaps?

jatkinson1000 commented 1 month ago

We currently have interpolation tests for matching SAM and CAM grids, and for when CAM is finer than SAM.

We need to add a test for when CAM is coarser than SAM (and extends higher?) as this is the realistic case we are dealing with.

jatkinson1000 commented 1 month ago

Some variables could be made module variables and better documented:

jatkinson1000 commented 1 month ago

The setup of the coarse grids in some tests using a reshape is very unintuitive. It would be much better to do so using a loop over column levels and setting the values at each level. e.g. https://github.com/m2lines/convection-parameterization-in-CAM/blob/1adf4ce02eeda6d78c48577211fcfa1d1c783962/tests/test_CAM_interface/test_cam_interface.F90#L78C1-L78C124

AdelekeBankole commented 1 week ago

Some variables could be made module variables and better documented:

  • 4 could be replaced by num_cols and applied to all tests as a module variable.

This was addressed in the earlier commit.

AdelekeBankole commented 1 week ago

The setup of the coarse grids in some tests using a reshape is very unintuitive. It would be much better to do so using a loop over column levels and setting the values at each level. e.g. https://github.com/m2lines/convection-parameterization-in-CAM/blob/1adf4ce02eeda6d78c48577211fcfa1d1c783962/tests/test_CAM_interface/test_cam_interface.F90#L78C1-L78C124

This was also addressed.