From 4d09491e1ed23020e4d31d2248973a77fb3bd107 Mon Sep 17 00:00:00 2001 From: Ganga P Purja Pun Date: Fri, 6 Jan 2023 16:28:31 -0500 Subject: [PATCH 1/5] Updated pointers, data1 and data2 in amip_interp_type to allocatables --- amip_interp/amip_interp.F90 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/amip_interp/amip_interp.F90 b/amip_interp/amip_interp.F90 index 931a16a745..199230238b 100644 --- a/amip_interp/amip_interp.F90 +++ b/amip_interp/amip_interp.F90 @@ -277,8 +277,7 @@ module amip_interp_mod type amip_interp_type private type (horiz_interp_type) :: Hintrp, Hintrp2 ! add by JHC - real, pointer :: data1(:,:) =>NULL(), & - data2(:,:) =>NULL() + real, allocatable :: data1(:,:), data2(:,:) type (date_type) :: Date1, Date2 logical :: use_climo, use_annual logical :: I_am_initialized=.false. @@ -1003,8 +1002,8 @@ end subroutine amip_interp_init !! when calling get_amip_sst and get_amip_ice. subroutine amip_interp_del (Interp) type (amip_interp_type), intent(inout) :: Interp - if(associated(Interp%data1)) deallocate(Interp%data1) - if(associated(Interp%data2)) deallocate(Interp%data2) + if(allocated(Interp%data1)) deallocate(Interp%data1) + if(allocated(Interp%data2)) deallocate(Interp%data2) if(allocated(lon_bnd)) deallocate(lon_bnd) if(allocated(lat_bnd)) deallocate(lat_bnd) call horiz_interp_del ( Interp%Hintrp ) @@ -1536,8 +1535,8 @@ subroutine amip_interp_type_eq(amip_interp_out, amip_interp_in) endif amip_interp_out%Hintrp = amip_interp_in%Hintrp - amip_interp_out%data1 => amip_interp_in%data1 - amip_interp_out%data2 => amip_interp_in%data2 + amip_interp_out%data1 = amip_interp_in%data1 + amip_interp_out%data2 = amip_interp_in%data2 amip_interp_out%Date1 = amip_interp_in%Date1 amip_interp_out%Date2 = amip_interp_in%Date2 amip_interp_out%Date1 = amip_interp_in%Date1 From bdcd1ac8bc44ba2886e8944e60e8e7fda5d17b10 Mon Sep 17 00:00:00 2001 From: ganganoaa <121043264+ganganoaa@users.noreply.github.com> Date: Wed, 11 Jan 2023 11:19:17 -0500 Subject: [PATCH 2/5] Added member assignment of Hintrp2 --- amip_interp/amip_interp.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/amip_interp/amip_interp.F90 b/amip_interp/amip_interp.F90 index 199230238b..ddb4d51973 100644 --- a/amip_interp/amip_interp.F90 +++ b/amip_interp/amip_interp.F90 @@ -1535,6 +1535,7 @@ subroutine amip_interp_type_eq(amip_interp_out, amip_interp_in) endif amip_interp_out%Hintrp = amip_interp_in%Hintrp + amip_interp_out%Hintrp2 = amip_interp_in%Hintrp2 ! Added GPP amip_interp_out%data1 = amip_interp_in%data1 amip_interp_out%data2 = amip_interp_in%data2 amip_interp_out%Date1 = amip_interp_in%Date1 From 98d5a25c522b9254b015134ac2e64c6c5217104f Mon Sep 17 00:00:00 2001 From: ganganoaa <121043264+ganganoaa@users.noreply.github.com> Date: Thu, 12 Jan 2023 08:18:22 -0500 Subject: [PATCH 3/5] Updated comment --- amip_interp/amip_interp.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amip_interp/amip_interp.F90 b/amip_interp/amip_interp.F90 index ddb4d51973..98914feaa3 100644 --- a/amip_interp/amip_interp.F90 +++ b/amip_interp/amip_interp.F90 @@ -1535,7 +1535,7 @@ subroutine amip_interp_type_eq(amip_interp_out, amip_interp_in) endif amip_interp_out%Hintrp = amip_interp_in%Hintrp - amip_interp_out%Hintrp2 = amip_interp_in%Hintrp2 ! Added GPP + amip_interp_out%Hintrp2 = amip_interp_in%Hintrp2 !< missing assignment statement; added by GPP amip_interp_out%data1 = amip_interp_in%data1 amip_interp_out%data2 = amip_interp_in%data2 amip_interp_out%Date1 = amip_interp_in%Date1 From 902938871c27dcc49a091d1963ba630dbb01dcca Mon Sep 17 00:00:00 2001 From: Ganga P Purja Pun Date: Wed, 18 Jan 2023 10:07:50 -0500 Subject: [PATCH 4/5] Add extra safe-guard before allocation of a pointer --- coupler/coupler_types.F90 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coupler/coupler_types.F90 b/coupler/coupler_types.F90 index 82d0c97082..dd679b8c92 100644 --- a/coupler/coupler_types.F90 +++ b/coupler/coupler_types.F90 @@ -3191,6 +3191,7 @@ subroutine CT_register_restarts_2d(var, bc_rest_files, num_rest_files, mpp_domai if (num_rest_files == 0) return + if (associated(bc_rest_files)) deallocate(bc_rest_files) !< Add extra safe-guard before allocation since the history of the pointer is not known. allocate(bc_rest_files(num_rest_files)) !< Open the files @@ -3394,6 +3395,7 @@ subroutine CT_register_restarts_3d(var, bc_rest_files, num_rest_files, mpp_domai if (num_rest_files == 0) return + if (associated(bc_rest_files)) deallocate(bc_rest_files) !< Add extra safe-guard before allocation since the history of the pointer is not known. allocate(bc_rest_files(num_rest_files)) !< Open the files @@ -3776,6 +3778,7 @@ subroutine mpp_io_CT_register_restarts_2d(var, bc_rest_files, num_rest_files, mp if (num_rest_files == 0) return ! Register the fields with the restart files + if (associated(bc_rest_files)) deallocate(bc_rest_files) !< Add extra safe-guard before allocation since the history of the pointer is not known. allocate(bc_rest_files(num_rest_files)) do n = 1, var%num_bcs if (var%bc(n)%num_fields <= 0) cycle @@ -3866,6 +3869,7 @@ subroutine mpp_io_CT_register_restarts_3d(var, bc_rest_files, num_rest_files, mp if (num_rest_files == 0) return ! Register the fields with the restart files + if (associated(bc_rest_files)) deallocate(bc_rest_files) !< Add extra safe-guard before allocation since the history of the pointer is not known. allocate(bc_rest_files(num_rest_files)) do n = 1, var%num_bcs if (var%bc(n)%num_fields <= 0) cycle From 63e0c6ba359bbfc4fe35c7da1421cb52970c4ae9 Mon Sep 17 00:00:00 2001 From: ganganoaa <121043264+ganganoaa@users.noreply.github.com> Date: Wed, 18 Jan 2023 15:54:58 -0500 Subject: [PATCH 5/5] Update to long comment lines --- coupler/coupler_types.F90 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/coupler/coupler_types.F90 b/coupler/coupler_types.F90 index dd679b8c92..1dea431fb6 100644 --- a/coupler/coupler_types.F90 +++ b/coupler/coupler_types.F90 @@ -3191,7 +3191,7 @@ subroutine CT_register_restarts_2d(var, bc_rest_files, num_rest_files, mpp_domai if (num_rest_files == 0) return - if (associated(bc_rest_files)) deallocate(bc_rest_files) !< Add extra safe-guard before allocation since the history of the pointer is not known. + if (associated(bc_rest_files)) deallocate(bc_rest_files) !< Add extra safe-guard before allocation allocate(bc_rest_files(num_rest_files)) !< Open the files @@ -3395,7 +3395,7 @@ subroutine CT_register_restarts_3d(var, bc_rest_files, num_rest_files, mpp_domai if (num_rest_files == 0) return - if (associated(bc_rest_files)) deallocate(bc_rest_files) !< Add extra safe-guard before allocation since the history of the pointer is not known. + if (associated(bc_rest_files)) deallocate(bc_rest_files) !< Add extra safe-guard before allocation allocate(bc_rest_files(num_rest_files)) !< Open the files @@ -3778,7 +3778,7 @@ subroutine mpp_io_CT_register_restarts_2d(var, bc_rest_files, num_rest_files, mp if (num_rest_files == 0) return ! Register the fields with the restart files - if (associated(bc_rest_files)) deallocate(bc_rest_files) !< Add extra safe-guard before allocation since the history of the pointer is not known. + if (associated(bc_rest_files)) deallocate(bc_rest_files) !< Add extra safe-guard before allocation allocate(bc_rest_files(num_rest_files)) do n = 1, var%num_bcs if (var%bc(n)%num_fields <= 0) cycle @@ -3869,7 +3869,7 @@ subroutine mpp_io_CT_register_restarts_3d(var, bc_rest_files, num_rest_files, mp if (num_rest_files == 0) return ! Register the fields with the restart files - if (associated(bc_rest_files)) deallocate(bc_rest_files) !< Add extra safe-guard before allocation since the history of the pointer is not known. + if (associated(bc_rest_files)) deallocate(bc_rest_files) !< Add extra safe-guard before allocation allocate(bc_rest_files(num_rest_files)) do n = 1, var%num_bcs if (var%bc(n)%num_fields <= 0) cycle