diff --git a/src/pmpo_MPMesh_assembly.hpp b/src/pmpo_MPMesh_assembly.hpp index be462ed6..543ebf0f 100644 --- a/src/pmpo_MPMesh_assembly.hpp +++ b/src/pmpo_MPMesh_assembly.hpp @@ -61,7 +61,7 @@ void MPMesh::assemblyVtx0() p_MPs->parallel_for(assemble, "assembly"); Kokkos::MDRangePolicy> policy({0,0},{numVtx, numEntries}); Kokkos::parallel_for("assembly average", policy, KOKKOS_LAMBDA(const int vtx, const int entry){ - if (sumWeights(vtx) > tolerance) + if (sumWeights(vtx) != tolerance) meshField(vtx, entry) /= sumWeights(vtx); }); } diff --git a/test/testFortranMPReconstruction.f90 b/test/testFortranMPReconstruction.f90 index f9d6b0b6..c1ab18ec 100644 --- a/test/testFortranMPReconstruction.f90 +++ b/test/testFortranMPReconstruction.f90 @@ -27,7 +27,7 @@ program main real(kind=MPAS_RKIND), dimension(:), pointer :: xVertex, yVertex, zVertex real(kind=MPAS_RKIND), dimension(:), pointer :: latVertex, lonVertex integer, dimension(:,:), pointer :: verticesOnCell, cellsOnCell - integer :: numMPs + integer :: numMPs, vID integer, dimension(:), pointer :: mpsPerElm, mp2Elm, isMPActive real(kind=MPAS_RKIND), dimension(:,:), pointer :: mpPosition, mpLatLon real(kind=MPAS_RKIND), dimension(:,:), pointer :: mpMass, mpVel @@ -118,16 +118,21 @@ program main call assert(meshVtxMass(i) < TEST_VAL+TOLERANCE .and. meshVtxMass(i) > TEST_VAL-TOLERANCE, "Error: wrong vtx mass") end do - ! Test elm push reconstruction + ! Test push reconstruction do j = 1, 5 call calcSurfDispIncr(mpMesh, latVertex, lonVertex, nEdgesOnCell, verticesOnCell, nVertices, sphereRadius) call polympo_setReconstructionOfMass(mpMesh,0,polympo_getMeshFElmType()) + call polympo_setReconstructionOfMass(mpMesh,0,polympo_getMeshFVtxType()) call polympo_push(mpMesh) call polympo_getMeshElmMass(mpMesh,nCells,c_loc(meshElmMass)) + call polympo_getMeshVtxMass(mpMesh,nVertices,c_loc(meshVtxMass)) call polympo_getMPCurElmID(mpMesh,numMPs,c_loc(mp2Elm)) do i = 1, numMPs + vID = verticesOnCell(1,mp2Elm(i)) + call assert(meshVtxMass(vID) < TEST_VAL+TOLERANCE .and. meshVtxMass(vID) > TEST_VAL-TOLERANCE, "Error: wrong vtx mass") + call assert(meshElmMass(mp2Elm(i)) < TEST_VAL+TOLERANCE & .and. meshElmMass(mp2Elm(i)) > TEST_VAL-TOLERANCE, "Error: wrong elm mass") end do