@@ -5,12 +5,11 @@ module ESM
55 !- ----------------------------------------------------------------------------
66
77 use shr_kind_mod , only : r8 = >shr_kind_r8 , cl= >shr_kind_cl, cs= >shr_kind_cs
8- use shr_sys_mod , only : shr_sys_abort
98 use shr_mpi_mod , only : shr_mpi_bcast
109 use shr_mem_mod , only : shr_mem_init
11- use shr_log_mod , only : shr_log_setLogunit
10+ use shr_log_mod , only : shr_log_setLogunit, shr_log_error
1211 use esm_utils_mod, only : logunit, maintask, dbug_flag, chkerr
13-
12+ use esmf , only : ESMF_FAILURE
1413 implicit none
1514 private
1615
@@ -490,10 +489,14 @@ subroutine InitAttributes(driver, rc)
490489 if (chkerr(rc,__LINE__,u_FILE_u)) return
491490
492491 if (.not. shr_wv_sat_valid_idx(shr_wv_sat_get_scheme_idx(trim (wv_sat_scheme)))) then
493- call shr_sys_abort(subname// ' : "' // trim (wv_sat_scheme)// ' " is not a recognized saturation vapor pressure scheme name' )
492+ call shr_log_error(subname// ' : "' // trim (wv_sat_scheme)// ' " is not a recognized saturation vapor pressure scheme name' )
493+ rc = ESMF_FAILURE
494+ return
494495 end if
495496 if (.not. shr_wv_sat_set_default(wv_sat_scheme)) then
496- call shr_sys_abort(' Invalid wv_sat_scheme.' )
497+ call shr_log_error(' Invalid wv_sat_scheme.' )
498+ rc = ESMF_FAILURE
499+ return
497500 end if
498501
499502 call NUOPC_CompAttributeGet(driver, name= " wv_sat_transition_start" , value= cvalue, rc= rc)
@@ -522,7 +525,9 @@ subroutine InitAttributes(driver, rc)
522525
523526 call shr_wv_sat_init(shr_const_tkfrz, shr_const_tktrip, wv_sat_transition_start, epsilo, errstring)
524527 if (errstring /= " " ) then
525- call shr_sys_abort(' shr_wv_sat_init: ' // trim (errstring))
528+ call shr_log_error(' shr_wv_sat_init: ' // trim (errstring))
529+ rc = ESMF_FAILURE
530+ return
526531 end if
527532
528533 ! The below produces internal lookup tables in the range 175-374K for
@@ -567,26 +572,34 @@ subroutine CheckAttributes( driver, rc )
567572 call NUOPC_CompAttributeGet(driver, name= " cime_model" , value= cime_model, rc= rc)
568573 if (chkerr(rc,__LINE__,u_FILE_u)) return
569574 if ( trim (cime_model) /= ' cesm' .and. trim (cime_model) /= ' ufs' ) then
570- call shr_sys_abort( subname// ' : cime_model must be set to cesm or ufs, aborting' )
575+ call shr_log_error( subname// ' : cime_model must be set to cesm or ufs, aborting' )
576+ rc = ESMF_FAILURE
577+ return
571578 end if
572579
573580 ! --- LogFile ending name -----
574581 call NUOPC_CompAttributeGet(driver, name= " logFilePostFix" , value= logFilePostFix, rc= rc)
575582 if (chkerr(rc,__LINE__,u_FILE_u)) return
576583
577584 if ( len_trim (logFilePostFix) == 0 ) then
578- call shr_sys_abort( subname// ' : logFilePostFix must be set to something not blank' )
585+ call shr_log_error( subname// ' : logFilePostFix must be set to something not blank' )
586+ rc = ESMF_FAILURE
587+ return
579588 end if
580589
581590 ! --- Output path root directory -----
582591 call NUOPC_CompAttributeGet(driver, name= " outPathRoot" , value= outPathRoot, rc= rc)
583592 if (chkerr(rc,__LINE__,u_FILE_u)) return
584593
585594 if ( len_trim (outPathRoot) == 0 ) then
586- call shr_sys_abort( subname// ' : outPathRoot must be set' )
595+ call shr_log_error( subname// ' : outPathRoot must be set' )
596+ rc = ESMF_FAILURE
597+ return
587598 end if
588599 if ( index (outPathRoot, " /" , back= .true. ) /= len_trim (outPathRoot) ) then
589- call shr_sys_abort( subname// ' : outPathRoot must end with a slash' )
600+ call shr_log_error( subname// ' : outPathRoot must end with a slash' )
601+ rc = ESMF_FAILURE
602+ return
590603 end if
591604
592605 end subroutine CheckAttributes
@@ -1256,7 +1269,7 @@ subroutine esm_set_single_column_attributes(compname, gcomp, rc)
12561269
12571270 if ( (scol_lon < scol_spval .and. scol_lat > scol_spval) .or. &
12581271 (scol_lon > scol_spval .and. scol_lat < scol_spval)) then
1259- call shr_sys_abort (subname// ' ERROR: ' // trim (compname)// ' both scol_lon and scol_lat must be greater than -999 ' )
1272+ call shr_log_error (subname// ' ERROR: ' // trim (compname)// ' both scol_lon and scol_lat must be greater than -999 ' )
12601273 end if
12611274
12621275 ! Set the special value for single column - if pts_lat or pts_lon are equal to the special value
@@ -1271,7 +1284,7 @@ subroutine esm_set_single_column_attributes(compname, gcomp, rc)
12711284 ! ATM, LND, OCN and ICE components only
12721285 ! verify that WAV and LND are not trying to use single column mode
12731286 if (trim (compname) == ' WAV' .or. trim (compname) == ' ROF' .or. trim (compname) == ' GLC' ) then
1274- call shr_sys_abort (subname// ' ERROR: ' // trim (compname)// ' does not support single column mode ' )
1287+ call shr_log_error (subname// ' ERROR: ' // trim (compname)// ' does not support single column mode ' )
12751288 end if
12761289
12771290 ! ensure that single column mode is only run on 1 pet
@@ -1280,7 +1293,7 @@ subroutine esm_set_single_column_attributes(compname, gcomp, rc)
12801293 call ESMF_VMGet(vm, petcount= petcount, rc= rc)
12811294 if (ChkErr(rc,__LINE__,u_FILE_u)) return
12821295 if (petcount > 1 ) then
1283- call shr_sys_abort (subname// ' ERROR: single column mode must be run on 1 pe' )
1296+ call shr_log_error (subname// ' ERROR: single column mode must be run on 1 pe' )
12841297 endif
12851298
12861299 write (logunit,' (a,2(f10.5,2x))' )trim (subname)// ' single column point for ' // trim (compname)// &
@@ -1304,27 +1317,27 @@ subroutine esm_set_single_column_attributes(compname, gcomp, rc)
13041317 ! the closest point in the domin file to scol_lon and scol_lat
13051318
13061319 status = nf90_open(single_column_lnd_domainfile, NF90_NOWRITE, ncid)
1307- if (status /= nf90_noerr) call shr_sys_abort (trim (subname) // ' : opening ' // &
1320+ if (status /= nf90_noerr) call shr_log_error (trim (subname) // ' : opening ' // &
13081321 trim (single_column_lnd_domainfile))
13091322 status = nf90_inq_dimid (ncid, ' ni' , dimid)
1310- if (status /= nf90_noerr) call shr_sys_abort (trim (subname) // ' : inq_dimid ni' )
1323+ if (status /= nf90_noerr) call shr_log_error (trim (subname) // ' : inq_dimid ni' )
13111324 status = nf90_inquire_dimension(ncid, dimid, len= ni)
1312- if (status /= nf90_noerr) call shr_sys_abort (trim (subname) // ' : inquire_dimension ni' )
1325+ if (status /= nf90_noerr) call shr_log_error (trim (subname) // ' : inquire_dimension ni' )
13131326 status = nf90_inq_dimid (ncid, ' nj' , dimid)
1314- if (status /= nf90_noerr) call shr_sys_abort (trim (subname) // ' : inq_dimid nj' )
1327+ if (status /= nf90_noerr) call shr_log_error (trim (subname) // ' : inq_dimid nj' )
13151328 status = nf90_inquire_dimension(ncid, dimid, len= nj)
1316- if (status /= nf90_noerr) call shr_sys_abort (trim (subname) // ' : inquire_dimension nj' )
1329+ if (status /= nf90_noerr) call shr_log_error (trim (subname) // ' : inquire_dimension nj' )
13171330
13181331 status = nf90_inq_varid(ncid, ' xc' , varid_xc)
1319- if (status /= nf90_noerr) call shr_sys_abort (subname// ' inq_varid xc' )
1332+ if (status /= nf90_noerr) call shr_log_error (subname// ' inq_varid xc' )
13201333 status = nf90_inq_varid(ncid, ' yc' , varid_yc)
1321- if (status /= nf90_noerr) call shr_sys_abort (subname// ' inq_varid yc' )
1334+ if (status /= nf90_noerr) call shr_log_error (subname// ' inq_varid yc' )
13221335 status = nf90_inq_varid(ncid, ' area' , varid_area)
1323- if (status /= nf90_noerr) call shr_sys_abort (subname// ' inq_varid area' )
1336+ if (status /= nf90_noerr) call shr_log_error (subname// ' inq_varid area' )
13241337 status = nf90_inq_varid(ncid, ' mask' , varid_mask)
1325- if (status /= nf90_noerr) call shr_sys_abort (subname// ' inq_varid mask' )
1338+ if (status /= nf90_noerr) call shr_log_error (subname// ' inq_varid mask' )
13261339 status = nf90_inq_varid(ncid, ' frac' , varid_frac)
1327- if (status /= nf90_noerr) call shr_sys_abort (subname// ' inq_varid frac' )
1340+ if (status /= nf90_noerr) call shr_log_error (subname// ' inq_varid frac' )
13281341
13291342 ! Read in domain file for single column
13301343 ! Check for unstructured data ni>1 and nj==1
@@ -1344,10 +1357,10 @@ subroutine esm_set_single_column_attributes(compname, gcomp, rc)
13441357 start3= (/ 1 ,1 ,1 / )
13451358 count3= (/ ni,nj,1 / )
13461359 status = nf90_get_var(ncid, varid_xc, glob_grid, start3, count3)
1347- if (status /= nf90_noerr) call shr_sys_abort (subname// ' get_var xc' )
1360+ if (status /= nf90_noerr) call shr_log_error (subname// ' get_var xc' )
13481361 lons(1 :ni) = glob_grid(1 :ni,1 )
13491362 status = nf90_get_var(ncid, varid_yc, glob_grid, start3, count3)
1350- if (status /= nf90_noerr) call shr_sys_abort (subname// ' get_var yc' )
1363+ if (status /= nf90_noerr) call shr_log_error (subname// ' get_var yc' )
13511364 if (unstructured) then
13521365 lats(1 :ni) = glob_grid(1 :ni,1 )
13531366 else
@@ -1379,31 +1392,31 @@ subroutine esm_set_single_column_attributes(compname, gcomp, rc)
13791392 ! read in value of nearest neighbor lon and RESET scol_lon and scol_lat
13801393 ! also get area of gridcell, mask and frac
13811394 status = nf90_get_var(ncid, varid_xc, scol_lon, start)
1382- if (status /= nf90_noerr) call shr_sys_abort (subname// ' get_var xc' )
1395+ if (status /= nf90_noerr) call shr_log_error (subname// ' get_var xc' )
13831396
13841397 status = nf90_get_var(ncid, varid_yc, scol_lat, start)
1385- if (status /= nf90_noerr) call shr_sys_abort (subname// ' get_var yc' )
1398+ if (status /= nf90_noerr) call shr_log_error (subname// ' get_var yc' )
13861399
13871400 status = nf90_get_var(ncid, varid_area, scol_area, start)
1388- if (status /= nf90_noerr) call shr_sys_abort (subname// ' get_var area' )
1401+ if (status /= nf90_noerr) call shr_log_error (subname// ' get_var area' )
13891402
13901403 status = nf90_get_var(ncid, varid_mask, iscol_data, start)
1391- if (status /= nf90_noerr) call shr_sys_abort (subname// ' get_var mask' )
1404+ if (status /= nf90_noerr) call shr_log_error (subname// ' get_var mask' )
13921405 scol_lndmask = iscol_data(1 )
13931406 scol_ocnmask = 1 - scol_lndmask
13941407
13951408 status = nf90_get_var(ncid, varid_frac, scol_data, start)
1396- if (status /= nf90_noerr) call shr_sys_abort (subname// ' get_var frac' )
1409+ if (status /= nf90_noerr) call shr_log_error (subname// ' get_var frac' )
13971410 scol_lndfrac = scol_data(1 )
13981411 scol_ocnfrac = 1._r8 - scol_lndfrac
13991412
14001413 if (scol_ocnmask == 0 .and. scol_lndmask == 0 ) then
1401- call shr_sys_abort (trim (subname)// ' in single column mode ' &
1414+ call shr_log_error (trim (subname)// ' in single column mode ' &
14021415 // ' ocean and land mask cannot both be zero' )
14031416 end if
14041417
14051418 status = nf90_close(ncid)
1406- if (status /= nf90_noerr) call shr_sys_abort (trim (subname) // ' : closing ' // &
1419+ if (status /= nf90_noerr) call shr_log_error (trim (subname) // ' : closing ' // &
14071420 trim (single_column_lnd_domainfile))
14081421
14091422 ! Now read in mesh file to get exact values of scol_lon and scol_lat that will be used
0 commit comments