From 6e22638e1c2b6ff6b6dfbfe44f0039dda5060455 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Sat, 3 Dec 2022 10:54:58 -0500 Subject: [PATCH] Experimenting with saving the vector position and velocity data rather than by component --- src/modules/swiftest_classes.f90 | 4 ++++ src/netcdf/netcdf.f90 | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/src/modules/swiftest_classes.f90 b/src/modules/swiftest_classes.f90 index 61e0ac846..d136cd7f6 100644 --- a/src/modules/swiftest_classes.f90 +++ b/src/modules/swiftest_classes.f90 @@ -64,6 +64,10 @@ module swiftest_classes integer(I4B) :: omega_varid !! ID for the arg. periapsis variable character(NAMELEN) :: capm_varname = "capm" !! name of the mean anomaly variable integer(I4B) :: capm_varid !! ID for the mean anomaly variable + character(NAMELEN) :: rh_varname = "rh" !! name of the heliocentric position vector variable + integer(I4B) :: rh_varid !! ID for the heliocentric position vector variable + character(NAMELEN) :: vh_varname = "vh" !! name of the heliocentric velocity vector variable + integer(I4B) :: vh_varid !! ID for the heliocentric velocity vector variable character(NAMELEN) :: xhx_varname = "xhx" !! name of the heliocentric position x variable integer(I4B) :: xhx_varid !! ID for the heliocentric position x variable character(NAMELEN) :: xhy_varname = "xhy" !! name of the heliocentric position y variable diff --git a/src/netcdf/netcdf.f90 b/src/netcdf/netcdf.f90 index 1459cf02b..818fa3302 100644 --- a/src/netcdf/netcdf.f90 +++ b/src/netcdf/netcdf.f90 @@ -226,6 +226,8 @@ module subroutine netcdf_initialize_output(self, param) call check( nf90_def_var(nciu%id, nciu%status_varname, NF90_CHAR, [nciu%str_dimid, nciu%id_dimid], nciu%status_varid), "netcdf_initialize_output nf90_def_var status_varid" ) if ((param%out_form == "XV") .or. (param%out_form == "XVEL")) then + call check( nf90_def_var(nciu%id, nciu%rh_varname, nciu%out_type, [nciu%space_dimid, nciu%id_dimid, nciu%time_dimid], nciu%rh_varid), "netcdf_initialize_output nf90_def_var rh_varid" ) + call check( nf90_def_var(nciu%id, nciu%vh_varname, nciu%out_type, [nciu%space_dimid, nciu%id_dimid, nciu%time_dimid], nciu%vh_varid), "netcdf_initialize_output nf90_def_var vh_varid" ) call check( nf90_def_var(nciu%id, nciu%xhx_varname, nciu%out_type, [nciu%id_dimid, nciu%time_dimid], nciu%xhx_varid), "netcdf_initialize_output nf90_def_var xhx_varid" ) call check( nf90_def_var(nciu%id, nciu%xhy_varname, nciu%out_type, [nciu%id_dimid, nciu%time_dimid], nciu%xhy_varid), "netcdf_initialize_output nf90_def_var xhy_varid" ) call check( nf90_def_var(nciu%id, nciu%xhz_varname, nciu%out_type, [nciu%id_dimid, nciu%time_dimid], nciu%xhz_varid), "netcdf_initialize_output nf90_def_var xhz_varid" ) @@ -389,6 +391,8 @@ module subroutine netcdf_open(self, param, readonly) call check( nf90_inq_varid(nciu%id, nciu%gmass_varname, nciu%Gmass_varid), "netcdf_open nf90_inq_varid Gmass_varid" ) if ((param%out_form == "XV") .or. (param%out_form == "XVEL")) then + status = nf90_inq_varid(nciu%id, nciu%rh_varname, nciu%rh_varid) + status = nf90_inq_varid(nciu%id, nciu%vh_varname, nciu%vh_varid) call check( nf90_inq_varid(nciu%id, nciu%xhx_varname, nciu%xhx_varid), "netcdf_open nf90_inq_varid xhx_varid" ) call check( nf90_inq_varid(nciu%id, nciu%xhy_varname, nciu%xhy_varid), "netcdf_open nf90_inq_varid xhy_varid" ) call check( nf90_inq_varid(nciu%id, nciu%xhz_varname, nciu%xhz_varid), "netcdf_open nf90_inq_varid xhz_varid" ) @@ -1212,6 +1216,8 @@ module subroutine netcdf_write_frame_base(self, nciu, param) if (param%lgr) call gr_pseudovel2vel(param, self%mu(j), self%xh(:, j), self%vh(:, j), vh(:)) if ((param%out_form == "XV") .or. (param%out_form == "XVEL")) then + call check( nf90_put_var(nciu%id, nciu%rh_varid, self%xh(:, j), start=[1,idslot, tslot], count=[3,1,1]), "netcdf_write_frame_base nf90_put_var rh_varid" ) + call check( nf90_put_var(nciu%id, nciu%vh_varid, self%vh(:, j), start=[1,idslot, tslot], count=[3,1,1]), "netcdf_write_frame_base nf90_put_var vh_varid" ) call check( nf90_put_var(nciu%id, nciu%xhx_varid, self%xh(1, j), start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var xhx_varid" ) call check( nf90_put_var(nciu%id, nciu%xhy_varid, self%xh(2, j), start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var xhy_varid" ) call check( nf90_put_var(nciu%id, nciu%xhz_varid, self%xh(3, j), start=[idslot, tslot]), "netcdf_write_frame_base nf90_put_var xhz_varid" )