Conversation
7bf17ca to
f13e95c
Compare
c211ca0 to
f0055d4
Compare
1559ff0 to
07afe13
Compare
|
After looking at the code again I now believe that the update is correct as is. The exchange always happens right after a field is updated, ensuring that the correct results are available for subsequent computations. The only exception are the advected fields in the dynamics that are also modified by the thermodynamics. Here we need to ensure that the halo cells contain the correct values before the advection, either by doing the column physics on the halo cells or by doing an exchange beforehand. Another exchange afterwards should not be strictly necessary but if we do another exchange, I think it might be possible to skip the exchange of stresses (s11,s12,s22), since that computation works purely local on individual cells . |
4d7cb40 to
87dadeb
Compare
Thanduriel
left a comment
There was a problem hiding this comment.
Looks correct to me as-is but I have a few thoughts on possible changes.
| #ifdef USE_MPI | ||
| haloDGVector.exchangeHalos(s11); | ||
| haloDGVector.exchangeHalos(s12); | ||
| haloDGVector.exchangeHalos(s22); |
There was a problem hiding this comment.
I think this exchange is redundant. If all the inputs are correct on the halo cells the computed stress should be as well. Maybe you can try this? I expect the results to be bit-wise identical.
einola
left a comment
There was a problem hiding this comment.
We should modify advectDynamicsField as per my comment on line R132.
There are also questions about redundant exchanges.
|
A possible test would be to run This does not check the thermodynamics. |
# Add corner neighbours into halo exchange logic ### Task List - [x] Linked an issue above that captures the requirements of this PR - [x] Defined the tests that specify a complete and functioning change - [x] Implemented the source code change that satisfies the tests - [x] Commented all code so that it can be understood without additional context - [x] No new warnings are generated or they are mentioned below - [x] The documentation has been updated (or an issue has been created to do so) - [x] Relevant labels (e.g., enhancement, bug) have been applied to this PR - [x] This change conforms to the conventions described in the README --- # Change Description This PR has the following key changes: - adds support for corner neighbours to the existing halo exchange logic (which previously just exchanged edges) - add support for `CGVector` and `DGVectorHolder` exchange (this is required for corners and edges) - updates metadata tests and closed-boundary (CB) halo test to work with corner neighbours - removes the Periodic-Boundary (PB) halo exchange test for now, this will be addressed in a subsequent PR #1044 --- # Test Description ### `HaloExchangePB_test.cpp` `HaloExchangeCB_test.cpp` creates test data for all the array types: - `HField` - `VertexField` - `DGField` - `DGVector` - `CGVector` I modified the previous version, so that the model data are created in such a way that the value of each cell can be calculated based on its indices. Therefore we can check after exchange that all of the cells have been exchanged successfully. This also now allows us to change the number of ranks arbitrarily (assuming you also provide the appropriate `partition_metadata` file. ### `ModelMetadataCB_test.cpp` and `ModelMetadataPB_test.cpp` Small modifications have been made to the periodic and closed boundary `ModelMetadata` tests. The changes now add the additional corner neighbour metadata and check that it is ready correctly. ### `partition_metadata_3_cb.cdl` and `partition_metadata_3_pb.cdl` These files are now generated at compile time by running the `decomp` tool on a new file `halo_test_mask.cdl`. This is in line with similar changes introduced by @joewallwork on the XIOS tests. --- # Other Details * `domain_decop` git commit has now been bumped to the latest version on main. This version of the decomp tool contains the corner neighbour metadata. ### Further work - Integrating halo exchange to nextsim is handled by PR #924
a951eb5 to
c31114b
Compare
Thanduriel
left a comment
There was a problem hiding this comment.
Looking good now!
What is the plan for the VP dynamics? Applying the changes from the BrittleCGDynamicsKernel shouldn't be much work now. I approve this regardless but if we don't do it right away, maybe create an issue?
Thanks see issue #1072 |
Add Halo Exchange to Dynamics
Fixes #120
Task List
Defined the tests that specify a complete and functioning changewill be done in separate follow up PR (see issue create idealised test for the MPI dynamics #1071Change Description
This PR adds halo exchange functionality to the dynamics and for advected fields.
After adding halo exchange into the dynamics we fix fields like
hicefor example.Figure 1
hice(left) before halo exchange is added to dyanmics and (right) after.After adding halo exchange into the
advectFieldfunction we also fix it for advected fields liketbottom,tsurfandtinterior, for example.Figure 2
tbottom(left) before halo exchange is added toadvectFieldand (right) after.Test Description
None currently
Documentation Impact
None currently
Other Details
Interpolations::DG2CG(smesh, cgVector, DGVector)values inside the "inner" domain (i.e., not halo cells) depends on vertices set outside the inner cells i.e., from neighbouring points on the lattice. This means that you have to halo exchange the DGVector before you halo exchange the CGVector. It is not equivalent to first interpolate from DGVector onto CGVector and then halo exchange the CGVector.Todo
Need some scientific/statistical/sense tests to ensure correctness (raised in issue Create differential tests on output data prior to merging MPI and OpenMP solutions #247) -- perhaps an idealized test case?will be done in separate follow up PR (see issue create idealised test for the MPI dynamics #1071