From c3d2612e7bb8673d989583cc060266cc1cc519d2 Mon Sep 17 00:00:00 2001 From: David A Minton Date: Wed, 15 Feb 2023 10:14:36 -0500 Subject: [PATCH] Added mass to NetCDF output --- src/netcdf_io/netcdf_io_module.f90 | 6 ++++-- src/swiftest/swiftest_io.f90 | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/netcdf_io/netcdf_io_module.f90 b/src/netcdf_io/netcdf_io_module.f90 index b8eb21d5d..bb2ddb55b 100644 --- a/src/netcdf_io/netcdf_io_module.f90 +++ b/src/netcdf_io/netcdf_io_module.f90 @@ -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 diff --git a/src/swiftest/swiftest_io.f90 b/src/swiftest/swiftest_io.f90 index 6f4845065..00e882ecd 100644 --- a/src/swiftest/swiftest_io.f90 +++ b/src/swiftest/swiftest_io.f90 @@ -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 @@ -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 @@ -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" )