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

Commit

Permalink
Added mass to NetCDF output
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Feb 15, 2023
1 parent 6b4b805 commit c3d2612
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/netcdf_io/netcdf_io_module.f90
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,10 @@ module netcdf_io
integer(I4B) :: vh_varid !! ID for the heliocentric velocity vector variable
character(NAMELEN) :: gr_pseudo_vh_varname = "gr_pseudo_vh" !! name of the heliocentric pseudovelocity vector variable (used in GR only)
integer(I4B) :: gr_pseudo_vh_varid !! ID for the heliocentric pseudovelocity vector variable (used in GR)
character(NAMELEN) :: Gmass_varname = "Gmass" !! name of the mass variable
integer(I4B) :: Gmass_varid !! ID for the mass variable
character(NAMELEN) :: Gmass_varname = "Gmass" !! name of the G*mass variable
integer(I4B) :: Gmass_varid !! ID for the G*mass variable
character(NAMELEN) :: mass_varname = "mass" !! name of the mass variable
integer(I4B) :: mass_varid !! ID for the mass variable
character(NAMELEN) :: rhill_varname = "rhill" !! name of the hill radius variable
integer(I4B) :: rhill_varid !! ID for the hill radius variable
character(NAMELEN) :: radius_varname = "radius" !! name of the radius variable
Expand Down
3 changes: 3 additions & 0 deletions src/swiftest/swiftest_io.f90
Original file line number Diff line number Diff line change
Expand Up @@ -738,6 +738,7 @@ module subroutine swiftest_io_netcdf_initialize_output(self, param)
end if

call netcdf_io_check( nf90_def_var(nc%id, nc%Gmass_varname, nc%out_type, [nc%name_dimid, nc%time_dimid], nc%Gmass_varid), "netcdf_io_initialize_output nf90_def_var Gmass_varid" )
call netcdf_io_check( nf90_def_var(nc%id, nc%mass_varname, nc%out_type, [nc%name_dimid, nc%time_dimid], nc%mass_varid), "netcdf_io_initialize_output nf90_def_var mass_varid" )
call netcdf_io_check( nf90_def_var(nc%id, nc%rhill_varname, nc%out_type, [nc%name_dimid, nc%time_dimid], nc%rhill_varid), "netcdf_io_initialize_output nf90_def_var rhill_varid" )

if (param%lclose) then
Expand Down Expand Up @@ -1610,6 +1611,7 @@ module subroutine swiftest_io_netcdf_write_frame_body(self, nc, param)
select type(self)
class is (swiftest_pl) ! Additional output if the passed polymorphic object is a massive body
call netcdf_io_check( nf90_put_var(nc%id, nc%Gmass_varid, self%Gmass(j), start=[idslot, tslot]), "netcdf_io_write_frame_body nf90_put_var body Gmass_varid" )
call netcdf_io_check( nf90_put_var(nc%id, nc%mass_varid, self%mass(j), start=[idslot, tslot]), "netcdf_io_write_frame_body nf90_put_var body mass_varid" )
if (param%lrhill_present) then
call netcdf_io_check( nf90_put_var(nc%id, nc%rhill_varid, self%rhill(j), start=[idslot, tslot]), "netcdf_io_write_frame_body nf90_put_var body rhill_varid" )
end if
Expand Down Expand Up @@ -1656,6 +1658,7 @@ module subroutine swiftest_io_netcdf_write_frame_cb(self, nc, param)
call netcdf_io_check( nf90_put_var(nc%id, nc%status_varid, ACTIVE, start=[idslot, tslot]), "netcdf_io_write_frame_cb nf90_put_var cb id_varid" )

call netcdf_io_check( nf90_put_var(nc%id, nc%Gmass_varid, self%Gmass, start=[idslot, tslot]), "netcdf_io_write_frame_cb nf90_put_var cb Gmass_varid" )
call netcdf_io_check( nf90_put_var(nc%id, nc%mass_varid, self%mass, start=[idslot, tslot]), "netcdf_io_write_frame_cb nf90_put_var cb mass_varid" )
if (param%lclose) call netcdf_io_check( nf90_put_var(nc%id, nc%radius_varid, self%radius, start=[idslot, tslot]), "netcdf_io_write_frame_cb nf90_put_var cb radius_varid" )
call netcdf_io_check( nf90_put_var(nc%id, nc%j2rp2_varid, self%j2rp2, start=[tslot]), "netcdf_io_write_frame_cb nf90_put_var cb j2rp2_varid" )
call netcdf_io_check( nf90_put_var(nc%id, nc%j4rp4_varid, self%j4rp4, start=[tslot]), "netcdf_io_write_frame_cb nf90_put_var cb j4rp4_varid" )
Expand Down

0 comments on commit c3d2612

Please sign in to comment.