Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 22, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
292 commits
Select commit Hold shift + click to select a range
ae9d7b6
GnomonicGrid validates
Jul 28, 2021
8325035
added handling for lonlat and tile dims in grid factory
Jul 28, 2021
053e2e5
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Aug 2, 2021
d43b623
expanding netcdf outputs to sequential tests and adding the output di…
Aug 2, 2021
24fc320
fixing some test args
Aug 2, 2021
e7cbbe0
ignoring debugging netcdf files
Aug 2, 2021
445c798
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Aug 3, 2021
1791b1f
More validating code, changing GridGrid outs
Aug 6, 2021
d38cb77
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Aug 17, 2021
7349a29
fix fill_corners in c_grid area calculation
Aug 17, 2021
287716d
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Aug 18, 2021
9c41148
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Aug 19, 2021
a1d276a
mostly finished validation for GridGrid
Aug 20, 2021
a08b7a2
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Aug 23, 2021
d2d1d99
everything except area_c
Aug 26, 2021
e55695d
reverting savenetcdf change
Aug 26, 2021
4e1c355
GridGrid passing
Sep 1, 2021
effc7ca
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Sep 1, 2021
73a99b6
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Sep 1, 2021
7cb3864
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Sep 2, 2021
477332f
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Sep 2, 2021
459a581
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Sep 3, 2021
7e1da6b
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Sep 3, 2021
68b277d
InitGrid almost passing, GridUtils coming into place
Sep 8, 2021
ea65d2e
adding thresholds for other tests
Sep 8, 2021
3f81b56
merge in master to new_grid/oop branch and resolve conflicts
rheacangeo Sep 8, 2021
2e2ea55
Revert "merge in master to new_grid/oop branch and resolve conflicts"
rheacangeo Sep 8, 2021
2945519
Revert "Revert "merge in master to new_grid/oop branch and resolve co…
rheacangeo Sep 8, 2021
b5515ff
more work on utils
Sep 9, 2021
c93d10b
Merge branch 'feature/new_grid' of github.com:VulcanClimateModeling/f…
Sep 9, 2021
6e52746
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Sep 9, 2021
3a60eb4
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Sep 10, 2021
de99599
most grid utils ported
Sep 13, 2021
ce9709b
InitGrids runs in parallel
rheacangeo Sep 14, 2021
ac516bc
moving parallel InitGrid code to generation, using GridIndexing inste…
rheacangeo Sep 14, 2021
b431d91
small tweak to generation
rheacangeo Sep 14, 2021
788e27b
minimal set_eta
Sep 14, 2021
6250780
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Sep 14, 2021
18a488b
intermediate commit
rheacangeo Sep 15, 2021
1050e8a
InitGrid using lat lon more than grid
rheacangeo Sep 15, 2021
2ee6938
working MetricTerms class that does the work of InitGrid, with comput…
rheacangeo Sep 15, 2021
6b87c54
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Sep 15, 2021
710d996
use grid and agrid instead of lat and lon
rheacangeo Sep 15, 2021
cee2a74
translate classes for more grid utils tests
Sep 15, 2021
c57b87e
filling out translate tests for grid_utils_init
Sep 15, 2021
a1fd201
initial version of gridutils translate tests
Sep 15, 2021
5564f4d
some small MetricTerms tweaks based on meeting feedback. not all feed…
rheacangeo Sep 16, 2021
222933e
refactoring supergrid sin and cos to conform to dycore
Sep 21, 2021
b2f2129
full implementation of split sg terms
Sep 21, 2021
e858d88
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Sep 21, 2021
364632c
intermediate commit with 54 ranks working by turning off corner code …
rheacangeo Sep 22, 2021
d204267
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Sep 22, 2021
6018789
improving vector handling
Sep 22, 2021
c699f6b
InitGrids passes with 54 ranks all variables. adjusted thresholds bec…
rheacangeo Sep 22, 2021
90611b5
Merge branch 'master' of github.com:VulcanClimateModeling/fv3core
Sep 23, 2021
3328e39
resolved vector dimension transposes
Sep 23, 2021
ca6b0c1
MoreTrig and AAMCorrection shapes fixed
Sep 23, 2021
ed6b054
TrigSg shapes fixed
Sep 24, 2021
6cf1479
DivgDel6 shapes resolved
Sep 24, 2021
7bcda6f
InitCubedtoLatLon passes
Sep 24, 2021
58fb37d
EdgeFactors shapes resolved
Sep 24, 2021
8d27b25
SetEta Passes
Sep 24, 2021
2ddbf81
halo is set to a default rather than being an optional argument
rheacangeo Sep 27, 2021
d2a8c31
local gnomonic_ed works for 54 ranks (without mirror step yet)
rheacangeo Sep 27, 2021
0ba7e45
more variables passing...
Sep 27, 2021
fd5cc17
fixed rsin_uv
Sep 27, 2021
725963f
cleanup local_gnomonic_ed
rheacangeo Sep 27, 2021
0030128
MoreTrig validates (with ignore_mear_zero_errors set)
Sep 27, 2021
b60a6d8
pass compute regionarguments rather than old grid object itself
rheacangeo Sep 27, 2021
9d06339
consolidating edge calculations into one function to ease debugging
Sep 27, 2021
910e637
gnomonic exact match 54 ranks, debugging statements included
rheacangeo Sep 28, 2021
22cf3a4
setup for testing local mirror_grid
rheacangeo Sep 28, 2021
458f366
DivgDel6 passes
Sep 28, 2021
a75397e
refactoring aam correction routines to help debug
Sep 28, 2021
351750e
AAMCorrection almost validates, removing commented code
Sep 28, 2021
bdf7e2a
UtilVectors passes for 6 ranks with a max_error changed for errors in…
rheacangeo Sep 28, 2021
b05b97e
strange merge
rheacangeo Sep 28, 2021
1928e91
cleanup
Sep 28, 2021
53e0626
Merge branch 'feature/new_grid' of github.com:VulcanClimateModeling/f…
Sep 28, 2021
734b9b5
EdgeFactors fixed
Sep 28, 2021
5959c35
setup for testing local mirror_grid
rheacangeo Sep 29, 2021
f2149dd
passing using local grid for 54 and 6 ranks sequentiall
rheacangeo Sep 29, 2021
4670fb6
cleanup debugging statements
rheacangeo Sep 29, 2021
5989813
cleanup of sequential InitGrid test, the gnomonic and mirror grid parts
rheacangeo Sep 29, 2021
4a35668
gnomonic and mirror grid operations happen in parallel on individual …
rheacangeo Sep 29, 2021
bf3108d
pulling the legacy grid out of mirror_grid, but it still exists in ge…
rheacangeo Sep 29, 2021
31de2ae
removed old legacy grid from grid generation
rheacangeo Sep 30, 2021
944d3ae
some cleanup
rheacangeo Sep 30, 2021
52f7e62
more moving stuff around
rheacangeo Sep 30, 2021
6c3e3f8
Merge branch 'feature/new_grid' into feature/new_grid_oop
rheacangeo Sep 30, 2021
5fdeb26
Merge branch 'feature/new_grid' into feature/new_grid_oop
rheacangeo Sep 30, 2021
942cf1e
fixing things already fixed but undone when handling merge conflicts
rheacangeo Sep 30, 2021
54e0c6e
Merge branch 'master' of github.com:ai2cm/fv3core
Sep 30, 2021
00bc210
remove redundant layout information that the communicator has
rheacangeo Sep 30, 2021
587ff3a
using cached_property for metric terms that have one variables comput…
rheacangeo Sep 30, 2021
c3fba6b
update the api of MetricTerms initialization to take in a quantity fa…
rheacangeo Sep 30, 2021
3790143
minor change
rheacangeo Sep 30, 2021
d140724
the local mirror does not rely on the mirror ranks being identical, t…
rheacangeo Sep 30, 2021
9aff550
type hinting
rheacangeo Sep 30, 2021
3b80ae9
fix comment
rheacangeo Sep 30, 2021
9287a47
get_center_vect np crosses in flipped order so do not need to hard co…
rheacangeo Sep 30, 2021
e452be0
Merge branch 'feature/new_grid' of github.com:VulcanClimateModeling/f…
rheacangeo Sep 30, 2021
36bed1a
UtilVectors passes for 54 ranks sequentially
rheacangeo Sep 30, 2021
13d8356
some updates to other tests
rheacangeo Oct 1, 2021
9afbfb8
Merge remote-tracking branch 'origin/feature/new_grid_oop' into featu…
rheacangeo Oct 1, 2021
f345c50
initial implementation of efactor_a2c_v for more than 6 ranks
Oct 4, 2021
ec503ff
Merge branch 'feature/new_grid' of github.com:VulcanClimateModeling/f…
Oct 5, 2021
a9a2cca
Merge branch 'master' of github.com:ai2cm/fv3core
Oct 5, 2021
886d03d
modifying legacy grid object so it can temporarily stand in place of …
rheacangeo Oct 5, 2021
9780e82
Merge branch 'feature/new_grid' of github.com:VulcanClimateModeling/f…
rheacangeo Oct 5, 2021
422cb29
Merge branch 'master' of github.com:ai2cm/fv3core
Oct 6, 2021
10e0876
More Validation
Oct 6, 2021
83896e6
Merge branch 'master' of github.com:ai2cm/fv3core
Oct 6, 2021
ce51693
fill_corners should use rank_grids rather than self.grid, which is us…
rheacangeo Oct 7, 2021
61961aa
More tests passing
Oct 7, 2021
516041e
Merge branch 'feature/new_grid' of github.com:VulcanClimateModeling/f…
Oct 7, 2021
f80f3df
More validation
Oct 7, 2021
96b6c59
Trying to validate InitGridUtils
Oct 7, 2021
54e536c
MoreAreas threshold is loosened because it has the same problem with …
rheacangeo Oct 8, 2021
e6d142e
replacing communicator.tile.rank with communicator.rank so that the 5…
rheacangeo Oct 8, 2021
5e1226d
adding GridUtils outputs to MetricTerms class
Oct 11, 2021
2be235d
added reciprocal metric terms
Oct 11, 2021
6dba72e
Merge branch 'feature/new_grid' of github.com:VulcanClimateModeling/f…
rheacangeo Oct 11, 2021
43aad41
fixed typo in from_tile_sizing and added units to global area min/maxes
Oct 11, 2021
a4d66e0
add the try except back to save netcdf
rheacangeo Oct 11, 2021
814257f
Merge branch 'master' of github.com:ai2cm/fv3core
Oct 12, 2021
07f9661
enabling comparing scalars with parallel tests
rheacangeo Oct 12, 2021
395954b
all the cos vars are ignore_near_zero
rheacangeo Oct 12, 2021
05aa083
save netcdf errors ignored
rheacangeo Oct 12, 2021
8bd4361
fix edge variables in InitGridUtils to be interface variables, initia…
rheacangeo Oct 12, 2021
4191a84
flip the divg and del6 halo updates, fails on the south and west edge…
rheacangeo Oct 12, 2021
8550479
resolved merge conflicts
rheacangeo Oct 12, 2021
24daca9
tests pass
Oct 12, 2021
5812f20
workaround for vector_halo_update not having scalar_pair option and f…
rheacangeo Oct 12, 2021
9c84266
implemented global area minmaxes, added halo update for divgdel6 in M…
Oct 12, 2021
a098716
merge
rheacangeo Oct 13, 2021
7f4fcbd
now that edge variables only save serialized local slices, remove the…
rheacangeo Oct 13, 2021
21d1ce7
Merge branch 'feature/new_grid' of github.com:VulcanClimateModeling/f…
rheacangeo Oct 13, 2021
f08b079
partial way to getting edge factors for 54 ranks, print statements st…
rheacangeo Oct 13, 2021
497a0ae
Merge branch 'master' of github.com:ai2cm/fv3core
Oct 13, 2021
ee39124
edge_* pass, edge_vect_* left
rheacangeo Oct 13, 2021
ca7a92d
EdgeFactors passes 54 ranks, but using a loop, not slicing
rheacangeo Oct 13, 2021
90a5639
hacky fix for slicing west_edge_vectors
rheacangeo Oct 13, 2021
bf9c001
adjusting jm so west_vector does not have workaround
rheacangeo Oct 13, 2021
ba88498
54 ranks validates of InitGridUtils
rheacangeo Oct 13, 2021
3102ff3
parallel tests don't crash
Oct 13, 2021
1518e94
resolving merge conflicts
Oct 13, 2021
1fc50ac
use grid or gridvar as aliases fro self._grid for the moment
rheacangeo Oct 13, 2021
44aac67
Merge branch 'feature/new_grid' of github.com:VulcanClimateModeling/f…
rheacangeo Oct 13, 2021
25dc5c4
updating parallel InitGridUtils to have some of the fixes the sequent…
rheacangeo Oct 13, 2021
7af0214
da_min computed using view rather than domain
rheacangeo Oct 13, 2021
7c69919
fixing area
Oct 13, 2021
0a5170b
Merge branch 'feature/new_grid' of github.com:VulcanClimateModeling/f…
Oct 13, 2021
c93a90f
InitGridUtils test reads the grid and agrid from serialized data rath…
rheacangeo Oct 13, 2021
43a87f9
Merge branch 'feature/new_grid' of github.com:VulcanClimateModeling/f…
rheacangeo Oct 13, 2021
f988575
Merge branch 'master' of github.com:ai2cm/fv3core
Oct 14, 2021
5839b10
linting
Oct 14, 2021
109a221
Merge branch 'master' of github.com:ai2cm/fv3core
Oct 19, 2021
ac83091
reworked TranslateAGrid to only test a-grid generation, and Translate…
Oct 19, 2021
9bced6b
Merge branch 'master' of github.com:ai2cm/fv3core
Oct 19, 2021
21a1fc7
bugfix in ParallelTranslate.compute_parallel
Oct 19, 2021
324d769
not testing MirrorGrid in parallel because it only runs on one rank
Oct 19, 2021
2dcadd2
addressing some comments
Oct 20, 2021
48576eb
bigfixes, clarification
Oct 20, 2021
92100cd
Merge branch 'master' of github.com:ai2cm/fv3core
Oct 21, 2021
dda5613
addressing more comments
Oct 21, 2021
3834a58
Merge branch 'master' of github.com:ai2cm/fv3core
Oct 25, 2021
a14390f
reworking trig tests to test MetricTerms generation
Oct 25, 2021
5fed23f
Removing sequential tests
Oct 25, 2021
9483823
Added docstrings for MetricTerms properties
Oct 26, 2021
87cd863
removing divg and del6 from grid module init
Oct 26, 2021
e7dee5e
skipping sequential tests that are no longer defined
Oct 26, 2021
40a5bf2
moving test threshold overrides into translate class inits
Oct 26, 2021
70db58c
tests pass
Oct 26, 2021
0c2983b
fixing typos
Oct 26, 2021
8454d82
Merge branch 'master' of github.com:ai2cm/fv3core
Oct 26, 2021
87bc5e2
cleanup and comments
Oct 27, 2021
75288f2
typo
Oct 27, 2021
050b994
typos
Oct 27, 2021
06bb25c
merging master
Oct 27, 2021
65aac3f
added a dataclass to eta.py to aid understanding
Oct 27, 2021
402112b
added docstring to hybrid_pressure_coefficients dataclass
Oct 27, 2021
7a8a32b
more typehints in geometry.py
Oct 27, 2021
5557699
Merge branch 'master' of github.com:ai2cm/fv3core
Oct 27, 2021
6cddd7d
more clarity?
Oct 28, 2021
be77044
initial review responses
Oct 29, 2021
e6e6cc3
removed unused functions
Oct 29, 2021
e076316
adjusting error thresholds for daint
Nov 1, 2021
2a3c919
Merging master
Nov 1, 2021
0ea55df
updating test thresholds
Nov 1, 2021
fe0620c
Extended asarray to handle lists safely
Nov 1, 2021
90ff511
skipping parallel SetEta tests
Nov 2, 2021
cd68458
moved global grid code to a separate file to avoid confusion. Also di…
Nov 2, 2021
4cefbe9
Adjusting TrigSg threshold
Nov 2, 2021
9388ce3
Merge branch 'master' of github.com:ai2cm/fv3core
Nov 2, 2021
9aabd89
tests/savepoint/translate/translate_grid.py
Nov 2, 2021
8f150c9
Merge branch 'master' into feature/new_grid
Nov 3, 2021
21c6afe
using asarray to fix the SetEta mock parallel test, which hopefully h…
Nov 3, 2021
4d4ffae
linting, always linting
rheacangeo Nov 3, 2021
b41b734
Merge branch 'feature/new_grid' of github.com:ai2cm/fv3core into feat…
Nov 3, 2021
7538171
updating docstrings and definitions
Nov 4, 2021
4c8ff27
Merge branch 'feature/new_grid' of github.com:VulcanClimateModeling/f…
Nov 4, 2021
e75bb42
Merge branch 'feature/new_grid' of github.com:ai2cm/fv3core into feat…
Nov 4, 2021
d3d8dda
Merge branch 'master' of github.com:ai2cm/fv3core
Nov 4, 2021
ef830d6
Merge branch 'master' into feature/new_grid
Nov 4, 2021
c5f0554
_vect_cross returns np.array
Nov 4, 2021
5bff875
Make grid data operations cupy compatible
Nov 4, 2021
316d6f3
Make storage operations cupy friendly for parallel tests
Nov 4, 2021
76f3702
Increase some error thresholds
Nov 4, 2021
687c699
Fix ak, bk assignments
Nov 4, 2021
0e9e0da
Return scalar rather than list with a single element
Nov 5, 2021
f50fd82
resolving review comments
Nov 8, 2021
e52a243
Merge branch 'feature/new_grid' of github.com:VulcanClimateModeling/f…
Nov 8, 2021
0b8c4af
resolving review notes
Nov 10, 2021
4f99941
moving grid constants from global_constants.py to grid.py
Nov 10, 2021
e649215
an initial start to making GridData instance from a MetricTerms inst…
rheacangeo Nov 10, 2021
657249a
Merge remote-tracking branch 'origin/master' into feature/use_new_grid
rheacangeo Nov 10, 2021
8532f52
running FVDynamics and Tracer2D1L tests using a GridData object initi…
rheacangeo Nov 11, 2021
1a51864
fvdynamics test uses grid data
rheacangeo Nov 12, 2021
875390a
remove leftover k_bounds because has reference to global spec.grid
rheacangeo Nov 14, 2021
8076d52
including updatedzd
rheacangeo Nov 14, 2021
590af33
c2l_ord4 uses grid_data rather than the global grid
rheacangeo Nov 14, 2021
8f5c326
divergence damping variables included, divergence damping object uses…
rheacangeo Nov 14, 2021
88f627c
grid variables fC and f0 and computed in the inits of d_sw and c_sw, …
rheacangeo Nov 14, 2021
e0c87e5
adding compute_grid option to pytest and parallel tests
rheacangeo Nov 15, 2021
c955a75
corilis parameters computed from common basic operations location
rheacangeo Nov 15, 2021
a07d1eb
maintenance
rheacangeo Nov 15, 2021
da45217
have the jenkins parallel regression tests also run the compute_grid …
rheacangeo Nov 15, 2021
1e6c28f
standalone uses generated grid rather than serialized data
rheacangeo Nov 15, 2021
686965e
temporary solution computing a2b edge factors inside of a2b, messes u…
rheacangeo Nov 15, 2021
30f2e2a
loosen a2b threshold for internal edge vector calculation
rheacangeo Nov 15, 2021
eec0c9f
linting
rheacangeo Nov 15, 2021
daeaf3a
ugg nh_p_grad test also has to loosen
rheacangeo Nov 15, 2021
acac25e
debug print statement
rheacangeo Nov 15, 2021
96172fe
more debugging
rheacangeo Nov 15, 2021
951d899
always linting
rheacangeo Nov 15, 2021
d62b2aa
MetricTerms does not include egde factors
rheacangeo Nov 15, 2021
73b2583
more debugging
rheacangeo Nov 15, 2021
65dd5ed
taking the min of a view does not seem to work on the gpu, trying usi…
rheacangeo Nov 16, 2021
243ea84
taking the min of a view does not seem to work on the gpu, trying usi…
rheacangeo Nov 16, 2021
80d1dff
yuck
rheacangeo Nov 16, 2021
8d8e196
ugg just trying to test da_min, why edge factor
rheacangeo Nov 16, 2021
0fb74c1
now to debug edge factors
rheacangeo Nov 16, 2021
9512e47
cupy is so annoying
rheacangeo Nov 16, 2021
aaf6321
using ak and bk from grid_data rather than as inputs
Nov 16, 2021
32e0913
we do not need the rank here
rheacangeo Nov 16, 2021
002a9ac
vertical grid components are pulled out of step_dynamics
rheacangeo Nov 16, 2021
10dd7ed
Merge remote-tracking branch 'origin/master' into feature/use_new_grid
rheacangeo Nov 16, 2021
ce975d7
replace state.ptop and state.ks with self.grid_data.ptop and self.gri…
rheacangeo Nov 16, 2021
deca140
Merge remote-tracking branch 'origin/master' into feature/use_new_grid
rheacangeo Nov 18, 2021
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
6 changes: 6 additions & 0 deletions .jenkins/actions/run_parallel_regression_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ if [ ${python_env} == "virtualenv" ]; then
else
make savepoint_tests_mpi
fi
export TEST_ARGS="${TEST_ARGS} --compute_grid"
if [ ${python_env} == "virtualenv" ]; then
CONTAINER_CMD="" make savepoint_tests_mpi
else
make savepoint_tests_mpi
fi
18 changes: 3 additions & 15 deletions examples/standalone/runfile/acoustics.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ def initialize_serializer(data_directory: str, rank: int = 0) -> serialbox.Seria
)


def read_grid(serializer: serialbox.Serializer, rank: int = 0) -> Grid:
"""Uses the serializer to generate a Grid object from serialized data"""
grid_savepoint = serializer.get_savepoint("Grid-Info")[0]
grid_data = {}
grid_fields = serializer.fields_at_savepoint(grid_savepoint)
for field in grid_fields:
grid_data[field] = serializer.read(field, grid_savepoint)
if len(grid_data[field].flatten()) == 1:
grid_data[field] = grid_data[field][0]
return fv3core.testing.TranslateGrid(grid_data, rank).python_grid()


def initialize_fv3core(backend: str, disable_halo_exchange: bool) -> None:
"""
Initializes globalfv3core config to the arguments for single runs
Expand Down Expand Up @@ -155,7 +143,9 @@ def driver(
serializer = initialize_serializer(data_directory)
initialize_fv3core(backend, disable_halo_exchange)
mpi_comm, communicator = set_up_communicator(disable_halo_exchange)
grid = read_grid(serializer)
grid = spec.make_grid_with_data_from_namelist(
spec.namelist, communicator, backend
)
spec.set_grid(grid)

input_data = read_input_data(grid, serializer)
Expand All @@ -169,8 +159,6 @@ def driver(
grid.nested,
grid.stretched_grid,
spec.namelist.dynamical_core.acoustic_dynamics,
input_data["ak"],
input_data["bk"],
input_data["pfull"],
input_data["phis"],
)
Expand Down
40 changes: 14 additions & 26 deletions examples/standalone/runfile/dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,21 +205,15 @@ def collect_data_and_write_to_file(
else:
mpi_comm = MPI.COMM_WORLD

# get grid from serialized data
grid_savepoint = serializer.get_savepoint("Grid-Info")[0]
grid_data = {}
grid_fields = serializer.fields_at_savepoint(grid_savepoint)
for field in grid_fields:
grid_data[field] = serializer.read(field, grid_savepoint)
if len(grid_data[field].flatten()) == 1:
grid_data[field] = grid_data[field][0]
grid = fv3core.testing.TranslateGrid(grid_data, rank).python_grid()
spec.set_grid(grid)

namelist = spec.namelist
# set up grid-dependent helper structures
layout = spec.namelist.layout
partitioner = util.CubedSpherePartitioner(util.TilePartitioner(layout))
partitioner = util.CubedSpherePartitioner(util.TilePartitioner(namelist.layout))
communicator = util.CubedSphereCommunicator(mpi_comm, partitioner)
# generate the grid
grid = spec.make_grid_with_data_from_namelist(
namelist, communicator, args.backend
)
spec.set_grid(grid)

# create a state from serialized data
savepoint_in = serializer.get_savepoint("FVDynamics-In")[0]
Expand All @@ -229,12 +223,10 @@ def collect_data_and_write_to_file(
state = driver_object.state_from_inputs(input_data)
dycore = fv3core.DynamicalCore(
comm=communicator,
grid_data=spec.grid.grid_data,
stencil_factory=spec.grid.stencil_factory,
damping_coefficients=spec.grid.damping_coefficients,
grid_data=grid.grid_data,
stencil_factory=grid.stencil_factory,
damping_coefficients=grid.damping_coefficients,
config=spec.namelist.dynamical_core,
ak=state["atmosphere_hybrid_a_coordinate"],
bk=state["atmosphere_hybrid_b_coordinate"],
phis=state["surface_geopotential"],
)

Expand All @@ -245,12 +237,10 @@ def collect_data_and_write_to_file(
print("timestep 1")
dycore.step_dynamics(
state,
input_data["consv_te"],
namelist.consv_te,
input_data["do_adiabatic_init"],
input_data["bdt"],
input_data["ptop"],
input_data["n_split"],
input_data["ks"],
namelist.n_split,
)

if profiler is not None:
Expand All @@ -267,12 +257,10 @@ def collect_data_and_write_to_file(
print(f"timestep {i+2}")
dycore.step_dynamics(
state,
input_data["consv_te"],
namelist.consv_te,
input_data["do_adiabatic_init"],
input_data["bdt"],
input_data["ptop"],
input_data["n_split"],
input_data["ks"],
namelist.n_split,
timestep_timer,
)
times_per_step.append(timestep_timer.times)
Expand Down
6 changes: 1 addition & 5 deletions examples/wrapped/runfiles/baroclinic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,6 @@ def convert_3d_to_1d(state, field_names):
stencil_factory=spec.grid.stencil_factory,
damping_coefficients=spec.grid.damping_coefficients,
config=spec.namelist.dynamical_core,
ak=state["atmosphere_hybrid_a_coordinate"],
bk=state["atmosphere_hybrid_b_coordinate"],
phis=state["surface_geopotential"],
)
fvsubgridz = fv3core.DryConvectiveAdjustment(
Expand Down Expand Up @@ -308,9 +306,7 @@ def convert_3d_to_1d(state, field_names):
wrapper.flags.consv_te,
wrapper.flags.do_adiabatic_init,
dt_atmos,
wrapper.flags.ptop,
wrapper.flags.n_split,
wrapper.flags.ks,
wrapper.flags.n_,
)
if spec.namelist.fv_sg_adj > 0:
state["eastward_wind_tendency_due_to_physics"] = u_tendency
Expand Down
4 changes: 0 additions & 4 deletions examples/wrapped/runfiles/fv3core_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,6 @@ def convert_3d_to_1d(state, field_names):
stencil_factory=spec.grid.stencil_factory,
damping_coefficients=spec.grid.damping_coefficients,
config=spec.namelist.dynamical_core,
ak=state["atmosphere_hybrid_a_coordinate"],
bk=state["atmosphere_hybrid_b_coordinate"],
phis=state["surface_geopotential"],
)

Expand Down Expand Up @@ -298,9 +296,7 @@ def convert_3d_to_1d(state, field_names):
wrapper.flags.consv_te,
wrapper.flags.do_adiabatic_init,
dt_atmos,
wrapper.flags.ptop,
wrapper.flags.n_split,
wrapper.flags.ks,
)
if spec.namelist.fv_sg_adj > 0:
state["eastward_wind_tendency_due_to_physics"] = u_tendency
Expand Down
14 changes: 12 additions & 2 deletions fv3core/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,8 +866,6 @@ def namelist_to_flatish_dict(nml_input):
return flatter_namelist


# TODO: Before this can be used, we need to write a module to make the grid data
# from files on disk and call it
def make_grid_from_namelist(namelist, rank):
shape_params = {}
for narg in ["npx", "npy", "npz"]:
Expand All @@ -885,6 +883,18 @@ def make_grid_from_namelist(namelist, rank):
return Grid(indices, shape_params, rank, namelist.layout)


def make_grid_with_data_from_namelist(namelist, communicator, backend):
grid = make_grid_from_namelist(namelist, communicator.rank)
grid.make_grid_data(
npx=namelist.npx,
npy=namelist.npy,
npz=namelist.npz,
communicator=communicator,
backend=backend,
)
return grid


def set_grid(in_grid):
"""Updates the global grid given another.

Expand Down
Loading