ICON dynamical core.
Project description
icon4py-atmosphere-dycore
Description
Contains code ported from ICON src/atm_dyn_iconam, which is the dynamical core of the ICON model.
Treatment of stencils operating on different vertical levels
Variables in ICON can either sit on full levels or half levels. Let's denote the number of full levels is nlev. Full-level variables have nlev levels in vertical dimension, while half-level variables have nlev+1 in vertical dimension. When running a GT4Py program over nlev+1 levels, do not output full-level and half-level variables together in a field_operator until the upper vertical bound of nlev+1 because the nlev+1 level will also be written for a full-level variable, which is out-of-bounds. The following code is an example:
@field_operator
def _foo(
input_var: CellKField[wpfloat],
k_field: KField[wpfloat],
nlev: int32,
) -> tuple[CellKField[wpfloat], CellKField[wpfloat]]:
(half_level_var, full_level_var) = where(
(k_field >= 0) & (k_field < nlev),
_compute_var(input_var),
(half_level_var, full_level_var),
)
half_level_var = where(k_field == nlev, _init_cell_kdim_field_with_zero_vp(), half_level_var)
return half_level_var, full_level_var
@program
def foo(
input_var: CellKField[wpfloat],
k_field: KField[wpfloat],
nlev: int32,
full_level_var: CellField[wpfloat],
half_level_var: CellField[wpfloat],
horizontal_start: int32,
horizontal_end: int32,
vertical_start: int32,
vertical_end: int32,
) -> None:
_foo(
input_var,
k_field,
nlev,
out=(half_level_var, full_level_var),
domain={
CellDim: (horizontal_start, horizontal_end),
KDim: (vertical_start, vertical_end),
}
)
)
foo(
input_var=input_var,
full_level_var=full_level_var,
half_level_var=half_level_var,
k_field=k_field,
nlev=nlev,
horizontal_start=start_cell,
horizontal_end=end_cell,
vertical_start=0,
vertical_end=nlev + 1,
offset_provider={},
)
Here is a fix to the example above:
@program
def foo(
input_var: CellKField[wpfloat],
full_level_var: CellField[wpfloat],
half_level_var: CellField[wpfloat],
horizontal_start: int32,
horizontal_end: int32,
vertical_start: int32,
vertical_end: int32,
) -> None:
_compute_var(
input_var,
out=(half_level_var, full_level_var),
domain={
CellDim: (horizontal_start, horizontal_end),
KDim: (vertical_start, vertical_end - 1),
}
)
_init_cell_kdim_field_with_zero_vp(
out=half_level_var,
domain={
CellDim: (horizontal_start, horizontal_end),
KDim: (vertical_end - 1, vertical_end),
}
)
)
foo(
input_var=input_var,
full_level_var=full_level_var,
half_level_var=half_level_var,
horizontal_start=start_cell,
horizontal_end=end_cell,
vertical_start=0,
vertical_end=nlev + 1,
offset_provider={},
)
In the fix above, the original field_operator _foo is removed and the GT4Py program directly calls _compute_var and _init_cell_kdim_field_with_zero_vp separately with different vertical bounds.
The illegal access to nlev+1 level of the full-level variable can thus be avoided by calling _compute_var with vertical bounds of (0, nlev).
The computation on nlev+1 level half_level_var = where(k_field == nlev, _init_cell_kdim_field_with_zero_vp(), half_level_var) in the removed field_operator _foo is instead performed explicitly by calling _init_cell_kdim_field_with_zero_vp with another vertical bounds of (nlev, nlev+1).
Installation instructions
Check the README.md at the root of the model folder for installation instructions.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file icon4py_atmosphere_dycore-0.2.0.tar.gz.
File metadata
- Download URL: icon4py_atmosphere_dycore-0.2.0.tar.gz
- Upload date:
- Size: 61.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0c7f922da1c74edbfdb682bc7ea80a83b0bcea04d8b73c6096214f448e494d8
|
|
| MD5 |
d45eff0f5ce20f172186fe762c3f9510
|
|
| BLAKE2b-256 |
d2e1ede8301d28e0f50fec5e26360b5fcbdb26e38275c8448d8bbd4759820439
|
Provenance
The following attestation bundles were made for icon4py_atmosphere_dycore-0.2.0.tar.gz:
Publisher:
pypi-deploy.yml on C2SM/icon4py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
icon4py_atmosphere_dycore-0.2.0.tar.gz -
Subject digest:
a0c7f922da1c74edbfdb682bc7ea80a83b0bcea04d8b73c6096214f448e494d8 - Sigstore transparency entry: 1718919729
- Sigstore integration time:
-
Permalink:
C2SM/icon4py@28d32c45afb4dbea1da6b6e5170202f08b4adb88 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/C2SM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-deploy.yml@28d32c45afb4dbea1da6b6e5170202f08b4adb88 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file icon4py_atmosphere_dycore-0.2.0-py3-none-any.whl.
File metadata
- Download URL: icon4py_atmosphere_dycore-0.2.0-py3-none-any.whl
- Upload date:
- Size: 120.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d6d6164bab5cb3492da660ada17a929c9d1a9a2238b254f848482c244f3359d
|
|
| MD5 |
3d6695eb33d17b16a53d949f831b77c8
|
|
| BLAKE2b-256 |
e427a8b661c829a5348e75c33bce613196ab91014ffb19f10da60c7e45bc363b
|
Provenance
The following attestation bundles were made for icon4py_atmosphere_dycore-0.2.0-py3-none-any.whl:
Publisher:
pypi-deploy.yml on C2SM/icon4py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
icon4py_atmosphere_dycore-0.2.0-py3-none-any.whl -
Subject digest:
7d6d6164bab5cb3492da660ada17a929c9d1a9a2238b254f848482c244f3359d - Sigstore transparency entry: 1718919860
- Sigstore integration time:
-
Permalink:
C2SM/icon4py@28d32c45afb4dbea1da6b6e5170202f08b4adb88 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/C2SM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-deploy.yml@28d32c45afb4dbea1da6b6e5170202f08b4adb88 -
Trigger Event:
workflow_dispatch
-
Statement type: