From 473e8500cea9469a7545cd0c3d7421f219c09a84 Mon Sep 17 00:00:00 2001 From: Marcos Longo Date: Sat, 8 Aug 2026 22:20:51 -0300 Subject: [PATCH 1/7] Add a few trace back options to try to track the error. --- Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 935bc748..71fe4378 100644 --- a/Makefile +++ b/Makefile @@ -690,10 +690,10 @@ intel-xd2000: "CC_SERIAL = cc" \ "CXX_SERIAL = CC" \ "FFLAGS_PROMOTION = -real-size 64" \ - "FFLAGS_OPT = -O3 -convert big_endian -FR" \ - "CFLAGS_OPT = -O3 -std=gnu90" \ - "CXXFLAGS_OPT = -O3" \ - "LDFLAGS_OPT = -O3" \ + "FFLAGS_OPT = -O3 -convert big_endian -FR -traceback -check bounds,pointers" \ + "CFLAGS_OPT = -O3 -std=gnu90 -traceback" \ + "CXXFLAGS_OPT = -O3 -traceback" \ + "LDFLAGS_OPT = -O3 -traceback" \ "FFLAGS_DEBUG = -g -convert big_endian -free -check bounds,pointers,arg_temp_created,format,shape,contiguous -fpe0 -traceback -Qoption,fpp,-macro_expand=vc" \ "CFLAGS_DEBUG = -g -traceback" \ "CXXFLAGS_DEBUG = -g -traceback" \ @@ -715,10 +715,10 @@ intel2-xd2000: "CC_SERIAL = cc" \ "CXX_SERIAL = CC" \ "FFLAGS_PROMOTION = -real-size 64" \ - "FFLAGS_OPT = -O2 -convert big_endian -FR" \ - "CFLAGS_OPT = -O2 -std=gnu90" \ - "CXXFLAGS_OPT = -O2" \ - "LDFLAGS_OPT = -O2" \ + "FFLAGS_OPT = -O2 -convert big_endian -FR -traceback -check bounds,pointers" \ + "CFLAGS_OPT = -O2 -std=gnu90 -traceback" \ + "CXXFLAGS_OPT = -O2 -traceback" \ + "LDFLAGS_OPT = -O2 -traceback" \ "FFLAGS_DEBUG = -g -convert big_endian -free -check bounds,pointers,arg_temp_created,format,shape,contiguous -fpe0 -traceback -Qoption,fpp,-macro_expand=vc" \ "CFLAGS_DEBUG = -g -traceback" \ "CFLAGS_DEBUG = -g -traceback" \ From 4641d5d5d118ea52f8b4f7ce0f3a17d3306cf0e9 Mon Sep 17 00:00:00 2001 From: Marcos Longo Date: Sun, 9 Aug 2026 07:54:34 -0300 Subject: [PATCH 2/7] Add trap for uninitialised variables. --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 71fe4378..8da1690e 100644 --- a/Makefile +++ b/Makefile @@ -690,14 +690,14 @@ intel-xd2000: "CC_SERIAL = cc" \ "CXX_SERIAL = CC" \ "FFLAGS_PROMOTION = -real-size 64" \ - "FFLAGS_OPT = -O3 -convert big_endian -FR -traceback -check bounds,pointers" \ + "FFLAGS_OPT = -O3 -convert big_endian -FR -traceback" \ "CFLAGS_OPT = -O3 -std=gnu90 -traceback" \ "CXXFLAGS_OPT = -O3 -traceback" \ "LDFLAGS_OPT = -O3 -traceback" \ - "FFLAGS_DEBUG = -g -convert big_endian -free -check bounds,pointers,arg_temp_created,format,shape,contiguous -fpe0 -traceback -Qoption,fpp,-macro_expand=vc" \ + "FFLAGS_DEBUG = -g -convert big_endian -free -check bounds,pointers,arg_temp_created,format,shape,contiguous -ftrapuv -fpe0 -traceback -Qoption,fpp,-macro_expand=vc" \ "CFLAGS_DEBUG = -g -traceback" \ "CXXFLAGS_DEBUG = -g -traceback" \ - "LDFLAGS_DEBUG = -g -traceback" \ + "LDFLAGS_DEBUG = -g -traceback" \ "FFLAGS_OMP = -qopenmp" \ "CFLAGS_OMP = -qopenmp" \ "CORE = $(CORE)" \ @@ -715,12 +715,12 @@ intel2-xd2000: "CC_SERIAL = cc" \ "CXX_SERIAL = CC" \ "FFLAGS_PROMOTION = -real-size 64" \ - "FFLAGS_OPT = -O2 -convert big_endian -FR -traceback -check bounds,pointers" \ + "FFLAGS_OPT = -O2 -convert big_endian -FR -traceback" \ "CFLAGS_OPT = -O2 -std=gnu90 -traceback" \ "CXXFLAGS_OPT = -O2 -traceback" \ "LDFLAGS_OPT = -O2 -traceback" \ - "FFLAGS_DEBUG = -g -convert big_endian -free -check bounds,pointers,arg_temp_created,format,shape,contiguous -fpe0 -traceback -Qoption,fpp,-macro_expand=vc" \ - "CFLAGS_DEBUG = -g -traceback" \ + "FFLAGS_DEBUG = -g -convert big_endian -free -check bounds,pointers,arg_temp_created,format,shape,contiguous -fpe0 -ftrapuv -traceback -Qoption,fpp,-macro_expand=vc" \ + "CFLAGS_DEBUG = -g -traceback" \ "CFLAGS_DEBUG = -g -traceback" \ "CXXFLAGS_DEBUG = -g -traceback" \ "LDFLAGS_DEBUG = -g -traceback" \ From af91f6e16b944a830813f538158c01a8fb5de22c Mon Sep 17 00:00:00 2001 From: Marcos Longo Date: Sun, 9 Aug 2026 12:24:42 -0300 Subject: [PATCH 3/7] Made some tweaks. This seeks to apply soil colour index = 4 consistently when soil colour is not available. There may have been a uninitialisation problem for glaciers/oceans. Not sure if this will make any difference though. --- src/core_atmosphere/physics/mpas_atmphys_update_surface.F | 5 ++++- src/core_init_atmosphere/mpas_geotile_manager.F | 4 ++-- src/core_init_atmosphere/mpas_init_atm_static.F | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/core_atmosphere/physics/mpas_atmphys_update_surface.F b/src/core_atmosphere/physics/mpas_atmphys_update_surface.F index 4d6a59e2..0bf326a1 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_update_surface.F +++ b/src/core_atmosphere/physics/mpas_atmphys_update_surface.F @@ -138,7 +138,7 @@ subroutine physics_update_sst(dminfo,config_frac_seaice,mesh,sfc_input,diag_phys integer:: icheck integer:: iCell,iSoil integer:: nb_to_land,nb_to_ocean,nb_removed - integer,dimension(:),pointer:: isltyp,ivgtyp,landmask + integer,dimension(:),pointer:: isltyp,isctyp,ivgtyp,landmask real(kind=RKIND):: local_min,local_max real(kind=RKIND):: global_sst_min,global_sst_max @@ -152,6 +152,7 @@ subroutine physics_update_sst(dminfo,config_frac_seaice,mesh,sfc_input,diag_phys call mpas_pool_get_array(sfc_input,'isice' ,isice ) call mpas_pool_get_array(sfc_input,'iswater' ,iswater ) call mpas_pool_get_array(sfc_input,'isltyp' ,isltyp ) + call mpas_pool_get_array(sfc_input,'isctyp' ,isctyp ) call mpas_pool_get_array(sfc_input,'ivgtyp' ,ivgtyp ) call mpas_pool_get_array(sfc_input,'landmask' ,landmask ) call mpas_pool_get_array(sfc_input,'vegfra' ,vegfra ) @@ -218,6 +219,7 @@ subroutine physics_update_sst(dminfo,config_frac_seaice,mesh,sfc_input,diag_phys !... sea-ice points are converted to land points: ivgtyp(iCell) = isice isltyp(iCell) = 16 + isctyp(iCell) = 4 vegfra(iCell) = 0._RKIND xland(iCell) = 1._RKIND tmn(iCell) = 271.4_RKIND @@ -243,6 +245,7 @@ subroutine physics_update_sst(dminfo,config_frac_seaice,mesh,sfc_input,diag_phys !land points turn to water points: ivgtyp(iCell) = iswater isltyp(iCell) = 14 + isctyp(iCell) = 4 vegfra(iCell) = 0._RKIND xland(iCell) = 2._RKIND tmn(iCell) = sst(iCell) diff --git a/src/core_init_atmosphere/mpas_geotile_manager.F b/src/core_init_atmosphere/mpas_geotile_manager.F index 89748f2c..a6ccca4a 100644 --- a/src/core_init_atmosphere/mpas_geotile_manager.F +++ b/src/core_init_atmosphere/mpas_geotile_manager.F @@ -98,7 +98,7 @@ module mpas_geotile_manager !> * isice = 24 !> * isurban = 1 !> * isoilwater = 14 - !> * islcolwater = 9 + !> * islcolwater = 4 ! !----------------------------------------------------------------------- function mpas_geotile_mgr_init(mgr, path) result(ierr) @@ -250,7 +250,7 @@ function mpas_geotile_mgr_init(mgr, path) result(ierr) endif if (.not. associated(islcolwater)) then - call mpas_pool_add_config(mgr % pool, 'islcolwater', 1) + call mpas_pool_add_config(mgr % pool, 'islcolwater', 4) end if endif diff --git a/src/core_init_atmosphere/mpas_init_atm_static.F b/src/core_init_atmosphere/mpas_init_atm_static.F index 2720643f..51ffb246 100644 --- a/src/core_init_atmosphere/mpas_init_atm_static.F +++ b/src/core_init_atmosphere/mpas_init_atm_static.F @@ -474,7 +474,7 @@ subroutine init_atm_static(mesh, dims, configs) ! slcol_input_select1: select case(trim(config_soilcol_data)) case('DEFAULT_RAD_NOAH') - call mpas_log_write('Using 9-class default NOAH soil colour classes') + call mpas_log_write('Using 8-class default NOAH soil colour classes') geog_sub_path = 'soilcolour_30s/' ! Set default category and default water category for NOAH soil colour. ! These will be overwritten if soil colour data sets exist. @@ -487,7 +487,7 @@ subroutine init_atm_static(mesh, dims, configs) ! Set default category and default water category for NOAH soil colour ! These will be overwritten if soil colour data sets exist. - isdefault_slcol = 14 + isdefault_slcol = 4 iswater_slcol = 21 case default call mpas_log_write('*****************************************************************', messageType=MPAS_LOG_ERR) From 27db0e9d45bd33e92706a69aae771b5c3f3eaf87 Mon Sep 17 00:00:00 2001 From: Marcos Longo Date: Mon, 17 Aug 2026 21:15:14 -0300 Subject: [PATCH 4/7] Changed the logic for soil colour initialisation a bit. Now we impose default values whenever we identify a grid cell with soil colour flagged as water. We no longer use the water soil colour to replace the values for soil class or land use. --- .../physics/mpas_atmphys_initialize_real.F | 2 ++ .../mpas_geotile_manager.F | 2 ++ .../mpas_init_atm_static.F | 28 ++++++++++++------- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/core_atmosphere/physics/mpas_atmphys_initialize_real.F b/src/core_atmosphere/physics/mpas_atmphys_initialize_real.F index d6dc1bc0..a56e142e 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_initialize_real.F +++ b/src/core_atmosphere/physics/mpas_atmphys_initialize_real.F @@ -633,6 +633,7 @@ subroutine physics_init_seaice(mesh, input, dims, configs) call mpas_pool_get_array(mesh, 'landmask', landmask) call mpas_pool_get_array(mesh, 'lu_index', ivgtyp) call mpas_pool_get_array(mesh, 'soilcat_top', isltyp) + call mpas_pool_get_array(mesh, 'soilcol_idx', isctyp) call mpas_pool_get_array(mesh, 'snoalb', snoalb) call mpas_pool_get_array(input, 'seaice', seaice) @@ -679,6 +680,7 @@ subroutine physics_init_seaice(mesh, input, dims, configs) if(landmask(iCell) .eq. 0) tmn(iCell) = 271.4_RKIND ivgtyp(iCell) = isice_lu isltyp(iCell) = 16 + isctyp(iCell) = 4 snoalb(iCell) = 0.75 vegfra(iCell) = 0._RKIND xland(iCell) = 1._RKIND diff --git a/src/core_init_atmosphere/mpas_geotile_manager.F b/src/core_init_atmosphere/mpas_geotile_manager.F index a6ccca4a..60bf8db6 100644 --- a/src/core_init_atmosphere/mpas_geotile_manager.F +++ b/src/core_init_atmosphere/mpas_geotile_manager.F @@ -249,6 +249,8 @@ function mpas_geotile_mgr_init(mgr, path) result(ierr) call mpas_pool_add_config(mgr % pool, 'isoilwater', 14) endif + ! Set this to 4 so it works with all tables. It will be overwritten with + ! the table-specific default if the data bases are not found. if (.not. associated(islcolwater)) then call mpas_pool_add_config(mgr % pool, 'islcolwater', 4) end if diff --git a/src/core_init_atmosphere/mpas_init_atm_static.F b/src/core_init_atmosphere/mpas_init_atm_static.F index 51ffb246..8f1d2579 100644 --- a/src/core_init_atmosphere/mpas_init_atm_static.F +++ b/src/core_init_atmosphere/mpas_init_atm_static.F @@ -479,7 +479,7 @@ subroutine init_atm_static(mesh, dims, configs) ! Set default category and default water category for NOAH soil colour. ! These will be overwritten if soil colour data sets exist. isdefault_slcol = 4 - iswater_slcol = 1 + iswater_slcol = 4 case('MODIFIED_RAD_CLM_NOAH') call mpas_log_write('Using 21-class MODIS 30-arc-second land cover dataset') @@ -487,8 +487,8 @@ subroutine init_atm_static(mesh, dims, configs) ! Set default category and default water category for NOAH soil colour ! These will be overwritten if soil colour data sets exist. - isdefault_slcol = 4 - iswater_slcol = 21 + isdefault_slcol = 14 + iswater_slcol = 21 case default call mpas_log_write('*****************************************************************', messageType=MPAS_LOG_ERR) call mpas_log_write('Invalid soil colour dataset '''//trim(config_soilcol_data) & @@ -509,13 +509,18 @@ subroutine init_atm_static(mesh, dims, configs) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! where (lu_index == isice_lu) soilcat_top = 16 +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! KLUDGE TO REPLACE DUMMY OCEAN SOIL COLOUR WITH DEFAULT VALUES +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + where ( soilcol_idx == iswater_slcol ) soilcol_idx = isdefault_slcol + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! CORRECT INCONSISTENT SOIL TYPE, SOIL COLOUR AND LAND USE DATA !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! do iCell = 1,nCells - if (lu_index(iCell) == iswater_lu .or. & - soilcat_top(iCell) == iswater_soil .or. & - soilcol_idx(iCell) == iswater_slcol ) then + if (lu_index(iCell) == iswater_lu .or. & + soilcat_top(iCell) == iswater_soil ) then if (lu_index(iCell) /= iswater_lu) then call mpas_log_write('Turning lu_index into water at $i', intArgs=(/iCell/)) lu_index(iCell) = iswater_lu @@ -524,10 +529,10 @@ subroutine init_atm_static(mesh, dims, configs) call mpas_log_write('Turning soilcat_top into water at $i', intArgs=(/iCell/)) soilcat_top(iCell) = iswater_soil end if - if (soilcol_idx(iCell) /= iswater_slcol) then - call mpas_log_write('Turning soilcol_idx into water at $i', intArgs=(/iCell/)) - soilcol_idx(iCell) = iswater_slcol - end if + + ! Impose the default soil colour for the grid cell + call mpas_log_write('Turning soilcol_idx into default at $i', intArgs=(/iCell/)) + soilcol_idx(iCell) = isdefault_slcol end if end do @@ -2059,6 +2064,9 @@ subroutine interp_soilcol(mesh, kdtree, geog_data_path, isdefault_slcol, iswater call mpas_pool_get_dimension(mesh, 'nCells', nCells) call mpas_pool_get_array(mesh, 'soilcol_idx', soilcol_idx) + ! Overwrite default soil colour to match the data base-specific default. + call mpas_pool_add_config(mgr % pool, 'islcolwater', iswater_slcol) + ! Define the entire domain with the default soil colour index soilcol_idx(1:nCells) = isdefault_slcol From a98701c9b2b4911b68e8679a3e78277b5271bd2f Mon Sep 17 00:00:00 2001 From: Marcos Longo Date: Mon, 17 Aug 2026 21:23:23 -0300 Subject: [PATCH 5/7] Add variable declaration for isctyp. --- src/core_atmosphere/physics/mpas_atmphys_initialize_real.F | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core_atmosphere/physics/mpas_atmphys_initialize_real.F b/src/core_atmosphere/physics/mpas_atmphys_initialize_real.F index a56e142e..12f4ad46 100644 --- a/src/core_atmosphere/physics/mpas_atmphys_initialize_real.F +++ b/src/core_atmosphere/physics/mpas_atmphys_initialize_real.F @@ -599,7 +599,7 @@ subroutine physics_init_seaice(mesh, input, dims, configs) integer, pointer:: nCellsSolve,nSoilLevels integer:: iCell,iSoil integer:: num_seaice_changes - integer,dimension(:),pointer:: landmask,isltyp,ivgtyp + integer,dimension(:),pointer:: landmask,isltyp,isctyp,ivgtyp real(kind=RKIND):: xice_threshold real(kind=RKIND):: mid_point_depth From eca49c31e6826ce7c69403e104873a1a9b6e509a Mon Sep 17 00:00:00 2001 From: Marcos Longo Date: Mon, 17 Aug 2026 22:41:44 -0300 Subject: [PATCH 6/7] Remove -traceback options from compiler with optimisation. I had temporarily added them to help debug the code. --- Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 8da1690e..3b5ed84f 100644 --- a/Makefile +++ b/Makefile @@ -690,10 +690,10 @@ intel-xd2000: "CC_SERIAL = cc" \ "CXX_SERIAL = CC" \ "FFLAGS_PROMOTION = -real-size 64" \ - "FFLAGS_OPT = -O3 -convert big_endian -FR -traceback" \ - "CFLAGS_OPT = -O3 -std=gnu90 -traceback" \ - "CXXFLAGS_OPT = -O3 -traceback" \ - "LDFLAGS_OPT = -O3 -traceback" \ + "FFLAGS_OPT = -O3 -convert big_endian -FR" \ + "CFLAGS_OPT = -O3 -std=gnu90" \ + "CXXFLAGS_OPT = -O3" \ + "LDFLAGS_OPT = -O3" \ "FFLAGS_DEBUG = -g -convert big_endian -free -check bounds,pointers,arg_temp_created,format,shape,contiguous -ftrapuv -fpe0 -traceback -Qoption,fpp,-macro_expand=vc" \ "CFLAGS_DEBUG = -g -traceback" \ "CXXFLAGS_DEBUG = -g -traceback" \ @@ -715,10 +715,10 @@ intel2-xd2000: "CC_SERIAL = cc" \ "CXX_SERIAL = CC" \ "FFLAGS_PROMOTION = -real-size 64" \ - "FFLAGS_OPT = -O2 -convert big_endian -FR -traceback" \ - "CFLAGS_OPT = -O2 -std=gnu90 -traceback" \ - "CXXFLAGS_OPT = -O2 -traceback" \ - "LDFLAGS_OPT = -O2 -traceback" \ + "FFLAGS_OPT = -O2 -convert big_endian -FR" \ + "CFLAGS_OPT = -O2 -std=gnu90" \ + "CXXFLAGS_OPT = -O2" \ + "LDFLAGS_OPT = -O2" \ "FFLAGS_DEBUG = -g -convert big_endian -free -check bounds,pointers,arg_temp_created,format,shape,contiguous -fpe0 -ftrapuv -traceback -Qoption,fpp,-macro_expand=vc" \ "CFLAGS_DEBUG = -g -traceback" \ "CFLAGS_DEBUG = -g -traceback" \ From de9c80ab2b0ccdeb11e007fea5fe786730d7cc48 Mon Sep 17 00:00:00 2001 From: Marcos Longo Date: Wed, 19 Aug 2026 17:47:17 -0300 Subject: [PATCH 7/7] Remove mpas_pool_add_config from interpolation. --- src/core_init_atmosphere/mpas_init_atm_static.F | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/core_init_atmosphere/mpas_init_atm_static.F b/src/core_init_atmosphere/mpas_init_atm_static.F index 8f1d2579..a4a865bd 100644 --- a/src/core_init_atmosphere/mpas_init_atm_static.F +++ b/src/core_init_atmosphere/mpas_init_atm_static.F @@ -2064,9 +2064,6 @@ subroutine interp_soilcol(mesh, kdtree, geog_data_path, isdefault_slcol, iswater call mpas_pool_get_dimension(mesh, 'nCells', nCells) call mpas_pool_get_array(mesh, 'soilcol_idx', soilcol_idx) - ! Overwrite default soil colour to match the data base-specific default. - call mpas_pool_add_config(mgr % pool, 'islcolwater', iswater_slcol) - ! Define the entire domain with the default soil colour index soilcol_idx(1:nCells) = isdefault_slcol