Skip to content

Commit

Permalink
divide advection tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelyr committed Oct 30, 2024
1 parent d858ac5 commit e04f3af
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 108 deletions.
5 changes: 4 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ if(EXISTS ${TEST_NC_FILE_SPHERICAL})
message(STATUS "Found Spherical NC File: ${TEST_NC_FILE_SPHERICAL}")
set(TEST_NC_FILE ${TEST_NC_FILE_SPHERICAL})
# this test only works for spherical NC files!
pmpo_add_test(testFortranMPAdvection 1 ./testFortranMPAdvection 5 5 ${TEST_NC_FILE})
pmpo_add_test(test_fortran_mp_advection_api 1 ./testFortranMPAdvection "API" 5 5 ${TEST_NC_FILE})
pmpo_add_test(test_fortran_mp_advection_migration 1 ./testFortranMPAdvection "MIGRATION" 5 5 ${TEST_NC_FILE})
pmpo_add_test(test_fortran_mp_advection_reconstruction 1 ./testFortranMPAdvection "RECONSTRUCTION" 5 5 ${TEST_NC_FILE})

else()
set(TEST_NC_FILE ${TEST_NC_FILE_PLANAR})
endif()
Expand Down
44 changes: 21 additions & 23 deletions test/testFortranMPAdvection.f90
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,6 @@ subroutine runReconstructionTest(mpMesh, numMPs, numPush, nCells, nVertices, mp2

call polympo_setMPMass(mpMesh,1,numMPs,c_loc(mpMass))
call polympo_setMPVel(mpMesh,2,numMPs,c_loc(mpVel))

! ! Test vtx reconstruction

! call polympo_setReconstructionOfMass(mpMesh,0,polympo_getMeshFVtxType())
! call polympo_applyReconstruction(mpMesh)
! call polympo_getMeshVtxMass(mpMesh,nVertices,c_loc(meshVtxMass))

! do i = 1, nVertices
! call assert(meshVtxMass(i) < TEST_VAL+TOLERANCE .and. meshVtxMass(i) > TEST_VAL-TOLERANCE, "Error: wrong vtx mass")
! end do

! Test push reconstruction

Expand Down Expand Up @@ -194,7 +184,7 @@ program main
integer :: mpi_comm_handle = MPI_COMM_WORLD
real(kind=MPAS_RKIND) :: xc, yc, zc, xMP, yMP, zMP, radius, lon
real(kind=MPAS_RKIND) :: pi = 4.0_MPAS_RKIND*atan(1.0_MPAS_RKIND)
character (len=2048) :: filename, input
character (len=2048) :: filename, input, testType
character (len=64) :: onSphere
real(kind=MPAS_RKIND) :: sphereRadius
integer, dimension(:), pointer :: nEdgesOnCell
Expand All @@ -219,14 +209,16 @@ program main

call polympo_checkPrecisionForRealKind(MPAS_RKIND)
argc = command_argument_count()
if(argc == 3) then
call get_command_argument(1, input)
read(input, '(I7)') mpsScaleFactorPerVtx
if(argc == 4) then
call get_command_argument(1, testType)
call get_command_argument(2, input)
read(input, '(I7)') mpsScaleFactorPerVtx
call get_command_argument(3, input)
read(input, '(I7)') numPush
call get_command_argument(3, filename)
call get_command_argument(4, filename)
else
write(0, *) "Usage: ./testFortranMPAdvection <mpsScaleFactorPerVtx> <numPush> <path to the nc file>"
write(0, *) "Usage: ./testFortranMPAdvection <API/MIGRATION/RECONSTRUCTION> &
<mpsScaleFactorPerVtx> <numPush> <path to the nc file>"
call exit(1)
end if

Expand Down Expand Up @@ -337,13 +329,19 @@ program main
call polympo_setMPRotLatLon(mpMesh,2,numMPs,c_loc(mpLatLon))
call polympo_setMPPositions(mpMesh,3,numMPs,c_loc(mpPosition))

! call setProcWedges(mpMesh, nCells, comm_size, nEdgesOnCell, verticesOnCell, lonCell)
! call runAdvectionTest(mpMesh, numPush, latVertex, lonVertex, nEdgesOnCell, verticesOnCell, nVertices, sphereRadius)

! call runReconstructionTest(mpMesh, numMPs, numPush, nCells, nVertices, mp2Elm, &
! latVertex, lonVertex, nEdgesOnCell, verticesOnCell, sphereRadius)

call runApiTest(mpMesh, numMPs, nVertices, nCells, numPush, mpLatLon, mpPosition, xVertex, yVertex, zVertex, latVertex)
if (testType == "API") then
call runApiTest(mpMesh, numMPs, nVertices, nCells, numPush, mpLatLon, mpPosition, xVertex, yVertex, zVertex, latVertex)
else if (testType == "MIGRATION") then
call setProcWedges(mpMesh, nCells, comm_size, nEdgesOnCell, verticesOnCell, lonCell)
call runAdvectionTest(mpMesh, numPush, latVertex, lonVertex, nEdgesOnCell, verticesOnCell, nVertices, sphereRadius)
else if (testType == "RECONSTRUCTION") then
call runReconstructionTest(mpMesh, numMPs, numPush, nCells, nVertices, mp2Elm, &
latVertex, lonVertex, nEdgesOnCell, verticesOnCell, sphereRadius)
else
write(0, *) "Usage: ./testFortranMPAdvection <API/MIGRATION/RECONSTRUCTION> &
<mpsScaleFactorPerVtx> <numPush> <path to the nc file>"
call exit(1)
end if

call polympo_summarizeTime();

Expand Down
84 changes: 0 additions & 84 deletions test/testMigration.cpp

This file was deleted.

0 comments on commit e04f3af

Please sign in to comment.