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

Commit

Permalink
Experimenting with saving the vector position and velocity data rathe…
Browse files Browse the repository at this point in the history
…r than by component
  • Loading branch information
daminton committed Dec 3, 2022
1 parent 968d395 commit 6e22638
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/modules/swiftest_classes.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/netcdf/netcdf.f90
Original file line number Diff line number Diff line change
Expand Up @@ -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" )
Expand Down Expand Up @@ -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" )
Expand Down Expand Up @@ -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" )
Expand Down

0 comments on commit 6e22638

Please sign in to comment.