Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split vertical and horizontal grid #593

Draft
wants to merge 142 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
142 commits
Select commit Hold shift + click to select a range
51bd673
WIP
halungge Jun 27, 2024
2270522
add backend to metric_fields stencils
halungge Jun 27, 2024
0bf8d18
ugly version that works for gtfn programs
halungge Jun 27, 2024
b78b24f
use operator.add instead of lambda
halungge Jul 1, 2024
faa931a
merge main
halungge Aug 8, 2024
5836a32
reduce dependencies, move ProgramFieldProvider out of Factory
halungge Aug 8, 2024
6f3e6c6
rename fields
halungge Aug 9, 2024
6d99a17
Merge branch 'main' into prototype_fields_factory
halungge Aug 14, 2024
21c744b
move factory.py to states package
halungge Aug 15, 2024
bf7dc7e
remove duplicated computation of wgtfacq_c_dsl
halungge Aug 15, 2024
d07fef2
fix type annotations for arrays
halungge Aug 15, 2024
8bb63f6
add type annotations to compute_vwind_impl_wgt.py
halungge Aug 15, 2024
a9b0b54
FieldProvider for numpy functions (WIP I)
halungge Aug 16, 2024
dc809e8
merge main
halungge Aug 16, 2024
ffb4661
first version for numpy functions
halungge Aug 16, 2024
9f042b1
fix: move _unallocated to ProgramFieldProvider
halungge Aug 20, 2024
809f060
move joint functionality into FieldProvider
halungge Aug 20, 2024
bcd65b5
- switch to device dependent import in compute_wgtfacq.py
halungge Aug 20, 2024
52a837d
add type annotation to connectivity
halungge Aug 21, 2024
72e742b
handle numpy field with connectivity
halungge Aug 21, 2024
d93c570
merge main
halungge Aug 27, 2024
fba0891
add type to get_processor_properties argument
halungge Aug 28, 2024
c2c250a
add c_lin_e metadata
halungge Aug 28, 2024
04645e0
start_index, end_index abstraction for vertical (WIP)
halungge Aug 28, 2024
306b761
basic sample of factory.
halungge Aug 28, 2024
cec01f9
fix with_allocator function
halungge Aug 29, 2024
57bf95d
update with upstrean
nfarabullini Sep 3, 2024
966abbd
update with upstrean
nfarabullini Sep 3, 2024
aa2c402
ran pre-commit and made fixes
nfarabullini Sep 3, 2024
afe3f47
small edit
nfarabullini Sep 3, 2024
df8ba00
Merge branch 'main' into prototype_fields_factory
halungge Sep 5, 2024
8f8d8de
using domains for the compute domain in factory
halungge Sep 5, 2024
cb65d6a
grid manager changes from halo construction branch
halungge Sep 6, 2024
a3481c5
remove function for halo construction form grid manager
halungge Sep 6, 2024
307fead
simplify test_refinement.py
halungge Sep 6, 2024
cde98d0
remove unused code from grid_manager.py
halungge Sep 6, 2024
31d1605
restructure GridFileName s
halungge Sep 6, 2024
1d0df1b
fix refinement control fields
halungge Sep 10, 2024
e1ec531
add docstring to Providers
halungge Sep 10, 2024
8e1f1b9
clean up tests (1)
halungge Sep 10, 2024
073bc3b
remove unnecessary constants
halungge Sep 10, 2024
1ec0b5a
use more conisistent naming in tests
halungge Sep 12, 2024
0dcced3
remove run function
halungge Sep 13, 2024
130e2e9
Merge branch 'main' into cleanup_grid_manager
halungge Sep 13, 2024
62c21ae
separate vertical and horizontal connectivities
halungge Sep 13, 2024
f98f8dc
pre-commit
halungge Sep 13, 2024
6a4f133
move previous refinement ctrl class and refactor level look up.
halungge Sep 13, 2024
09c91f7
move previous refinement ctrl class and refactor level look up.
halungge Sep 13, 2024
6cae7e9
Merge branch 'main' into cleanup_grid_manager
halungge Sep 17, 2024
110bec6
Merge branch 'main' into prototype_fields_factory
halungge Sep 17, 2024
03b289f
convert static method into module method
halungge Sep 18, 2024
abbf34c
merge grid_manager clean up
halungge Sep 18, 2024
0386ce1
remove some unused and duplicates from serialbox_utils
halungge Sep 19, 2024
5e0bdee
move simple stencils to math
halungge Sep 19, 2024
8cdcea6
merge main
halungge Sep 19, 2024
62d2098
remove obsolete notes, fix typos add test for edge_are
halungge Sep 19, 2024
afc7a49
add tests
halungge Sep 19, 2024
1e4a20f
Merge branch 'main' into prototype_fields_factory
halungge Sep 24, 2024
7db2b24
merge main
halungge Sep 24, 2024
ccaaf31
fix lat, lon confusion
halungge Sep 25, 2024
1e0dce0
fix import from merge
halungge Sep 25, 2024
ff6d9de
add validating tests for f_e, edge_area: update of read vs compute
halungge Sep 25, 2024
57c039e
WIP
halungge Sep 27, 2024
e697cc8
Merge branch 'main' into prototype_fields_factory
halungge Sep 27, 2024
8c7b782
Merge branch 'main' into prototype_fields_factory
halungge Oct 1, 2024
e417fd1
add types for metadata attributes
halungge Oct 2, 2024
75bda6d
fix int32 issues (ad hoc fix)
halungge Oct 2, 2024
f978d72
rename providers, fixes in FieldProvider Protocol
halungge Oct 2, 2024
e635e3d
add FieldSource Protocol
halungge Oct 3, 2024
fef2ced
fix doc strings, pre-commit
halungge Oct 3, 2024
1d7abf5
Merge branch 'main' into prototype_fields_factory
halungge Oct 4, 2024
02cce48
add documentation
halungge Oct 4, 2024
6484fcc
Merge branch 'main' into grid_geometry
halungge Oct 4, 2024
dea3856
primal normal cell (WIP)
halungge Oct 8, 2024
2deef2a
compute edgeparams (WIP)
halungge Oct 9, 2024
70063a7
move FieldSource protocol
halungge Oct 10, 2024
6195edc
tests with grid file coordinates
halungge Oct 10, 2024
e5c0e7e
add metadata for grid file coordinates
halungge Oct 10, 2024
f431f12
add radius to GlobalGridParams
halungge Oct 10, 2024
8159b52
test_grid_manager.py: validate E2V == E2C2V[:2]
halungge Oct 10, 2024
9d48466
combine vert_vert_length and primal_edge_length computation
halungge Oct 10, 2024
250cfd3
Merge branch 'prototype_fields_factory' into grid_geometry
halungge Oct 10, 2024
c6e07d2
combine edge length computations
halungge Oct 11, 2024
115caf0
add DWD LAM grid file (WIP)
halungge Oct 11, 2024
19ceae8
add return type to FieldSource.get(...)
halungge Oct 11, 2024
ae937d4
Split factory argument in FieldProvider to several protocols
halungge Oct 11, 2024
617a586
Merge branch 'prototype_fields_factory' into grid_geometry
halungge Oct 11, 2024
7cd8c56
remove simple grid file tests from test_grid_manager.py
halungge Oct 11, 2024
70f432d
add length fields computaiton to geometry.py
halungge Oct 16, 2024
4ef1cc1
move stencil functions
halungge Oct 16, 2024
bb49922
Merge branch 'main' into prototype_fields_factory
halungge Oct 22, 2024
f9234b3
pre commit
halungge Oct 22, 2024
6651be7
merge main
halungge Oct 22, 2024
1bdc574
Merge branch 'prototype_fields_factory' into grid_geometry
halungge Oct 22, 2024
1f9833c
add primal_normal, cartesian coordinates of edge normal
halungge Oct 23, 2024
058df73
separate primal_normal_cell and primal_normal_verts
halungge Oct 23, 2024
dc7d410
fix test: use program for edge_primal_vertex
halungge Oct 24, 2024
5548850
adding primal normal vertex and cell
halungge Oct 24, 2024
50b56ca
tangent orientation: fall back to grid file version
halungge Oct 24, 2024
273fa1e
- remove duplicated tests
halungge Oct 25, 2024
4c75acf
construct auxiliary orientation arrays
halungge Oct 29, 2024
26f376e
fix LAM for dual edge length
halungge Oct 29, 2024
ed8d2c7
fix LAM for cartesian primal normal (WIP)
halungge Oct 29, 2024
ed68b5c
add dual_normals (edge_tangent) computation to geometry, initialize E…
halungge Oct 30, 2024
850a0fa
cleanup test_geometry.py
halungge Oct 30, 2024
b2b17dc
fix global num_levels
halungge Oct 30, 2024
a7a4e87
add doc strings
halungge Oct 31, 2024
23a19bf
enable tests for LAM, remove double projection
halungge Oct 31, 2024
011ecdf
fix imports
halungge Oct 31, 2024
8d65ce8
use computed geometry in test_diffusion.py
halungge Nov 1, 2024
e564305
merge main
halungge Nov 1, 2024
90ad0c6
merge main
halungge Nov 1, 2024
282888d
add default implementations for get and register_provider to FieldSou…
halungge Nov 1, 2024
9900a9e
merge FieldSource updates from factory prototype
halungge Nov 1, 2024
f135bad
fix test_diffusion.py (WIP)
halungge Nov 1, 2024
dedbdfe
add cached grid geometry and topology to test_diffusion.py
halungge Nov 1, 2024
12e8396
get rid of grid_savepoint fixture in test_diffusion.py (except for th…
halungge Nov 1, 2024
bb03a14
cleanups
halungge Nov 5, 2024
6ca7c72
Merge branch 'main' into grid_geometry
halungge Nov 5, 2024
5b07356
cleanups
halungge Nov 5, 2024
c8bebce
Merge branch 'main' into grid_geometry
halungge Nov 5, 2024
325da7d
switch to rtol for vn comparison
halungge Nov 5, 2024
0bfef07
fix xarray import for tools
halungge Nov 5, 2024
6576909
fix io tests
halungge Nov 5, 2024
fd6fd77
switch from np to xp in test_helpers.py
halungge Nov 5, 2024
432c605
Merge branch 'main' into grid_geometry
halungge Nov 5, 2024
ca66397
pre-commit
halungge Nov 5, 2024
bfc0eca
add data to geometry metadata and remove TODOs
halungge Nov 7, 2024
7d78dd7
remove dummy DWD grid
halungge Nov 7, 2024
6bda971
rename function
halungge Nov 7, 2024
2cc129f
fix error message
halungge Nov 7, 2024
b218fc5
add long_names - remove TODOs in geometry_attributes.py
halungge Nov 7, 2024
d07b7e8
unified usage of arg vs keyword args in stencil functions
halungge Nov 7, 2024
57b1e95
extract function for construction of inverse
halungge Nov 7, 2024
1d23076
merge main
halungge Nov 7, 2024
0818973
add missing arg to doc string
halungge Nov 7, 2024
2d4604e
add docstring to GridGeometry class
halungge Nov 7, 2024
3e89ec7
fix imports in advection
halungge Nov 7, 2024
2d72e6f
remove unused imports from diffusion.py
halungge Nov 8, 2024
fa9cfa9
remove unused import
halungge Nov 8, 2024
ef1fb13
introduce VerticalSize protocol
halungge Nov 8, 2024
3a43ab3
merge main
halungge Nov 12, 2024
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 @@ -629,11 +629,7 @@ def __init__(
# TODO (magdalena) vertical nesting is only relevant in the context of
# horizontal nesting, since we don't support this we should remove this option
self.l_vert_nested: bool = False
if grid.lvert_nest:
self.l_vert_nested = True
self.jk_start = 1
else:
self.jk_start = 0
self.jk_start = 0

self._en_smag_fac_for_zero_nshift(
self._vertical_params.interface_physical_height,
Expand Down
15 changes: 8 additions & 7 deletions model/common/src/icon4py/model/common/grid/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import uuid
import warnings
from abc import ABC, abstractmethod
from typing import Callable, Dict
from typing import Callable, Dict, Protocol, runtime_checkable

import gt4py.next as gtx
import numpy as np
Expand All @@ -24,6 +24,13 @@ class MissingConnectivity(ValueError):
pass


@runtime_checkable
class VerticalSize(Protocol):
@property
def num_levels(self) -> int:
...


@dataclasses.dataclass(frozen=True)
class HorizontalGridSize:
num_vertices: int
Expand All @@ -39,7 +46,6 @@ class GridConfig:
limited_area: bool = True
n_shift_total: int = 0
length_rescale_factor: float = 1.0
lvertnest: bool = False
on_gpu: bool = False

@property
Expand Down Expand Up @@ -91,11 +97,6 @@ def num_vertices(self) -> int:
def num_edges(self) -> int:
pass

@property
@abstractmethod
def num_levels(self) -> int:
pass

@abstractmethod
def _has_skip_values(self, dimension: gtx.Dimension) -> bool:
pass
Expand Down
17 changes: 9 additions & 8 deletions model/common/src/icon4py/model/common/grid/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import numpy as np

from icon4py.model.common import dimension as dims
from icon4py.model.common.grid.base import BaseGrid, GridConfig, HorizontalGridSize
from icon4py.model.common.grid import base

# periodic
#
Expand Down Expand Up @@ -377,10 +377,11 @@ class SimpleGridData:
)


class SimpleGrid(BaseGrid):
class SimpleGrid(base.BaseGrid, base.VerticalSize):
_CELLS = 18
_EDGES = 27
_VERTICES = 9
_NUM_LEVELS = 10

def __init__(self):
"""Instantiate a SimpleGrid used for testing purposes."""
Expand Down Expand Up @@ -435,23 +436,23 @@ def __init__(self):

@property
def num_cells(self) -> int:
return self.config.num_cells
return self._CELLS

@property
def num_vertices(self) -> int:
return self.config.num_vertices
return self._VERTICES

@property
def num_edges(self) -> int:
return self.config.num_edges
return self._EDGES

@property
def diamond_table(self) -> np.ndarray:
return SimpleGridData.e2c2v_table

@property
def num_levels(self) -> int:
return self.config.num_levels
return self._NUM_LEVELS

@property
def id(self) -> uuid.UUID:
Expand All @@ -461,11 +462,11 @@ def _has_skip_values(self, dimension: gtx.Dimension) -> bool:
return False

def _configure(self):
horizontal_grid_size = HorizontalGridSize(
horizontal_grid_size = base.HorizontalGridSize(
num_vertices=self._VERTICES, num_edges=self._EDGES, num_cells=self._CELLS
)
vertical_grid_config = VerticalGridConfig(num_levels=10)
config = GridConfig(
config = base.GridConfig(
horizontal_config=horizontal_grid_size,
vertical_size=vertical_grid_config.num_levels,
)
Expand Down
Loading