Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Fixed some wonkiness with the name of the integrator that as a side e…
Browse files Browse the repository at this point in the history
…ffect turned off GR
  • Loading branch information
daminton committed Dec 4, 2022
1 parent d7357da commit 6bd8a9d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 29 deletions.
48 changes: 24 additions & 24 deletions src/io/io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,9 @@ module subroutine io_param_reader(self, unit, iotype, v_list, iostat, iomsg)
logical :: dt_set = .false. !! Is the step size set in the input file?
integer(I4B) :: ilength, ifirst, ilast, i !! Variables used to parse input file
character(STRMAX) :: line !! Line of the input file
character (len=:), allocatable :: line_trim,param_name, param_value !! Strings used to parse the param file
character(len=:), allocatable :: line_trim,param_name, param_value !! Strings used to parse the param file
character(*),parameter :: linefmt = '(A)' !! Format code for simple text string
character(len=:), allocatable :: integrator


! Parse the file line by line, extracting tokens then matching them up with known parameters if possible
Expand Down Expand Up @@ -762,30 +763,29 @@ module subroutine io_param_reader(self, unit, iotype, v_list, iostat, iomsg)
! Calculate the G for the system units
param%GU = GC / (param%DU2M**3 / (param%MU2KG * param%TU2S**2))

associate(integrator => v_list(1))
if ((integrator == RMVS) .or. (integrator == SYMBA)) then
if (.not.param%lclose) then
write(iomsg,*) 'This integrator requires CHK_CLOSE to be enabled.'
iostat = -1
return
end if
integrator = v_list(1)
if ((integrator == RMVS) .or. (integrator == SYMBA)) then
if (.not.param%lclose) then
write(iomsg,*) 'This integrator requires CHK_CLOSE to be enabled.'
iostat = -1
return
end if

! Determine if the GR flag is set correctly for this integrator
select case(integrator)
case(WHM, RMVS, HELIO, SYMBA)
case default
if (param%lgr) write(iomsg, *) 'GR is not yet implemented for this integrator. This parameter will be ignored.'
param%lgr = .false.
end select
end if

! Determine if the GR flag is set correctly for this integrator
select case(integrator)
case(WHM, RMVS, HELIO, SYMBA)
case default
if (param%lgr) write(iomsg, *) 'GR is not yet implemented for this integrator. This parameter will be ignored.'
param%lgr = .false.
end select

if (param%lgr) then
! Calculate the inverse speed of light in the system units
param%inv_c2 = einsteinC * param%TU2S / param%DU2M
param%inv_c2 = (param%inv_c2)**(-2)
end if
if (param%lgr) then
! Calculate the inverse speed of light in the system units
param%inv_c2 = einsteinC * param%TU2S / param%DU2M
param%inv_c2 = (param%inv_c2)**(-2)
end if

end associate

select case(trim(adjustl(param%interaction_loops)))
case("ADAPTIVE")
Expand Down Expand Up @@ -1444,8 +1444,8 @@ module subroutine io_read_in_param(self, param_file_name)
character(STRMAX) :: errmsg !! Error message in UDIO procedure

! Read in name of parameter file
write(self%display_unit, *) 'Parameter input file is ', trim(adjustl(param_file_name))
self%param_file_name = param_file_name
self%param_file_name = trim(adjustl(param_file_name))
write(self%display_unit, *) 'Parameter input file is ' // self%param_file_name

!! todo: Currently this procedure does not work in user-defined derived-type input mode
!! as the newline characters are ignored in the input file when compiled in ifort.
Expand Down
7 changes: 4 additions & 3 deletions src/main/swiftest_driver.f90
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ program swiftest_driver
case default
allocate(swiftest_parameters :: param)
end select
param%integrator = integrator
param%integrator = trim(adjustl(integrator))
call param%set_display(display_style)

!> Define the maximum number of threads
Expand Down Expand Up @@ -93,6 +93,7 @@ program swiftest_driver
else
if (param%lenergy) call nbody_system%conservation_report(param, lterminal=.false.) ! This will save the initial values of energy and momentum
call nbody_system%write_frame(param)
call nbody_system%dump(param)
end if

write(display_unit, *) " *************** Main Loop *************** "
Expand All @@ -102,7 +103,7 @@ program swiftest_driver
write(pbarmessage,fmt=pbarfmt) t0, tstop
call pbar%update(1,message=pbarmessage)
else if (display_style == "COMPACT") then
write(*,*) "SWIFTEST START " // trim(adjustl(param%integrator))
write(*,*) "SWIFTEST START " // param%integrator
call nbody_system%compact_output(param,integration_timer)
end if

Expand Down Expand Up @@ -160,7 +161,7 @@ program swiftest_driver
end do
! Dump any remaining history if it exists
call system_history%dump(param)
if (display_style == "COMPACT") write(*,*) "SWIFTEST STOP" // trim(adjustl(param%integrator))
if (display_style == "COMPACT") write(*,*) "SWIFTEST STOP" // param%integrator
end associate

call util_exit(SUCCESS)
Expand Down
4 changes: 2 additions & 2 deletions src/modules/swiftest_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ module swiftest_classes
!> User defined parameters that are read in from the parameters input file.
!> Each paramter is initialized to a default values.
type :: swiftest_parameters
character(STRMAX) :: integrator = UNKNOWN_INTEGRATOR !! Symbolic name of the nbody integrator used
character(STRMAX) :: param_file_name = "param.in" !! The default name of the parameter input file
character(len=:), allocatable :: integrator !! Symbolic name of the nbody integrator used
character(len=:), allocatable :: param_file_name !! The name of the parameter file
integer(I4B) :: maxid = -1 !! The current maximum particle id number
integer(I4B) :: maxid_collision = 0 !! The current maximum collision id number
real(DP) :: t0 = 0.0_DP !! Integration reference time
Expand Down

0 comments on commit 6bd8a9d

Please sign in to comment.