Skip to content
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b3bba30
[wip] start initializing tracer advection granule
DropD Feb 2, 2026
2108eda
[wip] work on advection granule init
DropD Feb 4, 2026
062d49f
add metric fields required for tracer advection
DropD Feb 5, 2026
77ffcab
[wip] add advection loop in driver and related changes
DropD Feb 12, 2026
c8809e4
fix missing future annotations
DropD Feb 12, 2026
b0ea1f8
Merge branch 'main' into ricoh-c34-tracer-advection
DropD Feb 13, 2026
a6ed178
ensure `test_standalone_driver` fails due to embedded remap
DropD Feb 13, 2026
f509aba
fix tracer advection init (pass `test_standalone_driver` with JW)
DropD Feb 17, 2026
0438f89
Merge branch 'main' into ricoh-c34-tracer-advection
DropD Feb 17, 2026
414eaad
typecheck standalone driver & fix revealed errors
DropD Feb 17, 2026
7f91a96
[wip] type check advection.py
DropD Feb 17, 2026
2ec8f48
type check advection_horizontal.py
DropD Feb 17, 2026
18770ac
type check advection_vertical.py
DropD Feb 18, 2026
8ffc8b6
type check advection_lsq_coeffs.py
DropD Feb 18, 2026
9ab9098
typecheck advection_states.py
DropD Feb 18, 2026
44778a6
type check advection stencils
DropD Feb 18, 2026
04d2ec1
type check standalone driver tests
DropD Feb 18, 2026
6a9f283
Merge branch 'main' into ricoh-c34-tracer-advection
DropD Feb 18, 2026
a06f90f
remove obsolete working notes and todos
DropD Feb 19, 2026
00076d9
initialize all prognostic states with empty tracers
DropD Feb 19, 2026
76d9765
Merge branch 'main' into ricoh-c34-tracer-advection
DropD Feb 19, 2026
f7c20a1
type check advection metrics comp, review cleanup
DropD Feb 19, 2026
f234014
cleanup icon variable suffixes
DropD Feb 19, 2026
dffb659
fix missing comma typo
DropD Feb 20, 2026
ca2cc74
update remaining PrognosticState constructor calls
DropD Feb 23, 2026
f04b506
Merge branch 'main' into ricoh-c34-tracer-advection
DropD Feb 23, 2026
23a6a43
stylistic fixes from review
DropD Feb 24, 2026
52c04fd
push backend customiztation out of advection classes
DropD Feb 24, 2026
79bdaa6
rename vpfloat_t -> anyfloat
DropD Feb 24, 2026
e9c9610
turn `compute_advection_deepatmo_fields` into a `ProgramFieldProvider`
DropD Feb 25, 2026
b618752
fix deepatmo field provider
DropD Feb 25, 2026
6e1b3cb
Merge branch 'main' into ricoh-c34-tracer-advection
DropD Feb 25, 2026
d1dd77f
reference known gt4py issues/prs for the related type ignores
DropD Feb 25, 2026
44c0575
improve standalone driver config documentation
DropD Feb 25, 2026
dd59b00
remove need to explicitly initialize tracer if ntracer=0
DropD Feb 25, 2026
3280d19
remove outdated todo comment and fix an error message
DropD Feb 26, 2026
a6e2f39
Merge branch 'main' into ricoh-c34-tracer-advection
DropD Feb 26, 2026
1e9a914
Merge branch 'main' into ricoh-c34-tracer-advection
DropD Feb 26, 2026
f5f106d
Merge branch 'main' into ricoh-c34-tracer-advection
DropD Feb 26, 2026
2d7676b
Merge branch 'main' into ricoh-c34-tracer-advection
DropD Feb 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@
apply_interpolated_tracer_time_tendency,
)
from icon4py.model.atmosphere.advection.stencils.copy_cell_kdim_field import copy_cell_kdim_field
from icon4py.model.common import dimension as dims, field_type_aliases as fa, type_alias as ta
from icon4py.model.common import (
dimension as dims,
field_type_aliases as fa,
model_backends,
type_alias as ta,
)
from icon4py.model.common.decomposition import definitions as decomposition
from icon4py.model.common.grid import horizontal as h_grid, icon as icon_grid
from icon4py.model.common.model_options import setup_program
Expand Down Expand Up @@ -98,10 +103,10 @@ class AdvectionConfig:
Contains necessary parameters to configure an advection run.
"""

def __post_init__(self):
def __post_init__(self) -> None:
self._validate()

def _validate(self):
def _validate(self) -> None:
"""Apply consistency checks and validation on configuration parameters."""

if not hasattr(HorizontalAdvectionType, self.horizontal_advection_type.name):
Expand Down Expand Up @@ -140,7 +145,7 @@ def run(
p_tracer_now: fa.CellKField[ta.wpfloat],
p_tracer_new: fa.CellKField[ta.wpfloat],
dtime: ta.wpfloat,
):
) -> None:
"""
Run an advection step.

Expand Down Expand Up @@ -198,7 +203,7 @@ def run(
p_tracer_now: fa.CellKField[ta.wpfloat],
p_tracer_new: fa.CellKField[ta.wpfloat],
dtime: ta.wpfloat,
):
) -> None:
log.debug("advection run - start")

log.debug("communication of prep_adv cell field: mass_flx_ic - start")
Expand Down Expand Up @@ -242,7 +247,10 @@ def __init__(
# density fields
#: intermediate density times cell thickness, includes either the horizontal or vertical advective density increment [kg/m^2]
self._rhodz_ast2 = data_alloc.zero_field(
self._grid, dims.CellDim, dims.KDim, allocator=self._backend
self._grid,
dims.CellDim,
dims.KDim,
allocator=model_backends.get_allocator(self._backend),
Copy link
Contributor

Choose a reason for hiding this comment

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

is it not enough to just specify self._backend without the get_allocator wrapper?

Copy link
Contributor

Choose a reason for hiding this comment

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

and same question for all of the other ones below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, because self._backend.allocator can be None, which leads to either type mismatches or a lot of checks for is not None or calls to get_allocator down the line.
It's a bit like the customize_backend, if we do it early on, we have to deal with fewer cases later.

)
self._determine_local_domains()
# stencils
Expand Down Expand Up @@ -277,7 +285,7 @@ def __init__(

log.debug("advection class init - end")

def _determine_local_domains(self):
def _determine_local_domains(self) -> None:
# cell indices
cell_domain = h_grid.domain(dims.CellDim)
self._start_cell_lateral_boundary = self._grid.start_index(
Expand All @@ -301,7 +309,7 @@ def run(
p_tracer_now: fa.CellKField[ta.wpfloat],
p_tracer_new: fa.CellKField[ta.wpfloat],
dtime: ta.wpfloat,
):
) -> None:
log.debug("advection run - start")

log.debug("communication of prep_adv cell field: mass_flx_ic - start")
Expand Down Expand Up @@ -410,9 +418,10 @@ def convert_config_to_horizontal_vertical_advection( # noqa: PLR0912 [too-many-
) -> tuple[advection_horizontal.HorizontalAdvection, advection_vertical.VerticalAdvection]:
exchange = exchange or decomposition.SingleNodeExchange()
assert exchange is not None, "Exchange runtime must not be None."
horizontal_limiter: advection_horizontal.HorizontalFluxLimiter | None
match config.horizontal_advection_limiter:
case HorizontalAdvectionLimiter.NO_LIMITER:
horizontal_limiter = advection_horizontal.HorizontalFluxLimiter()
horizontal_limiter = advection_horizontal.NoLimiter()
case HorizontalAdvectionLimiter.POSITIVE_DEFINITE:
horizontal_limiter = advection_horizontal.PositiveDefinite(
grid=grid,
Expand All @@ -423,6 +432,7 @@ def convert_config_to_horizontal_vertical_advection( # noqa: PLR0912 [too-many-
case _:
raise NotImplementedError("Unknown horizontal advection limiter.")

horizontal_advection: advection_horizontal.HorizontalAdvection
match config.horizontal_advection_type:
case HorizontalAdvectionType.NO_ADVECTION:
horizontal_advection = advection_horizontal.NoAdvection(grid=grid, backend=backend)
Expand All @@ -446,6 +456,7 @@ def convert_config_to_horizontal_vertical_advection( # noqa: PLR0912 [too-many-
case _:
raise NotImplementedError("Unknown horizontal advection type.")

vertical_limiter: advection_vertical.VerticalLimiter
match config.vertical_advection_limiter:
case VerticalAdvectionLimiter.NO_LIMITER:
vertical_limiter = advection_vertical.NoLimiter(grid=grid, backend=backend)
Expand All @@ -454,6 +465,7 @@ def convert_config_to_horizontal_vertical_advection( # noqa: PLR0912 [too-many-
case _:
raise NotImplementedError("Unknown vertical advection limiter.")

vertical_advection: advection_vertical.VerticalAdvection
match config.vertical_advection_type:
case VerticalAdvectionType.NO_ADVECTION:
vertical_advection = advection_vertical.NoAdvection(grid=grid, backend=backend)
Expand Down
Loading