diff --git a/CMakeLists.txt b/CMakeLists.txt index 190573745..29aa7b012 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,7 @@ endif() if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback") set(CMAKE_Fortran_FLAGS_RELEASE "-O3 -fp-model precise") - set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -check -check noarg_temp_created -check nopointer -fp-stack-check -fstack-protector-all -fpe0 -debug -ftrapuv") + set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -check all -ftrapuv") if(APPLE) # The linker on macOS does not include `common symbols` by default. # Passing the -c flag includes them and fixes an error with undefined symbols. @@ -77,9 +77,7 @@ elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch -fallow-invalid-boz") endif() set(CMAKE_Fortran_FLAGS_RELEASE "-O3") -# set(CMAKE_Fortran_FLAGS_DEBUG "-ggdb -Wall") - set(CMAKE_Fortran_FLAGS_DEBUG "-O1 -ggdb -Wall -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check -fno-omit-frame-pointer -fno-optimize-sibling-calls") -# set(CMAKE_Fortran_FLAGS_DEBUG "-ggdb -Wall -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check -fno-omit-frame-pointer -fno-optimize-sibling-calls") + set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -ggdb -Wall -fcheck=all") endif() if(CMAKE_C_COMPILER_ID MATCHES "^(Intel)$") diff --git a/docs/source/chgres_cube.rst b/docs/source/chgres_cube.rst index 38c48e491..71f1274c3 100644 --- a/docs/source/chgres_cube.rst +++ b/docs/source/chgres_cube.rst @@ -141,6 +141,25 @@ Initializing global domains with GRIB2 data - some caveats * Soil moisture in the GRIB2 files is created using bilinear interpolation and, therefore, may be a mixture of values from different soil types. Could result in poor latent/sensible heat fluxes. * Ozone is not available at all isobaric levels. Missing levels are set to a nominal value defined in the variable mapping (VARMAP) file (1E-07). * Only tested with GRIB2 data from GFS v14 and v15 (from 12z July 19, 2017 to current). May not work with older GFS data. Will not work with GRIB2 data from other models. + * Note that when concatenating grib2 files for use in initialization of global simulations, it is possible to inadvertently introduce duplicate variables and levels into the subsequent grib2 files. Chgres_cube will automatically fail with a warning message indicating that the grib2 file used contains these duplicate entries. Prior to continuing it will be necessary to strip out duplicate entries. Users can remove these entries through use of wgrib2, such as in the following command: + * ``wgrib2 IN.grb -submsg 1 | unique.pl | wgrib2 -i IN.grb -GRIB OUT.grb``, where IN.grb is the original concatenated grib2 file, and OUT.grb is the resulting grib2 file, with duplicates removed. The "unique.pl" Perl script is as follows, taken from the `Tricks for wgrib2 `_ website: + + .. code-block:: console + + ----------------------- unique.pl ------------------------ + #!/usr/bin/perl -w + # print only lines where fields 3..N are different + # + while () { + chomp; + $line = $_; + $_ =~ s/^[0-9.]*:[0-9]*://; + if (! defined $inv{$_}) { + $inv{$_} = 1; + print "$line\n"; + } + } + --------------------- end unique.pl ---------------------- Near Sea Surface Temperature (NSST) data and GRIB2 initialization ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -304,6 +323,25 @@ Keep these things in mind when using FV3GFS GRIB2 data for model initialization: * For FV3GFS GRIB2 data, soil moisture is created using bilinear interpolation and, therefore, may be a mixture of values from different soil types. Could result in poor latent/sensible heat fluxes. * Ozone is not available at all isobaric levels. Missing levels are set to a nominal value defined in the variable mapping (VARMAP) file (1E-07). * Only tested with GRIB2 data from FV3GFS, RAP, NAM, and HRRR data. May not work with GRIB2 data from other models. Use these at your own risk. + * Note that when concatenating grib2 files for use in initialization of regional simulations, it is possible to inadvertently introduce duplicate variables and levels into the subsequent grib2 files. Chgres_cube will automatically fail with a warning message indicating that the grib2 file used contains these duplicate entries. Prior to continuing it will be necessary to strip out duplicate entries. Users can remove these entries through use of wgrib2, such as in the following command: + * ``wgrib2 IN.grb -submsg 1 | unique.pl | wgrib2 -i IN.grb -GRIB OUT.grb``, where IN.grb is the original concatenated grib2 file, and OUT.grb is the resulting grib2 file, with duplicates removed. The "unique.pl" Perl script is as follows, taken from the `Tricks for wgrib2 `_ website: + + .. code-block:: console + + ----------------------- unique.pl ------------------------ + #!/usr/bin/perl -w + # print only lines where fields 3..N are different + # + while () { + chomp; + $line = $_; + $_ =~ s/^[0-9.]*:[0-9]*://; + if (! defined $inv{$_}) { + $inv{$_} = 1; + print "$line\n"; + } + } + --------------------- end unique.pl ---------------------- Regional chgres_cube namelist options ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/modulefiles/build.wcoss2.intel.lua b/modulefiles/build.wcoss2.intel.lua index d977b843b..af6066c0d 100644 --- a/modulefiles/build.wcoss2.intel.lua +++ b/modulefiles/build.wcoss2.intel.lua @@ -69,10 +69,8 @@ load(pathJoin("gsl", gsl_ver)) nco_ver=os.getenv("nco_ver") or "4.9.7" load(pathJoin("nco", nco_ver)) -setenv("HPC_OPT","/apps/ops/para/libs") -prepend_path("MODULEPATH", "/apps/ops/para/libs/modulefiles/compiler/intel/19.1.3.304") -prepend_path("MODULEPATH", "/apps/ops/para/libs/modulefiles/mpi/intel/19.1.3.304/cray-mpich/8.1.7") -esmf_ver=os.getenv("esmf_ver") or "8.4.0b08" +prepend_path("MODULEPATH", "/apps/dev/lmodules/intel_cray_mpich/19.1.3.304/cray-mpich/8.1.4") +esmf_ver=os.getenv("esmf_ver") or "8.4.1" load(pathJoin("esmf", esmf_ver)) whatis("Description: UFS_UTILS build environment") diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pesg.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pesg.f90 index 8ecd69189..af98016de 100644 --- a/sorc/grid_tools.fd/regional_esg_grid.fd/pesg.f90 +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pesg.f90 @@ -406,13 +406,14 @@ subroutine xmtoxc_vak1(ak,xm,xc,xcd,xc1,xcd1,ff)! [xmtoxc_ak] logical, intent(out):: ff real(dp),dimension(3,2,2):: xcdd real(dp),dimension(2,2,2):: xsd1,xsdd -real(dp),dimension(2,2) :: xtd,xsd,xs1,xtd1,xsdk +real(dp),dimension(2,2) :: xtd,xsd,xs1,xtd1,xsdk,mat22 real(dp),dimension(2) :: xt,xt1,xs,xsk integer(spi) :: i call xmtoxt1(ak(1),xm,xt,xtd,xt1,xtd1,ff); if(ff)return call xttoxs1(ak(2),xt,xs,xsd,xsdd,xsk,xsdk,ff); if(ff)return xs1(:,2)=xsk; xs1(:,1)=matmul(xsd,xt1) -xsd1(:,:,1)=matmul(xsd,xtd1)+matmul(xsdd(:,:,1)*xt1(1)+xsdd(:,:,2)*xt1(2),xtd) +mat22=xsdd(:,:,1)*xt1(1)+xsdd(:,:,2)*xt1(2) +xsd1(:,:,1)=matmul(xsd,xtd1)+matmul(mat22,xtd) xsd1(:,:,2)=matmul(xsdk,xtd) xsd=matmul(xsd,xtd) call xstoxc(xs,xc,xcd,xcdd) diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/psym2.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/psym2.f90 index e57c4163c..506eff87c 100644 --- a/sorc/grid_tools.fd/regional_esg_grid.fd/psym2.f90 +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/psym2.f90 @@ -411,7 +411,7 @@ subroutine logsym2d(x,z,zd)! [logsym2] real(dp),dimension(2,2), intent(in ):: x real(dp),dimension(2,2), intent(out):: z real(dp),dimension(2,2,2,2),intent(out):: zd -real(dp),dimension(2,2):: vv,oo,d11,d12,d22,pqr +real(dp),dimension(2,2):: vv,oo,d11,d12,d22,pqr,d11pqr,d12pqr,d22pqr real(dp) :: c,s,cc,cs,ss,c2h,p,q,r,lp,lq,L integer(spi) :: i call eigensym2(x,vv,oo) @@ -424,9 +424,12 @@ subroutine logsym2d(x,z,zd)! [logsym2] d12(1,:)=(/-cs,c2h/); d12(2,:)=(/c2h,cs/) d22(1,:)=(/ ss,-cs/); d22(2,:)=(/-cs,cc/) pqr(1,:)=(/p,r/) ; pqr(2,:)=(/r,q/) -zd(:,:,1,1)=matmul(vv,matmul(d11*pqr,transpose(vv))) -zd(:,:,1,2)=matmul(vv,matmul(d12*pqr,transpose(vv))) -zd(:,:,2,2)=matmul(vv,matmul(d22*pqr,transpose(vv))) +d11pqr=d11*pqr +d12pqr=d12*pqr +d22pqr=d22*pqr +zd(:,:,1,1)=matmul(vv,matmul(d11pqr,transpose(vv))) +zd(:,:,1,2)=matmul(vv,matmul(d12pqr,transpose(vv))) +zd(:,:,2,2)=matmul(vv,matmul(d22pqr,transpose(vv))) zd(:,:,2,1)=zd(:,:,1,2) end subroutine logsym2d