Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -18,6 +18,7 @@
import gt4py.next as gtx
import gt4py.next.typing as gtx_typing

from icon4py.model.atmosphere.advection import advection, advection_states
from icon4py.model.atmosphere.diffusion import diffusion, diffusion_states
from icon4py.model.atmosphere.dycore import dycore_states, solve_nonhydro as solve_nh
from icon4py.model.common import (
Expand Down Expand Up @@ -156,14 +157,12 @@ def initialize_granules(
vertical_grid: v_grid.VerticalGrid,
diffusion_config: diffusion.DiffusionConfig,
solve_nh_config: solve_nh.NonHydrostaticConfig,
advection_config: advection.AdvectionConfig,
static_field_factories: driver_states.StaticFieldFactories,
exchange: decomposition_defs.ExchangeRuntime,
owner_mask: fa.CellField[bool],
backend: model_backends.BackendLike,
) -> tuple[
diffusion.Diffusion,
solve_nh.SolveNonhydro,
]:
) -> tuple[diffusion.Diffusion, solve_nh.SolveNonhydro, advection.Advection]:
geometry_field_source = static_field_factories.geometry_field_source
interpolation_field_source = static_field_factories.interpolation_field_source
metrics_field_source = static_field_factories.metrics_field_source
Expand Down Expand Up @@ -342,7 +341,44 @@ def initialize_granules(
owner_mask=owner_mask,
)

return diffusion_granule, solve_nonhydro_granule
advection_granule = advection.convert_config_to_advection(
grid=grid,
backend=backend,
config=advection_config,
interpolation_state=advection_states.AdvectionInterpolationState(
geofac_div=interpolation_field_source.get(interpolation_attributes.GEOFAC_DIV),
rbf_vec_coeff_e=interpolation_field_source.get(
interpolation_attributes.RBF_VEC_COEFF_E
),
pos_on_tplane_e_1=interpolation_field_source.get(
interpolation_attributes.POS_ON_TPLANE_E_X
),
pos_on_tplane_e_2=interpolation_field_source.get(
interpolation_attributes.POS_ON_TPLANE_E_Y
),
),
least_squares_state=advection_states.AdvectionLeastSquaresState(
# TODO(ricoh): [c34] initialize with zero, check if works
lsq_pseudoinv_1=data_alloc.constant_field(
grid, 0.0, dims.CellDim, dims.C2E2CDim, allocator=backend
),
lsq_pseudoinv_2=data_alloc.constant_field(
grid, 0.0, dims.CellDim, dims.C2E2CDim, allocator=backend
),
),
metric_state=advection_states.AdvectionMetricState(
# TODO(ricoh): [c34] DEEPATMO_XYZ don't exist yet
deepatmo_divh=metrics_field_source.get(metrics_attributes.DEEPATMO_DIVH),
deepatmo_divzl=metrics_field_source.get(metrics_attributes.DEEPATMO_DIVZL),
deepatmo_divzu=metrics_field_source.get(metrics_attributes.DEEPATMO_DIVZU),
ddqz_z_full=metrics_field_source.get(metrics_attributes.DDQZ_Z_FULL),
),
edge_params=edge_geometry,
cell_params=cell_geometry,
exchange=exchange,
)

return diffusion_granule, solve_nonhydro_granule, advection_granule


def find_maximum_from_field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from gt4py.next import config as gtx_config, metrics as gtx_metrics

import icon4py.model.common.utils as common_utils
from icon4py.model.atmosphere.advection import advection
from icon4py.model.atmosphere.diffusion import diffusion, diffusion_states
from icon4py.model.atmosphere.dycore import dycore_states, solve_nonhydro as solve_nh
from icon4py.model.common import dimension as dims, model_backends, model_options, type_alias as ta
Expand Down Expand Up @@ -46,6 +47,7 @@ def __init__(
static_field_factories: driver_states.StaticFieldFactories,
diffusion_granule: diffusion.Diffusion,
solve_nonhydro_granule: solve_nh.SolveNonhydro,
advection_granule: advection.Advection, # NOTE(ricoh): [c34] wip
):
self.config = config
self.backend = backend
Expand All @@ -54,6 +56,7 @@ def __init__(
self.diffusion = diffusion_granule
self.solve_nonhydro = solve_nonhydro_granule
self.model_time_variables = driver_states.ModelTimeVariables(config=config)
self.tracer_advection = advection_granule # NOTE (ricoh): [c34] wip
self.timer_collection = driver_states.TimerCollection(
[timer.value for timer in driver_states.DriverTimers]
)
Expand Down Expand Up @@ -175,6 +178,9 @@ def _integrate_one_time_step(
)
timer_diffusion.capture()

# NOTE (ricoh): [c34] something like
# NOTE (ricoh): self.tracer_advection.run(...) # pass list of tracers (or by default step all of the initialized ones)

prognostic_states.swap()

def _update_time_levels_for_velocity_tendencies(
Expand Down Expand Up @@ -470,6 +476,7 @@ def _read_config(
driver_config.DriverConfig,
v_grid.VerticalGridConfig,
diffusion.DiffusionConfig,
advection.AdvectionConfig,
solve_nh.NonHydrostaticConfig,
]:
vertical_grid_config = v_grid.VerticalGridConfig(
Expand All @@ -492,6 +499,14 @@ def _read_config(
velocity_boundary_diffusion_denom=200.0,
)

# TODO (ricoh): [c34] check config correctness
advection_config = advection.AdvectionConfig(
horizontal_advection_limiter=advection.HorizontalAdvectionLimiter.NO_LIMITER,
horizontal_advection_type=advection.HorizontalAdvectionType.LINEAR_2ND_ORDER,
vertical_advection_limiter=advection.VerticalAdvectionLimiter.NO_LIMITER,
vertical_advection_type=advection.VerticalAdvectionType.UPWIND_1ST_ORDER,
)

nonhydro_config = solve_nh.NonHydrostaticConfig(
fourth_order_divdamp_factor=0.0025,
)
Expand All @@ -514,6 +529,7 @@ def _read_config(
icon4py_driver_config,
vertical_grid_config,
diffusion_config,
advection_config,
nonhydro_config,
)

Expand Down Expand Up @@ -569,9 +585,11 @@ def initialize_driver(
allocator = model_backends.get_allocator(backend)

log.info("Initializing the driver")
driver_config, vertical_grid_config, diffusion_config, solve_nh_config = _read_config(
output_path=output_path,
enable_profiling=False,
driver_config, vertical_grid_config, diffusion_config, advection_config, solve_nh_config = (
_read_config(
output_path=output_path,
enable_profiling=False,
)
)

log.info(f"initializing the grid manager from '{grid_file_path}'")
Expand Down Expand Up @@ -616,11 +634,13 @@ def initialize_driver(
(
diffusion_granule,
solve_nonhydro_granule,
advection_granule, # NOTE(ricoh): [c34] wip
) = driver_utils.initialize_granules(
grid=grid_manager.grid,
vertical_grid=vertical_grid,
diffusion_config=diffusion_config,
solve_nh_config=solve_nh_config,
advection_config=advection_config,
static_field_factories=static_field_factories,
exchange=exchange,
owner_mask=gtx.as_field(
Expand All @@ -637,6 +657,7 @@ def initialize_driver(
static_field_factories=static_field_factories,
diffusion_granule=diffusion_granule,
solve_nonhydro_granule=solve_nonhydro_granule,
advection_granule=advection_granule,
)

return icon4py_driver