Skip to content

Commit

Permalink
fixed vtx test
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelyr committed Jul 11, 2024
1 parent edf67c3 commit 553695f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pmpo_MPMesh_assembly.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void MPMesh::assemblyVtx0()
p_MPs->parallel_for(assemble, "assembly");
Kokkos::MDRangePolicy<Kokkos::Rank<2>> 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);
});
}
Expand Down
9 changes: 7 additions & 2 deletions test/testFortranMPReconstruction.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 553695f

Please sign in to comment.