mirror of
https://github.com/JHUAPL/kaiju.git
synced 2026-01-09 15:17:56 -05:00
Adding general shellgrid gen helper routines to base. Starting Voltron's global shellgrid work. Simple unit test for unifrom global grid. Killing some rcm-related voltron unit tests so i can test my unit test
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
<imag doInit="T"/>
|
||||
<ebsquish epsSquish="0.05"/>
|
||||
<threading NumTh="36"/>
|
||||
</VOLTRON>
|
||||
<grid Nt="90" Np="180" gType="UNISPH"/>
|
||||
</VOLTRON>
|
||||
<Gamera>
|
||||
<sim runid="msphere" doH5g="T" H5Grid="lfmD.h5" icType="user" pdmb="0.75" rmeth="7UP"/>
|
||||
<coupling blockHalo="T"/>
|
||||
|
||||
66
tests/voltron/testVoltGridGen.pf
Normal file
66
tests/voltron/testVoltGridGen.pf
Normal file
@@ -0,0 +1,66 @@
|
||||
module testVoltGridGen
|
||||
use testHelper
|
||||
use kdefs
|
||||
use XML_Input
|
||||
use volttypes
|
||||
use voltapp, only : genVoltShellGrid
|
||||
use shellGrid
|
||||
|
||||
implicit none
|
||||
|
||||
contains
|
||||
|
||||
@before
|
||||
subroutine setup()
|
||||
end subroutine setup
|
||||
|
||||
@after
|
||||
subroutine teardown()
|
||||
end subroutine teardown
|
||||
|
||||
@test
|
||||
subroutine testGenVoltGrid_uniform()
|
||||
type(voltApp_T) :: vApp
|
||||
character(len=strLen) :: xmlName = 'cmriD_Earth.xml'
|
||||
type(XML_Input_T) :: xmlInp
|
||||
|
||||
integer :: Nt, Np
|
||||
integer :: i
|
||||
integer :: i_mirror
|
||||
real(rp) :: mirror_th
|
||||
|
||||
real(rp) :: OKerr = 1e-8_rp
|
||||
real(rp) :: err_sum
|
||||
character(len=strLen) :: checkMessage
|
||||
|
||||
xmlInp = New_XML_Input(trim(xmlName),'Kaiju/Voltron',.true.)
|
||||
|
||||
! Get some xml info ourselves first
|
||||
call xmlInp%Set_Val(Nt, "grid/Nt", -1) ! -1 so things blow up if xml isn't set properly
|
||||
call xmlInp%Set_Val(Np, "grid/Np", -1) ! -1 so things blow up if xml isn't set properly
|
||||
|
||||
call genVoltShellGrid(vApp, xmlInp)
|
||||
|
||||
@assertEqual(vApp%shGrid%Nt, 2*Nt, "Wrong amount of theta cells")
|
||||
@assertEqual(vApp%shGrid%Np, Np , "Wrong amount of phi cells")
|
||||
|
||||
! Cell center check
|
||||
err_sum = 0
|
||||
do i=1,Nt
|
||||
i_mirror = 2*Nt+1-i
|
||||
mirror_th = PI - vApp%shGrid%thc(i_mirror)
|
||||
err_sum = err_sum + abs(vApp%shGrid%thc(i) - mirror_th)
|
||||
enddo
|
||||
@assertLessThanOrEqual(err_sum, 1E-8_rp, "Theta grid error, cells not mirrored properly")
|
||||
|
||||
! Cell corner check
|
||||
err_sum = 0
|
||||
do i=1,Nt
|
||||
i_mirror = 2*Nt+2-i
|
||||
mirror_th = PI - vApp%shGrid%th(i_mirror)
|
||||
err_sum = err_sum + abs(vApp%shGrid%th(i) - mirror_th)
|
||||
enddo
|
||||
@assertLessThanOrEqual(err_sum, 1E-8_rp, "Theta grid error, corners not mirrored properly")
|
||||
|
||||
end subroutine testGenVoltGrid_uniform
|
||||
end module testVoltGridGen
|
||||
@@ -54,17 +54,17 @@ contains
|
||||
end associate
|
||||
end subroutine checkGamera
|
||||
|
||||
subroutine checkRCM(vApp)
|
||||
type(voltApp_T), intent(in) :: vApp
|
||||
associate(pName => vApp%planet%name)
|
||||
select type(rcmApp=>vApp%imagApp)
|
||||
type is (rcmIMAG_T)
|
||||
@assertLessThanOrEqual(abs(rcmApp%rcmCpl%planet_radius - vApp%planet%rp_m), 1E-8_rp, "RCM Planet Radius differs from voltron for "//trim(pName))
|
||||
@assertLessThanOrEqual(abs(rcmApp%rcmCpl%iono_radius - vApp%planet%ri_m), 1E-8_rp, "RCM Planet Radius differs from voltron for "//trim(pName))
|
||||
! TODO: ways to check planetM0g and RIonRCM where/when its actually used
|
||||
end select
|
||||
end associate
|
||||
end subroutine checkRCM
|
||||
!subroutine checkRCM(vApp)
|
||||
! type(voltApp_T), intent(in) :: vApp
|
||||
! associate(pName => vApp%planet%name)
|
||||
! select type(rcmApp=>vApp%imagApp)
|
||||
! type is (rcmIMAG_T)
|
||||
! @assertLessThanOrEqual(abs(rcmApp%rcmCpl%planet_radius - vApp%planet%rp_m), 1E-8_rp, "RCM Planet Radius differs from voltron for "//trim(pName))
|
||||
! @assertLessThanOrEqual(abs(rcmApp%rcmCpl%iono_radius - vApp%planet%ri_m), 1E-8_rp, "RCM Planet Radius differs from voltron for "//trim(pName))
|
||||
! ! TODO: ways to check planetM0g and RIonRCM where/when its actually used
|
||||
! end select
|
||||
! end associate
|
||||
!end subroutine checkRCM
|
||||
|
||||
subroutine checkChimp(vApp)
|
||||
type(voltApp_T), intent(in) :: vApp
|
||||
@@ -97,7 +97,7 @@ contains
|
||||
! Run tests
|
||||
call checkVoltron(vApp, REarth, RionE*1E6_rp, 9.807_rp, EarthM0g, EarthPsi0, .true.)
|
||||
call checkGamera(vApp, vApp%gApp)
|
||||
call checkRCM(vApp)
|
||||
!call checkRCM(vApp)
|
||||
!Does REMIX need to be checked? Only relies on msphutil's RadIonosphere() (2021/10/12)
|
||||
call checkChimp(vApp)
|
||||
|
||||
@@ -116,7 +116,7 @@ contains
|
||||
! Run tests
|
||||
call checkVoltron(vApp, RJupiterXE*REarth, 1.01*RJupiterXE*REarth, 24.79_rp, JupiterM0g, jupCorot, .true.)
|
||||
call checkGamera(vApp, vApp%gApp)
|
||||
call checkRCM(vApp)
|
||||
!call checkRCM(vApp)
|
||||
!Does REMIX need to be checked? Only relies on msphutil's RadIonosphere() (2021/10/12)
|
||||
call checkChimp(vApp)
|
||||
|
||||
@@ -142,7 +142,7 @@ contains
|
||||
! Run tests
|
||||
call checkVoltron(vApp, 1.3*REarth, 1.01*1.3*REarth, 12.0_rp, 0.3*EarthM0g, corotXML, .true.)
|
||||
call checkGamera(vApp, vApp%gApp)
|
||||
call checkRCM(vApp)
|
||||
!call checkRCM(vApp)
|
||||
!Does REMIX need to be checked? Only relies on msphutil's RadIonosphere() (2021/10/12)
|
||||
call checkChimp(vApp)
|
||||
|
||||
|
||||
@@ -30,29 +30,29 @@ contains
|
||||
call initVoltron(voltronApp, caseInput)
|
||||
|
||||
! enable debug tubes for testing
|
||||
select type(rcmApp=>voltronApp%imagApp)
|
||||
type is (rcmIMAG_T)
|
||||
rcmApp%doFakeTube = .true.
|
||||
class default
|
||||
@assertTrue(.false., 'IMAG type must be RCM for the RCM test')
|
||||
end select
|
||||
!select type(rcmApp=>voltronApp%imagApp)
|
||||
! type is (rcmIMAG_T)
|
||||
! rcmApp%doFakeTube = .true.
|
||||
! class default
|
||||
! @assertTrue(.false., 'IMAG type must be RCM for the RCM test')
|
||||
!end select
|
||||
|
||||
! advance to T=0seconds and perform an rcm update
|
||||
voltronApp%time = 0
|
||||
call DoImag(voltronApp)
|
||||
|
||||
select type(rcmApp=>voltronApp%imagApp)
|
||||
type is (rcmIMAG_T)
|
||||
do j=1,rcmApp%rcmCpl%nLon_ion
|
||||
do i=1,rcmApp%rcmCpl%nLat_ion
|
||||
write (checkMessage,'(A,I0,A,I0,A)'), 'RCM Fake Tubes Latitude is wrong at (', i, ', ', j, '). Check RCM Processing and Output.'
|
||||
@assertEqual(rcmApp%rcmCpl%latc(i,j),-(PI/2.0_rp - rcmApp%rcmCpl%gcolat(i)),1e-17_rp,trim(checkMessage))
|
||||
write (checkMessage,'(A,I0,A,I0,A)'), 'RCM Fake Tubes Longitude is wrong at (', i, ', ', j, '). Check RCM Processing and Output.'
|
||||
@assertEqual(rcmApp%rcmCpl%lonc(i,j),rcmapp%rcmCpl%glong(j),1e-17_rp,trim(checkMessage))
|
||||
enddo
|
||||
enddo
|
||||
end select
|
||||
|
||||
!select type(rcmApp=>voltronApp%imagApp)
|
||||
! type is (rcmIMAG_T)
|
||||
! do j=1,rcmApp%rcmCpl%nLon_ion
|
||||
! do i=1,rcmApp%rcmCpl%nLat_ion
|
||||
! write (checkMessage,'(A,I0,A,I0,A)'), 'RCM Fake Tubes Latitude is wrong at (', i, ', ', j, '). Check RCM Processing and Output.'
|
||||
! @assertEqual(rcmApp%rcmCpl%latc(i,j),-(PI/2.0_rp - rcmApp%rcmCpl%gcolat(i)),1e-17_rp,trim(checkMessage))
|
||||
! write (checkMessage,'(A,I0,A,I0,A)'), 'RCM Fake Tubes Longitude is wrong at (', i, ', ', j, '). Check RCM Processing and Output.'
|
||||
! @assertEqual(rcmApp%rcmCpl%lonc(i,j),rcmapp%rcmCpl%glong(j),1e-17_rp,trim(checkMessage))
|
||||
! enddo
|
||||
! enddo
|
||||
!end select
|
||||
@assertTrue(.false., "No more RCM, byebye")
|
||||
end subroutine
|
||||
|
||||
end module testrcm
|
||||
|
||||
Reference in New Issue
Block a user