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

Initial condition for jw test #446

Merged
merged 29 commits into from
May 6, 2024
Merged

Initial condition for jw test #446

merged 29 commits into from
May 6, 2024

Conversation

OngChia
Copy link
Contributor

@OngChia OngChia commented Apr 18, 2024

  1. Initial condition for JW test is added in initialization_utils.py. The auxiliary functions that help compute the initial condition is stored in testcase_functions.py.
  2. DiagnosticState and DiagnosticMetricState are added. DiagnosticState contains global diagnostic variables that will be used in physics parameterizations. DiagnosticMetricState contains metric state for computations of diagnostic variables from prognostic variables.
  3. A new JABW_EXPERIMENT serialized data set is added to test the initial condition of JW test.
  4. A new C2E2C2E dim for rbf vector interpolation from edge to cell is added.

@OngChia OngChia requested a review from halungge April 23, 2024 08:38
)

if experiment == "mch_ch_r04b09_dsl":
def _Jablownoski_Williamson_config():
Copy link
Contributor

Choose a reason for hiding this comment

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

I would name this in proper snake case to conform to the standard, even though I know these are names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Renamed already.

model/driver/tests/test_testcase.py Show resolved Hide resolved
RD_O_CPD,
)
from icon4py.model.common.decomposition.definitions import DecompositionInfo, ProcessProperties
from icon4py.model.common.decomposition.mpi_decomposition import ParallelLogger
Copy link
Contributor

Choose a reason for hiding this comment

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

This import forces the user to have mpi4py installed. We tried to have the entire code run (of course only for single node) even without mpi4py in the environment. That is why there are these single_dispatch functions in mdecomposition/definitions.py I realize that there might be a single_dispatch missing for the logger.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have not really gone far to understand your logging system and decomposition. So, I add a TODO there when the single_dispatch functionality is ready.



# TODO (Chia Rui): Construct a proper test for these diagnostic stencils?
def diagnose_temperature_numpy(
Copy link
Contributor

Choose a reason for hiding this comment

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

you could easily make this a gt4py stencil...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice idea. I will port the temperature and pressure diagnosis to gt4py. They can be used when users want to output variables in the future.

return p_u_out, p_v_out


def interpolation_cells2edges_scalar_numpy(
Copy link
Contributor

Choose a reason for hiding this comment

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

can you replace that with a call to horizontal.py::cell_2_edge_interpolation` ? It should do the same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tend to keep this numpy version here because I want all computations during initialization to be consistent in one format, instead of some parts of the initialization process being gt4py stencil and the rest being numpy/cupy. Moreover, some of the computations in mode initialization are only used once. So, I think writing them all in numpy/cupy is enough. I move cell_2_edge_interpolation stencil to interpolation folder.

from icon4py.model.common.grid.icon import IconGrid


def interpolation_rbf_edges2cells_vector_numpy(
Copy link
Contributor

Choose a reason for hiding this comment

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

which one is this in icon? Can we port it to gt4py?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. It is bf_vec_interpol_cell in mo_intp_rbf.f90. I will create gt4py version of this stencil in interpolation folder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have removed this numpy version and use the gt4py version which I put it interpolation/stencils/edge_2_cell_vector_rbf_interpolation.py.

@OngChia OngChia requested a review from halungge May 2, 2024 11:30
@OngChia
Copy link
Contributor Author

OngChia commented May 3, 2024

cscs-ci run default

@@ -58,6 +61,12 @@
DELTA_TEMPERATURE: Final[wpfloat] = 75.0
DEL_T_BG: Final[wpfloat] = DELTA_TEMPERATURE

#: Earth average radius [m]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I added this in PR 428 Can you check for duplication?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. I confirm that it is duplicated. I deleted my one.

model/common/src/icon4py/model/common/grid/simple.py Outdated Show resolved Hide resolved
[22, 23, 3, 4, 5, 12, 7, 8, 15],
[25, 26, 6, 7, 8, 15, 1, 2, 9],
[0, 1, 5, 6, 7, 2, 9, 10, 14],
[3, 4, 8, 0, 1, 5, 12, 13, 17], # 5c
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
[3, 4, 8, 0, 1, 5, 12, 13, 17], # 5c
[3, 4, 8, 0, 1, 5, 12, 13, 17], # 4c

[1, 2, 9, 10, 11, 18, 13, 14, 21],
[4, 5, 12, 13, 14, 21, 16, 17, 24],
[7, 8, 15, 16, 17, 24, 10, 11, 18],
[9, 10, 14, 15, 16, 11, 18, 19, 23], # 10c
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
[9, 10, 14, 15, 16, 11, 18, 19, 23], # 10c
[9, 10, 14, 15, 16, 11, 18, 19, 23], # 9c

model/common/src/icon4py/model/common/grid/simple.py Outdated Show resolved Hide resolved
offset_provider={"Koff": KDim},
)

# TODO (Chia Rui): remember to uncomment this computation when the bug in gt4py is removed
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this TODO obsolete? Computation is not commented....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh. Yes, it is obsolete. I forgot to delete it.

@OngChia
Copy link
Contributor Author

OngChia commented May 3, 2024

cscs-ci run default

@OngChia
Copy link
Contributor Author

OngChia commented May 3, 2024

launch jenkins spack

@OngChia OngChia requested a review from halungge May 3, 2024 14:06
Copy link

github-actions bot commented May 3, 2024

Mandatory Tests

Please make sure you run these tests via comment before you merge!

  • cscs-ci run default
  • launch jenkins spack

Optional Tests

To run benchmarks you can use:

  • cscs-ci run benchmark

To run tests and benchmarks with the DaCe backend you can use:

  • cscs-ci run dace

In case your change might affect downstream icon-exclaim, please consider running

  • launch jenkins icon

For more detailed information please look at CI in the EXCLAIM universe.

@OngChia
Copy link
Contributor Author

OngChia commented May 3, 2024

cscs-ci run default

@OngChia
Copy link
Contributor Author

OngChia commented May 3, 2024

launch jenkins spack

pressure = (
sqrt(pressure_sfc * pressure_interface) if state[2] else sqrt(state[1] * pressure_interface)
)
return pressure, pressure_interface, False
Copy link
Contributor

Choose a reason for hiding this comment

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

there is a is_roundtrip function for that just in case.

@OngChia
Copy link
Contributor Author

OngChia commented May 6, 2024

Thanks. I have already used is_roundtrip to skip the test when backend is roundtrip.

@OngChia OngChia merged commit dd3d9d4 into main May 6, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants