From 767f760d1dacd97235be7f636156c4b08afc3e65 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Thu, 25 May 2023 09:21:21 -0600 Subject: [PATCH 1/5] Fix for mesh check in CESM driver --- cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 index a9b19df6b..b017bcf4e 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 @@ -559,7 +559,7 @@ subroutine ice_mesh_check(gcomp, ice_mesh, rc) ! Check CICE mesh - use ice_constants, only : c1,c0,c360 + use ice_constants, only : c1,c0,c2,c360 use ice_grid , only : tlon, tlat, hm ! input/output parameters @@ -641,7 +641,7 @@ subroutine ice_mesh_check(gcomp, ice_mesh, rc) if(tmplon < c0)tmplon = tmplon + c360 ! error check differences between internally generated lons and those read in - diff_lon = abs(mod(lonMesh(n) - tmplon,360.0)) + diff_lon = abs(mod(c2*c360+lonMesh(n),c360) - mod(c2*c360+lon(n),c360)) if (diff_lon > eps_imesh ) then write(6,100)n,lonMesh(n),tmplon, diff_lon !call abort_ice(error_message=subname, file=__FILE__, line=__LINE__) From 3fd7819ae34cc7ada7f1750cada25818042aa814 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Thu, 25 May 2023 14:12:21 -0600 Subject: [PATCH 2/5] Slightly different way to evaluate longitude difference --- cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 index b017bcf4e..d12ac0d16 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 @@ -559,7 +559,7 @@ subroutine ice_mesh_check(gcomp, ice_mesh, rc) ! Check CICE mesh - use ice_constants, only : c1,c0,c2,c360 + use ice_constants, only : c1,c0,c180,c360 use ice_grid , only : tlon, tlat, hm ! input/output parameters @@ -637,12 +637,12 @@ subroutine ice_mesh_check(gcomp, ice_mesh, rc) lon(n) = tlon(i,j,iblk)*rad_to_deg lat(n) = tlat(i,j,iblk)*rad_to_deg - tmplon = lon(n) - if(tmplon < c0)tmplon = tmplon + c360 - ! error check differences between internally generated lons and those read in - diff_lon = abs(mod(c2*c360+lonMesh(n),c360) - mod(c2*c360+lon(n),c360)) - if (diff_lon > eps_imesh ) then + diff_lon = abs(mod(lonMesh(n) - lon(n),360.0)) + if (diff_lon > c180) then + diff_lon = diff_lon - c360 + endif + if (abs(diff_lon) > eps_imesh ) then write(6,100)n,lonMesh(n),tmplon, diff_lon !call abort_ice(error_message=subname, file=__FILE__, line=__LINE__) end if From a93b7d4175dc3b400a2060d526fe397d47c80932 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Thu, 25 May 2023 14:13:16 -0600 Subject: [PATCH 3/5] Slightly different way to evaluate longitude difference --- cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 index d12ac0d16..0ee82b00d 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 @@ -583,7 +583,7 @@ subroutine ice_mesh_check(gcomp, ice_mesh, rc) real(dbl_kind) :: diff_lon real(dbl_kind) :: diff_lat real(dbl_kind) :: rad_to_deg - real(dbl_kind) :: tmplon, eps_imesh + real(dbl_kind) :: eps_imesh logical :: isPresent, isSet logical :: mask_error integer :: mask_internal @@ -643,7 +643,7 @@ subroutine ice_mesh_check(gcomp, ice_mesh, rc) diff_lon = diff_lon - c360 endif if (abs(diff_lon) > eps_imesh ) then - write(6,100)n,lonMesh(n),tmplon, diff_lon + write(6,100)n,lonMesh(n),lon(n), diff_lon !call abort_ice(error_message=subname, file=__FILE__, line=__LINE__) end if diff_lat = abs(latMesh(n) - lat(n)) From 699a97de9e2dc246699518666718c5202b0bd5d3 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Thu, 25 May 2023 15:33:46 -0600 Subject: [PATCH 4/5] Put the abs inside the mod --- cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 index 0ee82b00d..2f9ba741e 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 @@ -638,7 +638,7 @@ subroutine ice_mesh_check(gcomp, ice_mesh, rc) lat(n) = tlat(i,j,iblk)*rad_to_deg ! error check differences between internally generated lons and those read in - diff_lon = abs(mod(lonMesh(n) - lon(n),360.0)) + diff_lon = mod(abs(lonMesh(n) - lon(n)),360.0) if (diff_lon > c180) then diff_lon = diff_lon - c360 endif From ff4d6b34e4e655d0b7f1bd0705dadec323721304 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Thu, 15 Jun 2023 15:13:14 -0600 Subject: [PATCH 5/5] Add abort calls back in --- cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 b/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 index 2f9ba741e..601e59c7c 100644 --- a/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 +++ b/cicecore/drivers/nuopc/cmeps/ice_mesh_mod.F90 @@ -644,12 +644,12 @@ subroutine ice_mesh_check(gcomp, ice_mesh, rc) endif if (abs(diff_lon) > eps_imesh ) then write(6,100)n,lonMesh(n),lon(n), diff_lon - !call abort_ice(error_message=subname, file=__FILE__, line=__LINE__) + call abort_ice(error_message=subname, file=__FILE__, line=__LINE__) end if diff_lat = abs(latMesh(n) - lat(n)) if (diff_lat > eps_imesh) then write(6,101)n,latMesh(n),lat(n), diff_lat - !call abort_ice(error_message=subname, file=__FILE__, line=__LINE__) + call abort_ice(error_message=subname, file=__FILE__, line=__LINE__) end if enddo enddo