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

Additional xios patch #7

Open
hiker opened this issue Nov 6, 2024 · 1 comment
Open

Additional xios patch #7

hiker opened this issue Nov 6, 2024 · 1 comment

Comments

@hiker
Copy link
Collaborator

hiker commented Nov 6, 2024

While Scott is on leave, here is the one XIOS patch that I am aware of that is missing here (original link, which requires an account: https://git.nci.org.au/bom/ngm/spack-environments/-/blob/master/repos/bom-ngm/packages/xios/lfric_xios2.2629.patch?ref_type=heads_):

--- a/src/node/mesh.cpp	(revision 2629)
+++ b/src/node/mesh.cpp	(working copy)
@@ -148,8 +148,8 @@
 
   vector<size_t> CMesh::createHashes (const double longitude, const double latitude)
   {
-    double minBoundLon = 0. ;
-    double maxBoundLon = 360. ;
+    double minBoundLon = -180. ;
+    double maxBoundLon = 180. ;
     double minBoundLat = -90. ;
     double maxBoundLat = 90. ;
     double prec=1e-11 ;
@@ -158,8 +158,6 @@
     double lon = longitude;
     double lat = latitude;
 
-    if (lon > (360.- prec)) lon = 0.;
-
     size_t maxsize_t=numeric_limits<size_t>::max() ;
     if ( (maxBoundLon-minBoundLon)/maxsize_t > precLon) precLon=(maxBoundLon-minBoundLon)/maxsize_t ;
     if ( (maxBoundLat-minBoundLat)/maxsize_t > precLat) precLat=(maxBoundLat-minBoundLat)/maxsize_t ;
@@ -855,10 +853,11 @@
         }
         else
         {
-          if (mpiRank == (mpiSize - 1) )
+          int tmprem = nbEdgesGlo%mpiSize;
+          if (mpiRank >= tmprem)
           {
             edge_count = nbEdgesGlo/mpiSize;
-            edge_start = mpiRank*(nbEdgesGlo/mpiSize + 1);
+            edge_start = (mpiRank - tmprem)*edge_count + tmprem*(nbEdgesGlo/mpiSize + 1);
           }
           else
           {
@@ -884,6 +883,7 @@
         for (int i = 0; i < edge_count; ++i)
         {
           CClientClientDHTSizet::Index2VectorInfoTypeMap::iterator it = edgeIdxGlo2FaceIdx.find(i + edge_start);
+          if (it != edgeIdxGlo2FaceIdx.end()) {
           int indexGlo = it->first;
           vector<size_t> faces = it->second;
           int face1 = faces[0];
@@ -896,7 +896,7 @@
           else
           {
             edge_faces(1, indexGlo - edge_start) = fill_value_edge_faces();
-          }
+          }}
         }
 
         size_t tmp;

@ScottWales
Copy link
Collaborator

There are a few lfric updates in our local containers that need to be brought up here, need to syncronise them and then deprecate our internal repo

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

No branches or pull requests

2 participants