From d7f19ed56ebb73f0f3924b272445640a4048f757 Mon Sep 17 00:00:00 2001 From: Robert Pincus Date: Fri, 14 Jun 2019 18:35:51 -0400 Subject: [PATCH] Update master with change to develop (#30) * Remove nullify on declaration for thread safety (#29) Remove nullify statements on declaration of pointers in subroutines to ensure thread safety for mo_gas_optics_rrtmgp. When pointers get assigned in declarations, they implicitly get a save attribute and are assumed static. This is a problem when then occurs in a threaded region, so this code was NOT thread-safe before. Removing the `=> NULL()` does not change the behavior of the code for non-threaded applications, but does ensure thread-safety. * Array size bug fix in compute_bc() --- extensions/mo_compute_bc.F90 | 2 +- rrtmgp/kernels/mo_gas_optics_kernels.F90 | 1 - rrtmgp/mo_gas_optics_rrtmgp.F90 | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/extensions/mo_compute_bc.F90 b/extensions/mo_compute_bc.F90 index a5c2bc103..275a64808 100644 --- a/extensions/mo_compute_bc.F90 +++ b/extensions/mo_compute_bc.F90 @@ -80,7 +80,7 @@ function compute_bc(k_dist, & allocatable :: optical_props_1lay type(ty_fluxes_1lev) :: fluxes_1lev type(ty_source_func_lw) :: lw_sources_1lay - real(wp), dimension(size(play,1),k_dist%get_nband()) :: solar_src + real(wp), dimension(size(play,1),k_dist%get_ngpt()) :: solar_src ! ---------------------------------------------------------- ! ! Problem extent diff --git a/rrtmgp/kernels/mo_gas_optics_kernels.F90 b/rrtmgp/kernels/mo_gas_optics_kernels.F90 index e25ee66cc..ce1e0f592 100644 --- a/rrtmgp/kernels/mo_gas_optics_kernels.F90 +++ b/rrtmgp/kernels/mo_gas_optics_kernels.F90 @@ -16,7 +16,6 @@ module mo_gas_optics_kernels use mo_rte_kind, only : wp, wl - use mo_util_string, only : string_loc_in_array implicit none interface zero_array diff --git a/rrtmgp/mo_gas_optics_rrtmgp.F90 b/rrtmgp/mo_gas_optics_rrtmgp.F90 index 0f5454c10..653f66a33 100644 --- a/rrtmgp/mo_gas_optics_rrtmgp.F90 +++ b/rrtmgp/mo_gas_optics_rrtmgp.F90 @@ -390,7 +390,7 @@ function compute_gas_taus(this, & integer :: igas, idx_h2o ! index of some gases ! Number of molecules per cm^2 real(wp), dimension(ncol,nlay), target :: col_dry_arr - real(wp), dimension(:,:), pointer :: col_dry_wk => NULL() + real(wp), dimension(:,:), pointer :: col_dry_wk ! ! Interpolation variables used in major gas but not elsewhere, so don't need exporting ! @@ -607,7 +607,7 @@ function source(this, & real(wp), dimension(ngpt, ncol) :: sfc_source_t ! Variables for temperature at layer edges [K] (ncol, nlay+1) real(wp), dimension( ncol,nlay+1), target :: tlev_arr - real(wp), dimension(:,:), pointer :: tlev_wk => NULL() + real(wp), dimension(:,:), pointer :: tlev_wk ! ---------------------------------------------------------- error_msg = "" !