Skip to content

GF-2020 Convection Parameterization#15

Merged
FlorianDeconinck merged 72 commits into
dsl/feature/moist/UW_and_GFDL1Mfrom
fdeconinck/feat/pyMoist_infra
Apr 27, 2026
Merged

GF-2020 Convection Parameterization#15
FlorianDeconinck merged 72 commits into
dsl/feature/moist/UW_and_GFDL1Mfrom
fdeconinck/feat/pyMoist_infra

Conversation

@CharlesKrop
Copy link
Copy Markdown
Collaborator

This PR contains the NDSL port of the Grell-Freitas convection parameterization parameterization. Translate tests show numerical equivalence between Fortran and NDSL at individual time steps for SCM experiments bomex and armtwp-ice, as well as a test case GCM run with C24L72 resolution. This code has been tested using data from GEOS v11.5.2 and v11.8.1, with the current implementation aligning with then v11.8.1 Fortran code. This data is available on the data share at /css/astg/smt/geos-fp/v11.8.1, with further sorting based on cpu architecture and compiler.

Important note: some code paths remain unimplemented - only those needed to run the aforementioned suite of test cases were ported. All non-implemented code paths are protected with initialization and runtime error that prevent computation, as are the configuration options which lead to calling unimplemented code.

CharlesKrop and others added 30 commits March 24, 2026 13:03
…s (using dace instead of debug backend) and updated a few comments to reflected changes to translate test names
We've been tracking (in git) an empty vscode config and a temp graph
from dace. This commit removes both files and

- moves the `.vscode/` ignore "up" to the grid comp
- adds `_dacegraphs/` to the ignore paths because it will only ever
  contain invalid/failed dace graphs for debugging.
* GF2020: fix typos

* fix typo in README
Fix access of `updraft_lfc_level` inside `ensemble_forcing_mid_plume`.
* unrelated: fall back to default number of tracers

* unrelated: namelist is unused in `TestCore`

* unrelated: fixing typos in GF_2020

* unrelated: fixing typos (2) in GF2020

* unrelated: start_level and lcl_level are both 2d

* unrelated: unused variables

* unrelated: cleanup dzh temporary

The temprory `dzh` is only used in that scope and can be (manually)
scalarized. No need to have an IJ-Field.

* fix: manually inline `cap_max_internal` in the right computation

`cap_max_internal` might be read before written (in case `MOIST_TRIGGER`
is not `1`). DaCe wronly scalarizes the variable into both (previous)
computation blocks. That leads to a potential read of undefined memory
in the later computation block. Manually scoping `cap_max_internal` to
the later block ensures that an initial value is written before the
variable is read the first time.

This is only a temp fix. I'll go debug the DaCe scalarization ...

* GF2020: fix for DowndraftWindShear

* GF2020: fix for DowndraftWindShear

* cleanup: don't pass unused arguments

---------

Co-authored-by: Charles Kropiewnicki <charles.j.krop@gmail.com>
* fix/cleanup GF translate tests

This PR fixes and cleans up translate tests of GF2020. The things you
will find in this PR are:

1. Fix cumulus parametrization (args of `StaticControl`)
2. Clean up tests by not passing `namelist` down to `TestCore` if
   it isn't used there.
3. Fix some translate tests (e.g. GF2020) that were initializing
   `TranslateFortranData2Py` with `namelist`. `namelist` has never been
   an argument of that base class.
4. Cleaning up tests by not overloading `self.stencil_factory` in the
   subclass (the baseclass already assigns, given the right arguments
   are passed to the base class (see 3)).

* fix / cleanup GFDL_1M translate tests

This commit changes the translate tests of the GFDL_1M microphysics
code. In particular, this PR

1. fixes tests that were initiliazing `TranslateFortranData2Py` with a
   namelist argument (there is no such argument).
2. cleans up translate tests that were shadowing `self.stencil_factory`
   in the subclasse (already done in the base class).
… agree with the fortran (consistently about 0.5 degrees C too cold after the first day or so)
CharlesKrop and others added 23 commits April 9, 2026 09:48
…020 and GF2020_Setup tests (after they were removed form the savepoint). changed the data source for the GF2020_Finalize savepoint for those two fields
…ncils, with the execution hidden behind an existance check
unlike microphysics, gf convection takes a level (pbl_level) from the model state. this level must be adjusted by one to python indexing before the python runs, then back to fortran indexing before it is passed back to the rest of the state
…s doing if (X and Y): breaks when x or why is a boolean. Error: "ValueError: Arithmetic expression is not allowed in boolean operation."
… as these fields are integers (albiet always 0 or 1) and not booleans
Copy link
Copy Markdown
Owner

@FlorianDeconinck FlorianDeconinck left a comment

Choose a reason for hiding this comment

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

We have to figure out the E501, then a few clean up

@FlorianDeconinck FlorianDeconinck merged commit e6bda09 into dsl/feature/moist/UW_and_GFDL1M Apr 27, 2026
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.

3 participants