diff --git a/src/swiftest/swiftest_driver.f90 b/src/swiftest/swiftest_driver.f90 index 321ed2487..cab050b80 100644 --- a/src/swiftest/swiftest_driver.f90 +++ b/src/swiftest/swiftest_driver.f90 @@ -19,7 +19,11 @@ program swiftest_driver use swiftest implicit none +#ifdef COARRAY + class(swiftest_nbody_system), allocatable :: nbody_system[:] !! Polymorphic object containing the nbody system to be integrated +#else class(swiftest_nbody_system), allocatable :: nbody_system !! Polymorphic object containing the nbody system to be integrated +#endif type(swiftest_parameters) :: param !! Run configuration parameters character(len=:), allocatable :: integrator !! Integrator type code (see globals for symbolic names) character(len=:), allocatable :: param_file_name !! Name of the file containing user-defined parameters @@ -77,6 +81,12 @@ program swiftest_driver !$ write(param%display_unit,'(a)') ' ------------------' !$ write(param%display_unit,'(a,i3,/)') ' Number of threads = ', nthreads !$ if (param%log_output) write(*,'(a,i3)') ' OpenMP: Number of threads = ',nthreads +#ifdef COARRAY + if (this_image() == 1) then + write(param%display_unit,'(a)') ' Coarray parameters:' + write(param%display_unit,'(a)') ' -------------------' + write(param%display_unit,'(a)') ' Number of images = ', num_images() +#endif call nbody_system%initialize(param) @@ -138,6 +148,9 @@ program swiftest_driver call nbody_system%display_run_information(param, integration_timer, phase="last") end associate +#ifdef COARRAY + end if ! this_image() == 1 +#endif end associate call base_util_exit(SUCCESS) diff --git a/src/swiftest/swiftest_module.f90 b/src/swiftest/swiftest_module.f90 index b4b43b526..c4a105644 100644 --- a/src/swiftest/swiftest_module.f90 +++ b/src/swiftest/swiftest_module.f90 @@ -1060,8 +1060,12 @@ end subroutine swiftest_util_setup_body module subroutine swiftest_util_setup_construct_system(nbody_system, param) implicit none - class(swiftest_nbody_system), allocatable, intent(inout) :: nbody_system !! Swiftest nbody_system object - class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters +#ifdef COARRAY + class(swiftest_nbody_system), allocatable, intent(inout) :: nbody_system[:] !! Swiftest nbody_system object +#else + class(swiftest_nbody_system), allocatable, intent(inout) :: nbody_system !! Swiftest nbody_system object +#endif + class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters end subroutine swiftest_util_setup_construct_system module subroutine swiftest_util_setup_initialize_particle_info_system(self, param) diff --git a/src/swiftest/swiftest_util.f90 b/src/swiftest/swiftest_util.f90 index 18b6d22df..0b8f3e0e2 100644 --- a/src/swiftest/swiftest_util.f90 +++ b/src/swiftest/swiftest_util.f90 @@ -2694,7 +2694,6 @@ module subroutine swiftest_util_set_rhill_approximate(self,cb) return end subroutine swiftest_util_set_rhill_approximate - module subroutine swiftest_util_setup_construct_system(nbody_system, param) !! author: David A. Minton !! @@ -2702,14 +2701,22 @@ module subroutine swiftest_util_setup_construct_system(nbody_system, param) !! implicit none ! Arguments - class(swiftest_nbody_system), allocatable, intent(inout) :: nbody_system !! Swiftest nbody_system object - class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters +#ifdef COARRAY + class(swiftest_nbody_system), allocatable, intent(inout) :: nbody_system[:] !! Swiftest nbody_system object +#else + class(swiftest_nbody_system), allocatable, intent(inout) :: nbody_system !! Swiftest nbody_system object +#endif + class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters select case(param%integrator) case (INT_BS) write(*,*) 'Bulirsch-Stoer integrator not yet enabled' - case (INT_HELIO) + case (INT_HELIO) +#ifdef COARRAY + allocate(helio_nbody_system :: nbody_system[*]) +#else allocate(helio_nbody_system :: nbody_system) +#endif select type(nbody_system) class is (helio_nbody_system) allocate(helio_cb :: nbody_system%cb) @@ -2723,7 +2730,11 @@ module subroutine swiftest_util_setup_construct_system(nbody_system, param) case (INT_TU4) write(*,*) 'INT_TU4 integrator not yet enabled' case (INT_WHM) +#ifdef COARRAY + allocate(whm_nbody_system :: nbody_system[*]) +#else allocate(whm_nbody_system :: nbody_system) +#endif select type(nbody_system) class is (whm_nbody_system) allocate(whm_cb :: nbody_system%cb) @@ -2733,7 +2744,11 @@ module subroutine swiftest_util_setup_construct_system(nbody_system, param) end select param%collision_model = "MERGE" case (INT_RMVS) +#ifdef COARRAY + allocate(rmvs_nbody_system :: nbody_system[*]) +#else allocate(rmvs_nbody_system :: nbody_system) +#endif select type(nbody_system) class is (rmvs_nbody_system) allocate(rmvs_cb :: nbody_system%cb) @@ -2743,7 +2758,11 @@ module subroutine swiftest_util_setup_construct_system(nbody_system, param) end select param%collision_model = "MERGE" case (INT_SYMBA) +#ifdef COARRAY + allocate(symba_nbody_system :: nbody_system[*]) +#else allocate(symba_nbody_system :: nbody_system) +#endif select type(nbody_system) class is (symba_nbody_system) allocate(symba_cb :: nbody_system%cb) @@ -2768,10 +2787,8 @@ module subroutine swiftest_util_setup_construct_system(nbody_system, param) allocate(swiftest_particle_info :: nbody_system%cb%info) - nbody_system%t = param%tstart - return end subroutine swiftest_util_setup_construct_system