Merged in raiDriverUpdate (pull request #63)

RaiDriverUpdate

Approved-by: ksorathia
Approved-by: Jeff
This commit is contained in:
Anthony Sciola
2025-11-20 23:44:11 +00:00
8 changed files with 49 additions and 47 deletions

View File

@@ -195,11 +195,11 @@ add_subdirectory(src/raiju)
add_custom_target(raiju ALL)
# disabling raijuSA.x for now until it is completed
#message("\tAdding executable raijuSA.x")
message("\tAdding executable raijuSA.x")
#add_executable(raijuSA.x src/drivers/raijuSAx.F90 ${RAIJUIC})
#add_executable(raijuSA.x src/drivers/raijuSAx.F90)
#target_link_libraries(raijuSA.x baselib raijulib)
#add_dependencies(raiju raijuSA.x)
add_executable(raijuSA.x src/drivers/raijuSAx.F90)
target_link_libraries(raijuSA.x baselib raijulib)
add_dependencies(raiju raijuSA.x)
message("\tAdding executable raijuOWD.x")
#add_executable(raijuOWD.x src/drivers/raijuOWDx.F90 ${RAIJUIC})

View File

@@ -193,6 +193,8 @@ module raijutypes
!! Whether we initialize state from a restart file
integer :: nResIn = -1
!! Restart number to use for state init (-1 for symlink)
character(len=strLen) :: resId = ""
!! Restart filename id (resID.raiju.Res.xxxxx.h5) to read from
character(len=strLen) :: ResF = ""
!! Restart filename to read from

View File

@@ -68,7 +68,8 @@ program raijuOWDx
call inpXML%Set_Val(raiCplApp%opt%doColdStart,'/Kaiju/RAIJU/driver/doColdStart',.false.)
associate(ebGr=>vApp%ebTrcApp%ebState%ebGr, ebState=>vApp%ebTrcApp%ebState)
raiCplApp%opt%mjd0 = T2MJD(-1.0*ebState%ebTab%times(1)/inTscl, ebState%ebTab%MJDs(1))
raicplApp%opt%mhdRin = norm2(ebGr%xyzcc(ebGr%is,ebGr%js,ebGr%ks,:))
raicplApp%opt%mhdRin = norm2(ebGr%xyzcc(ebGr%is ,ebGr%js,ebGr%ks,:))
raicplApp%opt%mhdRinG = norm2(ebGr%xyzcc(ebGr%isg,ebGr%js,ebGr%ks,:))
raiCplApp%opt%voltGrid = vApp%shGrid
end associate

View File

@@ -15,9 +15,6 @@ program raijuSAx
implicit none
enum, bind(C)
enumerator :: RaiTest_WM=1
end enum
integer :: testCode
type(raijuApp_T ) :: raiApp
@@ -48,10 +45,6 @@ program raijuSAx
select case(testCode)
case (-1) ! Nothing, just pass
write(*,*) "No test code, doing standard SA driving"
case(RaiTest_WM)
write(*,*) "Doing test of Wave Model"
call test_WM(inpXML)
stop
case default
write(*,*) "Idk what this test code is, try again"
stop
@@ -66,7 +59,7 @@ program raijuSAx
call raiApp%InitIO(inpXML)
raiApp%State%isFirstCpl = .false.
if (raiApp%Model%isRestart) then
call raiApp%ReadRestart(raiApp%Model%RunID, raiApp%Model%nResIn)
call raiApp%ReadRestart(raiApp%Model%resID, raiApp%Model%nResIn)
raiApp%State%isFirstCpl = .false.
endif
@@ -142,25 +135,4 @@ program raijuSAx
contains
subroutine test_WM(iXML)
type(XML_Input_T), intent(in) :: iXML
character(len=strLen) :: confName
type(eLossWM_T) :: eWM
call iXML%Set_Val(confName, "config/fname","raijuconfig.h5")
call initEWM(eWM, confName, iXML, raiApp%Grid%shGrid)
write(*,*) "Kp1D (",size(eWM%Kp1D),"):"
write(*,*) eWM%Kp1D
write(*,*) "MLT1D (",size(eWM%MLT1D),"):"
write(*,*) eWM%MLT1D
write(*,*) "L1D (",size(eWM%L1D),"):"
write(*,*) eWM%L1D
write(*,*) "Energy1D (",size(eWM%Energy1D),"):"
write(*,*) eWM%Energy1D
write(*,*) "dims(Tau4D):"
write(*,*) size(eWM%Tau4D)
end subroutine
end program raijuSAx

View File

@@ -432,11 +432,12 @@ module raijuIO
end subroutine WriteRaiju
subroutine WriteRaijuRes(Model, Grid, State, ResF)
subroutine WriteRaijuRes(Model, Grid, State, opt, ResF)
!! Writes RAIJU restart info to provided path ResF
type(raijuModel_T), intent(in) :: Model
type(raijuGrid_T ), intent(in) :: Grid
type(raijuState_T), intent(in) :: State
type(raijuOptions_T), intent(in) :: opt
character(len=strLen), intent(in) :: ResF
! If a restart already exists, get rid of old one
@@ -446,12 +447,27 @@ module raijuIO
call writeShellGrid(Grid%shGrid, ResF)
! And species info
call writeSpeciesInfo(Model, Grid, ResF)
! App options
call WriteRaijuResOpts(opt, ResF)
! All necessary State info
call WriteRaijuResState(Model, Grid, State, ResF)
end subroutine WriteRaijuRes
subroutine WriteRaijuResOpts(opt, ResF)
type(raijuOptions_T), intent(in) :: opt
character(len=strLen), intent(in) :: ResF
type(IOVAR_T), dimension(20) :: IOVars
call AddOutVar(IOVars, "thetaL", opt%thetaL%get())
call AddOutVar(IOVars, "thetaU", opt%thetaU%get())
call WriteVars(IOVars,.false.,ResF,"Options")
end subroutine
subroutine WriteRaijuResState(Model, Grid, State, ResF)
!! Writes RAIJU State restart info to provided path ResF
type(raijuModel_T), intent(in) :: Model

View File

@@ -28,10 +28,11 @@ module raijuOut
end subroutine raijuOutput
subroutine raijuResOutput(Model, Grid, State)
subroutine raijuResOutput(Model, Grid, State, opt)
type(raijuModel_T), intent(in) :: Model
type(raijuGrid_T) , intent(in) :: Grid
type(raijuState_T), intent(inout) :: State
type(raijuOptions_T), intent(in) :: opt
character(len=strLen) :: ResF, tStr,lnResF !Name of restart file
logical :: fExist
@@ -45,7 +46,7 @@ module raijuOut
write (*, '(a,a,a,a,a)') ANSIGREEN, '<Writing RAIJU HDF5 RESTART @ t = ', trim(tStr), ' >', ANSIRESET
endif
call WriteRaijuRes(Model, Grid, State, ResF)
call WriteRaijuRes(Model, Grid, State, opt, ResF)
! Prep for next restart
State%IO%tRes = State%IO%tRes + State%IO%dtRes

View File

@@ -137,8 +137,8 @@ module raijustarter
else
tmpStr = "/Kaiju/Gamera/restart/resId"
endif
call iXML%Set_Val(tmpResId, trim(tmpStr), Model%RunID)
call genResInFname(Model, Model%ResF, runIdO=tmpResId) ! Determine filename to read from
call iXML%Set_Val(Model%resId, trim(tmpStr), Model%RunID)
call genResInFname(Model, Model%ResF, runIdO=Model%resId) ! Determine filename to read from
endif
!--- Plasmasphere ---!
@@ -316,10 +316,20 @@ module raijustarter
! Set grid params
call iXML%Set_Val(Grid%nB, "grid/Nbnd", 4 ) ! Number of cells between open boundary and active domain
call iXML%Set_Val(tmpStr, "grid/gType","UNISPH")
! If we are restarting, use shellGrid from file
if (Model%isRestart) then
tmpStr = "RESTART"
else
! Otherwise, ask user how we should be making our grid
call iXML%Set_Val(tmpStr, "grid/gType","UNISPH")
endif
! Fill out Grid object depending on chosen method
select case(tmpStr)
case("RESTART")
Grid%gType = RAI_G_SHGRID ! Idk, not important right now
call GenShellGridFromFile(Grid%shGrid, RAI_SG_NAME, Model%ResF)
case("UNISPH")
Grid%gType = RAI_G_UNISPH
! Generate our own grid from scratch
@@ -339,7 +349,7 @@ module raijustarter
write(*,*) "RAIJU expecting a ShellGrid_T but didn't receive one. Dying."
endif
case DEFAULT
write(*,*) "RAIJU Received invalid grid definition: ",Grid%gType
write(*,*) "RAIJU Received invalid grid definition: ",tmpStr
write(*,*) " Dying."
stop
end select

View File

@@ -37,7 +37,7 @@ submodule (raijutypes) raijuTypesSub
! synchronize restart output number
App%State%IO%nRes = nRes
call raijuResOutput(App%Model, App%Grid, App%State)
call raijuResOutput(App%Model, App%Grid, App%State, App%opt)
end subroutine raiWriteRestart
@@ -56,11 +56,11 @@ submodule (raijutypes) raijuTypesSub
App%Model%nResIn = nRes
call genResInFname(App%Model, App%Model%ResF, runIdO=resId)
! Handle grid reading first
call GenShellGridFromFile(shRes, RAI_SG_NAME, App%Model%ResF)
if(.not. checkResGrid(App%Grid%shGrid, shRes)) then
write(*,*)"RAIJU restart error: Grid generated from XML doesn't match that from restart file, that's not allowed"
stop
endif
!call GenShellGridFromFile(shRes, RAI_SG_NAME, App%Model%ResF)
!if(.not. checkResGrid(App%Grid%shGrid, shRes)) then
! write(*,*)"RAIJU restart error: Grid generated from XML doesn't match that from restart file, that's not allowed"
! stop
!endif
! Now read State info
call raijuResInput(App%Model, App%Grid, App%State)