@@ -281,7 +281,7 @@ void MPMesh::startCommunication(){
281281
282282 pumipic::RecordTime (" Start Communication" + std::to_string (self), timer.seconds ());
283283
284- bool isRotated= false ;
284+ bool isRotated = p_mesh-> getRotatedFlag () ;
285285 p_mesh->setGnomonicProjection (isRotated);
286286
287287 /*
@@ -416,7 +416,7 @@ void MPMesh::invertMatrix(const Kokkos::View<double**>& vtxMatrices, const doubl
416416 int nVertices = p_mesh->getNumVertices ();
417417 auto vtxCoords = p_mesh->getMeshField <polyMPO::MeshF_VtxCoords>();
418418 auto dual_triangle_area = p_mesh->getMeshField <MeshF_DualTriangleArea>();
419- bool isRotated= false ;
419+ bool isRotated = p_mesh-> getRotatedFlag ();
420420
421421 double eps = 1e-7 ;
422422 double truncateFactor = 0.05 ;
@@ -435,7 +435,8 @@ void MPMesh::invertMatrix(const Kokkos::View<double**>& vtxMatrices, const doubl
435435 double Y = vtxCoords (vtx, 1 )/radius;
436436 double Z = vtxCoords (vtx, 2 )/radius;
437437 if (isRotated){
438- // Change X and Z
438+ X = -vtxCoords (vtx, 2 )/radius;
439+ Z = vtxCoords (vtx, 0 )/radius;
439440 }
440441
441442 auto cosLat = sqrt (pow (X, 2 ) + pow (Y, 2 ));
@@ -446,7 +447,9 @@ void MPMesh::invertMatrix(const Kokkos::View<double**>& vtxMatrices, const doubl
446447 Vec3d v1 = { X * invCosLat, -Y * Z * invCosLat, Y / vtx_area_sqrt };
447448 Vec3d v2 = { 0.0 , cosLat, Z /vtx_area_sqrt };
448449 if (isRotated){
449-
450+ v0 = {0.0 , cosLat, Z / vtx_area_sqrt};
451+ v1 = {X * invCosLat, -Y * Z * invCosLat, Y / vtx_area_sqrt};
452+ v2 = {Y * invCosLat, X * Z *invCosLat, -X / vtx_area_sqrt};
450453 }
451454 Matrix3d rotateScaleM = {v0, v1, v2};
452455
@@ -518,7 +521,7 @@ void MPMesh::invertMatrix(const Kokkos::View<double**>& vtxMatrices, const doubl
518521 VtxCoeffs (vtx, 0 , 3 ) = temp[2 ];
519522
520523 // Debugging
521- if (vtx == 33821 ){
524+ if (vtx == 2630 ){
522525 printf (" Matrices %d vtx \n " , vtx);
523526 printf (" [ %.15e %.15e %.15e %.15e ]\n " , vtxMatrices (vtx,0 ), vtxMatrices (vtx,1 ), vtxMatrices (vtx,2 ), vtxMatrices (vtx,3 ));
524527 printf (" [ %.15e %.15e %.15e %.15e ]\n " , vtxMatrices (vtx,1 ), vtxMatrices (vtx,4 ), vtxMatrices (vtx,5 ), vtxMatrices (vtx,6 ));
@@ -607,11 +610,15 @@ void MPMesh::reconstruct_full() {
607610 communicate_and_take_halo_contributions (meshField, numVertices, numEntries, 0 , 0 );
608611 pumipic::RecordTime (" Communicate Field Values" + std::to_string (self), timer.seconds ());
609612
613+ Kokkos::fence ();
614+ assert (cudaDeviceSynchronize () == cudaSuccess);
610615 // Debug Delete
611616 Kokkos::parallel_for (" printSymmetricBlock" , numVertices, KOKKOS_LAMBDA (const int vtx){
612- if (vtx == 33821 ) {
613- printf (" IceArea in %d: " , vtx);
614- printf (" %25.15e \n " , meshField (vtx, 0 ));
617+ if (vtx == 2630 ) {
618+ printf (" Field in %d: " , vtx);
619+ for (int k=0 ; k<numEntries; k++)
620+ printf (" %.15e " , meshField (vtx, k));
621+ printf (" \n " );
615622 }
616623 });
617624
0 commit comments