Skip to content

Commit 63e0f35

Browse files
author
Steve Goldhaber
committed
Fix character declarations and init logic
1 parent acc3c36 commit 63e0f35

1 file changed

Lines changed: 31 additions & 29 deletions

File tree

src/cpl/nuopc/atm_stream_co2.F90

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module atm_stream_co2
66
! interpolation.
77
!-----------------------------------------------------------------------
88
!
9-
use ESMF , only : ESMF_SUCCESS
9+
use ESMF , only : ESMF_SUCCESS
1010
use nuopc_shr_methods , only : chkerr
1111
use dshr_strdata_mod , only : shr_strdata_type
1212
use shr_kind_mod , only : r8 => shr_kind_r8, CL => shr_kind_cl, CS => shr_kind_cs
@@ -57,7 +57,7 @@ subroutine stream_co2_surface_source_readnl(nlfile)
5757
integer :: nml_error ! namelist i/o error flag
5858
integer :: ierr ! error status
5959
integer :: nf ! field counter
60-
character(*), parameter :: subName = "('stream_co2_surface_source_readnl')"
60+
character(len=*), parameter :: subName = "('stream_co2_surface_source_readnl')"
6161
!-----------------------------------------------------------------------
6262

6363
namelist /co2_surface_source_stream_nl/ &
@@ -165,36 +165,38 @@ subroutine stream_co2_surface_source_init(rc)
165165
integer, intent(out) :: rc
166166

167167
! local variables
168-
character(*), parameter :: subName = "('stream_co2_surface_source_init')"
168+
character(len=*), parameter :: subName = "('stream_co2_surface_source_init')"
169169
!-----------------------------------------------------------------------
170170

171171
rc = ESMF_SUCCESS
172172

173-
! Initialize the cdeps data type sdat_co2_surface_source
174-
call shr_strdata_init_from_inline(sdat_co2_surface_source, &
175-
my_task = iam, &
176-
logunit = iulog, &
177-
compname = 'ATM', &
178-
model_clock = model_clock, &
179-
model_mesh = model_mesh, &
180-
stream_meshfile = trim(stream_co2_surface_source_mesh_filename), &
181-
stream_filenames = (/trim(stream_co2_surface_source_data_filename)/), &
182-
stream_yearFirst = stream_co2_surface_source_year_first, &
183-
stream_yearLast = stream_co2_surface_source_year_last, &
184-
stream_yearAlign = stream_co2_surface_source_year_align, &
185-
stream_fldlistFile = (/stream_co2_surface_source_data_varname/), &
186-
stream_fldListModel = (/stream_co2_surface_source_data_varname/), &
187-
stream_lev_dimname = 'null', &
188-
stream_mapalgo = 'bilinear', &
189-
stream_offset = 0, &
190-
stream_taxmode = trim(stream_co2_surface_source_taxmode), &
191-
stream_dtlimit = 1.0e30_r8, &
192-
stream_tintalgo = 'linear', &
193-
stream_name = 'CO2_SURFACE_SOURCE data ', &
194-
rc = rc)
195-
if (ChkErr(rc,__LINE__,u_FILE_u)) return
196-
197-
stream_co2_surface_source_is_initialized = .true.
173+
if (co2_surface_source .and. .not. stream_co2_surface_source_is_initialized) then
174+
! Initialize the cdeps data type sdat_co2_surface_source
175+
call shr_strdata_init_from_inline(sdat_co2_surface_source, &
176+
my_task = iam, &
177+
logunit = iulog, &
178+
compname = 'ATM', &
179+
model_clock = model_clock, &
180+
model_mesh = model_mesh, &
181+
stream_meshfile = trim(stream_co2_surface_source_mesh_filename), &
182+
stream_filenames = (/trim(stream_co2_surface_source_data_filename)/), &
183+
stream_yearFirst = stream_co2_surface_source_year_first, &
184+
stream_yearLast = stream_co2_surface_source_year_last, &
185+
stream_yearAlign = stream_co2_surface_source_year_align, &
186+
stream_fldlistFile = (/stream_co2_surface_source_data_varname/), &
187+
stream_fldListModel = (/stream_co2_surface_source_data_varname/), &
188+
stream_lev_dimname = 'null', &
189+
stream_mapalgo = 'bilinear', &
190+
stream_offset = 0, &
191+
stream_taxmode = trim(stream_co2_surface_source_taxmode), &
192+
stream_dtlimit = 1.0e30_r8, &
193+
stream_tintalgo = 'linear', &
194+
stream_name = 'CO2_SURFACE_SOURCE data ', &
195+
rc = rc)
196+
if (ChkErr(rc,__LINE__,u_FILE_u)) return
197+
198+
stream_co2_surface_source_is_initialized = .true.
199+
end if
198200

199201
end subroutine stream_co2_surface_source_init
200202

@@ -220,7 +222,7 @@ subroutine stream_co2_surface_source_interp(cam_out, rc)
220222
integer :: sec ! seconds into current date for nstep+1
221223
integer :: mcdate ! Current model date (yyyymmdd)
222224
real(r8), pointer :: dataptr1d(:)
223-
character(*), parameter :: subName = "('stream_co2_surface_source_interp')"
225+
character(len=*), parameter :: subName = "('stream_co2_surface_source_interp')"
224226
!-----------------------------------------------------------------------
225227

226228
rc = ESMF_SUCCESS

0 commit comments

Comments
 (0)