diff --git a/src/fragmentation/fragmentation.f90 b/src/fragmentation/fragmentation.f90 index 7b6190400..43ed02599 100644 --- a/src/fragmentation/fragmentation.f90 +++ b/src/fragmentation/fragmentation.f90 @@ -364,7 +364,7 @@ subroutine construct_temporary_system(tmpsys, tmpparam) end where lexclude(npl+1:(npl + nfrag)) = .true. allocate(tmpparam, source=param) - call setup_construct_system(tmpsys, param) + call setup_construct_system(tmpsys, tmpparam) call tmpsys%tp%setup(0, param) deallocate(tmpsys%cb) allocate(tmpsys%cb, source=cb) diff --git a/src/io/io.f90 b/src/io/io.f90 index e54d67042..45d2e2b13 100644 --- a/src/io/io.f90 +++ b/src/io/io.f90 @@ -1811,7 +1811,6 @@ module subroutine io_write_frame_system(self, param) character(len=STRMAX) :: errmsg integer(I4B) :: iu = BINUNIT !! Unit number for the output file to write frame to logical :: fileExists - type(netcdf_parameters) :: nciu if (.not.lfirst .and. param%lenergy) call self%conservation_report(param, lterminal=.true.) @@ -1861,17 +1860,17 @@ module subroutine io_write_frame_system(self, param) select case(param%out_stat) case('APPEND') - call nciu%open(param) + call param%nciu%open(param) case('NEW', 'REPLACE', 'UNKNOWN') - call nciu%initialize(param) - call nciu%close(param) - call nciu%open(param) + call param%nciu%initialize(param) + call param%nciu%close(param) + call param%nciu%open(param) end select lfirst = .false. else - call nciu%open(param) + call param%nciu%open(param) end if - call self%write_hdr(nciu, param) + call self%write_hdr(param%nciu, param) end if if (param%lgr) then @@ -1892,10 +1891,10 @@ module subroutine io_write_frame_system(self, param) close(iu, err = 667, iomsg = errmsg) else if ((param%out_type == NETCDF_FLOAT_TYPE) .or. (param%out_type == NETCDF_DOUBLE_TYPE)) then - call cb%write_frame(nciu, param) - call pl%write_frame(nciu, param) - call tp%write_frame(nciu, param) - call nciu%close(param) + call cb%write_frame(param%nciu, param) + call pl%write_frame(param%nciu, param) + call tp%write_frame(param%nciu, param) + call param%nciu%close(param) end if return diff --git a/src/modules/swiftest_classes.f90 b/src/modules/swiftest_classes.f90 index 322b759e9..8b07b5b33 100644 --- a/src/modules/swiftest_classes.f90 +++ b/src/modules/swiftest_classes.f90 @@ -7,6 +7,64 @@ module swiftest_classes implicit none public + + type :: netcdf_parameters + integer(I4B) :: out_type !! NetCDF output type (will be assigned either NF90_DOUBLE or NF90_FLOAT, depending on the user parameter) + integer(I4B) :: ncid !! NetCDF ID for the output file + integer(I4B) :: dimids(3) !! Dimensions of the NetCDF file + integer(I4B) :: time_dimid !! NetCDF ID for the time dimension + integer(I4B) :: id_dimid !! NetCDF ID for the particle id dimension + integer(I4B) :: str_dimid !! NetCDF ID for the character string dimension + integer(I4B) :: time_varid !! NetCDF ID for the time variable + integer(I4B) :: id_varid !! NetCDF ID for the particle name variable + integer(I4B) :: name_varid !! NetCDF ID for the namevariable + integer(I4B) :: ptype_varid !! NetCDF ID for the particle type variable + integer(I4B) :: npl_varid !! NetCDF ID for the number of active massive bodies variable + integer(I4B) :: ntp_varid !! NetCDF ID for the number of active test particles variable + integer(I4B) :: a_varid !! NetCDF ID for the semimajor axis variable + integer(I4B) :: e_varid !! NetCDF ID for the eccentricity variable + integer(I4B) :: inc_varid !! NetCDF ID for the inclination variable + integer(I4B) :: capom_varid !! NetCDF ID for the long. asc. node variable + integer(I4B) :: omega_varid !! NetCDF ID for the arg. periapsis variable + integer(I4B) :: capm_varid !! NetCDF ID for the mean anomaly variable + integer(I4B) :: xhx_varid !! NetCDF ID for the heliocentric position x variable + integer(I4B) :: xhy_varid !! NetCDF ID for the heliocentric position y variable + integer(I4B) :: xhz_varid !! NetCDF ID for the heliocentric position z variable + integer(I4B) :: vhx_varid !! NetCDF ID for the heliocentric velocity x variable + integer(I4B) :: vhy_varid !! NetCDF ID for the heliocentric velocity y variable + integer(I4B) :: vhz_varid !! NetCDF ID for the heliocentric velocity z variable + integer(I4B) :: Gmass_varid !! NetCDF ID for the mass variable + integer(I4B) :: rhill_varid !! NetCDF ID for the hill radius variable + integer(I4B) :: radius_varid !! NetCDF ID for the radius variable + integer(I4B) :: Ip1_varid !! NetCDF ID for the axis 1 principal moment of inertia variable + integer(I4B) :: Ip2_varid !! NetCDF ID for the axis 2 principal moment of inertia variable + integer(I4B) :: Ip3_varid !! NetCDF ID for the axis 3 principal moment of inertia variable + integer(I4B) :: rotx_varid !! NetCDF ID for the rotation x variable + integer(I4B) :: roty_varid !! NetCDF ID for the rotation y variable + integer(I4B) :: rotz_varid !! NetCDF ID for the rotation z variable + integer(I4B) :: k2_varid !! NetCDF ID for the Love number variable + integer(I4B) :: Q_varid !! NetCDF ID for the energy dissipation variable + integer(I4B) :: KE_orb_varid !! NetCDF ID for the system orbital kinetic energy variable + integer(I4B) :: KE_spin_varid !! NetCDF ID for the system spin kinetic energy variable + integer(I4B) :: PE_varid !! NetCDF ID for the system potential energy variable + integer(I4B) :: L_orbx_varid !! NetCDF ID for the system orbital angular momentum x variable + integer(I4B) :: L_orby_varid !! NetCDF ID for the system orbital angular momentum y variable + integer(I4B) :: L_orbz_varid !! NetCDF ID for the system orbital angular momentum z variable + integer(I4B) :: L_spinx_varid !! NetCDF ID for the system spin angular momentum x variable + integer(I4B) :: L_spiny_varid !! NetCDF ID for the system spin angular momentum y variable + integer(I4B) :: L_spinz_varid !! NetCDF ID for the system spin angular momentum z variable + integer(I4B) :: L_escapex_varid !! NetCDF ID for the escaped angular momentum x variable + integer(I4B) :: L_escapey_varid !! NetCDF ID for the escaped angular momentum x variable + integer(I4B) :: L_escapez_varid !! NetCDF ID for the escaped angular momentum x variable + integer(I4B) :: Ecollisions_varid !! NetCDF ID for the energy lost in collisions variable + integer(I4B) :: Euntracked_varid !! NetCDF ID for the energy that is untracked due to loss (untracked potential energy due to mergers and body energy for escaped bodies) + integer(I4B) :: GMescape_varid !! NetCDF ID for the G*Mass of bodies that escape the system + contains + procedure :: close => netcdf_close !! Closes an open NetCDF file + procedure :: initialize => netcdf_initialize_output !! Initialize a set of parameters used to identify a NetCDF output object + procedure :: open => netcdf_open !! Opens a NetCDF file + end type netcdf_parameters + !******************************************************************************************************************************** ! swiftest_parameters class definitions !******************************************************************************************************************************** @@ -77,6 +135,8 @@ module swiftest_classes logical :: lgr = .false. !! Turn on GR logical :: lyarkovsky = .false. !! Turn on Yarkovsky effect logical :: lyorp = .false. !! Turn on YORP effect + + class(netcdf_parameters), allocatable :: nciu !! Object containing NetCDF parameters contains procedure :: reader => io_param_reader procedure :: writer => io_param_writer @@ -84,62 +144,6 @@ module swiftest_classes procedure :: read_in => io_read_in_param end type swiftest_parameters - type :: netcdf_parameters - integer(I4B) :: out_type !! NetCDF output type (will be assigned either NF90_DOUBLE or NF90_FLOAT, depending on the user parameter) - integer(I4B) :: ncid !! NetCDF ID for the output file - integer(I4B) :: dimids(3) !! Dimensions of the NetCDF file - integer(I4B) :: time_dimid !! NetCDF ID for the time dimension - integer(I4B) :: id_dimid !! NetCDF ID for the particle id dimension - integer(I4B) :: str_dimid !! NetCDF ID for the character string dimension - integer(I4B) :: time_varid !! NetCDF ID for the time variable - integer(I4B) :: id_varid !! NetCDF ID for the particle name variable - integer(I4B) :: name_varid !! NetCDF ID for the namevariable - integer(I4B) :: ptype_varid !! NetCDF ID for the particle type variable - integer(I4B) :: npl_varid !! NetCDF ID for the number of active massive bodies variable - integer(I4B) :: ntp_varid !! NetCDF ID for the number of active test particles variable - integer(I4B) :: a_varid !! NetCDF ID for the semimajor axis variable - integer(I4B) :: e_varid !! NetCDF ID for the eccentricity variable - integer(I4B) :: inc_varid !! NetCDF ID for the inclination variable - integer(I4B) :: capom_varid !! NetCDF ID for the long. asc. node variable - integer(I4B) :: omega_varid !! NetCDF ID for the arg. periapsis variable - integer(I4B) :: capm_varid !! NetCDF ID for the mean anomaly variable - integer(I4B) :: xhx_varid !! NetCDF ID for the heliocentric position x variable - integer(I4B) :: xhy_varid !! NetCDF ID for the heliocentric position y variable - integer(I4B) :: xhz_varid !! NetCDF ID for the heliocentric position z variable - integer(I4B) :: vhx_varid !! NetCDF ID for the heliocentric velocity x variable - integer(I4B) :: vhy_varid !! NetCDF ID for the heliocentric velocity y variable - integer(I4B) :: vhz_varid !! NetCDF ID for the heliocentric velocity z variable - integer(I4B) :: Gmass_varid !! NetCDF ID for the mass variable - integer(I4B) :: rhill_varid !! NetCDF ID for the hill radius variable - integer(I4B) :: radius_varid !! NetCDF ID for the radius variable - integer(I4B) :: Ip1_varid !! NetCDF ID for the axis 1 principal moment of inertia variable - integer(I4B) :: Ip2_varid !! NetCDF ID for the axis 2 principal moment of inertia variable - integer(I4B) :: Ip3_varid !! NetCDF ID for the axis 3 principal moment of inertia variable - integer(I4B) :: rotx_varid !! NetCDF ID for the rotation x variable - integer(I4B) :: roty_varid !! NetCDF ID for the rotation y variable - integer(I4B) :: rotz_varid !! NetCDF ID for the rotation z variable - integer(I4B) :: k2_varid !! NetCDF ID for the Love number variable - integer(I4B) :: Q_varid !! NetCDF ID for the energy dissipation variable - integer(I4B) :: KE_orb_varid !! NetCDF ID for the system orbital kinetic energy variable - integer(I4B) :: KE_spin_varid !! NetCDF ID for the system spin kinetic energy variable - integer(I4B) :: PE_varid !! NetCDF ID for the system potential energy variable - integer(I4B) :: L_orbx_varid !! NetCDF ID for the system orbital angular momentum x variable - integer(I4B) :: L_orby_varid !! NetCDF ID for the system orbital angular momentum y variable - integer(I4B) :: L_orbz_varid !! NetCDF ID for the system orbital angular momentum z variable - integer(I4B) :: L_spinx_varid !! NetCDF ID for the system spin angular momentum x variable - integer(I4B) :: L_spiny_varid !! NetCDF ID for the system spin angular momentum y variable - integer(I4B) :: L_spinz_varid !! NetCDF ID for the system spin angular momentum z variable - integer(I4B) :: L_escapex_varid !! NetCDF ID for the escaped angular momentum x variable - integer(I4B) :: L_escapey_varid !! NetCDF ID for the escaped angular momentum x variable - integer(I4B) :: L_escapez_varid !! NetCDF ID for the escaped angular momentum x variable - integer(I4B) :: Ecollisions_varid !! NetCDF ID for the energy lost in collisions variable - integer(I4B) :: Euntracked_varid !! NetCDF ID for the energy that is untracked due to loss (untracked potential energy due to mergers and body energy for escaped bodies) - integer(I4B) :: GMescape_varid !! NetCDF ID for the G*Mass of bodies that escape the system - contains - procedure :: close => netcdf_close !! Closes an open NetCDF file - procedure :: initialize => netcdf_initialize_output !! Initialize a set of parameters used to identify a NetCDF output object - procedure :: open => netcdf_open !! Opens a NetCDF file - end type netcdf_parameters !******************************************************************************************************************************** ! swiftest_swiftest_particle_info class definitions and method interfaces @@ -986,7 +990,7 @@ end subroutine setup_body module subroutine setup_construct_system(system, param) implicit none class(swiftest_nbody_system), allocatable, intent(inout) :: system !! Swiftest system object - class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters + class(swiftest_parameters), intent(inout) :: param !! Current run configuration parameters end subroutine setup_construct_system module subroutine setup_encounter(self, n) diff --git a/src/modules/symba_classes.f90 b/src/modules/symba_classes.f90 index 18cb8fe96..aa0a187f8 100644 --- a/src/modules/symba_classes.f90 +++ b/src/modules/symba_classes.f90 @@ -81,6 +81,7 @@ module symba_classes real(DP) :: R0 = 0.0_DP !! Initial radius of the central body real(DP) :: dR = 0.0_DP !! Change in the radius of the central body contains + procedure :: write_frame_netcdf => symba_netcdf_write_frame_cb !! I/O routine for writing out a single frame of time-series data for all bodies in the system in NetCDF format end type symba_cb !******************************************************************************************************************************** @@ -119,7 +120,6 @@ module symba_classes procedure :: rearrange => symba_util_sort_rearrange_pl !! Rearranges the order of array elements of body based on an input index array. Used in sorting methods procedure :: spill => symba_util_spill_pl !! "Spills" bodies from one object to another depending on the results of a mask (uses the PACK intrinsic) procedure :: write_frame_netcdf => symba_netcdf_write_frame_pl !! I/O routine for writing out a single frame of time-series data for all bodies in the system in NetCDF format - generic :: write_frame => write_frame_netcdf end type symba_pl type, extends(symba_pl) :: symba_merger @@ -149,6 +149,7 @@ module symba_classes procedure :: sort => symba_util_sort_tp !! Sorts body arrays by a sortable componen procedure :: rearrange => symba_util_sort_rearrange_tp !! Rearranges the order of array elements of body based on an input index array. Used in sorting methods procedure :: spill => symba_util_spill_tp !! "Spills" bodies from one object to another depending on the results of a mask (uses the PACK intrinsic) + procedure :: write_frame_netcdf => symba_netcdf_write_frame_tp !! I/O routine for writing out a single frame of time-series data for all bodies in the system in NetCDF format end type symba_tp !******************************************************************************************************************************** @@ -472,14 +473,30 @@ module subroutine symba_netcdf_open(self, param) class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters end subroutine symba_netcdf_open + module subroutine symba_netcdf_write_frame_cb(self, iu, param) + use swiftest_classes, only : swiftest_parameters, netcdf_parameters + implicit none + class(symba_cb), intent(in) :: self !! Symba central body object + class(netcdf_parameters), intent(inout) :: iu !! Parameters used to identify a particular NetCDF dataset + class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters + end subroutine symba_netcdf_write_frame_cb + module subroutine symba_netcdf_write_frame_pl(self, iu, param) use swiftest_classes, only : swiftest_parameters, netcdf_parameters implicit none - class(symba_pl), intent(in) :: self !! Swiftest particle object + class(symba_pl), intent(in) :: self !! Symba massive body object class(netcdf_parameters), intent(inout) :: iu !! Parameters used to identify a particular NetCDF dataset class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters end subroutine symba_netcdf_write_frame_pl + module subroutine symba_netcdf_write_frame_tp(self, iu, param) + use swiftest_classes, only : swiftest_parameters, netcdf_parameters + implicit none + class(symba_tp), intent(in) :: self !! SyMBA test particle object + class(netcdf_parameters), intent(inout) :: iu !! Parameters used to identify a particular NetCDF dataset + class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters + end subroutine symba_netcdf_write_frame_tp + module subroutine symba_setup_initialize_particle_info_system(self, param) use swiftest_classes, only : swiftest_parameters implicit none diff --git a/src/setup/setup.f90 b/src/setup/setup.f90 index fe78ee9e3..02a44f091 100644 --- a/src/setup/setup.f90 +++ b/src/setup/setup.f90 @@ -10,7 +10,7 @@ module subroutine setup_construct_system(system, param) implicit none ! Arguments class(swiftest_nbody_system), allocatable, intent(inout) :: system !! Swiftest system object - class(swiftest_parameters), intent(in) :: param !! Swiftest parameters + class(swiftest_parameters), intent(inout) :: param !! Swiftest parameters select case(param%integrator) case (BS) @@ -69,9 +69,11 @@ module subroutine setup_construct_system(system, param) select type(system) class is (symba_nbody_system) - allocate(symba_particle_info :: system%cb%info) + if (.not.allocated(system%cb%info)) allocate(symba_particle_info :: system%cb%info) + if (.not.allocated(param%nciu)) allocate(symba_netcdf_parameters :: param%nciu) class default - allocate(swiftest_particle_info :: system%cb%info) + if (.not.allocated(system%cb%info)) allocate(swiftest_particle_info :: system%cb%info) + if (.not.allocated(param%nciu)) allocate(netcdf_parameters :: param%nciu) end select return diff --git a/src/symba/symba_netcdf.f90 b/src/symba/symba_netcdf.f90 index e4e715f35..a3ef5cec0 100644 --- a/src/symba/symba_netcdf.f90 +++ b/src/symba/symba_netcdf.f90 @@ -60,7 +60,7 @@ module subroutine symba_netcdf_open(self, param) call netcdf_open(self, param) call check( nf90_inq_varid(self%ncid, ORIGIN_TYPE_VARNAME, self%origin_type_varid)) - call check( nf90_inq_varid(self%ncid, ORIGIN_TIME_VARNAME, self%origin_type_varid)) + call check( nf90_inq_varid(self%ncid, ORIGIN_TIME_VARNAME, self%origin_time_varid)) call check( nf90_inq_varid(self%ncid, ORIGIN_XHX_VARNAME, self%origin_xhx_varid)) call check( nf90_inq_varid(self%ncid, ORIGIN_XHY_VARNAME, self%origin_xhy_varid)) call check( nf90_inq_varid(self%ncid, ORIGIN_XHZ_VARNAME, self%origin_xhz_varid)) @@ -71,6 +71,43 @@ module subroutine symba_netcdf_open(self, param) return end subroutine symba_netcdf_open + module subroutine symba_netcdf_write_frame_cb(self, iu, param) + !! author: Carlisle A. Wishard, Dana Singh, and David A. Minton + !! + !! Write a frame of output of a SyMBA massive body data to the binary output file + !! Note: If outputting to orbital elements, but sure that the conversion is done prior to calling this method + implicit none + ! Arguments + class(symba_cb), intent(in) :: self !! SyMBA central body object + class(netcdf_parameters), intent(inout) :: iu !! Parameters used to identify a particular NetCDF dataset + class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters + ! Internals + integer(I4B) :: strlen, idslot + character(len=:), allocatable :: charstring + + call netcdf_write_frame_base(self, iu, param) + select type(iu) + class is (symba_netcdf_parameters) + select type(info => self%info) + class is (symba_particle_info) + idslot = self%id + 1 + + charstring = trim(adjustl(info%origin_type)) + strlen = len(charstring) + call check( nf90_put_var(iu%ncid, iu%origin_type_varid, charstring, start=[1, idslot], count=[strlen, 1]) ) + call check( nf90_put_var(iu%ncid, iu%origin_time_varid, info%origin_time, start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_xhx_varid, info%origin_xh(1), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_xhy_varid, info%origin_xh(2), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_xhz_varid, info%origin_xh(3), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_vhx_varid, info%origin_vh(1), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_vhy_varid, info%origin_vh(2), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_vhz_varid, info%origin_vh(3), start=[idslot]) ) + end select + end select + + return + end subroutine symba_netcdf_write_frame_cb + module subroutine symba_netcdf_write_frame_pl(self, iu, param) !! author: Carlisle A. Wishard, Dana Singh, and David A. Minton @@ -83,12 +120,11 @@ module subroutine symba_netcdf_write_frame_pl(self, iu, param) class(netcdf_parameters), intent(inout) :: iu !! Parameters used to identify a particular NetCDF dataset class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters ! Internals - integer(I4B) :: i, j, tslot, strlen, idslot + integer(I4B) :: i, j, strlen, idslot integer(I4B), dimension(:), allocatable :: ind character(len=:), allocatable :: charstring call netcdf_write_frame_base(self, iu, param) - tslot = int(param%ioutput, kind=I4B) + 1 select type(iu) class is (symba_netcdf_parameters) associate(npl => self%nbody) @@ -104,6 +140,13 @@ module subroutine symba_netcdf_write_frame_pl(self, iu, param) charstring = trim(adjustl(info(j)%origin_type)) strlen = len(charstring) call check( nf90_put_var(iu%ncid, iu%origin_type_varid, charstring, start=[1, idslot], count=[strlen, 1]) ) + call check( nf90_put_var(iu%ncid, iu%origin_time_varid, info(j)%origin_time, start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_xhx_varid, info(j)%origin_xh(1), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_xhy_varid, info(j)%origin_xh(2), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_xhz_varid, info(j)%origin_xh(3), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_vhx_varid, info(j)%origin_vh(1), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_vhy_varid, info(j)%origin_vh(2), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_vhz_varid, info(j)%origin_vh(3), start=[idslot]) ) end do end select end associate @@ -112,4 +155,52 @@ module subroutine symba_netcdf_write_frame_pl(self, iu, param) return end subroutine symba_netcdf_write_frame_pl + + + module subroutine symba_netcdf_write_frame_tp(self, iu, param) + !! author: Carlisle A. Wishard, Dana Singh, and David A. Minton + !! + !! Write a frame of output of a SyMBA massive body data to the binary output file + !! Note: If outputting to orbital elements, but sure that the conversion is done prior to calling this method + implicit none + ! Arguments + class(symba_tp), intent(in) :: self !! SyMBA test particle + class(netcdf_parameters), intent(inout) :: iu !! Parameters used to identify a particular NetCDF dataset + class(swiftest_parameters), intent(in) :: param !! Current run configuration parameters + ! Internals + integer(I4B) :: i, j, strlen, idslot + integer(I4B), dimension(:), allocatable :: ind + character(len=:), allocatable :: charstring + + call netcdf_write_frame_base(self, iu, param) + select type(iu) + class is (symba_netcdf_parameters) + associate(ntp => self%nbody) + if (ntp == 0) return + allocate(ind(ntp)) + call util_sort(self%id(1:ntp), ind(1:ntp)) + select type(info => self%info) + class is (symba_particle_info) + do i = 1, ntp + j = ind(i) + idslot = self%id(j) + 1 + + charstring = trim(adjustl(info(j)%origin_type)) + strlen = len(charstring) + call check( nf90_put_var(iu%ncid, iu%origin_type_varid, charstring, start=[1, idslot], count=[strlen, 1]) ) + call check( nf90_put_var(iu%ncid, iu%origin_time_varid, info(j)%origin_time, start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_xhx_varid, info(j)%origin_xh(1), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_xhy_varid, info(j)%origin_xh(2), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_xhz_varid, info(j)%origin_xh(3), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_vhx_varid, info(j)%origin_vh(1), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_vhy_varid, info(j)%origin_vh(2), start=[idslot]) ) + call check( nf90_put_var(iu%ncid, iu%origin_vhz_varid, info(j)%origin_vh(3), start=[idslot]) ) + end do + end select + end associate + + end select + + return + end subroutine symba_netcdf_write_frame_tp end submodule s_symba_netcdf \ No newline at end of file diff --git a/src/util/util_append.f90 b/src/util/util_append.f90 index 11664827e..2f7d54474 100644 --- a/src/util/util_append.f90 +++ b/src/util/util_append.f90 @@ -128,6 +128,7 @@ module subroutine util_append_arr_info(arr, source, nold, nsrc, lsource_mask) logical, dimension(:), intent(in) :: lsource_mask !! Logical mask indicating which elements to append to ! Internals integer(I4B) :: nnew + class(swiftest_particle_info), allocatable :: tmp if (.not. allocated(source)) return