-
Notifications
You must be signed in to change notification settings - Fork 13
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
Physics use GridData #46
Conversation
@@ -146,8 +151,20 @@ def __call__( | |||
self._dt, | |||
) | |||
# [TODO] needs a better solution to handle u_dt, v_dt quantity | |||
u_dt_quantity = self.grid.make_quantity(u_dt) | |||
v_dt_quantity = self.grid.make_quantity(v_dt) | |||
u_dt_quantity = fv3gfs.util.Quantity( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still a TODO for later but yeah, we should really not have to make a quantity to turn into a storage and then back into a quantity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go away when we have proper PhysicsState, and each variable has a quantity and storage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Not much to improve, just a couple nits. I'm commenting just because I should read through this again after the pace.util
PR is merged in.
namelist, | ||
comm: fv3gfs.util.CubedSphereCommunicator, | ||
partitioner: TilePartitioner, | ||
rank, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rank, | |
rank: int, |
partitioner: TilePartitioner, | ||
rank, | ||
namelist, | ||
grid_info, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For my reference, what is grid_info and why is it everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the missing grid info that is currently provided by serialized data. We just haven't gotten around using MetricTerms in physics, will do that in a separate PR.
self, | ||
stencil_factory: StencilFactory, | ||
partitioner: TilePartitioner, | ||
rank, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rank, | |
rank: int, |
What's the type hint on namelist
? It can't be Namelist
since that will be owned by pace.driver
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make config classes for Physics, so this is the old global spec.namelist
. Need another PR for this.
) | ||
self._update_vwind_stencil = stencil_factory.from_origin_domain( | ||
update_vwind_stencil, | ||
origin=(self.grid.halo, self.grid.halo, 0), | ||
domain=(self.grid.nic + 1, self.grid.njc, self.grid.npz), | ||
origin=(grid_indexing.n_halo, grid_indexing.n_halo, 0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So much indexing logic we have to do here! At least it gets cached since it's done on init.
@@ -68,7 +68,9 @@ def compute(self, inputs): | |||
inputs["va_t1"] = copy.deepcopy(storage) | |||
inputs["omga"] = copy.deepcopy(storage) | |||
physics_state = PhysicsState(**inputs) | |||
microph = Microphysics(self.grid.stencil_factory, self.grid, spec.namelist) | |||
microph = Microphysics( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Might as well spell out microphysics
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! This should help a lot in decoupling.
@@ -1,6 +1,7 @@ | |||
import numpy as np | |||
|
|||
import fv3core._config as spec | |||
import pace.util as util |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: it's a bit clearer to just import pace.util
, there are a variety of things util
means in our different modules.
In this PR, we replace the use of Grid in Physics with GridIndexing and GridData.
update_dwind_phys.py
, references to missing Grid functions are added here since this is the only spot that uses them. E.g., global_to_local_1d