@@ -285,10 +285,14 @@ end function const_molec_weight
285
285
! #######################################################################
286
286
287
287
subroutine const_get_index (name , cindex , abort , warning , caller )
288
- use shr_kind_mod, only: CX = > SHR_KIND_CX
289
- use cam_abortutils, only: endrun
290
- use cam_logfile, only: iulog
291
- use cam_ccpp_cap, only: cam_const_get_index
288
+ ! from to_be_ccppized utility routine
289
+ use ccpp_const_utils, only: ccpp_const_get_idx
290
+
291
+ use shr_kind_mod, only: CX = > SHR_KIND_CX
292
+ use cam_abortutils, only: endrun
293
+ use cam_logfile, only: iulog
294
+ use phys_vars_init_check, only: std_name_len
295
+ use string_utils, only: stringify
292
296
293
297
! Get the index of a constituent with standard name, <name>.
294
298
! Setting optional <abort> argument to .false. returns control to
@@ -298,11 +302,11 @@ subroutine const_get_index(name, cindex, abort, warning, caller)
298
302
! instead of <subname> in messages.
299
303
300
304
!- ----------------------------Arguments---------------------------------
301
- character (len=* ), intent (in ) :: name ! constituent name
302
- integer , intent (out ) :: cindex ! global constituent ind
303
- logical , optional , intent (in ) :: abort ! flag controlling abort
305
+ character (len=* ), intent (in ) :: name ! constituent name
306
+ integer , intent (out ) :: cindex ! global constituent index
307
+ logical , optional , intent (in ) :: abort ! flag controlling abort
304
308
logical , optional , intent (in ) :: warning ! flag controlling warning
305
- character (len=* ), optional , intent (in ) :: caller ! calling routine
309
+ character (len=* ), optional , intent (in ) :: caller ! calling routine
306
310
307
311
!- --------------------------Local workspace-----------------------------
308
312
logical :: warning_on_error
@@ -312,10 +316,14 @@ subroutine const_get_index(name, cindex, abort, warning, caller)
312
316
character (len=* ), parameter :: subname = ' const_get_index: '
313
317
!- ----------------------------------------------------------------------
314
318
315
- ! Find tracer name in the master table
316
- call cam_const_get_index(name, cindex, errcode= errcode, errmsg= errmsg)
319
+ call ccpp_const_get_idx(const_props, name, cindex, errmsg, errcode)
317
320
318
321
if (errcode /= 0 ) then
322
+ call endrun(subname// " Error " // stringify((/ errcode/ ))// " : " // &
323
+ trim (errmsg), file= __FILE__, line= __LINE__)
324
+ endif
325
+
326
+ if (cindex == - 1 ) then
319
327
! Unrecognized name, set an error return and possibly abort
320
328
cindex = - 1
321
329
if (present (abort)) then
0 commit comments