From 4643e2c7e1c393e24a45a0965c367ef31a84a8fe Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Tue, 15 Oct 2019 09:57:55 -0400 Subject: [PATCH 001/192] develop: This commit references #23. Update sfc_climo_gen and chgres_cube programs: For regrid options other than conservative and neighbor, change pole method from NONE to ALLAVG. This prevents interpolation problems near the poles. --- sorc/chgres_cube.fd/atmosphere.F90 | 6 +++--- sorc/chgres_cube.fd/surface.F90 | 2 +- sorc/sfc_climo_gen.fd/interp.F90 | 9 ++++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sorc/chgres_cube.fd/atmosphere.F90 b/sorc/chgres_cube.fd/atmosphere.F90 index 067362c04..0e22b551e 100644 --- a/sorc/chgres_cube.fd/atmosphere.F90 +++ b/sorc/chgres_cube.fd/atmosphere.F90 @@ -182,7 +182,7 @@ subroutine atmosphere_driver(localpet) call ESMF_FieldRegridStore(temp_input_grid, & temp_b4adj_target_grid, & - polemethod=ESMF_POLEMETHOD_NONE, & + polemethod=ESMF_POLEMETHOD_ALLAVG, & srctermprocessing=isrctermprocessing, & extrapmethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & routehandle=regrid_bl, & @@ -333,7 +333,7 @@ subroutine atmosphere_driver(localpet) print*,"- CALL FieldRegridStore FOR 3D-WIND WEST EDGE." call ESMF_FieldRegridStore(wind_target_grid, & wind_w_target_grid, & - polemethod=ESMF_POLEMETHOD_NONE, & + polemethod=ESMF_POLEMETHOD_ALLAVG, & srctermprocessing=isrctermprocessing, & extrapMethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & routehandle=regrid_bl, & @@ -360,7 +360,7 @@ subroutine atmosphere_driver(localpet) print*,"- CALL FieldRegridStore FOR 3D-WIND SOUTH EDGE." call ESMF_FieldRegridStore(wind_target_grid, & wind_s_target_grid, & - polemethod=ESMF_POLEMETHOD_NONE, & + polemethod=ESMF_POLEMETHOD_ALLAVG, & srctermprocessing=isrctermprocessing, & extrapMethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & routehandle=regrid_bl, & diff --git a/sorc/chgres_cube.fd/surface.F90 b/sorc/chgres_cube.fd/surface.F90 index bd9e7c8af..4b6ea37da 100644 --- a/sorc/chgres_cube.fd/surface.F90 +++ b/sorc/chgres_cube.fd/surface.F90 @@ -376,7 +376,7 @@ subroutine interp(localpet) print*,"- CALL FieldRegridStore FOR NON-MASKED BILINEAR INTERPOLATION." call ESMF_FieldRegridStore(t2m_input_grid, & t2m_target_grid, & - polemethod=ESMF_POLEMETHOD_NONE, & + polemethod=ESMF_POLEMETHOD_ALLAVG, & srctermprocessing=isrctermprocessing, & routehandle=regrid_bl_no_mask, & regridmethod=method, rc=rc) diff --git a/sorc/sfc_climo_gen.fd/interp.F90 b/sorc/sfc_climo_gen.fd/interp.F90 index 880f2e7d4..a61450e80 100644 --- a/sorc/sfc_climo_gen.fd/interp.F90 +++ b/sorc/sfc_climo_gen.fd/interp.F90 @@ -50,6 +50,7 @@ subroutine interp(localpet, method, input_file) type(esmf_regridmethod_flag),intent(in) :: method type(esmf_field) :: data_field_src type(esmf_routehandle) :: regrid_data + type(esmf_polemethod_flag) :: pole print*,"- CALL FieldCreate FOR SOURCE GRID DATA." data_field_src = ESMF_FieldCreate(grid_src, & @@ -121,13 +122,19 @@ subroutine interp(localpet, method, input_file) if (record == 1) then + if (method == ESMF_REGRIDMETHOD_BILINEAR) then + pole = ESMF_POLEMETHOD_ALLAVG + else + pole = ESMF_POLEMETHOD_NONE + endif + print*,"- CALL FieldRegridStore." nullify(unmapped_ptr) call ESMF_FieldRegridStore(data_field_src, & data_field_mdl, & srcmaskvalues=(/0/), & dstmaskvalues=(/0/), & - polemethod=ESMF_POLEMETHOD_NONE, & + polemethod=pole, & unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, & normtype=ESMF_NORMTYPE_FRACAREA, & srctermprocessing=isrctermprocessing, & From b2ab11872de088ec93cd6215aa26e86c68456245 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Thu, 24 Oct 2019 15:18:02 -0400 Subject: [PATCH 002/192] release/v1.1.0: This commit references #26. (#28) develop: This commit references issue #26. Merge minor change to fv3gfs_chgres.sh script from 'release/v1.1.0'. --- ush/fv3gfs_chgres.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ush/fv3gfs_chgres.sh b/ush/fv3gfs_chgres.sh index a7f02dcc7..8e22ba648 100755 --- a/ush/fv3gfs_chgres.sh +++ b/ush/fv3gfs_chgres.sh @@ -13,7 +13,7 @@ # 'machine' variable is uncommented. Ensure job cards for # the other machines are prefixed by "##". # - Check the job card account. On Hera, this is -# "#SBATCH -q $account". On WCOSS, this is "#BSUB -P $account". +# "#SBATCH -A $account". On WCOSS, this is "#BSUB -P $account". # You may not have permissions to run under the default account. # - Make sure you have linked the 'fixed' directories using # sorc/link_fixdirs.sh. From 2104affa7384905f0215658c36d63bf260fa9cf8 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Mon, 28 Oct 2019 12:44:41 -0400 Subject: [PATCH 003/192] chgres_cube snow fix (#30) develop: This commit references #27. Update chgres_cube - Initialize all surface variables to a missing flag after the FieldCreate step. In routine qc_check explicitly set snow to zero at open water and ice depth to zero at non-ice points. --- reg_tests/chgres_cube/driver.jet.sh | 4 +- sorc/chgres_cube.fd/surface.F90 | 243 +++++++++++++++++++++++++--- 2 files changed, 221 insertions(+), 26 deletions(-) diff --git a/reg_tests/chgres_cube/driver.jet.sh b/reg_tests/chgres_cube/driver.jet.sh index 6f76db74c..b256b64c3 100755 --- a/reg_tests/chgres_cube/driver.jet.sh +++ b/reg_tests/chgres_cube/driver.jet.sh @@ -34,8 +34,8 @@ module load netcdf/4.2.1.1 module list export OUTDIR=/mnt/lfs3/projects/emcda/$LOGNAME/stmp/chgres_reg_tests -PROJECT_CODE="emcda" -QUEUE="windfall" +PROJECT_CODE="hfv3gfs" +QUEUE="debug" #----------------------------------------------------------------------------- # Should not have to change anything below here. HOMEufs is the root diff --git a/sorc/chgres_cube.fd/surface.F90 b/sorc/chgres_cube.fd/surface.F90 index 4b6ea37da..d68f704a9 100644 --- a/sorc/chgres_cube.fd/surface.F90 +++ b/sorc/chgres_cube.fd/surface.F90 @@ -2723,6 +2723,7 @@ subroutine qc_check real(esmf_kind_r8), pointer :: seaice_skint_ptr(:,:) real(esmf_kind_r8), pointer :: skint_ptr(:,:) real(esmf_kind_r8), pointer :: fice_ptr(:,:) + real(esmf_kind_r8), pointer :: hice_ptr(:,:) print*,"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK." call ESMF_FieldGet(landmask_target_grid, & @@ -2732,11 +2733,7 @@ subroutine qc_check if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldGet", rc) -!--------------------------------------------------------------------------------------------- -! Set slope type flag value at non-land points. -!--------------------------------------------------------------------------------------------- - - print*,"- CALL FieldGet FOR TARGET GRID SLOPE TYPE." + print*,"- SET NON-LAND FLAG FOR TARGET GRID SLOPE TYPE." call ESMF_FieldGet(slope_type_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2748,7 +2745,7 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID SOIL TYPE." + print*,"- SET NON-LAND FLAG FOR TARGET GRID SOIL TYPE." call ESMF_FieldGet(soil_type_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2760,7 +2757,7 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID VEGETATION TYPE." + print*,"- SET NON-LAND FLAG FOR TARGET GRID VEGETATION TYPE." call ESMF_FieldGet(veg_type_target_grid, & farrayPtr=veg_type_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2772,7 +2769,7 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID ALVSF." + print*,"- SET TARGET GRID ALVSF AT NON-LAND." call ESMF_FieldGet(alvsf_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2784,7 +2781,7 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID ALVWF." + print*,"- SET TARGET GRID ALVWF AT NON-LAND." call ESMF_FieldGet(alvwf_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2796,7 +2793,7 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID ALNSF." + print*,"- SET TARGET GRID ALNSF AT NON-LAND." call ESMF_FieldGet(alnsf_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2808,7 +2805,7 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID ALNWF." + print*,"- SET TARGET GRID ALNWF AT NON-LAND." call ESMF_FieldGet(alnwf_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2820,7 +2817,7 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID FACSF." + print*,"- SET NON-LAND FLAG FOR TARGET GRID FACSF." call ESMF_FieldGet(facsf_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2832,7 +2829,7 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID FAWSF." + print*,"- SET NON-LAND FLAG FOR TARGET GRID FACSF." call ESMF_FieldGet(facwf_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2844,7 +2841,7 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID MAXIMUM GREENNESS." + print*,"- SET NON-LAND FLAG FOR TARGET GRID MAXIMUM GREENNESS." call ESMF_FieldGet(max_veg_greenness_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2856,7 +2853,7 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID MINIMUM GREENNESS." + print*,"- SET NON-LAND FLAG FOR TARGET GRID MINIMUM GREENNESS." call ESMF_FieldGet(min_veg_greenness_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2868,7 +2865,7 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID VEGETATION GREENNESS." + print*,"- SET NON-LAND FLAG FOR TARGET GRID VEGETATION GREENNESS." call ESMF_FieldGet(veg_greenness_target_grid, & farrayPtr=veg_greenness_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2880,7 +2877,7 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID MAX SNOW ALBEDO." + print*,"- SET NON-LAND FLAG FOR TARGET GRID MAX SNOW ALBEDO." call ESMF_FieldGet(mxsno_albedo_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2892,7 +2889,7 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID CANOPY MOISTURE CONTENT." + print*,"- ZERO OUT TARGET GRID CANOPY MOISTURE CONTENT WHERE NO PLANTS." call ESMF_FieldGet(canopy_mc_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2910,7 +2907,7 @@ subroutine qc_check if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldGet", rc) - print*,"- CALL FieldGet FOR TARGET GRID SKIN TEMP." + print*,"- SET TARGET GRID SKIN TEMP AT ICE POINTS." call ESMF_FieldGet(skin_temp_target_grid, & farrayPtr=skint_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2922,6 +2919,12 @@ subroutine qc_check if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldGet", rc) + print*,"- SET TARGET GRID SEA ICE DEPTH TO ZERO AT NON-ICE POINTS." + call ESMF_FieldGet(seaice_depth_target_grid, & + farrayPtr=hice_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + do j = clb(2), cub(2) do i = clb(1), cub(1) if (fice_ptr(i,j) > 0.0) then @@ -2929,11 +2932,12 @@ subroutine qc_check ( (1.0 - fice_ptr(i,j)) * frz_ice ) else seaice_skint_ptr(i,j) = skint_ptr(i,j) + hice_ptr(i,j) = 0.0 endif enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID SUBSTRATE TEMP." + print*,"- SET TARGET GRID SUBSTRATE TEMP AT ICE." call ESMF_FieldGet(substrate_temp_target_grid, & farrayPtr=data_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2949,13 +2953,41 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID TOTAL SOIL MOISTURE." + print*,"- ZERO OUT TARGET GRID SNOW DEPTH AT OPEN WATER." + call ESMF_FieldGet(snow_depth_target_grid, & + farrayPtr=data_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + do j = clb(2), cub(2) + do i = clb(1), cub(1) + if (landmask_ptr(i,j) == 0) then ! open water + data_ptr(i,j) = 0.0 + end if + enddo + enddo + + print*,"- ZERO OUT TARGET GRID SNOW LIQ AT OPEN WATER." + call ESMF_FieldGet(snow_liq_equiv_target_grid, & + farrayPtr=data_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + do j = clb(2), cub(2) + do i = clb(1), cub(1) + if (landmask_ptr(i,j) == 0) then ! open water + data_ptr(i,j) = 0.0 + endif + enddo + enddo + + print*,"- SET NON-LAND FLAG VALUE FOR TARGET GRID TOTAL SOIL MOISTURE." call ESMF_FieldGet(soilm_tot_target_grid, & farrayPtr=soilmt_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldGet", rc) - print*,"- CALL FieldGet FOR TARGET GRID LIQUID SOIL MOISTURE." + print*,"- SET NON-LAND FLAG VALUE FOR TARGET GRID LIQUID SOIL MOISTURE." call ESMF_FieldGet(soilm_liq_target_grid, & farrayPtr=soilml_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -2971,7 +3003,7 @@ subroutine qc_check enddo enddo - print*,"- CALL FieldGet FOR TARGET GRID SOIL TEMPERATURE." + print*,"- SET OPEN WATER FLAG FOR TARGET GRID SOIL TEMPERATURE." call ESMF_FieldGet(soil_temp_target_grid, & farrayPtr=data3d_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & @@ -3206,7 +3238,10 @@ subroutine create_surface_esmf_fields implicit none - integer :: rc + integer :: rc + + real(esmf_kind_r8), pointer :: target_ptr(:,:), target_ptr_3d(:,:,:) + real :: init_val = -999.9 print*,"- CALL FieldCreate FOR TARGET GRID T2M." t2m_target_grid = ESMF_FieldCreate(target_grid, & @@ -3215,6 +3250,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid t2m." + call ESMF_FieldGet(t2m_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID Q2M." q2m_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3222,6 +3265,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid q2m." + call ESMF_FieldGet(q2m_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID TPRCP." tprcp_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3229,6 +3280,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid tprcp." + call ESMF_FieldGet(tprcp_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID F10M." f10m_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3236,6 +3295,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid f10m." + call ESMF_FieldGet(f10m_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID FFMM." ffmm_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3243,6 +3310,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid ffmm." + call ESMF_FieldGet(ffmm_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID USTAR." ustar_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3250,6 +3325,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid ustar." + call ESMF_FieldGet(ustar_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SNOW LIQ EQUIV." snow_liq_equiv_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3257,6 +3340,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid snow liq equiv." + call ESMF_FieldGet(snow_liq_equiv_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SNOW DEPTH." snow_depth_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3264,6 +3355,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid snow depth." + call ESMF_FieldGet(snow_depth_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SEA ICE FRACTION." seaice_fract_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3271,6 +3370,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid sea ice fraction." + call ESMF_FieldGet(seaice_fract_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SEA ICE DEPTH." seaice_depth_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3278,6 +3385,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET sea ice depth." + call ESMF_FieldGet(seaice_depth_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SEA ICE SKIN TEMP." seaice_skin_temp_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3285,6 +3400,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET sea ice skin temp." + call ESMF_FieldGet(seaice_skin_temp_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SRFLAG." srflag_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3292,6 +3415,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET srflag." + call ESMF_FieldGet(srflag_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SKIN TEMPERATURE." skin_temp_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3299,6 +3430,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid skin temp." + call ESMF_FieldGet(skin_temp_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID CANOPY MOISTURE CONTENT." canopy_mc_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3306,6 +3445,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid canopy moisture." + call ESMF_FieldGet(canopy_mc_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID Z0." z0_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3313,6 +3460,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid z0." + call ESMF_FieldGet(z0_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR INTERPOLATED TARGET GRID TERRAIN." terrain_from_input_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3320,6 +3475,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid interpolated terrain." + call ESMF_FieldGet(terrain_from_input_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR INTERPOLATED TARGET GRID SOIL TYPE." soil_type_from_input_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3327,6 +3490,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid soil type" + call ESMF_FieldGet(soil_type_from_input_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val + print*,"- CALL FieldCreate FOR TARGET GRID SOIL TEMPERATURE." soil_temp_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3336,6 +3507,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid soil temp" + call ESMF_FieldGet(soil_temp_target_grid, & + farrayPtr=target_ptr_3d, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr_3d = init_val + print*,"- CALL FieldCreate FOR TARGET GRID TOTAL SOIL MOISTURE." soilm_tot_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3345,6 +3524,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid soil moist" + call ESMF_FieldGet(soilm_tot_target_grid, & + farrayPtr=target_ptr_3d, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr_3d = init_val + print*,"- CALL FieldCreate FOR TARGET GRID LIQUID SOIL MOISTURE." soilm_liq_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -3354,6 +3541,14 @@ subroutine create_surface_esmf_fields if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN FieldCreate", rc) + print*,"- INITIALIZE TARGET grid soil liq" + call ESMF_FieldGet(soilm_liq_target_grid, & + farrayPtr=target_ptr_3d, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + call error_handler("IN FieldGet", rc) + + target_ptr_3d = init_val + end subroutine create_surface_esmf_fields subroutine create_nst_esmf_fields From f7f04fcb8b7647a9c499686657b02d7485dad38c Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2019 09:00:24 -0500 Subject: [PATCH 004/192] Feature/chgres ice check (#35) develop: This commit references #32. Updates to chgres_cube: 1) Ensure sea ice fraction does not exceed 1.00. 2) Update 'model_grid.F90' to use separate pointers for the center and corner point lat/lons for gaussian grids. Recycling the same pointer for both could cause problems. --- sorc/chgres_cube.fd/model_grid.F90 | 20 +++++++++++--------- sorc/chgres_cube.fd/surface.F90 | 7 +++++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/sorc/chgres_cube.fd/model_grid.F90 b/sorc/chgres_cube.fd/model_grid.F90 index 1fc4f2567..37c8a3072 100644 --- a/sorc/chgres_cube.fd/model_grid.F90 +++ b/sorc/chgres_cube.fd/model_grid.F90 @@ -161,6 +161,8 @@ subroutine define_input_grid_gaussian(localpet, npets) real(esmf_kind_r8), allocatable :: longitude(:,:) real(esmf_kind_r8), pointer :: lat_src_ptr(:,:) real(esmf_kind_r8), pointer :: lon_src_ptr(:,:) + real(esmf_kind_r8), pointer :: lat_corner_src_ptr(:,:) + real(esmf_kind_r8), pointer :: lon_corner_src_ptr(:,:) real(esmf_kind_r8) :: deltalon real(esmf_kind_r8), allocatable :: slat(:), wlat(:) @@ -320,22 +322,22 @@ subroutine define_input_grid_gaussian(localpet, npets) call error_handler("IN GridAddCoord", rc) print*,"- CALL GridGetCoord FOR INPUT GRID X-COORD." - nullify(lon_src_ptr) + nullify(lon_corner_src_ptr) call ESMF_GridGetCoord(input_grid, & staggerLoc=ESMF_STAGGERLOC_CORNER, & coordDim=1, & - farrayPtr=lon_src_ptr, rc=rc) + farrayPtr=lon_corner_src_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN GridGetCoord", rc) print*,"- CALL GridGetCoord FOR INPUT GRID Y-COORD." - nullify(lat_src_ptr) + nullify(lat_corner_src_ptr) call ESMF_GridGetCoord(input_grid, & staggerLoc=ESMF_STAGGERLOC_CORNER, & coordDim=2, & computationalLBound=clb, & computationalUBound=cub, & - farrayPtr=lat_src_ptr, rc=rc) + farrayPtr=lat_corner_src_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & call error_handler("IN GridGetCoord", rc) @@ -343,17 +345,17 @@ subroutine define_input_grid_gaussian(localpet, npets) do j = clb(2), cub(2) do i = clb(1), cub(1) - lon_src_ptr(i,j) = longitude(i,1) - (0.5_esmf_kind_r8*deltalon) - if (lon_src_ptr(i,j) > 360.0_esmf_kind_r8) lon_src_ptr(i,j) = lon_src_ptr(i,j) - 360.0_esmf_kind_r8 + lon_corner_src_ptr(i,j) = longitude(i,1) - (0.5_esmf_kind_r8*deltalon) + if (lon_corner_src_ptr(i,j) > 360.0_esmf_kind_r8) lon_corner_src_ptr(i,j) = lon_corner_src_ptr(i,j) - 360.0_esmf_kind_r8 if (j == 1) then - lat_src_ptr(i,j) = 90.0_esmf_kind_r8 + lat_corner_src_ptr(i,j) = 90.0_esmf_kind_r8 cycle endif if (j == jp1_input) then - lat_src_ptr(i,j) = -90.0_esmf_kind_r8 + lat_corner_src_ptr(i,j) = -90.0_esmf_kind_r8 cycle endif - lat_src_ptr(i,j) = 0.5_esmf_kind_r8 * (latitude(i,j-1)+ latitude(i,j)) + lat_corner_src_ptr(i,j) = 0.5_esmf_kind_r8 * (latitude(i,j-1)+ latitude(i,j)) enddo enddo diff --git a/sorc/chgres_cube.fd/surface.F90 b/sorc/chgres_cube.fd/surface.F90 index d68f704a9..3ac79c632 100644 --- a/sorc/chgres_cube.fd/surface.F90 +++ b/sorc/chgres_cube.fd/surface.F90 @@ -603,8 +603,11 @@ subroutine interp(localpet) if (localpet == 0) then do j = 1, j_target do i = 1, i_target - if (data_one_tile(i,j) < 0.15) data_one_tile(i,j) = 0.0 - if (data_one_tile(i,j) >= 0.15) mask_target_one_tile(i,j) = 2 + if (data_one_tile(i,j) > 1.0_esmf_kind_r8) then + data_one_tile(i,j) = 1.0_esmf_kind_r8 + endif + if (data_one_tile(i,j) < 0.15_esmf_kind_r8) data_one_tile(i,j) = 0.0_esmf_kind_r8 + if (data_one_tile(i,j) >= 0.15_esmf_kind_r8) mask_target_one_tile(i,j) = 2 enddo enddo endif From 5147e32bf6dbe2f468227f4d00083c9ca00319d2 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Wed, 11 Dec 2019 15:51:21 -0500 Subject: [PATCH 005/192] Update for new NCEPLIB library location on Jet (#34 #37) NCEPLIBS were recompiled on Jet and moved to a new location. Update repository accordingly. See issue #34 for more details. --- driver_scripts/driver_grid.jet.sh | 2 +- modulefiles/chgres_cube.jet | 19 +++++++++---------- modulefiles/fv3gfs/global_chgres.jet | 6 +++--- modulefiles/fv3gfs/global_cycle.jet | 6 +++--- modulefiles/fv3gfs/nst_tf_chg.jet | 4 ++-- modulefiles/fv3gfs/orog.jet | 4 ++-- modulefiles/module_base.jet | 14 +++++--------- modulefiles/module_nemsutil.jet | 6 +++--- .../modulefile.global_emcsfc_ice_blend.jet | 6 +++--- .../modulefile.global_emcsfc_snow2mdl.jet | 8 ++++---- modulefiles/modulefile.sfc_climo_gen.jet | 2 +- reg_tests/chgres_cube/driver.jet.sh | 2 +- sorc/machine-setup.sh | 2 +- ush/fv3gfs_driver_grid.sh | 8 ++++++++ 14 files changed, 46 insertions(+), 43 deletions(-) diff --git a/driver_scripts/driver_grid.jet.sh b/driver_scripts/driver_grid.jet.sh index 0f7ca77b0..7035b33f7 100644 --- a/driver_scripts/driver_grid.jet.sh +++ b/driver_scripts/driver_grid.jet.sh @@ -54,7 +54,7 @@ set -x . /apps/lmod/lmod/init/sh module purge -module load intel/15.0.3.187 +module load intel/18.0.5.274 module load impi/2018.4.274 module load szip module load hdf5 diff --git a/modulefiles/chgres_cube.jet b/modulefiles/chgres_cube.jet index d420970a7..9ec1069dc 100644 --- a/modulefiles/chgres_cube.jet +++ b/modulefiles/chgres_cube.jet @@ -2,22 +2,21 @@ ## chgres build module for Jet ############################################################# -module use /mnt/lfs3/projects/hfv3gfs/gwv/ljtjet/lib/modulefiles - -module load intel/15.0.3.187 +module load intel/18.0.5.274 module load impi/2018.4.274 module load szip module load hdf5 module load netcdf/4.2.1.1 -module load esmflocal/ESMF_8_0_0_beta_snapshot_21 +module load w3nco/v2.0.6 +module load sp/v2.0.2 +module load bacio/v2.0.2 +module load sigio/v2.1.0 +module load sfcio/v1.0.0 +module load nemsio/v2.2.3 -module load w3nco-intel-sandybridge/2.0.6 -module load sp-intel-sandybridge/2.0.2 -module load bacio-intel-sandybridge/2.0.2 -module load sigio-intel-sandybridge/2.0.1 -module load sfcio-intel-sandybridge/1.0.0 -module load nemsio-intel-sandybridge/2.2.2 +module use /mnt/lfs3/projects/hfv3gfs/gwv/ljtjet/lib/modulefiles +module load esmflocal/ESMF_8_0_0_beta_snapshot_21 export FCOMP=mpiifort export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" diff --git a/modulefiles/fv3gfs/global_chgres.jet b/modulefiles/fv3gfs/global_chgres.jet index 98c3bf282..088023563 100644 --- a/modulefiles/fv3gfs/global_chgres.jet +++ b/modulefiles/fv3gfs/global_chgres.jet @@ -3,7 +3,7 @@ ############################################################# module purge -module load intel/15.0.3.187 +module load intel/18.0.5.274 module load szip/2.1 module load hdf5/1.8.9 module load netcdf/4.2.1.1 @@ -13,8 +13,8 @@ module load sp/v2.0.2 module load w3emc/v2.2.0 module load w3nco/v2.0.6 module load bacio/v2.0.2 -module load sigio/v2.0.1 -module load nemsio/v2.2.2 +module load sigio/v2.1.0 +module load nemsio/v2.2.3 module load nemsiogfs/v2.0.1 module load sfcio/v1.0.0 module load gfsio/v1.1.0 diff --git a/modulefiles/fv3gfs/global_cycle.jet b/modulefiles/fv3gfs/global_cycle.jet index 6702cdf03..fc12b53f8 100644 --- a/modulefiles/fv3gfs/global_cycle.jet +++ b/modulefiles/fv3gfs/global_cycle.jet @@ -3,12 +3,12 @@ ############################################################# # Loading Intel Compiler Suite -module load intel/15.0.3.187 -module load impi/5.0.3.048 +module load intel/18.0.5.274 +module load impi/2018.4.274 module load w3nco/v2.0.6 module load sp/v2.0.2 -module load bacio/v2.0.1 +module load bacio/v2.0.2 module load ip/v3.0.0 module load szip module load hdf5/1.8.9 diff --git a/modulefiles/fv3gfs/nst_tf_chg.jet b/modulefiles/fv3gfs/nst_tf_chg.jet index a66e1f644..67bd8a087 100644 --- a/modulefiles/fv3gfs/nst_tf_chg.jet +++ b/modulefiles/fv3gfs/nst_tf_chg.jet @@ -3,11 +3,11 @@ ############################################################# # Loading Intel Compiler Suite -module load intel/15.0.3.187 +module load intel/18.0.5.274 module load w3nco/v2.0.6 module load bacio/v2.0.2 -module load nemsio/v2.2.2 +module load nemsio/v2.2.3 module load szip module load hdf5/1.8.9 module load netcdf/4.2.1.1 diff --git a/modulefiles/fv3gfs/orog.jet b/modulefiles/fv3gfs/orog.jet index 5b067744d..893457136 100644 --- a/modulefiles/fv3gfs/orog.jet +++ b/modulefiles/fv3gfs/orog.jet @@ -5,7 +5,7 @@ # module purge -module load intel/15.0.3.187 +module load intel/18.0.5.274 module load szip/2.1 module load hdf5/1.8.9 module load netcdf/4.2.1.1 @@ -13,6 +13,6 @@ module load netcdf/4.2.1.1 # Loding nceplibs modules module load ip/v2.0.0 module load sp/v2.0.2 -module load w3emc/v2.2.0 +module load w3emc/v2.3.0 module load w3nco/v2.0.6 module load bacio/v2.0.2 diff --git a/modulefiles/module_base.jet b/modulefiles/module_base.jet index c6c767eed..00e997aee 100644 --- a/modulefiles/module_base.jet +++ b/modulefiles/module_base.jet @@ -1,3 +1,4 @@ +#%Module############################################################# ## ## nems prerequisites ## @@ -6,19 +7,15 @@ proc ModulesHelp {} { puts stderr "The prerequisites for compiling or running FV3 on Jet. " } -module load newdefaults intel/15.0.3.187 impi/5.1.3.181 szip hdf5 netcdf4/4.2.1.1 +module load intel/15.0.3.187 impi/2018.4.274 szip hdf5 netcdf4/4.2.1.1 -module use /lfs3/projects/hfv3gfs/nwprod/lib/modulefiles +module use /lfs3/projects/hfv3gfs/nwprod/NCEPLIBS/modulefiles module load bacio/v2.0.2 module load sp/v2.0.2 module load ip/v2.0.0 module load w3nco/v2.0.6 -module load w3emc/v2.2.0 -module load nemsio/v2.2.2 - -#set NCEPLIBS $::env(NCEPLIBS) -#module use $NCEPLIBS/modulefiles -#module load esmf/7.1.0r_impi +module load w3emc/v2.3.0 +module load nemsio/v2.2.3 module use /lfs3/projects/hwrf-vd/soft/modulefiles module load prod_util @@ -29,4 +26,3 @@ module load hpss module load mpiserial module load gempak/7.4.2 - diff --git a/modulefiles/module_nemsutil.jet b/modulefiles/module_nemsutil.jet index 7f6bb028b..c1ff57408 100644 --- a/modulefiles/module_nemsutil.jet +++ b/modulefiles/module_nemsutil.jet @@ -3,12 +3,12 @@ ############################################################# # Loading Intel Compiler Suite -module load intel/15.0.3.187 +module load intel/18.0.5.274 module load impi/5.0.3.048 # Loding nceplibs modules module load w3nco/v2.0.6 -module load bacio/v2.0.1 -module load nemsio/v2.2.1 +module load bacio/v2.0.2 +module load nemsio/v2.2.3 export FCMP=ifort diff --git a/modulefiles/modulefile.global_emcsfc_ice_blend.jet b/modulefiles/modulefile.global_emcsfc_ice_blend.jet index 37f4ca900..2e094dc03 100644 --- a/modulefiles/modulefile.global_emcsfc_ice_blend.jet +++ b/modulefiles/modulefile.global_emcsfc_ice_blend.jet @@ -2,15 +2,15 @@ ## emcsfc_ice_blend build module for Jet ############################################################# -module load intel/15.0.3.187 +module load intel/18.0.5.274 export FCOMP=ifort export FFLAGS="-O0 -i4" # load ncep library modules module load w3nco/v2.0.6 -module load bacio/v2.0.1 +module load bacio/v2.0.2 module load jasper/v1.900.1 module load z/v1.2.6 module load png/v1.2.44 -module load g2/v2.5.0 +module load g2/v3.1.0 diff --git a/modulefiles/modulefile.global_emcsfc_snow2mdl.jet b/modulefiles/modulefile.global_emcsfc_snow2mdl.jet index b1f6a6fd6..0b88ae7c0 100644 --- a/modulefiles/modulefile.global_emcsfc_snow2mdl.jet +++ b/modulefiles/modulefile.global_emcsfc_snow2mdl.jet @@ -4,19 +4,19 @@ # load intel compiler -module load intel/15.0.3.187 +module load intel/18.0.5.274 # load ncep library modules module load ip/v3.0.0 module load sp/v2.0.2 module load w3nco/v2.0.6 -module load bacio/v2.0.1 +module load bacio/v2.0.2 module load jasper/v1.900.1 module load z/v1.2.6 module load png/v1.2.44 -module load g2/v2.5.0 +module load g2/v3.1.0 module load landsfcutil/v2.1.0 export FCOMP=ifort -export FFLAGS="-O0 -r8 -i4 -FR -I${IP_INCd} -openmp -convert big_endian -assume byterecl" +export FFLAGS="-O0 -r8 -i4 -FR -I${IP_INCd} -qopenmp -convert big_endian -assume byterecl" diff --git a/modulefiles/modulefile.sfc_climo_gen.jet b/modulefiles/modulefile.sfc_climo_gen.jet index 108dfcf2d..4969d85c6 100644 --- a/modulefiles/modulefile.sfc_climo_gen.jet +++ b/modulefiles/modulefile.sfc_climo_gen.jet @@ -4,7 +4,7 @@ module use /mnt/lfs3/projects/hfv3gfs/gwv/ljtjet/lib/modulefiles -module load intel/15.0.3.187 +module load intel/18.0.5.274 module load impi/2018.4.274 module load szip module load hdf5 diff --git a/reg_tests/chgres_cube/driver.jet.sh b/reg_tests/chgres_cube/driver.jet.sh index b256b64c3..7fe60ee71 100755 --- a/reg_tests/chgres_cube/driver.jet.sh +++ b/reg_tests/chgres_cube/driver.jet.sh @@ -26,7 +26,7 @@ set -x source /apps/lmod/lmod/init/sh module purge -module load intel/15.0.3.187 +module load intel/18.0.5.274 module load impi/2018.4.274 module load szip module load hdf5 diff --git a/sorc/machine-setup.sh b/sorc/machine-setup.sh index d54235b60..f518f2617 100644 --- a/sorc/machine-setup.sh +++ b/sorc/machine-setup.sh @@ -27,7 +27,7 @@ if [[ -d /lfs3 ]] ; then fi target=jet module purge - module use /mnt/lfs3/projects/hfv3gfs/nwprod/lib/modulefiles + module use /lfs3/projects/hfv3gfs/nwprod/NCEPLIBS/modulefiles elif [[ -d /scratch1 ]] ; then # We are on NOAA Hera if ( ! eval module help > /dev/null 2>&1 ) ; then diff --git a/ush/fv3gfs_driver_grid.sh b/ush/fv3gfs_driver_grid.sh index 838552139..3fd806c67 100755 --- a/ush/fv3gfs_driver_grid.sh +++ b/ush/fv3gfs_driver_grid.sh @@ -185,6 +185,10 @@ if [ $gtype = uniform ] || [ $gtype = stretch ] || [ $gtype = nest ]; then echo set -x $script_dir/fv3gfs_make_orog.sh $res $tile $grid_dir $orog_dir $script_dir $topo $TMPDIR + err=$? + if [ $err != 0 ]; then + exit $err + fi tile=$(( $tile + 1 )) done fi @@ -322,6 +326,10 @@ elif [ $gtype = regional ]; then echo set -x $script_dir/fv3gfs_make_orog.sh $res $tile $grid_dir $orog_dir $script_dir $topo $TMPDIR + err=$? + if [ $err != 0 ]; then + exit $err + fi fi set +x From d28afa0c3e393af905846e6b1756ec7ba1530372 Mon Sep 17 00:00:00 2001 From: Mark A Potts Date: Fri, 13 Dec 2019 17:34:09 +0000 Subject: [PATCH 006/192] working version --- CMakeLists.txt | 65 ++++++++++++++ cmake | 1 + modulefiles/chgres_cube.hera | 32 ++++--- modulefiles/chgres_cube.theia | 23 +++++ modulefiles/fv3gfs/fre-nctools.theia | 7 ++ modulefiles/fv3gfs/global_chgres.theia | 31 +++++++ modulefiles/fv3gfs/global_cycle.theia | 20 +++++ modulefiles/fv3gfs/nst_tf_chg.theia | 21 +++++ modulefiles/fv3gfs/orog.theia | 16 ++++ modulefiles/module-setup.csh.inc | 89 +++++++++++++++++++ modulefiles/module_base.hera | 10 ++- modulefiles/module_base.theia | 19 ++++ modulefiles/module_nemsutil.theia | 15 ++++ .../modulefile.global_emcsfc_ice_blend.theia | 17 ++++ .../modulefile.global_emcsfc_snow2mdl.theia | 23 +++++ modulefiles/modulefile.sfc_climo_gen.theia | 12 +++ sorc/chgres_cube.fd/CMakeLists.txt | 35 ++++++++ 17 files changed, 420 insertions(+), 16 deletions(-) create mode 100644 CMakeLists.txt create mode 160000 cmake create mode 100644 modulefiles/chgres_cube.theia create mode 100644 modulefiles/fv3gfs/fre-nctools.theia create mode 100644 modulefiles/fv3gfs/global_chgres.theia create mode 100644 modulefiles/fv3gfs/global_cycle.theia create mode 100644 modulefiles/fv3gfs/nst_tf_chg.theia create mode 100644 modulefiles/fv3gfs/orog.theia create mode 100644 modulefiles/module-setup.csh.inc create mode 100644 modulefiles/module_base.theia create mode 100644 modulefiles/module_nemsutil.theia create mode 100644 modulefiles/modulefile.global_emcsfc_ice_blend.theia create mode 100644 modulefiles/modulefile.global_emcsfc_snow2mdl.theia create mode 100644 modulefiles/modulefile.sfc_climo_gen.theia create mode 100644 sorc/chgres_cube.fd/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..6a1aa543c --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,65 @@ +cmake_minimum_required(VERSION 2.6) +project(ufs_util) +set(VERSION v1.1.1) +enable_language (Fortran) +if (NOT CMAKE_BUILD_TYPE) + set (CMAKE_BUILD_TYPE RELEASE CACHE STRING + "Choose the type of build, options are: PRODUCTION Debug Release." + FORCE) +endif() +if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + message("setting intel true") + set(IntelComp true ) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU*") + set(GNUComp true ) +elseif(CMAKE_CXX_COMPILER_ID MATCHES "pgc*") + set(PGIComp true ) +endif() +MESSAGE(${CMAKE_CURRENT_SOURCE_DIR}) +STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RelWithDebInfo" BUILD_RELEASE) +if(NOT BUILD_RELEASE ) + STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) +endif() +STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) +STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "DEGUG" BUILD_DEBUG) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") + +if(POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) +endif() +if(POLICY CMP0012) + cmake_policy(SET CMP0012 NEW) +endif() +find_package( NetCDF ) +find_package( OpenMP ) +message("openmp flags is ${OpenMP_Fortran_FLAGS}") +find_package( MPI ) +find_package( LAPACK ) +find_package( LANDSFCUTIL ) +find_package( Jasper ) +find_package( PNG ) +find_package( SFCIO ) +find_package( ZLIB ) +find_package( W3NCO ) +#find_package( G2 ) +find_package( BACIO ) +find_package( NEMSIO ) +#find_package( NEMSIOGFS ) +find_package( SIGIO ) +#find_package( IP ) +find_package( SP ) +find_package( HDF5 COMPONENTS C HL Fortran_HL ) +find_package( ESMF ) + +add_subdirectory(sorc/chgres_cube.fd) +#add_subdirectory(sorc/emcsfc_ice_blend.fd) +#add_subdirectory(sorc/emcsfc_snow2mdl.fd) +#add_subdirectory(sorc/fre-nctools.fd) +#add_subdirectory(sorc/global_chgres.fd) +#add_subdirectory(sorc/global_cycle.fd) +#add_subdirectory(sorc/nemsio_chgdate.fd) +#add_subdirectory(sorc/nemsio_get.fd) +#add_subdirectory(sorc/nemsio_read.fd) +#add_subdirectory(sorc/nst_tf_chg.fd) +#add_subdirectory(sorc/orog.fd) +#add_subdirectory(sorc/sfc_climo_gen.fd) diff --git a/cmake b/cmake new file mode 160000 index 000000000..255ab8c7f --- /dev/null +++ b/cmake @@ -0,0 +1 @@ +Subproject commit 255ab8c7facee736c178feca97038ec5a92e7617 diff --git a/modulefiles/chgres_cube.hera b/modulefiles/chgres_cube.hera index 72529a510..6a57f8128 100644 --- a/modulefiles/chgres_cube.hera +++ b/modulefiles/chgres_cube.hera @@ -4,20 +4,26 @@ module load intel/18.0.5.274 module load impi/2018.0.4 +#module use -a $MOD_PATH +module use -a /contrib/da/spack/share/spack/modules/linux-centos7-skylake_avx512 +module load cmake/3.15.3-intel-19.0.4.243 +module load w3nco/v2.0.6-intel-19.0.4.243-impi +module load nemsio/v2.2.3-intel-19.0.4.243-impi +module load nemsiogfs/v2.2.1-intel-19.0.4.243-impi +module load ip/v3.0.0-intel-19.0.4.243 +module load g2/v3.1.0-intel-19.0.4.243 +module load landsfcutil/v2.1.0-intel-19.0.4.243 +module load bacio/v2.1.0-intel-19.0.4.243 +module load sp/v2.0.2-intel-19.0.4.243 +module load sfcio//v1.1.0-intel-19.0.4.243 +module load sigio/v2.1.0-intel-19.0.4.243-impi +module load esmf/8.0.0b-intel-19.0.4.243-impi -module use -a $MOD_PATH -module load w3nco/2.0.6 -module load nemsio/2.2.3 -module load bacio/2.0.2 -module load sp/2.0.2 -module load sfcio/1.1.0 -module load sigio/2.1.0 +#export NCEPLIBS=/scratch1/NCEPDEV/global/gwv/l819/lib +#module use -a $NCEPLIBS/modulefiles +#module load esmflocal/8_0_48b.netcdf47 -export NCEPLIBS=/scratch1/NCEPDEV/global/gwv/l819/lib -module use -a $NCEPLIBS/modulefiles -module load esmflocal/8_0_48b.netcdf47 - -export FCOMP=mpiifort -export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" +#export FCOMP=mpiifort +#export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" # for debugging #export FFLAGS="-O0 -g -traceback -r8 -i4 -qopenmp -convert big_endian -check bounds -warn unused -assume byterecl" diff --git a/modulefiles/chgres_cube.theia b/modulefiles/chgres_cube.theia new file mode 100644 index 000000000..2b3548ba0 --- /dev/null +++ b/modulefiles/chgres_cube.theia @@ -0,0 +1,23 @@ +#%Module##################################################### +## chgres build module for Theia +############################################################# + +module load intel/15.1.133 +module load impi/5.1.1.109 +module load netcdf/4.3.0 + +module use /scratch4/NCEPDEV/nems/noscrub/emc.nemspara/soft/modulefiles +module load esmf/8.0.0bs20 + +module use -a /scratch3/NCEPDEV/nwprod/lib/modulefiles +module load w3nco +module load nemsio/v2.2.3 +module load bacio/v2.0.1 +module load sp/v2.0.2 +module load sfcio/v1.0.0 +module load sigio/v2.0.1 + +export FCOMP=mpiifort +export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" +# for debugging +#export FFLAGS="-O0 -g -traceback -r8 -i4 -qopenmp -convert big_endian -check bounds -warn unused -assume byterecl" diff --git a/modulefiles/fv3gfs/fre-nctools.theia b/modulefiles/fv3gfs/fre-nctools.theia new file mode 100644 index 000000000..c1b678411 --- /dev/null +++ b/modulefiles/fv3gfs/fre-nctools.theia @@ -0,0 +1,7 @@ +#%Module##################################################### +## Module file for fre-nctools +############################################################# +module load intel/14.0.2 +module load impi/4.1.3.048 +module load netcdf/4.3.0 +module load hdf5/1.8.14 diff --git a/modulefiles/fv3gfs/global_chgres.theia b/modulefiles/fv3gfs/global_chgres.theia new file mode 100644 index 000000000..fa764895f --- /dev/null +++ b/modulefiles/fv3gfs/global_chgres.theia @@ -0,0 +1,31 @@ +#%Module##################################################### +## global_chgres component - theia +############################################################# + +# Loading Intel Compiler Suite +module load intel/14.0.2 +module load impi/5.1.2.150 + +# Loding nceplibs modules +module use -a $MOD_PATH +module load sigio/v2.0.1 +module load w3nco/v2.0.6 +module load w3emc/v2.2.0 +module load sp/v2.0.2 +module load bacio/v2.0.2 +module load nemsio/v2.2.3 +module load nemsiogfs/v2.0.1 +export NEMSIOGFS_INC=/scratch4/NCEPDEV/global/save/glopara/svn/nceplibs/branches/nemsiogfsv2.0.1/include/nemsiogfs +export NEMSIOGFS_LIB=/scratch4/NCEPDEV/global/save/glopara/svn/nceplibs/branches/nemsiogfsv2.0.1/libnemsiogfs.a + +module load ip/v3.0.0 +module load sfcio/v1.0.0 +module load gfsio/v1.1.0 +module load landsfcutil/v2.1.0 +module load netcdf/4.3.0 +module load hdf5/1.8.14 + +export NETCDF_INCLUDE="-I${NETCDF}/include" +export NETCDF_LDFLAGS_F="-L${NETCDF}/lib -lnetcdf -lnetcdff -L${HDF5}/lib -lhdf5 -lhdf5_fortran" + +set FCMP ifort diff --git a/modulefiles/fv3gfs/global_cycle.theia b/modulefiles/fv3gfs/global_cycle.theia new file mode 100644 index 000000000..2f0f82cec --- /dev/null +++ b/modulefiles/fv3gfs/global_cycle.theia @@ -0,0 +1,20 @@ +#%Module##################################################### +## global_cycle component - theia +############################################################# + +# Loading Intel Compiler Suite +module load intel/16.1.150 +module load impi + +# Loding nceplibs modules +module use -a /scratch3/NCEPDEV/nwprod/lib/modulefiles +module load w3nco/v2.0.6 +module load sp/v2.0.2 +module load bacio/v2.0.1 +module load ip/v3.0.0 +module load netcdf/4.3.0 +module load hdf5/1.8.14 +export NETCDF_INCLUDE="-I${NETCDF}/include" +export NETCDF_LDFLAGS_F="-L${NETCDF}/lib -lnetcdf -lnetcdff -L${HDF5}/lib -lhdf5 -lhdf5_fortran" + +export FCMP=mpiifort diff --git a/modulefiles/fv3gfs/nst_tf_chg.theia b/modulefiles/fv3gfs/nst_tf_chg.theia new file mode 100644 index 000000000..9a8829df8 --- /dev/null +++ b/modulefiles/fv3gfs/nst_tf_chg.theia @@ -0,0 +1,21 @@ +#%Module##################################################### +## gaussian_sfcanl build module for Theia +############################################################# + +# Loading Intel Compiler Suite +module load intel/15.1.133 + +# Loding nceplibs modules +module use -a /scratch3/NCEPDEV/nwprod/lib/modulefiles +module load w3nco/v2.0.6 +module load bacio/v2.0.2 +module load nemsio/v2.2.3 +module load netcdf/4.3.0 +module load hdf5/1.8.14 +export NETCDF_INCLUDE="-I${NETCDF}/include" +export NETCDF_LDFLAGS_F="-L${NETCDF}/lib -lnetcdf -lnetcdff -L${HDF5}/lib -lhdf5 -lhdf5_fortran" + +export FCOMP=ifort +export FFLAGS="-O3 -fp-model precise -g -r8 -i4" +# for debugging +#export FFLAGS="-g -r8 -i4 -warn unused -check bounds" diff --git a/modulefiles/fv3gfs/orog.theia b/modulefiles/fv3gfs/orog.theia new file mode 100644 index 000000000..b0543289b --- /dev/null +++ b/modulefiles/fv3gfs/orog.theia @@ -0,0 +1,16 @@ +#%Module##################################################### +## Module file for orog +############################################################# +# Loading Intel Compiler Suite +module unload intel +module load intel/16.1.150 + +module load netcdf/4.3.0 + +# Loding nceplibs modules +module use -a $MOD_PATH +module load ip/v2.0.0 +module load sp/v2.0.2 +module load w3emc/v2.2.0 +module load w3nco/v2.0.6 +module load bacio/v2.0.2 diff --git a/modulefiles/module-setup.csh.inc b/modulefiles/module-setup.csh.inc new file mode 100644 index 000000000..a93b21a3c --- /dev/null +++ b/modulefiles/module-setup.csh.inc @@ -0,0 +1,89 @@ +set __ms_shell=csh + +eval "if ( -d / ) set __ms_shell=tcsh" + +if ( { test -d /lfs3 } ) then + if ( ! { module help >& /dev/null } ) then + source /apps/lmod/lmod/init/$__ms_shell + endif + module purge +else if ( { test -d /scratch3 } ) then + # We are on NOAA Theia + if ( ! { module help >& /dev/null } ) then + source /apps/lmod/lmod/init/$__ms_shell + endif + module purge +else if ( { test -d /gpfs/hps -a -e /etc/SuSE-release } ) then + # We are on NOAA Luna or Surge + if ( ! { module help >& /dev/null } ) then + source /opt/modules/default/init/$__ms_shell + endif + module purge + module purge + unset _LMFILES_ + unset LOADEDMODULES + module use /opt/modulefiles + module use /opt/cray/ari/modulefiles + module use /opt/cray/craype/default/alt-modulefiles + module use /opt/cray/alt-modulefiles + module use /gpfs/hps/nco/ops/nwprod/modulefiles + module use /gpfs/hps/nco/ops/nwprod/lib/modulefiles + module use /usrx/local/prod/modulefiles +else if ( { test -d /dcom -a -d /hwrf } ) then + # We are on NOAA Tide or Gyre + if ( ! { module help >& /dev/null } ) then + source /usrx/local/Modules/default/init/$__ms_shell + endif + module purge +else if ( { test -L /usrx && sh -c "readlink /usrx 2> /dev/null | grep dell" } ) then + # We are on WCOSS Mars or Venus + if ( ! { module help >& /dev/null } ) then + source /usrx/local/prod/lmod/lmod/init/$__ms_shell + endif + module purge +else if ( { test -d /glade } ) then + # We are on NCAR Yellowstone + if ( ! { module help >& /dev/null } ) then + source /usr/share/Modules/init/$__ms_shell + endif + module purge +else if ( { test -d /lustre -a -d /ncrc } ) then + # We are on GAEA. + if ( ! { module help >& /dev/null } ) then + # We cannot simply load the module command. The GAEA + # /etc/csh.login modifies a number of module-related variables + # before loading the module command. Without those variables, + # the module command fails. Hence we actually have to source + # /etc/csh.login here. + source /etc/csh.login + set __ms_source_etc_csh_login=yes + else + set __ms_source_etc_csh_login=no + endif + module purge + unsetenv _LMFILES_ + unsetenv _LMFILES_000 + unsetenv _LMFILES_001 + unsetenv LOADEDMODULES + module load modules + if ( { test -d /opt/cray/ari/modulefiles } ) then + module use -a /opt/cray/ari/modulefiles + endif + if ( { test -d /opt/cray/pe/ari/modulefiles } ) then + module use -a /opt/cray/pe/ari/modulefiles + endif + if ( { test -d /opt/cray/pe/craype/default/modulefiles } ) then + module use -a /opt/cray/pe/craype/default/modulefiles + endif + setenv NCEPLIBS /lustre/f1/pdata/ncep_shared/NCEPLIBS/lib + if ( { test -d /lustre/f1/pdata/ncep_shared/NCEPLIBS/lib } ) then + module use $NCEPLIBS/modulefiles + endif + if ( "$__ms_source_etc_csh_login" == yes ) then + source /etc/csh.login + unset __ms_source_etc_csh_login + endif +else + # Workaround for csh limitation. Use sh to print to stderr. + sh -c 'echo WARNING: UNKNOWN PLATFORM 1>&2' +endif diff --git a/modulefiles/module_base.hera b/modulefiles/module_base.hera index 07e78cfc9..d888bcd24 100644 --- a/modulefiles/module_base.hera +++ b/modulefiles/module_base.hera @@ -2,10 +2,14 @@ ## ## FV3GFS prerequisites ## - +setenv CC icc +setenv CXX icpc +setenv FC ifort +module use -a /contrib/da/spack/share/spack/modules/linux-centos7-skylake_avx512 module load intel/18.0.5.274 module load impi/2018.0.4 module load hpss/hpss -module load netcdf/4.7.0 +module load netcdf/4.6.2-intel-19.0.4.243-impi +module load netcdf-fortran/4.4.5-intel-19.0.4.243-impi module load nco/4.7.0 -module load hdf5/1.10.5 +module load hdf5/1.10.5-intel-19.0.4.243-impi diff --git a/modulefiles/module_base.theia b/modulefiles/module_base.theia new file mode 100644 index 000000000..13fad8fd5 --- /dev/null +++ b/modulefiles/module_base.theia @@ -0,0 +1,19 @@ +#%Module###################################################################### +## +## FV3GFS prerequisites +## + +module load intel/16.1.150 +module load impi/5.1.2.150 +module load wgrib2 +module load hpss +module load netcdf +module load nco +module load hdf5/1.8.14 +module load gempak/6.7.0 + +module use /scratch3/NCEPDEV/nwprod/lib/modulefiles +module load EnvVars/v1.0.2 + +module use /scratch4/NCEPDEV/nems/noscrub/emc.nemspara/soft/modulefiles +module load prod_util diff --git a/modulefiles/module_nemsutil.theia b/modulefiles/module_nemsutil.theia new file mode 100644 index 000000000..45685118e --- /dev/null +++ b/modulefiles/module_nemsutil.theia @@ -0,0 +1,15 @@ +#%Module##################################################### +## Module file for nemsutil +############################################################# + +# Loading Intel Compiler Suite +module load intel/14.0.2 +module load impi/5.1.2.150 + +# Loding nceplibs modules +module use -a $MOD_PATH +module load w3nco/v2.0.6 +module load bacio/v2.0.1 +module load nemsio/v2.2.1 + +export FCMP=ifort diff --git a/modulefiles/modulefile.global_emcsfc_ice_blend.theia b/modulefiles/modulefile.global_emcsfc_ice_blend.theia new file mode 100644 index 000000000..d42fb6ac8 --- /dev/null +++ b/modulefiles/modulefile.global_emcsfc_ice_blend.theia @@ -0,0 +1,17 @@ +#%Module##################################################### +## emcsfc_ice_blend build module for Theia +############################################################# + +module load intel/14.0.2 +export FCOMP=ifort +export FFLAGS="-O0 -i4" + +# load ncep library modules + +module use -a /scratch3/NCEPDEV/nwprod/lib/modulefiles +module load w3nco/v2.0.6 +module load bacio/v2.0.1 +module load jasper +module load z +module load png +module load g2/v2.5.0 diff --git a/modulefiles/modulefile.global_emcsfc_snow2mdl.theia b/modulefiles/modulefile.global_emcsfc_snow2mdl.theia new file mode 100644 index 000000000..b364fbe47 --- /dev/null +++ b/modulefiles/modulefile.global_emcsfc_snow2mdl.theia @@ -0,0 +1,23 @@ +#%Module##################################################### +## emcsfc_snow2mdl build module for Theia +############################################################# + +# load intel compiler + +module load intel/14.0.2 + +# load ncep library modules + +module use -a /scratch3/NCEPDEV/nwprod/lib/modulefiles +module load ip/v3.0.0 +module load sp/v2.0.2 +module load w3nco/v2.0.6 +module load bacio/v2.0.1 +module load jasper +module load z +module load png +module load g2/v2.5.0 +module load landsfcutil/v2.1.0 + +export FCOMP=ifort +export FFLAGS="-O0 -r8 -i4 -FR -I${IP_INCd} -openmp -convert big_endian -assume byterecl" diff --git a/modulefiles/modulefile.sfc_climo_gen.theia b/modulefiles/modulefile.sfc_climo_gen.theia new file mode 100644 index 000000000..39e306c5e --- /dev/null +++ b/modulefiles/modulefile.sfc_climo_gen.theia @@ -0,0 +1,12 @@ +#%Module##################################################### +## Module file for sfc_climo_gen +############################################################# + +module load intel/15.1.133 +module load impi/5.1.1.109 +module load netcdf/4.3.0 +module use /scratch4/NCEPDEV/nems/noscrub/emc.nemspara/soft/modulefiles +module load esmf/7.1.0r + +export FCOMP=mpiifort +export FFLAGS="-O3 -fp-model=precise -g -traceback -r8 -i4 -convert big_endian" diff --git a/sorc/chgres_cube.fd/CMakeLists.txt b/sorc/chgres_cube.fd/CMakeLists.txt new file mode 100644 index 000000000..8ef905530 --- /dev/null +++ b/sorc/chgres_cube.fd/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 2.6) +set(EXENAME chgres_cube.exe ) +file(GLOB EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.F90 ${CMAKE_CURRENT_SOURCE_DIR}/*.f90 ${CMAKE_CURRENT_SOURCE_DIR}/*.F) +#file(GLOB EXE_C_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.c) +if(IntelComp) + message("setting intel flags") + set(CMAKE_Fortran_4_FLAGS " -g -O3 -axCORE-AVX2" CACHE INTERNAL "" ) +else() + message("unkown compiler!") + set(CMAKE_Fortran_4_FLAGS "-ffree-form -ffree-line-length-0 -g -O3 " CACHE INTERNAL "" ) +endif() + + +#set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLAGS} ) +#add_definitions( ${CMAKE_Fortran_4_FLAGS} ) +add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC} ) +set_target_properties( ${EXENAME} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_4_FLAGS} ) +set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS ${CMAKE_Fortran_4_FLAGS} ) +message("sfcio lib is ${SFCIO_LIB} ${W3NCO_LIBd}") +#include_directories( ${G2_INC4} ${ESMF_INC} ${NEMSIO_INC} ${NETCDF_INCLUDES} ${MPI_Fortran_INCLUDE_PATH} ${SFCIO_INC} ${NETCDF_INCLUDES_F90}) +include_directories( ${ESMF_INC} ${NEMSIO_INC} ${NETCDF_INCLUDES} ${MPI_Fortran_INCLUDE_PATH} ${SFCIO_INC} ${NETCDF_INCLUDES_F90}) +set(CMAKE_INCLUDE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include_4") +set_target_properties(${EXENAME} PROPERTIES Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include_4") +target_include_directories(${EXENAME} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include_4") +#target_link_libraries(${EXENAME} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${NEMSIO_LIB} ${ESMF_LIB} ${SFCIO_LIB} ${MPI_Fortran_LIBRARIES} ${SIGIO_LIB} ${BACIO_LIB4} ${SP_LIBd} ${W3NCO_LIBd} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${OpenMP_Fortran_FLAGS} ) +target_link_libraries(${EXENAME} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${NEMSIO_LIB} ${ESMF_LIB} ${SFCIO_LIB} ${MPI_Fortran_LIBRARIES} ${SIGIO_LIB} ${BACIO_LIB4} ${SP_LIBd} ${W3NCO_LIBd} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${OpenMP_Fortran_FLAGS} ) + +file(MAKE_DIRECTORY ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) + +install(TARGETS ${EXENAME} + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin + LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib + ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) +install(DIRECTORY ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/ DESTINATION include_4 ) + From 42b6e32b0b04eeba691d09bdbc45c625c3e0553f Mon Sep 17 00:00:00 2001 From: Mark A Potts Date: Mon, 16 Dec 2019 15:49:12 +0000 Subject: [PATCH 007/192] Revert "Merge branch 'working' into develop" This reverts commit 6f17d4f2d034fb42eadd44a2f9c0acda740caf3c, reversing changes made to 5147e32bf6dbe2f468227f4d00083c9ca00319d2. --- CMakeLists.txt | 65 -------------- cmake | 1 - modulefiles/chgres_cube.hera | 32 +++---- modulefiles/chgres_cube.theia | 23 ----- modulefiles/fv3gfs/fre-nctools.theia | 7 -- modulefiles/fv3gfs/global_chgres.theia | 31 ------- modulefiles/fv3gfs/global_cycle.theia | 20 ----- modulefiles/fv3gfs/nst_tf_chg.theia | 21 ----- modulefiles/fv3gfs/orog.theia | 16 ---- modulefiles/module-setup.csh.inc | 89 ------------------- modulefiles/module_base.hera | 10 +-- modulefiles/module_base.theia | 19 ---- modulefiles/module_nemsutil.theia | 15 ---- .../modulefile.global_emcsfc_ice_blend.theia | 17 ---- .../modulefile.global_emcsfc_snow2mdl.theia | 23 ----- modulefiles/modulefile.sfc_climo_gen.theia | 12 --- sorc/chgres_cube.fd/CMakeLists.txt | 35 -------- 17 files changed, 16 insertions(+), 420 deletions(-) delete mode 100644 CMakeLists.txt delete mode 160000 cmake delete mode 100644 modulefiles/chgres_cube.theia delete mode 100644 modulefiles/fv3gfs/fre-nctools.theia delete mode 100644 modulefiles/fv3gfs/global_chgres.theia delete mode 100644 modulefiles/fv3gfs/global_cycle.theia delete mode 100644 modulefiles/fv3gfs/nst_tf_chg.theia delete mode 100644 modulefiles/fv3gfs/orog.theia delete mode 100644 modulefiles/module-setup.csh.inc delete mode 100644 modulefiles/module_base.theia delete mode 100644 modulefiles/module_nemsutil.theia delete mode 100644 modulefiles/modulefile.global_emcsfc_ice_blend.theia delete mode 100644 modulefiles/modulefile.global_emcsfc_snow2mdl.theia delete mode 100644 modulefiles/modulefile.sfc_climo_gen.theia delete mode 100644 sorc/chgres_cube.fd/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 6a1aa543c..000000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,65 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -project(ufs_util) -set(VERSION v1.1.1) -enable_language (Fortran) -if (NOT CMAKE_BUILD_TYPE) - set (CMAKE_BUILD_TYPE RELEASE CACHE STRING - "Choose the type of build, options are: PRODUCTION Debug Release." - FORCE) -endif() -if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") - message("setting intel true") - set(IntelComp true ) -elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU*") - set(GNUComp true ) -elseif(CMAKE_CXX_COMPILER_ID MATCHES "pgc*") - set(PGIComp true ) -endif() -MESSAGE(${CMAKE_CURRENT_SOURCE_DIR}) -STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RelWithDebInfo" BUILD_RELEASE) -if(NOT BUILD_RELEASE ) - STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "RELEASE" BUILD_RELEASE) -endif() -STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "PRODUCTION" BUILD_PRODUCTION) -STRING(COMPARE EQUAL ${CMAKE_BUILD_TYPE} "DEGUG" BUILD_DEBUG) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") - -if(POLICY CMP0054) - cmake_policy(SET CMP0054 NEW) -endif() -if(POLICY CMP0012) - cmake_policy(SET CMP0012 NEW) -endif() -find_package( NetCDF ) -find_package( OpenMP ) -message("openmp flags is ${OpenMP_Fortran_FLAGS}") -find_package( MPI ) -find_package( LAPACK ) -find_package( LANDSFCUTIL ) -find_package( Jasper ) -find_package( PNG ) -find_package( SFCIO ) -find_package( ZLIB ) -find_package( W3NCO ) -#find_package( G2 ) -find_package( BACIO ) -find_package( NEMSIO ) -#find_package( NEMSIOGFS ) -find_package( SIGIO ) -#find_package( IP ) -find_package( SP ) -find_package( HDF5 COMPONENTS C HL Fortran_HL ) -find_package( ESMF ) - -add_subdirectory(sorc/chgres_cube.fd) -#add_subdirectory(sorc/emcsfc_ice_blend.fd) -#add_subdirectory(sorc/emcsfc_snow2mdl.fd) -#add_subdirectory(sorc/fre-nctools.fd) -#add_subdirectory(sorc/global_chgres.fd) -#add_subdirectory(sorc/global_cycle.fd) -#add_subdirectory(sorc/nemsio_chgdate.fd) -#add_subdirectory(sorc/nemsio_get.fd) -#add_subdirectory(sorc/nemsio_read.fd) -#add_subdirectory(sorc/nst_tf_chg.fd) -#add_subdirectory(sorc/orog.fd) -#add_subdirectory(sorc/sfc_climo_gen.fd) diff --git a/cmake b/cmake deleted file mode 160000 index 255ab8c7f..000000000 --- a/cmake +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 255ab8c7facee736c178feca97038ec5a92e7617 diff --git a/modulefiles/chgres_cube.hera b/modulefiles/chgres_cube.hera index 6a57f8128..72529a510 100644 --- a/modulefiles/chgres_cube.hera +++ b/modulefiles/chgres_cube.hera @@ -4,26 +4,20 @@ module load intel/18.0.5.274 module load impi/2018.0.4 -#module use -a $MOD_PATH -module use -a /contrib/da/spack/share/spack/modules/linux-centos7-skylake_avx512 -module load cmake/3.15.3-intel-19.0.4.243 -module load w3nco/v2.0.6-intel-19.0.4.243-impi -module load nemsio/v2.2.3-intel-19.0.4.243-impi -module load nemsiogfs/v2.2.1-intel-19.0.4.243-impi -module load ip/v3.0.0-intel-19.0.4.243 -module load g2/v3.1.0-intel-19.0.4.243 -module load landsfcutil/v2.1.0-intel-19.0.4.243 -module load bacio/v2.1.0-intel-19.0.4.243 -module load sp/v2.0.2-intel-19.0.4.243 -module load sfcio//v1.1.0-intel-19.0.4.243 -module load sigio/v2.1.0-intel-19.0.4.243-impi -module load esmf/8.0.0b-intel-19.0.4.243-impi -#export NCEPLIBS=/scratch1/NCEPDEV/global/gwv/l819/lib -#module use -a $NCEPLIBS/modulefiles -#module load esmflocal/8_0_48b.netcdf47 +module use -a $MOD_PATH +module load w3nco/2.0.6 +module load nemsio/2.2.3 +module load bacio/2.0.2 +module load sp/2.0.2 +module load sfcio/1.1.0 +module load sigio/2.1.0 -#export FCOMP=mpiifort -#export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" +export NCEPLIBS=/scratch1/NCEPDEV/global/gwv/l819/lib +module use -a $NCEPLIBS/modulefiles +module load esmflocal/8_0_48b.netcdf47 + +export FCOMP=mpiifort +export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" # for debugging #export FFLAGS="-O0 -g -traceback -r8 -i4 -qopenmp -convert big_endian -check bounds -warn unused -assume byterecl" diff --git a/modulefiles/chgres_cube.theia b/modulefiles/chgres_cube.theia deleted file mode 100644 index 2b3548ba0..000000000 --- a/modulefiles/chgres_cube.theia +++ /dev/null @@ -1,23 +0,0 @@ -#%Module##################################################### -## chgres build module for Theia -############################################################# - -module load intel/15.1.133 -module load impi/5.1.1.109 -module load netcdf/4.3.0 - -module use /scratch4/NCEPDEV/nems/noscrub/emc.nemspara/soft/modulefiles -module load esmf/8.0.0bs20 - -module use -a /scratch3/NCEPDEV/nwprod/lib/modulefiles -module load w3nco -module load nemsio/v2.2.3 -module load bacio/v2.0.1 -module load sp/v2.0.2 -module load sfcio/v1.0.0 -module load sigio/v2.0.1 - -export FCOMP=mpiifort -export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" -# for debugging -#export FFLAGS="-O0 -g -traceback -r8 -i4 -qopenmp -convert big_endian -check bounds -warn unused -assume byterecl" diff --git a/modulefiles/fv3gfs/fre-nctools.theia b/modulefiles/fv3gfs/fre-nctools.theia deleted file mode 100644 index c1b678411..000000000 --- a/modulefiles/fv3gfs/fre-nctools.theia +++ /dev/null @@ -1,7 +0,0 @@ -#%Module##################################################### -## Module file for fre-nctools -############################################################# -module load intel/14.0.2 -module load impi/4.1.3.048 -module load netcdf/4.3.0 -module load hdf5/1.8.14 diff --git a/modulefiles/fv3gfs/global_chgres.theia b/modulefiles/fv3gfs/global_chgres.theia deleted file mode 100644 index fa764895f..000000000 --- a/modulefiles/fv3gfs/global_chgres.theia +++ /dev/null @@ -1,31 +0,0 @@ -#%Module##################################################### -## global_chgres component - theia -############################################################# - -# Loading Intel Compiler Suite -module load intel/14.0.2 -module load impi/5.1.2.150 - -# Loding nceplibs modules -module use -a $MOD_PATH -module load sigio/v2.0.1 -module load w3nco/v2.0.6 -module load w3emc/v2.2.0 -module load sp/v2.0.2 -module load bacio/v2.0.2 -module load nemsio/v2.2.3 -module load nemsiogfs/v2.0.1 -export NEMSIOGFS_INC=/scratch4/NCEPDEV/global/save/glopara/svn/nceplibs/branches/nemsiogfsv2.0.1/include/nemsiogfs -export NEMSIOGFS_LIB=/scratch4/NCEPDEV/global/save/glopara/svn/nceplibs/branches/nemsiogfsv2.0.1/libnemsiogfs.a - -module load ip/v3.0.0 -module load sfcio/v1.0.0 -module load gfsio/v1.1.0 -module load landsfcutil/v2.1.0 -module load netcdf/4.3.0 -module load hdf5/1.8.14 - -export NETCDF_INCLUDE="-I${NETCDF}/include" -export NETCDF_LDFLAGS_F="-L${NETCDF}/lib -lnetcdf -lnetcdff -L${HDF5}/lib -lhdf5 -lhdf5_fortran" - -set FCMP ifort diff --git a/modulefiles/fv3gfs/global_cycle.theia b/modulefiles/fv3gfs/global_cycle.theia deleted file mode 100644 index 2f0f82cec..000000000 --- a/modulefiles/fv3gfs/global_cycle.theia +++ /dev/null @@ -1,20 +0,0 @@ -#%Module##################################################### -## global_cycle component - theia -############################################################# - -# Loading Intel Compiler Suite -module load intel/16.1.150 -module load impi - -# Loding nceplibs modules -module use -a /scratch3/NCEPDEV/nwprod/lib/modulefiles -module load w3nco/v2.0.6 -module load sp/v2.0.2 -module load bacio/v2.0.1 -module load ip/v3.0.0 -module load netcdf/4.3.0 -module load hdf5/1.8.14 -export NETCDF_INCLUDE="-I${NETCDF}/include" -export NETCDF_LDFLAGS_F="-L${NETCDF}/lib -lnetcdf -lnetcdff -L${HDF5}/lib -lhdf5 -lhdf5_fortran" - -export FCMP=mpiifort diff --git a/modulefiles/fv3gfs/nst_tf_chg.theia b/modulefiles/fv3gfs/nst_tf_chg.theia deleted file mode 100644 index 9a8829df8..000000000 --- a/modulefiles/fv3gfs/nst_tf_chg.theia +++ /dev/null @@ -1,21 +0,0 @@ -#%Module##################################################### -## gaussian_sfcanl build module for Theia -############################################################# - -# Loading Intel Compiler Suite -module load intel/15.1.133 - -# Loding nceplibs modules -module use -a /scratch3/NCEPDEV/nwprod/lib/modulefiles -module load w3nco/v2.0.6 -module load bacio/v2.0.2 -module load nemsio/v2.2.3 -module load netcdf/4.3.0 -module load hdf5/1.8.14 -export NETCDF_INCLUDE="-I${NETCDF}/include" -export NETCDF_LDFLAGS_F="-L${NETCDF}/lib -lnetcdf -lnetcdff -L${HDF5}/lib -lhdf5 -lhdf5_fortran" - -export FCOMP=ifort -export FFLAGS="-O3 -fp-model precise -g -r8 -i4" -# for debugging -#export FFLAGS="-g -r8 -i4 -warn unused -check bounds" diff --git a/modulefiles/fv3gfs/orog.theia b/modulefiles/fv3gfs/orog.theia deleted file mode 100644 index b0543289b..000000000 --- a/modulefiles/fv3gfs/orog.theia +++ /dev/null @@ -1,16 +0,0 @@ -#%Module##################################################### -## Module file for orog -############################################################# -# Loading Intel Compiler Suite -module unload intel -module load intel/16.1.150 - -module load netcdf/4.3.0 - -# Loding nceplibs modules -module use -a $MOD_PATH -module load ip/v2.0.0 -module load sp/v2.0.2 -module load w3emc/v2.2.0 -module load w3nco/v2.0.6 -module load bacio/v2.0.2 diff --git a/modulefiles/module-setup.csh.inc b/modulefiles/module-setup.csh.inc deleted file mode 100644 index a93b21a3c..000000000 --- a/modulefiles/module-setup.csh.inc +++ /dev/null @@ -1,89 +0,0 @@ -set __ms_shell=csh - -eval "if ( -d / ) set __ms_shell=tcsh" - -if ( { test -d /lfs3 } ) then - if ( ! { module help >& /dev/null } ) then - source /apps/lmod/lmod/init/$__ms_shell - endif - module purge -else if ( { test -d /scratch3 } ) then - # We are on NOAA Theia - if ( ! { module help >& /dev/null } ) then - source /apps/lmod/lmod/init/$__ms_shell - endif - module purge -else if ( { test -d /gpfs/hps -a -e /etc/SuSE-release } ) then - # We are on NOAA Luna or Surge - if ( ! { module help >& /dev/null } ) then - source /opt/modules/default/init/$__ms_shell - endif - module purge - module purge - unset _LMFILES_ - unset LOADEDMODULES - module use /opt/modulefiles - module use /opt/cray/ari/modulefiles - module use /opt/cray/craype/default/alt-modulefiles - module use /opt/cray/alt-modulefiles - module use /gpfs/hps/nco/ops/nwprod/modulefiles - module use /gpfs/hps/nco/ops/nwprod/lib/modulefiles - module use /usrx/local/prod/modulefiles -else if ( { test -d /dcom -a -d /hwrf } ) then - # We are on NOAA Tide or Gyre - if ( ! { module help >& /dev/null } ) then - source /usrx/local/Modules/default/init/$__ms_shell - endif - module purge -else if ( { test -L /usrx && sh -c "readlink /usrx 2> /dev/null | grep dell" } ) then - # We are on WCOSS Mars or Venus - if ( ! { module help >& /dev/null } ) then - source /usrx/local/prod/lmod/lmod/init/$__ms_shell - endif - module purge -else if ( { test -d /glade } ) then - # We are on NCAR Yellowstone - if ( ! { module help >& /dev/null } ) then - source /usr/share/Modules/init/$__ms_shell - endif - module purge -else if ( { test -d /lustre -a -d /ncrc } ) then - # We are on GAEA. - if ( ! { module help >& /dev/null } ) then - # We cannot simply load the module command. The GAEA - # /etc/csh.login modifies a number of module-related variables - # before loading the module command. Without those variables, - # the module command fails. Hence we actually have to source - # /etc/csh.login here. - source /etc/csh.login - set __ms_source_etc_csh_login=yes - else - set __ms_source_etc_csh_login=no - endif - module purge - unsetenv _LMFILES_ - unsetenv _LMFILES_000 - unsetenv _LMFILES_001 - unsetenv LOADEDMODULES - module load modules - if ( { test -d /opt/cray/ari/modulefiles } ) then - module use -a /opt/cray/ari/modulefiles - endif - if ( { test -d /opt/cray/pe/ari/modulefiles } ) then - module use -a /opt/cray/pe/ari/modulefiles - endif - if ( { test -d /opt/cray/pe/craype/default/modulefiles } ) then - module use -a /opt/cray/pe/craype/default/modulefiles - endif - setenv NCEPLIBS /lustre/f1/pdata/ncep_shared/NCEPLIBS/lib - if ( { test -d /lustre/f1/pdata/ncep_shared/NCEPLIBS/lib } ) then - module use $NCEPLIBS/modulefiles - endif - if ( "$__ms_source_etc_csh_login" == yes ) then - source /etc/csh.login - unset __ms_source_etc_csh_login - endif -else - # Workaround for csh limitation. Use sh to print to stderr. - sh -c 'echo WARNING: UNKNOWN PLATFORM 1>&2' -endif diff --git a/modulefiles/module_base.hera b/modulefiles/module_base.hera index d888bcd24..07e78cfc9 100644 --- a/modulefiles/module_base.hera +++ b/modulefiles/module_base.hera @@ -2,14 +2,10 @@ ## ## FV3GFS prerequisites ## -setenv CC icc -setenv CXX icpc -setenv FC ifort -module use -a /contrib/da/spack/share/spack/modules/linux-centos7-skylake_avx512 + module load intel/18.0.5.274 module load impi/2018.0.4 module load hpss/hpss -module load netcdf/4.6.2-intel-19.0.4.243-impi -module load netcdf-fortran/4.4.5-intel-19.0.4.243-impi +module load netcdf/4.7.0 module load nco/4.7.0 -module load hdf5/1.10.5-intel-19.0.4.243-impi +module load hdf5/1.10.5 diff --git a/modulefiles/module_base.theia b/modulefiles/module_base.theia deleted file mode 100644 index 13fad8fd5..000000000 --- a/modulefiles/module_base.theia +++ /dev/null @@ -1,19 +0,0 @@ -#%Module###################################################################### -## -## FV3GFS prerequisites -## - -module load intel/16.1.150 -module load impi/5.1.2.150 -module load wgrib2 -module load hpss -module load netcdf -module load nco -module load hdf5/1.8.14 -module load gempak/6.7.0 - -module use /scratch3/NCEPDEV/nwprod/lib/modulefiles -module load EnvVars/v1.0.2 - -module use /scratch4/NCEPDEV/nems/noscrub/emc.nemspara/soft/modulefiles -module load prod_util diff --git a/modulefiles/module_nemsutil.theia b/modulefiles/module_nemsutil.theia deleted file mode 100644 index 45685118e..000000000 --- a/modulefiles/module_nemsutil.theia +++ /dev/null @@ -1,15 +0,0 @@ -#%Module##################################################### -## Module file for nemsutil -############################################################# - -# Loading Intel Compiler Suite -module load intel/14.0.2 -module load impi/5.1.2.150 - -# Loding nceplibs modules -module use -a $MOD_PATH -module load w3nco/v2.0.6 -module load bacio/v2.0.1 -module load nemsio/v2.2.1 - -export FCMP=ifort diff --git a/modulefiles/modulefile.global_emcsfc_ice_blend.theia b/modulefiles/modulefile.global_emcsfc_ice_blend.theia deleted file mode 100644 index d42fb6ac8..000000000 --- a/modulefiles/modulefile.global_emcsfc_ice_blend.theia +++ /dev/null @@ -1,17 +0,0 @@ -#%Module##################################################### -## emcsfc_ice_blend build module for Theia -############################################################# - -module load intel/14.0.2 -export FCOMP=ifort -export FFLAGS="-O0 -i4" - -# load ncep library modules - -module use -a /scratch3/NCEPDEV/nwprod/lib/modulefiles -module load w3nco/v2.0.6 -module load bacio/v2.0.1 -module load jasper -module load z -module load png -module load g2/v2.5.0 diff --git a/modulefiles/modulefile.global_emcsfc_snow2mdl.theia b/modulefiles/modulefile.global_emcsfc_snow2mdl.theia deleted file mode 100644 index b364fbe47..000000000 --- a/modulefiles/modulefile.global_emcsfc_snow2mdl.theia +++ /dev/null @@ -1,23 +0,0 @@ -#%Module##################################################### -## emcsfc_snow2mdl build module for Theia -############################################################# - -# load intel compiler - -module load intel/14.0.2 - -# load ncep library modules - -module use -a /scratch3/NCEPDEV/nwprod/lib/modulefiles -module load ip/v3.0.0 -module load sp/v2.0.2 -module load w3nco/v2.0.6 -module load bacio/v2.0.1 -module load jasper -module load z -module load png -module load g2/v2.5.0 -module load landsfcutil/v2.1.0 - -export FCOMP=ifort -export FFLAGS="-O0 -r8 -i4 -FR -I${IP_INCd} -openmp -convert big_endian -assume byterecl" diff --git a/modulefiles/modulefile.sfc_climo_gen.theia b/modulefiles/modulefile.sfc_climo_gen.theia deleted file mode 100644 index 39e306c5e..000000000 --- a/modulefiles/modulefile.sfc_climo_gen.theia +++ /dev/null @@ -1,12 +0,0 @@ -#%Module##################################################### -## Module file for sfc_climo_gen -############################################################# - -module load intel/15.1.133 -module load impi/5.1.1.109 -module load netcdf/4.3.0 -module use /scratch4/NCEPDEV/nems/noscrub/emc.nemspara/soft/modulefiles -module load esmf/7.1.0r - -export FCOMP=mpiifort -export FFLAGS="-O3 -fp-model=precise -g -traceback -r8 -i4 -convert big_endian" diff --git a/sorc/chgres_cube.fd/CMakeLists.txt b/sorc/chgres_cube.fd/CMakeLists.txt deleted file mode 100644 index 8ef905530..000000000 --- a/sorc/chgres_cube.fd/CMakeLists.txt +++ /dev/null @@ -1,35 +0,0 @@ -cmake_minimum_required(VERSION 2.6) -set(EXENAME chgres_cube.exe ) -file(GLOB EXE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.F90 ${CMAKE_CURRENT_SOURCE_DIR}/*.f90 ${CMAKE_CURRENT_SOURCE_DIR}/*.F) -#file(GLOB EXE_C_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.c) -if(IntelComp) - message("setting intel flags") - set(CMAKE_Fortran_4_FLAGS " -g -O3 -axCORE-AVX2" CACHE INTERNAL "" ) -else() - message("unkown compiler!") - set(CMAKE_Fortran_4_FLAGS "-ffree-form -ffree-line-length-0 -g -O3 " CACHE INTERNAL "" ) -endif() - - -#set_source_files_properties( ${EXE_C_SRC} PROPERTIES COMPILE_FLAGS ${CMAKE_C_FLAGS} ) -#add_definitions( ${CMAKE_Fortran_4_FLAGS} ) -add_executable(${EXENAME} ${EXE_SRC} ${EXE_C_SRC} ) -set_target_properties( ${EXENAME} PROPERTIES COMPILE_FLAGS ${CMAKE_Fortran_4_FLAGS} ) -set_target_properties( ${EXENAME} PROPERTIES LINK_FLAGS ${CMAKE_Fortran_4_FLAGS} ) -message("sfcio lib is ${SFCIO_LIB} ${W3NCO_LIBd}") -#include_directories( ${G2_INC4} ${ESMF_INC} ${NEMSIO_INC} ${NETCDF_INCLUDES} ${MPI_Fortran_INCLUDE_PATH} ${SFCIO_INC} ${NETCDF_INCLUDES_F90}) -include_directories( ${ESMF_INC} ${NEMSIO_INC} ${NETCDF_INCLUDES} ${MPI_Fortran_INCLUDE_PATH} ${SFCIO_INC} ${NETCDF_INCLUDES_F90}) -set(CMAKE_INCLUDE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include_4") -set_target_properties(${EXENAME} PROPERTIES Fortran_MODULE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include_4") -target_include_directories(${EXENAME} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include_4") -#target_link_libraries(${EXENAME} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${NEMSIO_LIB} ${ESMF_LIB} ${SFCIO_LIB} ${MPI_Fortran_LIBRARIES} ${SIGIO_LIB} ${BACIO_LIB4} ${SP_LIBd} ${W3NCO_LIBd} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${OpenMP_Fortran_FLAGS} ) -target_link_libraries(${EXENAME} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${NEMSIO_LIB} ${ESMF_LIB} ${SFCIO_LIB} ${MPI_Fortran_LIBRARIES} ${SIGIO_LIB} ${BACIO_LIB4} ${SP_LIBd} ${W3NCO_LIBd} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${OpenMP_Fortran_FLAGS} ) - -file(MAKE_DIRECTORY ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) - -install(TARGETS ${EXENAME} - RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin - LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib - ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) -install(DIRECTORY ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}/ DESTINATION include_4 ) - From 732210a883b4a392418eb1191573f4749a0f5056 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Mon, 30 Dec 2019 11:27:20 -0500 Subject: [PATCH 008/192] chgres_cube vertical velocity fix Update chgres_cube to zero out vertical velocity when using tiled history files or tile restart files as input. See issue #31 for details. --- reg_tests/chgres_cube/driver.cray.sh | 2 +- reg_tests/chgres_cube/driver.dell.sh | 2 +- sorc/chgres_cube.fd/input_data.F90 | 29 +++++++++++++++++----------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/reg_tests/chgres_cube/driver.cray.sh b/reg_tests/chgres_cube/driver.cray.sh index e6f073256..005812149 100755 --- a/reg_tests/chgres_cube/driver.cray.sh +++ b/reg_tests/chgres_cube/driver.cray.sh @@ -34,7 +34,7 @@ module list export OUTDIR=/gpfs/hps3/stmp/$LOGNAME/chgres_reg_tests QUEUE="debug" -PROJECT_CODE="FV3GFS-T2O" +PROJECT_CODE="GFS-DEV" #----------------------------------------------------------------------------- # Should not have to change anything below here. HOMEufs is the root diff --git a/reg_tests/chgres_cube/driver.dell.sh b/reg_tests/chgres_cube/driver.dell.sh index e9369e2f9..a8fcb7cf2 100755 --- a/reg_tests/chgres_cube/driver.dell.sh +++ b/reg_tests/chgres_cube/driver.dell.sh @@ -33,7 +33,7 @@ module list export OUTDIR=/gpfs/dell1/stmp/$LOGNAME/chgres_reg_tests QUEUE="debug" -PROJECT_CODE="FV3GFS-T2O" +PROJECT_CODE="GFS-DEV" #----------------------------------------------------------------------------- # Should not have to change anything below here. HOMEufs is the root diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index 2725e5560..3c1d88a8b 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -1609,11 +1609,14 @@ subroutine read_input_atm_restart_file(localpet) enddo if (localpet < num_tiles_input_grid) then - error=nf90_inq_varid(ncid, 'W', id_var) - call netcdf_err(error, 'reading field id' ) - error=nf90_get_var(ncid, id_var, data_one_tile_3d) - call netcdf_err(error, 'reading field' ) - data_one_tile_3d(:,:,1:lev_input) = data_one_tile_3d(:,:,lev_input:1:-1) +! error=nf90_inq_varid(ncid, 'W', id_var) +! call netcdf_err(error, 'reading field id' ) +! error=nf90_get_var(ncid, id_var, data_one_tile_3d) +! call netcdf_err(error, 'reading field' ) +! data_one_tile_3d(:,:,1:lev_input) = data_one_tile_3d(:,:,lev_input:1:-1) + +! Using 'w' from restart files has caused problems. Set to zero. + data_one_tile_3d = 0.0_8 endif do tile = 1, num_tiles_input_grid @@ -1943,12 +1946,16 @@ subroutine read_input_atm_history_file(localpet) endif if (localpet < num_tiles_input_grid) then - print*,"- READ VERTICAL VELOCITY." - error=nf90_inq_varid(ncid, 'dzdt', id_var) - call netcdf_err(error, 'reading field id' ) - error=nf90_get_var(ncid, id_var, data_one_tile_3d) - call netcdf_err(error, 'reading field' ) - data_one_tile_3d(:,:,1:lev_input) = data_one_tile_3d(:,:,lev_input:1:-1) +! print*,"- READ VERTICAL VELOCITY." +! error=nf90_inq_varid(ncid, 'dzdt', id_var) +! call netcdf_err(error, 'reading field id' ) +! error=nf90_get_var(ncid, id_var, data_one_tile_3d) +! call netcdf_err(error, 'reading field' ) +! data_one_tile_3d(:,:,1:lev_input) = data_one_tile_3d(:,:,lev_input:1:-1) + +! Using w from the tiled history files has caused problems. +! Set to zero. + data_one_tile_3d = 0.0_8 endif do tile = 1, num_tiles_input_grid From 9a6f8a1ce081a56ab22b2874719d13eaf456dd41 Mon Sep 17 00:00:00 2001 From: DomHeinzeller <58610420+DomHeinzeller@users.noreply.github.com> Date: Thu, 23 Jan 2020 13:02:44 -0500 Subject: [PATCH 009/192] develop: chgres_cube and sfc_climo_gen programs: Correct pre-processor directives "__line__" and "__file__" to "__LINE__" and "__FILE__" in order to work with compilers other than Intel (which tolerates the lowercase versions). --- sorc/chgres_cube.fd/atmosphere.F90 | 148 +++--- sorc/chgres_cube.fd/chgres.F90 | 6 +- sorc/chgres_cube.fd/input_data.F90 | 568 +++++++++++------------ sorc/chgres_cube.fd/model_grid.F90 | 86 ++-- sorc/chgres_cube.fd/static_data.F90 | 56 +-- sorc/chgres_cube.fd/surface.F90 | 626 +++++++++++++------------- sorc/chgres_cube.fd/write_data.F90 | 144 +++--- sorc/sfc_climo_gen.fd/driver.F90 | 6 +- sorc/sfc_climo_gen.fd/interp.F90 | 20 +- sorc/sfc_climo_gen.fd/model_grid.F90 | 16 +- sorc/sfc_climo_gen.fd/source_grid.F90 | 28 +- 11 files changed, 852 insertions(+), 852 deletions(-) diff --git a/sorc/chgres_cube.fd/atmosphere.F90 b/sorc/chgres_cube.fd/atmosphere.F90 index 0e22b551e..98881d95e 100644 --- a/sorc/chgres_cube.fd/atmosphere.F90 +++ b/sorc/chgres_cube.fd/atmosphere.F90 @@ -171,7 +171,7 @@ subroutine atmosphere_driver(localpet) atm_weight_file, & routehandle=regrid_bl, & srctermprocessing=isrctermprocessing, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldSMMStore", rc) else @@ -187,7 +187,7 @@ subroutine atmosphere_driver(localpet) extrapmethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & routehandle=regrid_bl, & regridmethod=method, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridStore", rc) endif @@ -198,7 +198,7 @@ subroutine atmosphere_driver(localpet) routehandle=regrid_bl, & termorderflag=ESMF_TERMORDER_SRCSEQ, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid FOR PRESSURE." @@ -207,7 +207,7 @@ subroutine atmosphere_driver(localpet) routehandle=regrid_bl, & termorderflag=ESMF_TERMORDER_SRCSEQ, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) do n = 1, num_tracers @@ -216,7 +216,7 @@ subroutine atmosphere_driver(localpet) tracers_b4adj_target_grid(n), & routehandle=regrid_bl, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) enddo @@ -225,14 +225,14 @@ subroutine atmosphere_driver(localpet) dzdt_b4adj_target_grid, & routehandle=regrid_bl, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) nullify(psptr) print*,"- CALL FieldGet FOR INPUT SURFACE PRESSURE." call ESMF_FieldGet(ps_input_grid, & farrayPtr=psptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) !------------------------------------------------------------------------------------ @@ -247,14 +247,14 @@ subroutine atmosphere_driver(localpet) routehandle=regrid_bl, & termorderflag=ESMF_TERMORDER_SRCSEQ, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) nullify(psptr) print*,"- CALL FieldGet FOR INPUT SURFACE PRESSURE B4ADJ." call ESMF_FieldGet(ps_b4adj_target_grid, & farrayPtr=psptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) psptr = p0 * psptr**one_over_exponent @@ -265,7 +265,7 @@ subroutine atmosphere_driver(localpet) routehandle=regrid_bl, & termorderflag=ESMF_TERMORDER_SRCSEQ, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid FOR 3-D WIND." @@ -273,12 +273,12 @@ subroutine atmosphere_driver(localpet) wind_b4adj_target_grid, & routehandle=regrid_bl, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL FieldRegridRelease." call ESMF_FieldRegridRelease(routehandle=regrid_bl, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridRelease", rc) !----------------------------------------------------------------------------------- @@ -338,7 +338,7 @@ subroutine atmosphere_driver(localpet) extrapMethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & routehandle=regrid_bl, & regridmethod=method, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridStore", rc) print*,"- CALL Field_Regrid FOR 3-D WIND WEST EDGE." @@ -346,12 +346,12 @@ subroutine atmosphere_driver(localpet) wind_w_target_grid, & routehandle=regrid_bl, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL FieldRegridRelease." call ESMF_FieldRegridRelease(routehandle=regrid_bl, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridRelease", rc) isrctermprocessing = 1 @@ -365,7 +365,7 @@ subroutine atmosphere_driver(localpet) extrapMethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & routehandle=regrid_bl, & regridmethod=method, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridStore", rc) print*,"- CALL Field_Regrid FOR 3-D WIND SOUTH EDGE." @@ -373,12 +373,12 @@ subroutine atmosphere_driver(localpet) wind_s_target_grid, & routehandle=regrid_bl, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL FieldRegridRelease." call ESMF_FieldRegridRelease(routehandle=regrid_bl, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridRelease", rc) !----------------------------------------------------------------------------------- @@ -423,7 +423,7 @@ subroutine create_atm_b4adj_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) enddo @@ -433,7 +433,7 @@ subroutine create_atm_b4adj_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID PRESSURE BEFORE ADJUSTMENT." @@ -442,7 +442,7 @@ subroutine create_atm_b4adj_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID VERTICAL VELOCITY BEFORE ADJUSTMENT." @@ -451,7 +451,7 @@ subroutine create_atm_b4adj_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID UNSTAGGERED WINDS BEFORE ADJUSTMENT." @@ -460,21 +460,21 @@ subroutine create_atm_b4adj_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1,1/), & ungriddedUBound=(/lev_input,3/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET TERRAIN." terrain_interp_to_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET SURFACE PRESSURE BEFORE ADJUSTMENT." ps_b4adj_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) end subroutine create_atm_b4adj_esmf_fields @@ -498,7 +498,7 @@ subroutine create_atm_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_target/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) enddo @@ -508,7 +508,7 @@ subroutine create_atm_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_target/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID PRESSURE." @@ -517,7 +517,7 @@ subroutine create_atm_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_target/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID VERTICAL VELOCITY." @@ -526,7 +526,7 @@ subroutine create_atm_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_target/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID DELP." @@ -535,7 +535,7 @@ subroutine create_atm_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_target/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET HEIGHT." @@ -544,7 +544,7 @@ subroutine create_atm_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/levp1_target/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET UNSTAGGERED 3D-WIND." @@ -553,7 +553,7 @@ subroutine create_atm_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1,1/), & ungriddedUBound=(/lev_target,3/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET U_S." @@ -562,7 +562,7 @@ subroutine create_atm_esmf_fields staggerloc=ESMF_STAGGERLOC_EDGE2, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_target/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET V_S." @@ -571,7 +571,7 @@ subroutine create_atm_esmf_fields staggerloc=ESMF_STAGGERLOC_EDGE2, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_target/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET 3D-WIND_S." @@ -580,7 +580,7 @@ subroutine create_atm_esmf_fields staggerloc=ESMF_STAGGERLOC_EDGE2, & ungriddedLBound=(/1,1/), & ungriddedUBound=(/lev_target,3/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET U_W." @@ -589,7 +589,7 @@ subroutine create_atm_esmf_fields staggerloc=ESMF_STAGGERLOC_EDGE1, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_target/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET V_W." @@ -598,7 +598,7 @@ subroutine create_atm_esmf_fields staggerloc=ESMF_STAGGERLOC_EDGE1, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_target/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET 3D-WIND_W." @@ -607,14 +607,14 @@ subroutine create_atm_esmf_fields staggerloc=ESMF_STAGGERLOC_EDGE1, & ungriddedLBound=(/1,1/), & ungriddedUBound=(/lev_target,3/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET SURFACE PRESSURE." ps_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) end subroutine create_atm_esmf_fields @@ -644,31 +644,31 @@ subroutine convert_winds computationalLBound=clb, & computationalUBound=cub, & farrayPtr=windptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR U_S." call ESMF_FieldGet(u_s_target_grid, & farrayPtr=uptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR V_S." call ESMF_FieldGet(v_s_target_grid, & farrayPtr=vptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR LATITUDE_S." call ESMF_FieldGet(latitude_s_target_grid, & farrayPtr=latptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR LONGITUDE_S." call ESMF_FieldGet(longitude_s_target_grid, & farrayPtr=lonptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do i = clb(1), cub(1) @@ -689,31 +689,31 @@ subroutine convert_winds computationalLBound=clb, & computationalUBound=cub, & farrayPtr=windptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR U_W." call ESMF_FieldGet(u_w_target_grid, & farrayPtr=uptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR V_W." call ESMF_FieldGet(v_w_target_grid, & farrayPtr=vptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR LATITUDE_W." call ESMF_FieldGet(latitude_w_target_grid, & farrayPtr=latptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR LONGITUDE_W." call ESMF_FieldGet(longitude_w_target_grid, & farrayPtr=lonptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do i = clb(1), cub(1) @@ -798,7 +798,7 @@ subroutine newpr1(localpet) computationalLBound=clb, & computationalUBound=cub, & farrayPtr=pptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR DELP." @@ -806,13 +806,13 @@ subroutine newpr1(localpet) computationalLBound=clb, & computationalUBound=cub, & farrayPtr=delp_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR SURFACE PRESSURE AFTER ADJUSTMENT" call ESMF_FieldGet(ps_target_grid, & farrayPtr=psptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) allocate(pi(clb(1):cub(1),clb(2):cub(2),1:levp1_target)) @@ -926,7 +926,7 @@ subroutine newps(localpet) computationalLBound=clb, & computationalUBound=cub, & farrayPtr=pptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) if(localpet==0) then @@ -936,7 +936,7 @@ subroutine newps(localpet) print*,"- CALL FieldGet FOR TEMPERATURE" call ESMF_FieldGet(temp_b4adj_target_grid, & farrayPtr=tptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) ! Find specific humidity in the array of tracer fields. @@ -948,31 +948,31 @@ subroutine newps(localpet) print*,"- CALL FieldGet FOR SPECIFIC HUMIDITY" call ESMF_FieldGet(tracers_b4adj_target_grid(ii), & farrayPtr=qptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR SURFACE PRESSURE BEFORE ADJUSTMENT" call ESMF_FieldGet(ps_b4adj_target_grid, & farrayPtr=psptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR SURFACE PRESSURE AFTER ADJUSTMENT" call ESMF_FieldGet(ps_target_grid, & farrayPtr=psnewptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR OLD TERRAIN" call ESMF_FieldGet(terrain_interp_to_target_grid, & farrayPtr=zsptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR NEW TERRAIN" call ESMF_FieldGet(terrain_target_grid, & farrayPtr=zsnewptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) allocate(zu(clb(1):cub(1),clb(2):cub(2))) @@ -1180,7 +1180,7 @@ SUBROUTINE VINTG computationalLBound=clb, & computationalUBound=cub, & farrayPtr=p1ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1199,7 +1199,7 @@ SUBROUTINE VINTG print*,"- CALL FieldGet FOR 3-D ADJUSTED PRESS" call ESMF_FieldGet(pres_target_grid, & farrayPtr=P2PTR, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) Z2 = -LOG(P2PTR) @@ -1207,7 +1207,7 @@ SUBROUTINE VINTG print*,"- CALL FieldGet FOR 3-D WIND." call ESMF_FieldGet(wind_b4adj_target_grid, & farrayPtr=WIND1PTR, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) C1(:,:,:,1) = WIND1PTR(:,:,:,1) @@ -1217,7 +1217,7 @@ SUBROUTINE VINTG print*,"- CALL FieldGet FOR VERTICAL VELOCITY." call ESMF_FieldGet(dzdt_b4adj_target_grid, & farrayPtr=DZDT1PTR, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) C1(:,:,:,4) = DZDT1PTR(:,:,:) @@ -1225,7 +1225,7 @@ SUBROUTINE VINTG print*,"- CALL FieldGet FOR 3-D TEMP." call ESMF_FieldGet(temp_b4adj_target_grid, & farrayPtr=T1PTR, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) C1(:,:,:,5) = T1PTR(:,:,:) @@ -1235,7 +1235,7 @@ SUBROUTINE VINTG print*,"- CALL FieldGet FOR 3-D TRACERS ", trim(tracers(i)) call ESMF_FieldGet(tracers_b4adj_target_grid(i), & farrayPtr=Q1PTR, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) C1(:,:,:,5+I) = Q1PTR(:,:,:) @@ -1265,19 +1265,19 @@ SUBROUTINE VINTG print*,"- CALL FieldGet FOR 3-D ADJUSTED TEMP." call ESMF_FieldGet(temp_target_grid, & farrayPtr=T2PTR, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR ADJUSTED VERTICAL VELOCITY." call ESMF_FieldGet(dzdt_target_grid, & farrayPtr=DZDT2PTR, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR 3-D ADJUSTED WIND." call ESMF_FieldGet(wind_target_grid, & farrayPtr=WIND2PTR, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) DO K=1,LEV_TARGET @@ -1302,7 +1302,7 @@ SUBROUTINE VINTG print*,"- CALL FieldGet FOR 3-D TRACER ", trim(tracers(ii)) call ESMF_FieldGet(tracers_target_grid(ii), & farrayPtr=Q2PTR, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) IF (TRIM(TRACERS(II)) == "sphum") THEN ! specific humidity @@ -1668,25 +1668,25 @@ subroutine compute_zh computationalLBound=clb, & computationalUBound=cub, & farrayPtr=psptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TERRAIN HEIGHT" call ESMF_FieldGet(terrain_target_grid, & farrayPtr=zhsfcptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR HEIGHT" call ESMF_FieldGet(zh_target_grid, & farrayPtr=zhptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TEMPERATURE" call ESMF_FieldGet(temp_target_grid, & farrayPtr=tptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do ii = 1, num_tracers @@ -1696,7 +1696,7 @@ subroutine compute_zh print*,"- CALL FieldGet FOR SPECIFIC HUMIDITY" call ESMF_FieldGet(tracers_target_grid(ii), & farrayPtr=qptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) grd = grav/rdgas diff --git a/sorc/chgres_cube.fd/chgres.F90 b/sorc/chgres_cube.fd/chgres.F90 index 2b160b32a..8dedc1122 100644 --- a/sorc/chgres_cube.fd/chgres.F90 +++ b/sorc/chgres_cube.fd/chgres.F90 @@ -39,17 +39,17 @@ program chgres print*,"- INITIALIZE ESMF" call ESMF_Initialize(rc=ierr) - if(ESMF_logFoundError(rcToCheck=ierr,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=ierr,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("INITIALIZING ESMF", ierr) print*,"- CALL VMGetGlobal" call ESMF_VMGetGlobal(vm, rc=ierr) - if(ESMF_logFoundError(rcToCheck=ierr,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=ierr,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN VMGetGlobal", ierr) print*,"- CALL VMGet" call ESMF_VMGet(vm, localPet=localpet, petCount=npets, rc=ierr) - if(ESMF_logFoundError(rcToCheck=ierr,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=ierr,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN VMGet", ierr) print*,'- NPETS IS ',npets diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index 3c1d88a8b..c813e0a6a 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -172,126 +172,126 @@ subroutine read_input_nst_data(localpet) c_d_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID C_0." c_0_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID D_CONV." d_conv_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID DT_COOL." dt_cool_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID IFD." ifd_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID QRAIN." qrain_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID TREF." tref_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID W_D." w_d_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID W_0." w_0_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID XS." xs_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID XT." xt_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID XU." xu_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID XV." xv_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID XZ." xz_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID XTTS." xtts_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID XZTS." xzts_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID Z_C." z_c_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID ZM." zm_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) if (trim(input_type) == "gaussian" .or. trim(input_type) == "gfs_gaussian") then @@ -318,133 +318,133 @@ subroutine read_input_sfc_data(localpet) landsea_mask_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID Z0." z0_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID VEGETATION TYPE." veg_type_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID CANOPY MOISTURE CONTENT." canopy_mc_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID SEAICE FRACTION." seaice_fract_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID SEAICE DEPTH." seaice_depth_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID SEAICE SKIN TEMPERATURE." seaice_skin_temp_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID SNOW DEPTH." snow_depth_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID SNOW LIQUID EQUIVALENT." snow_liq_equiv_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID T2M." t2m_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID Q2M." q2m_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID TPRCP." tprcp_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID F10M." f10m_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID USTAR." ustar_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID FFMM." ffmm_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID SRFLAG." srflag_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT SKIN TEMPERATURE." skin_temp_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT SOIL TYPE." soil_type_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT TERRAIN." terrain_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT SOIL TEMPERATURE." @@ -453,7 +453,7 @@ subroutine read_input_sfc_data(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lsoil_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT TOTAL SOIL MOISTURE." @@ -462,7 +462,7 @@ subroutine read_input_sfc_data(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lsoil_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT LIQUID SOIL MOISTURE." @@ -471,7 +471,7 @@ subroutine read_input_sfc_data(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lsoil_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) if (trim(input_type) == "restart") then @@ -555,14 +555,14 @@ subroutine read_input_atm_gfs_spectral_file(localpet) ps_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID TERRAIN." terrain_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID TEMPERATURE." @@ -571,7 +571,7 @@ subroutine read_input_atm_gfs_spectral_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) allocate(tracers_input_grid(num_tracers)) @@ -583,7 +583,7 @@ subroutine read_input_atm_gfs_spectral_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) enddo @@ -593,7 +593,7 @@ subroutine read_input_atm_gfs_spectral_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID U." @@ -602,7 +602,7 @@ subroutine read_input_atm_gfs_spectral_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID V." @@ -611,7 +611,7 @@ subroutine read_input_atm_gfs_spectral_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) if (localpet == 0) then @@ -642,7 +642,7 @@ subroutine read_input_atm_gfs_spectral_file(localpet) print*,"- CALL FieldScatter FOR SURFACE PRESSURE." call ESMF_FieldScatter(ps_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -652,7 +652,7 @@ subroutine read_input_atm_gfs_spectral_file(localpet) print*,"- CALL FieldScatter FOR TERRAIN." call ESMF_FieldScatter(terrain_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) do k = 1, num_tracers @@ -664,7 +664,7 @@ subroutine read_input_atm_gfs_spectral_file(localpet) print*,"- CALL FieldScatter FOR INPUT ", trim(tracers_input(k)) call ESMF_FieldScatter(tracers_input_grid(k), dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -676,7 +676,7 @@ subroutine read_input_atm_gfs_spectral_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID TEMPERATURE." call ESMF_FieldScatter(temp_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) !--------------------------------------------------------------------------- @@ -691,7 +691,7 @@ subroutine read_input_atm_gfs_spectral_file(localpet) print*,"- CALL FieldScatter FOR INPUT DZDT." call ESMF_FieldScatter(dzdt_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -702,12 +702,12 @@ subroutine read_input_atm_gfs_spectral_file(localpet) print*,"- CALL FieldScatter FOR INPUT U-WIND." call ESMF_FieldScatter(u_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldScatter FOR INPUT V-WIND." call ESMF_FieldScatter(v_input_grid, dummy3d2, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) deallocate(dummy2d, dummy3d, dummy3d2) @@ -734,7 +734,7 @@ subroutine read_input_atm_gfs_spectral_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & print*,"- CALL FieldGet FOR 3-D PRES." nullify(pptr) @@ -742,14 +742,14 @@ subroutine read_input_atm_gfs_spectral_file(localpet) computationalLBound=clb, & computationalUBound=cub, & farrayPtr=pptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR SURFACE PRESSURE." nullify(psptr) call ESMF_FieldGet(ps_input_grid, & farrayPtr=psptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) !--------------------------------------------------------------------------- @@ -844,7 +844,7 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) ps_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID TEMPERATURE." @@ -853,7 +853,7 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) allocate(tracers_input_grid(num_tracers)) @@ -865,7 +865,7 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) enddo @@ -875,7 +875,7 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID V." @@ -884,7 +884,7 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID DZDT." @@ -893,14 +893,14 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID TERRAIN." terrain_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) if (localpet == 0) then @@ -932,7 +932,7 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID TEMPERATURE." call ESMF_FieldScatter(temp_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) do n = 1, num_tracers @@ -951,7 +951,7 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT ", trim(tracers_input(n)) call ESMF_FieldScatter(tracers_input_grid(n), dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -970,7 +970,7 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT U-WIND." call ESMF_FieldScatter(u_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -987,7 +987,7 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT V-WIND." call ESMF_FieldScatter(v_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) !--------------------------------------------------------------------------- @@ -1002,7 +1002,7 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT DZDT." call ESMF_FieldScatter(dzdt_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -1018,7 +1018,7 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR TERRAIN." call ESMF_FieldScatter(terrain_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -1034,7 +1034,7 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR SURFACE PRESSURE." call ESMF_FieldScatter(ps_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) call nemsio_close(gfile) @@ -1059,7 +1059,7 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & print*,"- CALL FieldGet FOR 3-D PRES." nullify(pptr) @@ -1067,14 +1067,14 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) computationalLBound=clb, & computationalUBound=cub, & farrayPtr=pptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR SURFACE PRESSURE." nullify(psptr) call ESMF_FieldGet(ps_input_grid, & farrayPtr=psptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) !--------------------------------------------------------------------------- @@ -1162,7 +1162,7 @@ subroutine read_input_atm_gaussian_file(localpet) ps_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID TEMPERATURE." @@ -1171,7 +1171,7 @@ subroutine read_input_atm_gaussian_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) allocate(tracers_input_grid(num_tracers)) @@ -1183,7 +1183,7 @@ subroutine read_input_atm_gaussian_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) enddo @@ -1193,7 +1193,7 @@ subroutine read_input_atm_gaussian_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID V." @@ -1202,7 +1202,7 @@ subroutine read_input_atm_gaussian_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT DPRES." @@ -1211,7 +1211,7 @@ subroutine read_input_atm_gaussian_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID DZDT." @@ -1220,14 +1220,14 @@ subroutine read_input_atm_gaussian_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID TERRAIN." terrain_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) if (localpet == 0) then @@ -1259,7 +1259,7 @@ subroutine read_input_atm_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID TEMPERATURE." call ESMF_FieldScatter(temp_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) do n = 1, num_tracers @@ -1278,7 +1278,7 @@ subroutine read_input_atm_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT ", trim(tracers_input(n)) call ESMF_FieldScatter(tracers_input_grid(n), dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -1297,7 +1297,7 @@ subroutine read_input_atm_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT U-WIND." call ESMF_FieldScatter(u_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -1314,7 +1314,7 @@ subroutine read_input_atm_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT V-WIND." call ESMF_FieldScatter(v_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -1331,7 +1331,7 @@ subroutine read_input_atm_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT DPRES." call ESMF_FieldScatter(dpres_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -1348,7 +1348,7 @@ subroutine read_input_atm_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT DZDT." call ESMF_FieldScatter(dzdt_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -1364,7 +1364,7 @@ subroutine read_input_atm_gaussian_file(localpet) print*,"- CALL FieldScatter FOR TERRAIN." call ESMF_FieldScatter(terrain_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) call nemsio_close(gfile) @@ -1393,7 +1393,7 @@ subroutine read_input_atm_gaussian_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldGet FOR DELTA PRESSURE." @@ -1402,21 +1402,21 @@ subroutine read_input_atm_gaussian_file(localpet) computationalLBound=clb, & computationalUBound=cub, & farrayPtr=dpresptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR 3-D PRESSURE." nullify(presptr) call ESMF_FieldGet(pres_input_grid, & farrayPtr=presptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR SURFACE PRESSURE." nullify(psptr) call ESMF_FieldGet(ps_input_grid, & farrayPtr=psptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) allocate(pres_interface(levp1_input)) @@ -1516,7 +1516,7 @@ subroutine read_input_atm_restart_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID V." @@ -1525,7 +1525,7 @@ subroutine read_input_atm_restart_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID DZDT." @@ -1534,7 +1534,7 @@ subroutine read_input_atm_restart_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID TEMPERATURE." @@ -1543,7 +1543,7 @@ subroutine read_input_atm_restart_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID DELTA PRESSURE." @@ -1552,14 +1552,14 @@ subroutine read_input_atm_restart_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID TERRAIN." terrain_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) allocate(tracers_input_grid(num_tracers)) @@ -1572,7 +1572,7 @@ subroutine read_input_atm_restart_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) enddo @@ -1604,7 +1604,7 @@ subroutine read_input_atm_restart_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT GRID TERRAIN for tile ",tile call ESMF_FieldScatter(terrain_input_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -1622,7 +1622,7 @@ subroutine read_input_atm_restart_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT GRID VERTICAL VELOCITY for tile ",tile call ESMF_FieldScatter(dzdt_input_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -1637,7 +1637,7 @@ subroutine read_input_atm_restart_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT GRID TEMPERATURE." call ESMF_FieldScatter(temp_input_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -1652,7 +1652,7 @@ subroutine read_input_atm_restart_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT DELTA PRESSURE." call ESMF_FieldScatter(dpres_input_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -1667,7 +1667,7 @@ subroutine read_input_atm_restart_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT GRID U." call ESMF_FieldScatter(u_input_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -1682,7 +1682,7 @@ subroutine read_input_atm_restart_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT GRID V." call ESMF_FieldScatter(v_input_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -1709,7 +1709,7 @@ subroutine read_input_atm_restart_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT ", trim(tracers_input(i)) call ESMF_FieldScatter(tracers_input_grid(i), data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -1731,13 +1731,13 @@ subroutine read_input_atm_restart_file(localpet) ps_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldGet FOR SURFACE PRESSURE." call ESMF_FieldGet(ps_input_grid, & farrayPtr=psptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldCreate FOR INPUT GRID PRESSURE." @@ -1746,7 +1746,7 @@ subroutine read_input_atm_restart_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldGet FOR PRESSURE." @@ -1754,13 +1754,13 @@ subroutine read_input_atm_restart_file(localpet) computationalLBound=clb, & computationalUBound=cub, & farrayPtr=presptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR DELTA PRESSURE." call ESMF_FieldGet(dpres_input_grid, & farrayPtr=dpresptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) allocate(pres_interface(levp1_input)) @@ -1865,7 +1865,7 @@ subroutine read_input_atm_history_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) enddo @@ -1876,7 +1876,7 @@ subroutine read_input_atm_history_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID DELTA PRESSURE." @@ -1885,7 +1885,7 @@ subroutine read_input_atm_history_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID TEMPERATURE." @@ -1894,7 +1894,7 @@ subroutine read_input_atm_history_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID U." @@ -1903,7 +1903,7 @@ subroutine read_input_atm_history_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID V." @@ -1912,21 +1912,21 @@ subroutine read_input_atm_history_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID SURFACE PRESSURE." ps_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID TERRAIN." terrain_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) if (localpet < num_tiles_input_grid) then @@ -1961,7 +1961,7 @@ subroutine read_input_atm_history_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT GRID VERTICAL VELOCITY." call ESMF_FieldScatter(dzdt_input_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -1979,7 +1979,7 @@ subroutine read_input_atm_history_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT GRID TRACER ", trim(tracers_input(n)) call ESMF_FieldScatter(tracers_input_grid(n), data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -1997,7 +1997,7 @@ subroutine read_input_atm_history_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT GRID TEMPERATURE." call ESMF_FieldScatter(temp_input_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -2013,7 +2013,7 @@ subroutine read_input_atm_history_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT GRID U." call ESMF_FieldScatter(u_input_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -2029,7 +2029,7 @@ subroutine read_input_atm_history_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT GRID V." call ESMF_FieldScatter(v_input_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -2044,7 +2044,7 @@ subroutine read_input_atm_history_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT GRID SURFACE PRESSURE." call ESMF_FieldScatter(ps_input_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -2059,7 +2059,7 @@ subroutine read_input_atm_history_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT GRID TERRAIN." call ESMF_FieldScatter(terrain_input_grid, data_one_tile, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -2075,7 +2075,7 @@ subroutine read_input_atm_history_file(localpet) do tile = 1, num_tiles_input_grid print*,"- CALL FieldScatter FOR INPUT DELTA PRESSURE." call ESMF_FieldScatter(dpres_input_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -2099,7 +2099,7 @@ subroutine read_input_atm_history_file(localpet) staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldGet FOR PRESSURE." @@ -2107,19 +2107,19 @@ subroutine read_input_atm_history_file(localpet) computationalLBound=clb, & computationalUBound=cub, & farrayPtr=presptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR DELTA PRESSURE." call ESMF_FieldGet(dpres_input_grid, & farrayPtr=dpresptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR SURFACE PRESSURE." call ESMF_FieldGet(ps_input_grid, & farrayPtr=psptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) allocate(pres_interface(levp1_input)) @@ -2212,21 +2212,21 @@ subroutine read_input_sfc_gfs_sfcio_file(localpet) print*,"- CALL FieldScatter FOR INPUT LANDSEA MASK." call ESMF_FieldScatter(landsea_mask_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%zorl print*,"- CALL FieldScatter FOR INPUT Z0." call ESMF_FieldScatter(z0_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = nint(sfcdata%vtype) print*,"- CALL FieldScatter FOR INPUT VEG TYPE." call ESMF_FieldScatter(veg_type_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! Prior to July, 2017, gfs used zobler soil types. '13' indicates permanent land ice. @@ -2236,133 +2236,133 @@ subroutine read_input_sfc_gfs_sfcio_file(localpet) print*,"- CALL FieldScatter FOR INPUT CANOPY MC." call ESMF_FieldScatter(canopy_mc_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%fice print*,"- CALL FieldScatter FOR INPUT ICE FRACTION." call ESMF_FieldScatter(seaice_fract_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%hice print*,"- CALL FieldScatter FOR INPUT ICE DEPTH." call ESMF_FieldScatter(seaice_depth_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%tisfc print*,"- CALL FieldScatter FOR INPUT ICE SKIN TEMP." call ESMF_FieldScatter(seaice_skin_temp_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%snwdph ! mm (expected by program) print*,"- CALL FieldScatter FOR INPUT SNOW DEPTH." call ESMF_FieldScatter(snow_depth_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%sheleg print*,"- CALL FieldScatter FOR INPUT SNOW LIQUID EQUIV." call ESMF_FieldScatter(snow_liq_equiv_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%t2m print*,"- CALL FieldScatter FOR INPUT T2M." call ESMF_FieldScatter(t2m_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%q2m print*,"- CALL FieldScatter FOR INPUT Q2M." call ESMF_FieldScatter(q2m_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%tprcp print*,"- CALL FieldScatter FOR INPUT TPRCP." call ESMF_FieldScatter(tprcp_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%f10m print*,"- CALL FieldScatter FOR INPUT F10M." call ESMF_FieldScatter(f10m_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%uustar print*,"- CALL FieldScatter FOR INPUT USTAR." call ESMF_FieldScatter(ustar_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%ffmm print*,"- CALL FieldScatter FOR INPUT FFMM." call ESMF_FieldScatter(ffmm_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%srflag print*,"- CALL FieldScatter FOR INPUT SRFLAG." call ESMF_FieldScatter(srflag_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%tsea print*,"- CALL FieldScatter FOR INPUT SKIN TEMP." call ESMF_FieldScatter(skin_temp_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = nint(sfcdata%stype) print*,"- CALL FieldScatter FOR INPUT SOIL TYPE." call ESMF_FieldScatter(soil_type_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = sfcdata%orog print*,"- CALL FieldScatter FOR INPUT TERRAIN." call ESMF_FieldScatter(terrain_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy3d = sfcdata%slc print*,"- CALL FieldScatter FOR INPUT LIQUID SOIL MOISTURE." call ESMF_FieldScatter(soilm_liq_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy3d = sfcdata%smc print*,"- CALL FieldScatter FOR INPUT TOTAL SOIL MOISTURE." call ESMF_FieldScatter(soilm_tot_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy3d = sfcdata%stc print*,"- CALL FieldScatter FOR INPUT SOIL TEMPERATURE." call ESMF_FieldScatter(soil_temp_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) deallocate(dummy2d, dummy3d) @@ -2418,7 +2418,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT TERRAIN." call ESMF_FieldScatter(terrain_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2431,7 +2431,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT LANDSEA MASK." call ESMF_FieldScatter(landsea_mask_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2444,7 +2444,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SEAICE FRACTION." call ESMF_FieldScatter(seaice_fract_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2457,7 +2457,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SEAICE DEPTH." call ESMF_FieldScatter(seaice_depth_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2470,7 +2470,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SEAICE SKIN TEMPERATURE." call ESMF_FieldScatter(seaice_skin_temp_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2483,7 +2483,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SNOW LIQUID EQUIVALENT." call ESMF_FieldScatter(snow_liq_equiv_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2496,7 +2496,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SNOW DEPTH." call ESMF_FieldScatter(snow_depth_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2509,7 +2509,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID VEG TYPE." call ESMF_FieldScatter(veg_type_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2522,7 +2522,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SOIL TYPE." call ESMF_FieldScatter(soil_type_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2535,7 +2535,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID T2M." call ESMF_FieldScatter(t2m_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2548,7 +2548,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID Q2M." call ESMF_FieldScatter(q2m_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2561,7 +2561,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID TPRCP." call ESMF_FieldScatter(tprcp_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2574,7 +2574,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID FFMM" call ESMF_FieldScatter(ffmm_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2587,13 +2587,13 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID USTAR" call ESMF_FieldScatter(ustar_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = 0.0 print*,"- CALL FieldScatter FOR INPUT GRID SRFLAG" call ESMF_FieldScatter(srflag_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2606,7 +2606,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SKIN TEMPERATURE" call ESMF_FieldScatter(skin_temp_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2619,7 +2619,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID F10M." call ESMF_FieldScatter(f10m_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2632,7 +2632,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID CANOPY MOISTURE CONTENT." call ESMF_FieldScatter(canopy_mc_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2645,7 +2645,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID Z0." call ESMF_FieldScatter(z0_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) deallocate(dummy2d) @@ -2669,7 +2669,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT LIQUID SOIL MOISTURE." call ESMF_FieldScatter(soilm_liq_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2691,7 +2691,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT TOTAL SOIL MOISTURE." call ESMF_FieldScatter(soilm_tot_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2713,7 +2713,7 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT SOIL TEMPERATURE." call ESMF_FieldScatter(soil_temp_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) deallocate(dummy3d, dummy) @@ -2767,7 +2767,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT TERRAIN." call ESMF_FieldScatter(terrain_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2780,7 +2780,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT LANDSEA MASK." call ESMF_FieldScatter(landsea_mask_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2793,7 +2793,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SEAICE FRACTION." call ESMF_FieldScatter(seaice_fract_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2806,7 +2806,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SEAICE DEPTH." call ESMF_FieldScatter(seaice_depth_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2819,7 +2819,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SEAICE SKIN TEMPERATURE." call ESMF_FieldScatter(seaice_skin_temp_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2832,7 +2832,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SNOW LIQUID EQUIVALENT." call ESMF_FieldScatter(snow_liq_equiv_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2845,7 +2845,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SNOW DEPTH." call ESMF_FieldScatter(snow_depth_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2858,7 +2858,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID VEG TYPE." call ESMF_FieldScatter(veg_type_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2871,7 +2871,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SOIL TYPE." call ESMF_FieldScatter(soil_type_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2884,7 +2884,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID T2M." call ESMF_FieldScatter(t2m_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2897,7 +2897,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID Q2M." call ESMF_FieldScatter(q2m_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2910,7 +2910,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID TPRCP." call ESMF_FieldScatter(tprcp_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2923,7 +2923,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID FFMM" call ESMF_FieldScatter(ffmm_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2936,13 +2936,13 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID USTAR" call ESMF_FieldScatter(ustar_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) dummy2d = 0.0 print*,"- CALL FieldScatter FOR INPUT GRID SRFLAG" call ESMF_FieldScatter(srflag_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2955,7 +2955,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SKIN TEMPERATURE" call ESMF_FieldScatter(skin_temp_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2968,7 +2968,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID F10M." call ESMF_FieldScatter(f10m_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2981,7 +2981,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID CANOPY MOISTURE CONTENT." call ESMF_FieldScatter(canopy_mc_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -2994,7 +2994,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID Z0." call ESMF_FieldScatter(z0_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) deallocate(dummy2d) @@ -3018,7 +3018,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT LIQUID SOIL MOISTURE." call ESMF_FieldScatter(soilm_liq_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3040,7 +3040,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT TOTAL SOIL MOISTURE." call ESMF_FieldScatter(soilm_tot_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3062,7 +3062,7 @@ subroutine read_input_sfc_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT SOIL TEMPERATURE." call ESMF_FieldScatter(soil_temp_input_grid, dummy3d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) deallocate(dummy3d, dummy) @@ -3141,7 +3141,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT TERRAIN." call ESMF_FieldScatter(terrain_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo TERRAIN_LOOP @@ -3157,7 +3157,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT LIQUID SOIL MOISTURE." call ESMF_FieldScatter(soilm_liq_input_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3167,7 +3167,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT TOTAL SOIL MOISTURE." call ESMF_FieldScatter(soilm_tot_input_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3177,7 +3177,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT SOIL TEMPERATURE." call ESMF_FieldScatter(soil_temp_input_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! land mask @@ -3189,7 +3189,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT LANDSEA MASK." call ESMF_FieldScatter(landsea_mask_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! sea ice fraction @@ -3201,7 +3201,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SEAICE FRACTION." call ESMF_FieldScatter(seaice_fract_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! sea ice depth @@ -3213,7 +3213,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SEAICE DEPTH." call ESMF_FieldScatter(seaice_depth_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! sea ice skin temperature @@ -3225,7 +3225,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SEAICE SKIN TEMPERATURE." call ESMF_FieldScatter(seaice_skin_temp_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! liquid equivalent snow depth @@ -3237,7 +3237,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SNOW LIQUID EQUIVALENT." call ESMF_FieldScatter(snow_liq_equiv_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! physical snow depth @@ -3250,7 +3250,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SNOW DEPTH." call ESMF_FieldScatter(snow_depth_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! Vegetation type @@ -3262,7 +3262,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID VEG TYPE." call ESMF_FieldScatter(veg_type_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! Soil type @@ -3274,7 +3274,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SOIL TYPE." call ESMF_FieldScatter(soil_type_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! Two-meter temperature @@ -3286,7 +3286,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID T2M." call ESMF_FieldScatter(t2m_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! Two-meter q @@ -3298,7 +3298,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID Q2M." call ESMF_FieldScatter(q2m_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3308,7 +3308,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID TPRCP." call ESMF_FieldScatter(tprcp_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3318,7 +3318,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID F10M" call ESMF_FieldScatter(f10m_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3328,7 +3328,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID FFMM" call ESMF_FieldScatter(ffmm_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3338,7 +3338,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID USTAR" call ESMF_FieldScatter(ustar_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3348,7 +3348,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SRFLAG" call ESMF_FieldScatter(srflag_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3358,7 +3358,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SKIN TEMPERATURE" call ESMF_FieldScatter(skin_temp_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3368,7 +3368,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID CANOPY MOISTURE CONTENT." call ESMF_FieldScatter(canopy_mc_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3378,7 +3378,7 @@ subroutine read_input_sfc_restart_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID Z0." call ESMF_FieldScatter(z0_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo TILE_LOOP @@ -3457,7 +3457,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT TERRAIN." call ESMF_FieldScatter(terrain_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo TERRAIN_LOOP @@ -3483,7 +3483,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT LIQUID SOIL MOISTURE." call ESMF_FieldScatter(soilm_liq_input_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! total soil moisture @@ -3505,7 +3505,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT TOTAL SOIL MOISTURE." call ESMF_FieldScatter(soilm_tot_input_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! soil tempeature (ice temp at land ice points) @@ -3527,7 +3527,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT SOIL TEMPERATURE." call ESMF_FieldScatter(soil_temp_input_grid, data_one_tile_3d, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! land mask @@ -3539,7 +3539,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT LANDSEA MASK." call ESMF_FieldScatter(landsea_mask_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! sea ice fraction @@ -3551,7 +3551,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SEAICE FRACTION." call ESMF_FieldScatter(seaice_fract_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! sea ice depth @@ -3563,7 +3563,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SEAICE DEPTH." call ESMF_FieldScatter(seaice_depth_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! sea ice skin temperature @@ -3575,7 +3575,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SEAICE SKIN TEMPERATURE." call ESMF_FieldScatter(seaice_skin_temp_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! liquid equivalent snow depth @@ -3587,7 +3587,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SNOW LIQUID EQUIVALENT." call ESMF_FieldScatter(snow_liq_equiv_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! physical snow depth @@ -3600,7 +3600,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SNOW DEPTH." call ESMF_FieldScatter(snow_depth_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! Vegetation type @@ -3612,7 +3612,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID VEG TYPE." call ESMF_FieldScatter(veg_type_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! Soil type @@ -3624,7 +3624,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SOIL TYPE." call ESMF_FieldScatter(soil_type_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! Two-meter temperature @@ -3636,7 +3636,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID T2M." call ESMF_FieldScatter(t2m_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! Two-meter q @@ -3648,7 +3648,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID Q2M." call ESMF_FieldScatter(q2m_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3658,7 +3658,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID TPRCP." call ESMF_FieldScatter(tprcp_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3668,7 +3668,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID F10M" call ESMF_FieldScatter(f10m_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3678,7 +3678,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID FFMM" call ESMF_FieldScatter(ffmm_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3688,7 +3688,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID USTAR" call ESMF_FieldScatter(ustar_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3699,7 +3699,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SRFLAG" call ESMF_FieldScatter(srflag_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3709,7 +3709,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID SKIN TEMPERATURE" call ESMF_FieldScatter(skin_temp_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3719,7 +3719,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID CANOPY MOISTURE CONTENT." call ESMF_FieldScatter(canopy_mc_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -3729,7 +3729,7 @@ subroutine read_input_sfc_history_file(localpet) print*,"- CALL FieldScatter FOR INPUT GRID Z0." call ESMF_FieldScatter(z0_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo TILE_LOOP @@ -3776,7 +3776,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT C_D" call ESMF_FieldScatter(c_d_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! c_0 @@ -3793,7 +3793,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT C_0" call ESMF_FieldScatter(c_0_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! d_conv @@ -3810,7 +3810,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT D_CONV." call ESMF_FieldScatter(d_conv_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! dt_cool @@ -3827,7 +3827,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT DT_COOL." call ESMF_FieldScatter(dt_cool_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! ifd - xu li said initialize to '1'. @@ -3838,7 +3838,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT IFD." call ESMF_FieldScatter(ifd_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! qrain @@ -3850,7 +3850,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT QRAIN." call ESMF_FieldScatter(qrain_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! tref @@ -3862,7 +3862,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT TREF" call ESMF_FieldScatter(tref_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! w_d @@ -3879,7 +3879,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT W_D" call ESMF_FieldScatter(w_d_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! w_0 @@ -3896,7 +3896,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT W_0" call ESMF_FieldScatter(w_0_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! xs @@ -3908,7 +3908,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT XS" call ESMF_FieldScatter(xs_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! xt @@ -3920,7 +3920,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT XT" call ESMF_FieldScatter(xt_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! xu @@ -3932,7 +3932,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT XU" call ESMF_FieldScatter(xu_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! xv @@ -3944,7 +3944,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT XV" call ESMF_FieldScatter(xv_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! xz @@ -3956,7 +3956,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT XZ" call ESMF_FieldScatter(xz_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! xtts @@ -3968,7 +3968,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT XTTS" call ESMF_FieldScatter(xtts_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! xzts @@ -3980,7 +3980,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT XZTS" call ESMF_FieldScatter(xzts_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! z_c @@ -3997,7 +3997,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT Z_C" call ESMF_FieldScatter(z_c_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! zm - Not used yet. Xu li said set to '0'. @@ -4008,7 +4008,7 @@ subroutine read_input_nst_tile_file(localpet) print*,"- CALL FieldScatter FOR INPUT ZM" call ESMF_FieldScatter(zm_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo TILE_LOOP @@ -4067,7 +4067,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT TREF." call ESMF_FieldScatter(tref_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4080,7 +4080,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT C_D." call ESMF_FieldScatter(c_d_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4093,7 +4093,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT C_0." call ESMF_FieldScatter(c_0_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4106,7 +4106,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT D_CONV." call ESMF_FieldScatter(d_conv_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4119,7 +4119,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT DT_COOL." call ESMF_FieldScatter(dt_cool_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4128,7 +4128,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT IFD." call ESMF_FieldScatter(ifd_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4141,7 +4141,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT QRAIN." call ESMF_FieldScatter(qrain_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4154,7 +4154,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT WD." call ESMF_FieldScatter(w_d_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4167,7 +4167,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT W0." call ESMF_FieldScatter(w_0_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4180,7 +4180,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT XS." call ESMF_FieldScatter(xs_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4193,7 +4193,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT XT." call ESMF_FieldScatter(xt_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4206,7 +4206,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT XU." call ESMF_FieldScatter(xu_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4219,7 +4219,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT XV." call ESMF_FieldScatter(xv_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4232,7 +4232,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT XZ." call ESMF_FieldScatter(xz_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4245,7 +4245,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT XTTS." call ESMF_FieldScatter(xtts_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4258,7 +4258,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT XZTS." call ESMF_FieldScatter(xzts_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4271,7 +4271,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT Z_C." call ESMF_FieldScatter(z_c_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then @@ -4280,7 +4280,7 @@ subroutine read_input_nst_gaussian_file(localpet) print*,"- CALL FieldScatter FOR INPUT ZM." call ESMF_FieldScatter(zm_input_grid, dummy2d, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) deallocate(dummy, dummy2d) @@ -4351,7 +4351,7 @@ subroutine convert_winds staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1,1/), & ungriddedUBound=(/lev_input,3/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldGet FOR 3-D WIND." @@ -4359,31 +4359,31 @@ subroutine convert_winds computationalLBound=clb, & computationalUBound=cub, & farrayPtr=windptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR U." call ESMF_FieldGet(u_input_grid, & farrayPtr=uptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR V." call ESMF_FieldGet(v_input_grid, & farrayPtr=vptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR LATITUDE." call ESMF_FieldGet(latitude_input_grid, & farrayPtr=latptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR LONGITUDE." call ESMF_FieldGet(longitude_input_grid, & farrayPtr=lonptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do i = clb(1), cub(1) diff --git a/sorc/chgres_cube.fd/model_grid.F90 b/sorc/chgres_cube.fd/model_grid.F90 index 37c8a3072..bcf4e8ace 100644 --- a/sorc/chgres_cube.fd/model_grid.F90 +++ b/sorc/chgres_cube.fd/model_grid.F90 @@ -233,7 +233,7 @@ subroutine define_input_grid_gaussian(localpet, npets) coordSys=ESMF_COORDSYS_SPH_DEG, & regDecomp=(/1,npets/), & indexflag=ESMF_INDEX_GLOBAL, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridCreate1PeriDim", rc) print*,"- CALL FieldCreate FOR INPUT GRID LATITUDE." @@ -241,7 +241,7 @@ subroutine define_input_grid_gaussian(localpet, npets) typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, & name="input_grid_latitude", rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR INPUT GRID LONGITUDE." @@ -249,7 +249,7 @@ subroutine define_input_grid_gaussian(localpet, npets) typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, & name="input_grid_longitude", rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) allocate(longitude(i_input,j_input)) @@ -273,18 +273,18 @@ subroutine define_input_grid_gaussian(localpet, npets) print*,"- CALL FieldScatter FOR INPUT GRID LONGITUDE." call ESMF_FieldScatter(longitude_input_grid, longitude, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldScatter FOR INPUT GRID LATITUDE." call ESMF_FieldScatter(latitude_input_grid, latitude, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL GridAddCoord FOR INPUT GRID." call ESMF_GridAddCoord(input_grid, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridAddCoord", rc) print*,"- CALL GridGetCoord FOR INPUT GRID X-COORD." @@ -293,7 +293,7 @@ subroutine define_input_grid_gaussian(localpet, npets) staggerLoc=ESMF_STAGGERLOC_CENTER, & coordDim=1, & farrayPtr=lon_src_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridGetCoord", rc) print*,"- CALL GridGetCoord FOR INPUT GRID Y-COORD." @@ -304,7 +304,7 @@ subroutine define_input_grid_gaussian(localpet, npets) computationalLBound=clb, & computationalUBound=cub, & farrayPtr=lat_src_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridGetCoord", rc) do j = clb(2), cub(2) @@ -318,7 +318,7 @@ subroutine define_input_grid_gaussian(localpet, npets) print*,"- CALL GridAddCoord FOR INPUT GRID." call ESMF_GridAddCoord(input_grid, & staggerloc=ESMF_STAGGERLOC_CORNER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridAddCoord", rc) print*,"- CALL GridGetCoord FOR INPUT GRID X-COORD." @@ -327,7 +327,7 @@ subroutine define_input_grid_gaussian(localpet, npets) staggerLoc=ESMF_STAGGERLOC_CORNER, & coordDim=1, & farrayPtr=lon_corner_src_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridGetCoord", rc) print*,"- CALL GridGetCoord FOR INPUT GRID Y-COORD." @@ -338,7 +338,7 @@ subroutine define_input_grid_gaussian(localpet, npets) computationalLBound=clb, & computationalUBound=cub, & farrayPtr=lat_corner_src_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridGetCoord", rc) print*,'bounds for corners ',localpet,clb(1),cub(1),clb(2),cub(2) @@ -427,7 +427,7 @@ subroutine define_input_grid_mosaic(localpet, npets) indexflag=ESMF_INDEX_GLOBAL, & tileFilePath=trim(orog_dir_input_grid), & rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridCreateMosaic", error) !----------------------------------------------------------------------- @@ -440,7 +440,7 @@ subroutine define_input_grid_mosaic(localpet, npets) staggerloc=ESMF_STAGGERLOC_CENTER, & name="input_grid_latitude", & rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR INPUT GRID LONGITUDE." @@ -449,7 +449,7 @@ subroutine define_input_grid_mosaic(localpet, npets) staggerloc=ESMF_STAGGERLOC_CENTER, & name="input_grid_longitude", & rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR INPUT GRID LATITUDE_S." @@ -458,7 +458,7 @@ subroutine define_input_grid_mosaic(localpet, npets) staggerloc=ESMF_STAGGERLOC_EDGE2, & name="input_grid_latitude_s", & rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR INPUT GRID LONGITUDE_S." @@ -467,7 +467,7 @@ subroutine define_input_grid_mosaic(localpet, npets) staggerloc=ESMF_STAGGERLOC_EDGE2, & name="input_grid_longitude_s", & rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR INPUT GRID LATITUDE_W." @@ -476,7 +476,7 @@ subroutine define_input_grid_mosaic(localpet, npets) staggerloc=ESMF_STAGGERLOC_EDGE1, & name="input_grid_latitude_w", & rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR INPUT GRID LONGITUDE_W." @@ -485,7 +485,7 @@ subroutine define_input_grid_mosaic(localpet, npets) staggerloc=ESMF_STAGGERLOC_EDGE1, & name="input_grid_longitude_w", & rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) the_file = trim(orog_dir_input_grid) // trim(orog_files_input_grid(1)) @@ -536,27 +536,27 @@ subroutine define_input_grid_mosaic(localpet, npets) endif print*,"- CALL FieldScatter FOR INPUT GRID LATITUDE. TILE IS: ", tile call ESMF_FieldScatter(latitude_input_grid, latitude_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR INPUT GRID LONGITUDE. TILE IS: ", tile call ESMF_FieldScatter(longitude_input_grid, longitude_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR INPUT GRID LATITUDE_S. TILE IS: ", tile call ESMF_FieldScatter(latitude_s_input_grid, latitude_s_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR INPUT GRID LONGITUDE_S. TILE IS: ", tile call ESMF_FieldScatter(longitude_s_input_grid, longitude_s_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR INPUT GRID LATITUDE_W. TILE IS: ", tile call ESMF_FieldScatter(latitude_w_input_grid, latitude_w_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR INPUT GRID LONGITUDE_W. TILE IS: ", tile call ESMF_FieldScatter(longitude_w_input_grid, longitude_w_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) enddo @@ -668,7 +668,7 @@ subroutine define_target_grid(localpet, npets) ESMF_STAGGERLOC_EDGE1, ESMF_STAGGERLOC_EDGE2/), & indexflag=ESMF_INDEX_GLOBAL, & tileFilePath=trim(orog_dir_target_grid), rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridCreateMosaic", error) !----------------------------------------------------------------------- @@ -681,7 +681,7 @@ subroutine define_target_grid(localpet, npets) typekind=ESMF_TYPEKIND_I8, & staggerloc=ESMF_STAGGERLOC_CENTER, & name="target_grid_landmask", rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR TARGET GRID SEAMASK." @@ -689,7 +689,7 @@ subroutine define_target_grid(localpet, npets) typekind=ESMF_TYPEKIND_I8, & staggerloc=ESMF_STAGGERLOC_CENTER, & name="target_grid_seamask", rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR TARGET GRID LATITUDE." @@ -697,7 +697,7 @@ subroutine define_target_grid(localpet, npets) typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, & name="target_grid_latitude", rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR TARGET GRID LATITUDE_S." @@ -705,7 +705,7 @@ subroutine define_target_grid(localpet, npets) typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_EDGE2, & name="target_grid_latitude_s", rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR TARGET GRID LATITUDE_W." @@ -714,7 +714,7 @@ subroutine define_target_grid(localpet, npets) staggerloc=ESMF_STAGGERLOC_EDGE1, & name="target_grid_latitude_w", & rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR TARGET GRID LONGITUDE." @@ -723,7 +723,7 @@ subroutine define_target_grid(localpet, npets) staggerloc=ESMF_STAGGERLOC_CENTER, & name="target_grid_longitude", & rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR TARGET GRID LONGITUDE_S." @@ -732,7 +732,7 @@ subroutine define_target_grid(localpet, npets) staggerloc=ESMF_STAGGERLOC_EDGE2, & name="target_grid_longitude_s", & rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR TARGET GRID LONGITUDE_W." @@ -741,7 +741,7 @@ subroutine define_target_grid(localpet, npets) staggerloc=ESMF_STAGGERLOC_EDGE1, & name="target_grid_longitude_w", & rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR TARGET GRID TERRAIN." @@ -750,7 +750,7 @@ subroutine define_target_grid(localpet, npets) staggerloc=ESMF_STAGGERLOC_CENTER, & name="target_grid_terrain", & rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) if (localpet == 0) then @@ -789,39 +789,39 @@ subroutine define_target_grid(localpet, npets) endif print*,"- CALL FieldScatter FOR TARGET GRID LANDMASK. TILE IS: ", tile call ESMF_FieldScatter(landmask_target_grid, landmask_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR TARGET GRID SEAMASK. TILE IS: ", tile call ESMF_FieldScatter(seamask_target_grid, seamask_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR TARGET GRID LONGITUDE. TILE IS: ", tile call ESMF_FieldScatter(longitude_target_grid, longitude_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR TARGET GRID LONGITUDE_S. TILE IS: ", tile call ESMF_FieldScatter(longitude_s_target_grid, longitude_s_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR TARGET GRID LONGITUDE_W. TILE IS: ", tile call ESMF_FieldScatter(longitude_w_target_grid, longitude_w_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR TARGET GRID LATITUDE. TILE IS: ", tile call ESMF_FieldScatter(latitude_target_grid, latitude_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR TARGET GRID LATITUDE_S. TILE IS: ", tile call ESMF_FieldScatter(latitude_s_target_grid, latitude_s_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR TARGET GRID LATITUDE_W. TILE IS: ", tile call ESMF_FieldScatter(latitude_w_target_grid, latitude_w_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR TARGET GRID TERRAIN. TILE IS: ", tile call ESMF_FieldScatter(terrain_target_grid, terrain_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) enddo diff --git a/sorc/chgres_cube.fd/static_data.F90 b/sorc/chgres_cube.fd/static_data.F90 index 9d6f7fc75..3bd297475 100644 --- a/sorc/chgres_cube.fd/static_data.F90 +++ b/sorc/chgres_cube.fd/static_data.F90 @@ -95,7 +95,7 @@ subroutine get_static_fields(localpet) slope_type_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) do tile = 1, num_tiles_target_grid @@ -104,7 +104,7 @@ subroutine get_static_fields(localpet) endif print*,"- CALL FieldScatter FOR TARGET GRID SLOPE TYPE." call ESMF_FieldScatter(slope_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) enddo @@ -116,7 +116,7 @@ subroutine get_static_fields(localpet) mxsno_albedo_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) do tile = 1, num_tiles_target_grid @@ -125,7 +125,7 @@ subroutine get_static_fields(localpet) endif print*,"- CALL FieldScatter FOR TARGET GRID MAXIMUM SNOW ALBEDO." call ESMF_FieldScatter(mxsno_albedo_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) enddo @@ -137,7 +137,7 @@ subroutine get_static_fields(localpet) soil_type_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) do tile = 1, num_tiles_target_grid @@ -146,7 +146,7 @@ subroutine get_static_fields(localpet) endif print*,"- CALL FieldScatter FOR TARGET GRID SOIL TYPE." call ESMF_FieldScatter(soil_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) enddo @@ -158,7 +158,7 @@ subroutine get_static_fields(localpet) veg_type_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) do tile = 1, num_tiles_target_grid @@ -167,7 +167,7 @@ subroutine get_static_fields(localpet) endif print*,"- CALL FieldScatter FOR TARGET GRID VEGETATION TYPE." call ESMF_FieldScatter(veg_type_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) enddo @@ -179,21 +179,21 @@ subroutine get_static_fields(localpet) veg_greenness_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR TARGET GRID MAXIMUM VEGETATION GREENNESS." max_veg_greenness_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR TARGET GRID MINIMUM VEGETATION GREENNESS." min_veg_greenness_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) if (localpet == 0) then @@ -211,15 +211,15 @@ subroutine get_static_fields(localpet) endif print*,"- CALL FieldScatter FOR TARGET GRID VEGETATION GREENNESS." call ESMF_FieldScatter(veg_greenness_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR TARGET GRID MAXIMUM VEGETATION GREENNESS." call ESMF_FieldScatter(max_veg_greenness_target_grid, max_data_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) print*,"- CALL FieldScatter FOR TARGET GRID MINIMUM VEGETATION GREENNESS." call ESMF_FieldScatter(min_veg_greenness_target_grid, min_data_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) enddo @@ -233,7 +233,7 @@ subroutine get_static_fields(localpet) substrate_temp_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) do tile = 1, num_tiles_target_grid @@ -242,7 +242,7 @@ subroutine get_static_fields(localpet) endif print*,"- CALL FieldScatter FOR TARGET GRID SUBSTRATE TEMPERATURE." call ESMF_FieldScatter(substrate_temp_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) enddo @@ -254,7 +254,7 @@ subroutine get_static_fields(localpet) alvsf_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) do tile = 1, num_tiles_target_grid @@ -263,7 +263,7 @@ subroutine get_static_fields(localpet) endif print*,"- CALL FieldScatter FOR TARGET GRID ALVSF." call ESMF_FieldScatter(alvsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) enddo @@ -271,7 +271,7 @@ subroutine get_static_fields(localpet) alvwf_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) do tile = 1, num_tiles_target_grid @@ -280,7 +280,7 @@ subroutine get_static_fields(localpet) endif print*,"- CALL FieldScatter FOR TARGET GRID ALVWF." call ESMF_FieldScatter(alvwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) enddo @@ -288,7 +288,7 @@ subroutine get_static_fields(localpet) alnsf_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) do tile = 1, num_tiles_target_grid @@ -297,7 +297,7 @@ subroutine get_static_fields(localpet) endif print*,"- CALL FieldScatter FOR TARGET GRID ALNSF." call ESMF_FieldScatter(alnsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) enddo @@ -305,7 +305,7 @@ subroutine get_static_fields(localpet) alnwf_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) do tile = 1, num_tiles_target_grid @@ -314,7 +314,7 @@ subroutine get_static_fields(localpet) endif print*,"- CALL FieldScatter FOR TARGET GRID ALNWF." call ESMF_FieldScatter(alnwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) enddo @@ -326,14 +326,14 @@ subroutine get_static_fields(localpet) facsf_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) print*,"- CALL FieldCreate FOR TARGET GRID FACWF." facwf_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", error) do tile = 1, num_tiles_target_grid @@ -342,7 +342,7 @@ subroutine get_static_fields(localpet) endif print*,"- CALL FieldScatter FOR TARGET GRID FACSF." call ESMF_FieldScatter(facsf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) if (localpet == 0) then do j = 1, j_target @@ -354,7 +354,7 @@ subroutine get_static_fields(localpet) enddo endif call ESMF_FieldScatter(facwf_target_grid, data_one_tile, rootpet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", error) enddo diff --git a/sorc/chgres_cube.fd/surface.F90 b/sorc/chgres_cube.fd/surface.F90 index 3ac79c632..d566e2bc9 100644 --- a/sorc/chgres_cube.fd/surface.F90 +++ b/sorc/chgres_cube.fd/surface.F90 @@ -380,7 +380,7 @@ subroutine interp(localpet) srctermprocessing=isrctermprocessing, & routehandle=regrid_bl_no_mask, & regridmethod=method, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridStore", rc) print*,"- CALL Field_Regrid T2M." @@ -388,7 +388,7 @@ subroutine interp(localpet) t2m_target_grid, & routehandle=regrid_bl_no_mask, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid Q2M." @@ -396,7 +396,7 @@ subroutine interp(localpet) q2m_target_grid, & routehandle=regrid_bl_no_mask, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid TPRCP." @@ -404,7 +404,7 @@ subroutine interp(localpet) tprcp_target_grid, & routehandle=regrid_bl_no_mask, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid F10M." @@ -412,7 +412,7 @@ subroutine interp(localpet) f10m_target_grid, & routehandle=regrid_bl_no_mask, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid FFMM." @@ -420,7 +420,7 @@ subroutine interp(localpet) ffmm_target_grid, & routehandle=regrid_bl_no_mask, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid USTAR." @@ -428,7 +428,7 @@ subroutine interp(localpet) ustar_target_grid, & routehandle=regrid_bl_no_mask, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid SRFLAG." @@ -436,13 +436,13 @@ subroutine interp(localpet) srflag_target_grid, & routehandle=regrid_bl_no_mask, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL FieldGet FOR SRFLAG." call ESMF_FieldGet(srflag_target_grid, & farrayPtr=srflag_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) !----------------------------------------------------------------------- @@ -454,7 +454,7 @@ subroutine interp(localpet) print*,"- CALL FieldRegridRelease." call ESMF_FieldRegridRelease(routehandle=regrid_bl_no_mask, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridRelease", rc) !----------------------------------------------------------------------- @@ -467,14 +467,14 @@ subroutine interp(localpet) call ESMF_GridAddItem(target_grid, & itemflag=ESMF_GRIDITEM_MASK, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridAddItem", rc) print*,"- CALL GridGetItem FOR TARGET GRID." call ESMF_GridGetItem(target_grid, & itemflag=ESMF_GRIDITEM_MASK, & farrayPtr=mask_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridGetItem", rc) print*,"- CALL FieldGet FOR TARGET GRID SEAMASK." @@ -482,7 +482,7 @@ subroutine interp(localpet) computationalLBound=clb_target, & computationalUBound=cub_target, & farrayPtr=seamask_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) mask_target_ptr = seamask_target_ptr @@ -491,20 +491,20 @@ subroutine interp(localpet) call ESMF_GridAddItem(input_grid, & itemflag=ESMF_GRIDITEM_MASK, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridAddItem", rc) print*,"- CALL FieldGet FOR INPUT GRID LANDMASK." call ESMF_FieldGet(landsea_mask_input_grid, & farrayPtr=landmask_input_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL GridGetItem FOR INPUT GRID LANDMASK." call ESMF_GridGetItem(input_grid, & itemflag=ESMF_GRIDITEM_MASK, & farrayPtr=mask_input_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridGetItem", rc) mask_input_ptr = 1 @@ -530,7 +530,7 @@ subroutine interp(localpet) routehandle=regrid_nonland, & regridmethod=method, & unmappedDstList=unmapped_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridStore", rc) print*,"- CALL Field_Regrid for sea ice fraction." @@ -538,7 +538,7 @@ subroutine interp(localpet) seaice_fract_target_grid, & routehandle=regrid_nonland, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) if (localpet == 0) then @@ -554,7 +554,7 @@ subroutine interp(localpet) print*,"- CALL FieldGet FOR TARGET grid sea ice fraction." call ESMF_FieldGet(seaice_fract_target_grid, & farrayPtr=seaice_fract_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) l = lbound(unmapped_ptr) @@ -577,17 +577,17 @@ subroutine interp(localpet) print*,"- CALL FieldGather FOR TARGET GRID SEAICE FRACTION TILE: ", tile call ESMF_FieldGather(seaice_fract_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) print*,"- CALL FieldGather FOR TARGET GRID MASK TILE: ", tile call ESMF_FieldGather(seamask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) print*,"- CALL FieldGather FOR TARGET LATITUDE TILE: ", tile call ESMF_FieldGather(latitude_target_grid, latitude_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -597,7 +597,7 @@ subroutine interp(localpet) print*,"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile call ESMF_FieldGather(landmask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -614,12 +614,12 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID SEAICE FRACTION TILE: ", tile call ESMF_FieldScatter(seaice_fract_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldScatter FOR TARGET LANDMASK TILE: ", tile call ESMF_FieldScatter(landmask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -628,7 +628,7 @@ subroutine interp(localpet) print*,"- CALL FieldRegridRelease." call ESMF_FieldRegridRelease(routehandle=regrid_nonland, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridRelease", rc) !--------------------------------------------------------------------------------------------- @@ -642,7 +642,7 @@ subroutine interp(localpet) print*,"- CALL FieldGet FOR TARGET land sea mask." call ESMF_FieldGet(landmask_target_grid, & farrayPtr=landmask_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) mask_target_ptr = 0 @@ -667,7 +667,7 @@ subroutine interp(localpet) routehandle=regrid_seaice, & regridmethod=method, & unmappedDstList=unmapped_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridStore", rc) print*,"- CALL Field_Regrid for soil temperature over seaice." @@ -675,13 +675,13 @@ subroutine interp(localpet) soil_temp_target_grid, & routehandle=regrid_seaice, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL FieldGet FOR TARGET grid soil temperature over seaice." call ESMF_FieldGet(soil_temp_target_grid, & farrayPtr=soil_temp_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL Field_Regrid for sea ice depth." @@ -689,13 +689,13 @@ subroutine interp(localpet) seaice_depth_target_grid, & routehandle=regrid_seaice, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL FieldGet FOR TARGET grid sea ice depth." call ESMF_FieldGet(seaice_depth_target_grid, & farrayPtr=seaice_depth_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL Field_Regrid for snow depth." @@ -703,13 +703,13 @@ subroutine interp(localpet) snow_depth_target_grid, & routehandle=regrid_seaice, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL FieldGet FOR TARGET grid snow depth." call ESMF_FieldGet(snow_depth_target_grid, & farrayPtr=snow_depth_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL Field_Regrid for snow liq equiv." @@ -717,13 +717,13 @@ subroutine interp(localpet) snow_liq_equiv_target_grid, & routehandle=regrid_seaice, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL FieldGet FOR TARGET grid snow liq equiv." call ESMF_FieldGet(snow_liq_equiv_target_grid, & farrayPtr=snow_liq_equiv_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL Field_Regrid for sea ice skin temp." @@ -731,13 +731,13 @@ subroutine interp(localpet) seaice_skin_temp_target_grid, & routehandle=regrid_seaice, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL FieldGet FOR TARGET grid sea ice skin temp." call ESMF_FieldGet(seaice_skin_temp_target_grid, & farrayPtr=seaice_skin_temp_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) l = lbound(unmapped_ptr) @@ -756,12 +756,12 @@ subroutine interp(localpet) print*,"- CALL FieldGather FOR TARGET GRID SEAICE DEPTH TILE: ", tile call ESMF_FieldGather(seaice_depth_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) print*,"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile call ESMF_FieldGather(landmask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -772,12 +772,12 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID SEAICE DEPTH TILE: ", tile call ESMF_FieldScatter(seaice_depth_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldGather FOR TARGET GRID SNOW DEPTH TILE: ", tile call ESMF_FieldGather(snow_depth_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -786,12 +786,12 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID SNOW DEPTH TILE: ", tile call ESMF_FieldScatter(snow_depth_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldGather FOR TARGET GRID SNOW LIQ EQUIV TILE: ", tile call ESMF_FieldGather(snow_liq_equiv_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -800,12 +800,12 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID SNOW LIQ EQUIV TILE: ", tile call ESMF_FieldScatter(snow_liq_equiv_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldGather FOR TARGET GRID SEAICE SKIN TEMP: ", tile call ESMF_FieldGather(seaice_skin_temp_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -814,12 +814,12 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID SEAICE SKIN TEMP: ", tile call ESMF_FieldScatter(seaice_skin_temp_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldGather FOR TARGET GRID SEAICE COLUMN TEMP: ", tile call ESMF_FieldGather(soil_temp_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -832,14 +832,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID SEAICE COLUMN TEMP: ", tile call ESMF_FieldScatter(soil_temp_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo print*,"- CALL FieldRegridRelease." call ESMF_FieldRegridRelease(routehandle=regrid_seaice, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridRelease", rc) !--------------------------------------------------------------------------------------------- @@ -867,7 +867,7 @@ subroutine interp(localpet) routehandle=regrid_water, & regridmethod=method, & unmappedDstList=unmapped_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridStore", rc) print*,"- CALL Field_Regrid for skin temperature over water." @@ -875,13 +875,13 @@ subroutine interp(localpet) skin_temp_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL FieldGet FOR TARGET skin temperature." call ESMF_FieldGet(skin_temp_target_grid, & farrayPtr=skin_temp_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL Field_Regrid for z0 over water." @@ -889,13 +889,13 @@ subroutine interp(localpet) z0_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL FieldGet FOR TARGET z0." call ESMF_FieldGet(z0_target_grid, & farrayPtr=z0_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) l = lbound(unmapped_ptr) @@ -914,7 +914,7 @@ subroutine interp(localpet) c_d_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for c_0 over water." @@ -922,7 +922,7 @@ subroutine interp(localpet) c_0_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for d_conv over water." @@ -930,7 +930,7 @@ subroutine interp(localpet) d_conv_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for dt_cool over water." @@ -938,7 +938,7 @@ subroutine interp(localpet) dt_cool_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for ifd over water." @@ -946,7 +946,7 @@ subroutine interp(localpet) ifd_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for qrain over water." @@ -954,7 +954,7 @@ subroutine interp(localpet) qrain_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for tref over water." @@ -962,7 +962,7 @@ subroutine interp(localpet) tref_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for w_d over water." @@ -970,7 +970,7 @@ subroutine interp(localpet) w_d_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for w_0 over water." @@ -978,7 +978,7 @@ subroutine interp(localpet) w_0_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for xs over water." @@ -986,7 +986,7 @@ subroutine interp(localpet) xs_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for xt over water." @@ -994,7 +994,7 @@ subroutine interp(localpet) xt_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for xu over water." @@ -1002,7 +1002,7 @@ subroutine interp(localpet) xu_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for xv over water." @@ -1010,7 +1010,7 @@ subroutine interp(localpet) xv_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for xz over water." @@ -1018,7 +1018,7 @@ subroutine interp(localpet) xz_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for xtts over water." @@ -1026,7 +1026,7 @@ subroutine interp(localpet) xtts_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for xzts over water." @@ -1034,7 +1034,7 @@ subroutine interp(localpet) xzts_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for z_c over water." @@ -1042,7 +1042,7 @@ subroutine interp(localpet) z_c_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for zm over water." @@ -1050,7 +1050,7 @@ subroutine interp(localpet) zm_target_grid, & routehandle=regrid_water, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) ! Tag unmapped points @@ -1058,31 +1058,31 @@ subroutine interp(localpet) print*,"- CALL FieldGet FOR TARGET c_d." call ESMF_FieldGet(c_d_target_grid, & farrayPtr=c_d_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET c_0." call ESMF_FieldGet(c_0_target_grid, & farrayPtr=c_0_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET d_conv." call ESMF_FieldGet(d_conv_target_grid, & farrayPtr=d_conv_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET dt_cool." call ESMF_FieldGet(dt_cool_target_grid, & farrayPtr=dt_cool_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET ifd." call ESMF_FieldGet(ifd_target_grid, & farrayPtr=ifd_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) ifd_target_ptr = float(nint(ifd_target_ptr)) @@ -1090,79 +1090,79 @@ subroutine interp(localpet) print*,"- CALL FieldGet FOR TARGET qrain." call ESMF_FieldGet(qrain_target_grid, & farrayPtr=qrain_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET tref." call ESMF_FieldGet(tref_target_grid, & farrayPtr=tref_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET w_d." call ESMF_FieldGet(w_d_target_grid, & farrayPtr=w_d_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET w_0." call ESMF_FieldGet(w_0_target_grid, & farrayPtr=w_0_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET xs." call ESMF_FieldGet(xs_target_grid, & farrayPtr=xs_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET xt." call ESMF_FieldGet(xt_target_grid, & farrayPtr=xt_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET xu." call ESMF_FieldGet(xu_target_grid, & farrayPtr=xu_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET xv." call ESMF_FieldGet(xv_target_grid, & farrayPtr=xv_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET xz." call ESMF_FieldGet(xz_target_grid, & farrayPtr=xz_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET xtts." call ESMF_FieldGet(xtts_target_grid, & farrayPtr=xtts_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET xzts." call ESMF_FieldGet(xzts_target_grid, & farrayPtr=xzts_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET z_c." call ESMF_FieldGet(z_c_target_grid, & farrayPtr=z_c_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET zm." call ESMF_FieldGet(zm_target_grid, & farrayPtr=zm_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do ij = l(1), u(1) @@ -1201,17 +1201,17 @@ subroutine interp(localpet) print*,"- CALL FieldGather FOR TARGET GRID SKIN TEMPERATURE TILE: ", tile call ESMF_FieldGather(skin_temp_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) print*,"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile call ESMF_FieldGather(landmask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) print*,"- CALL FieldGather FOR TARGET LATITUDE TILE: ", tile call ESMF_FieldGather(latitude_target_grid, latitude_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1224,14 +1224,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID SKIN TEMP: ", tile call ESMF_FieldScatter(skin_temp_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! z0 print*,"- CALL FieldGather FOR TARGET GRID Z0 TILE: ", tile call ESMF_FieldGather(z0_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1240,7 +1240,7 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID Z0: ", tile call ESMF_FieldScatter(z0_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (convert_nst) then @@ -1249,7 +1249,7 @@ subroutine interp(localpet) print*,"- CALL FieldGather FOR TARGET GRID C_D TILE: ", tile call ESMF_FieldGather(c_d_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1258,14 +1258,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID C_D: ", tile call ESMF_FieldScatter(c_d_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! c_0 print*,"- CALL FieldGather FOR TARGET GRID C_0 TILE: ", tile call ESMF_FieldGather(c_0_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1274,14 +1274,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID C_0: ", tile call ESMF_FieldScatter(c_0_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! d_conv print*,"- CALL FieldGather FOR TARGET GRID D_CONV TILE: ", tile call ESMF_FieldGather(d_conv_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1290,14 +1290,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID D_CONV: ", tile call ESMF_FieldScatter(d_conv_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! dt_cool print*,"- CALL FieldGather FOR TARGET GRID DT_COOL TILE: ", tile call ESMF_FieldGather(dt_cool_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1306,14 +1306,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID DT_COOL: ", tile call ESMF_FieldScatter(dt_cool_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! ifd print*,"- CALL FieldGather FOR TARGET GRID IFD TILE: ", tile call ESMF_FieldGather(ifd_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1322,14 +1322,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID IFD: ", tile call ESMF_FieldScatter(ifd_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! qrain print*,"- CALL FieldGather FOR TARGET GRID QRAIN TILE: ", tile call ESMF_FieldGather(qrain_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1338,14 +1338,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID QRAIN: ", tile call ESMF_FieldScatter(qrain_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! tref print*,"- CALL FieldGather FOR TARGET GRID TREF TILE: ", tile call ESMF_FieldGather(tref_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1355,14 +1355,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID TREF: ", tile call ESMF_FieldScatter(tref_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! w_d print*,"- CALL FieldGather FOR TARGET GRID W_D TILE: ", tile call ESMF_FieldGather(w_d_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1371,14 +1371,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID W_D: ", tile call ESMF_FieldScatter(w_d_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! w_0 print*,"- CALL FieldGather FOR TARGET GRID W_0 TILE: ", tile call ESMF_FieldGather(w_0_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1387,14 +1387,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID W_0: ", tile call ESMF_FieldScatter(w_0_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! xs print*,"- CALL FieldGather FOR TARGET GRID XS TILE: ", tile call ESMF_FieldGather(xs_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1403,14 +1403,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID XS: ", tile call ESMF_FieldScatter(xs_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! xt print*,"- CALL FieldGather FOR TARGET GRID XT TILE: ", tile call ESMF_FieldGather(xt_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1419,14 +1419,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID XT: ", tile call ESMF_FieldScatter(xt_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! xu print*,"- CALL FieldGather FOR TARGET GRID XU TILE: ", tile call ESMF_FieldGather(xu_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1435,14 +1435,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID XU: ", tile call ESMF_FieldScatter(xu_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! xv print*,"- CALL FieldGather FOR TARGET GRID XV TILE: ", tile call ESMF_FieldGather(xv_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1451,14 +1451,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID XV: ", tile call ESMF_FieldScatter(xv_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! xz print*,"- CALL FieldGather FOR TARGET GRID XZ TILE: ", tile call ESMF_FieldGather(xz_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1467,14 +1467,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID XZ: ", tile call ESMF_FieldScatter(xz_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! xtts print*,"- CALL FieldGather FOR TARGET GRID XTTS TILE: ", tile call ESMF_FieldGather(xtts_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1483,14 +1483,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID XTTS: ", tile call ESMF_FieldScatter(xtts_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! xzts print*,"- CALL FieldGather FOR TARGET GRID XZTS TILE: ", tile call ESMF_FieldGather(xzts_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1499,14 +1499,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID XZTS: ", tile call ESMF_FieldScatter(xzts_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! z_c print*,"- CALL FieldGather FOR TARGET GRID Z_C TILE: ", tile call ESMF_FieldGather(z_c_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1515,14 +1515,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID Z_C: ", tile call ESMF_FieldScatter(z_c_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) ! zm print*,"- CALL FieldGather FOR TARGET GRID ZM TILE: ", tile call ESMF_FieldGather(zm_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1531,7 +1531,7 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID ZM: ", tile call ESMF_FieldScatter(zm_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) endif @@ -1544,7 +1544,7 @@ subroutine interp(localpet) print*,"- CALL FieldRegridRelease." call ESMF_FieldRegridRelease(routehandle=regrid_water, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridRelease", rc) !--------------------------------------------------------------------------------------------- @@ -1572,7 +1572,7 @@ subroutine interp(localpet) routehandle=regrid_all_land, & regridmethod=method, & unmappedDstList=unmapped_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridStore", rc) print*,"- CALL Field_Regrid for snow depth over land." @@ -1583,7 +1583,7 @@ subroutine interp(localpet) zeroregion=ESMF_REGION_SELECT, & ! flag needed so snow over sea ! ice is not zeroed out. rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for snow liq equiv over land." @@ -1592,7 +1592,7 @@ subroutine interp(localpet) routehandle=regrid_all_land, & termorderflag=ESMF_TERMORDER_SRCSEQ, & zeroregion=ESMF_REGION_SELECT, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for canopy mc." @@ -1600,25 +1600,25 @@ subroutine interp(localpet) canopy_mc_target_grid, & routehandle=regrid_all_land, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL FieldGet FOR TARGET snow depth." call ESMF_FieldGet(snow_depth_target_grid, & farrayPtr=snow_depth_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET snow liq equiv." call ESMF_FieldGet(snow_liq_equiv_target_grid, & farrayPtr=snow_liq_equiv_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET canopy moisture." call ESMF_FieldGet(canopy_mc_target_grid, & farrayPtr=canopy_mc_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) l = lbound(unmapped_ptr) @@ -1635,12 +1635,12 @@ subroutine interp(localpet) print*,"- CALL FieldGather FOR TARGET GRID SNOW DEPTH TILE: ", tile call ESMF_FieldGather(snow_depth_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) print*,"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile call ESMF_FieldGather(landmask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1652,12 +1652,12 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID SNOW DEPTH: ", tile call ESMF_FieldScatter(snow_depth_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldGather FOR TARGET GRID SNOW LIQUID EQUIV: ", tile call ESMF_FieldGather(snow_liq_equiv_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1666,12 +1666,12 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID SNOW LIQUID EQUIV: ", tile call ESMF_FieldScatter(snow_liq_equiv_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldGather FOR TARGET GRID CANOPY MC: ", tile call ESMF_FieldGather(canopy_mc_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1681,14 +1681,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID CANOPY MC: ", tile call ESMF_FieldScatter(canopy_mc_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo print*,"- CALL FieldRegridRelease." call ESMF_FieldRegridRelease(routehandle=regrid_all_land, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridRelease", rc) !--------------------------------------------------------------------------------------------- @@ -1698,7 +1698,7 @@ subroutine interp(localpet) print*,"- CALL FieldGet FOR INPUT GRID VEG TYPE." call ESMF_FieldGet(veg_type_input_grid, & farrayPtr=veg_type_input_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,'land ice check ',veg_type_landice_input @@ -1709,7 +1709,7 @@ subroutine interp(localpet) print*,"- CALL FieldGet FOR TARGET GRID VEG TYPE." call ESMF_FieldGet(veg_type_target_grid, & farrayPtr=veg_type_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) mask_target_ptr = 0 @@ -1730,7 +1730,7 @@ subroutine interp(localpet) routehandle=regrid_landice, & regridmethod=method, & unmappedDstList=unmapped_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridStore", rc) print*,"- CALL Field_Regrid for soil temperature over landice." @@ -1739,7 +1739,7 @@ subroutine interp(localpet) routehandle=regrid_landice, & termorderflag=ESMF_TERMORDER_SRCSEQ, & zeroregion=ESMF_REGION_SELECT, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for skin temperature over landice." @@ -1748,7 +1748,7 @@ subroutine interp(localpet) routehandle=regrid_landice, & termorderflag=ESMF_TERMORDER_SRCSEQ, & zeroregion=ESMF_REGION_SELECT, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for terrain over landice." @@ -1757,25 +1757,25 @@ subroutine interp(localpet) routehandle=regrid_landice, & termorderflag=ESMF_TERMORDER_SRCSEQ, & zeroregion=ESMF_REGION_SELECT, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL FieldGet FOR TARGET grid column temperature over landice." call ESMF_FieldGet(soil_temp_target_grid, & farrayPtr=soil_temp_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET skin temperature." call ESMF_FieldGet(skin_temp_target_grid, & farrayPtr=skin_temp_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR terrain from input grid." call ESMF_FieldGet(terrain_from_input_grid, & farrayPtr=terrain_from_input_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) l = lbound(unmapped_ptr) @@ -1800,12 +1800,12 @@ subroutine interp(localpet) print*,"- CALL FieldGather FOR TARGET GRID SKIN TEMP TILE: ", tile call ESMF_FieldGather(skin_temp_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) print*,"- CALL FieldGather FOR TARGET VEG TYPE TILE: ", tile call ESMF_FieldGather(veg_type_target_grid, veg_type_target_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1816,12 +1816,12 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID SKIN TEMP, TILE: ", tile call ESMF_FieldScatter(skin_temp_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldGather FOR TERRAIN FROM INPUT GRID, TILE: ", tile call ESMF_FieldGather(terrain_from_input_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1830,12 +1830,12 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TERRAIN FROM INPUT GRID, TILE: ", tile call ESMF_FieldScatter(terrain_from_input_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldGather FOR TARGET GRID LANDICE COLUMN TEMP: ", tile call ESMF_FieldGather(soil_temp_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -1848,7 +1848,7 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID SEAICE COLUMN TEMP: ", tile call ESMF_FieldScatter(soil_temp_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -1858,7 +1858,7 @@ subroutine interp(localpet) print*,"- CALL FieldRegridRelease." call ESMF_FieldRegridRelease(routehandle=regrid_landice, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridRelease", rc) !--------------------------------------------------------------------------------------------- @@ -1888,7 +1888,7 @@ subroutine interp(localpet) routehandle=regrid_land, & regridmethod=method, & unmappedDstList=unmapped_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridStore", rc) print*,"- CALL Field_Regrid for total soil moisture over land." @@ -1896,7 +1896,7 @@ subroutine interp(localpet) soilm_tot_target_grid, & routehandle=regrid_land, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for soil temperature over land." @@ -1905,7 +1905,7 @@ subroutine interp(localpet) routehandle=regrid_land, & termorderflag=ESMF_TERMORDER_SRCSEQ, & zeroregion=ESMF_REGION_SELECT, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for skin temperature over land." @@ -1914,7 +1914,7 @@ subroutine interp(localpet) routehandle=regrid_land, & termorderflag=ESMF_TERMORDER_SRCSEQ, & zeroregion=ESMF_REGION_SELECT, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for terrain over land." @@ -1923,7 +1923,7 @@ subroutine interp(localpet) routehandle=regrid_land, & termorderflag=ESMF_TERMORDER_SRCSEQ, & zeroregion=ESMF_REGION_SELECT, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL Field_Regrid for soil type over land." @@ -1931,37 +1931,37 @@ subroutine interp(localpet) soil_type_from_input_grid, & routehandle=regrid_land, & termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) print*,"- CALL FieldGet FOR TARGET grid total soil moisture over land." call ESMF_FieldGet(soilm_tot_target_grid, & farrayPtr=soilm_tot_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET grid soil temp over ice." call ESMF_FieldGet(soil_temp_target_grid, & farrayPtr=soil_temp_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET skin temperature." call ESMF_FieldGet(skin_temp_target_grid, & farrayPtr=skin_temp_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR terrain from input grid." call ESMF_FieldGet(terrain_from_input_grid, & farrayPtr=terrain_from_input_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR soil type from input grid." call ESMF_FieldGet(soil_type_from_input_grid, & farrayPtr=soil_type_from_input_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) l = lbound(unmapped_ptr) @@ -1986,17 +1986,17 @@ subroutine interp(localpet) print*,"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile call ESMF_FieldGather(landmask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) print*,"- CALL FieldGather FOR TARGET VEG TYPE TILE: ", tile call ESMF_FieldGather(veg_type_target_grid, veg_type_target_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) print*,"- CALL FieldGather FOR TERRAIN FROM INPUT GRID, TILE: ", tile call ESMF_FieldGather(terrain_from_input_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -2006,12 +2006,12 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TERRAIN FROM INPUT GRID, TILE: ", tile call ESMF_FieldScatter(terrain_from_input_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldGather FOR TARGET GRID SKIN TEMPERATURE, TILE: ", tile call ESMF_FieldGather(skin_temp_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -2020,12 +2020,12 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID SKIN TEMPERATURE, TILE: ", tile call ESMF_FieldScatter(skin_temp_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldGather FOR SOIL TYPE FROM INPUT GRID, TILE: ", tile call ESMF_FieldGather(soil_type_from_input_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -2034,12 +2034,12 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR SOIL TYPE FROM INPUT GRID, TILE: ", tile call ESMF_FieldScatter(soil_type_from_input_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldGather FOR TARGET GRID TOTAL SOIL MOISTURE, TILE: ", tile call ESMF_FieldGather(soilm_tot_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -2052,12 +2052,12 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID TOTAL SOIL MOISTURE, TILE: ", tile call ESMF_FieldScatter(soilm_tot_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) print*,"- CALL FieldGather FOR TARGET GRID SOIL TEMPERATURE, TILE: ", tile call ESMF_FieldGather(soil_temp_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) if (localpet == 0) then @@ -2070,14 +2070,14 @@ subroutine interp(localpet) print*,"- CALL FieldScatter FOR TARGET GRID SOIL TEMPERATURE, TILE: ", tile call ESMF_FieldScatter(soil_temp_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo print*,"- CALL FieldRegridRelease." call ESMF_FieldRegridRelease(routehandle=regrid_land, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridRelease", rc) deallocate(veg_type_target_one_tile) @@ -2128,37 +2128,37 @@ subroutine calc_liq_soil_moisture computationalLBound=clb, & computationalUBound=cub, & farrayPtr=soilm_tot_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR LIQUID SOIL MOISTURE." call ESMF_FieldGet(soilm_liq_target_grid, & farrayPtr=soilm_liq_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR SOIL TEMPERATURE." call ESMF_FieldGet(soil_temp_target_grid, & farrayPtr=soil_temp_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR VEGETATION TYPE." call ESMF_FieldGet(veg_type_target_grid, & farrayPtr=veg_type_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR SOIL TYPE." call ESMF_FieldGet(soil_type_target_grid, & farrayPtr=soil_type_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR LANDMASK." call ESMF_FieldGet(landmask_target_grid, & farrayPtr=landmask_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2429,37 +2429,37 @@ subroutine rescale_soil_moisture computationalLBound=clb, & computationalUBound=cub, & farrayPtr=soilm_tot_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR LAND MASK." call ESMF_FieldGet(landmask_target_grid, & farrayPtr=landmask_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR VEGETATION TYPE." call ESMF_FieldGet(veg_type_target_grid, & farrayPtr=veg_type_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR VEGETATION GREENNESS." call ESMF_FieldGet(veg_greenness_target_grid, & farrayPtr=veg_greenness_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET GRID SOIL TYPE." call ESMF_FieldGet(soil_type_target_grid, & farrayPtr=soil_type_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR SOIL TYPE FROM INPUT GRID." call ESMF_FieldGet(soil_type_from_input_grid, & farrayPtr=soil_type_input_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2586,25 +2586,25 @@ subroutine adjust_soilt_for_terrain print*,"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK." call ESMF_FieldGet(landmask_target_grid, & farrayPtr=landmask_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET GRID VEGETATION TYPE." call ESMF_FieldGet(veg_type_target_grid, & farrayPtr=veg_type_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET GRID TERRAIN." call ESMF_FieldGet(terrain_target_grid, & farrayPtr=terrain_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TERRAIN INTERP TO TARGET GRID." call ESMF_FieldGet(terrain_from_input_grid, & farrayPtr=terrain_input_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR SOIL TEMP TARGET GRID." @@ -2612,7 +2612,7 @@ subroutine adjust_soilt_for_terrain computationalLBound=clb, & computationalUBound=cub, & farrayPtr=soil_temp_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2662,19 +2662,19 @@ subroutine roughness computationalLBound=clb, & computationalUBound=cub, & farrayPtr=landmask_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET GRID VEGETATION TYPE." call ESMF_FieldGet(veg_type_target_grid, & farrayPtr=veg_type_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET GRID Z0." call ESMF_FieldGet(z0_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2733,13 +2733,13 @@ subroutine qc_check computationalLBound=clb, & computationalUBound=cub, & farrayPtr=landmask_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- SET NON-LAND FLAG FOR TARGET GRID SLOPE TYPE." call ESMF_FieldGet(slope_type_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2751,7 +2751,7 @@ subroutine qc_check print*,"- SET NON-LAND FLAG FOR TARGET GRID SOIL TYPE." call ESMF_FieldGet(soil_type_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2763,7 +2763,7 @@ subroutine qc_check print*,"- SET NON-LAND FLAG FOR TARGET GRID VEGETATION TYPE." call ESMF_FieldGet(veg_type_target_grid, & farrayPtr=veg_type_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2775,7 +2775,7 @@ subroutine qc_check print*,"- SET TARGET GRID ALVSF AT NON-LAND." call ESMF_FieldGet(alvsf_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2787,7 +2787,7 @@ subroutine qc_check print*,"- SET TARGET GRID ALVWF AT NON-LAND." call ESMF_FieldGet(alvwf_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2799,7 +2799,7 @@ subroutine qc_check print*,"- SET TARGET GRID ALNSF AT NON-LAND." call ESMF_FieldGet(alnsf_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2811,7 +2811,7 @@ subroutine qc_check print*,"- SET TARGET GRID ALNWF AT NON-LAND." call ESMF_FieldGet(alnwf_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2823,7 +2823,7 @@ subroutine qc_check print*,"- SET NON-LAND FLAG FOR TARGET GRID FACSF." call ESMF_FieldGet(facsf_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2835,7 +2835,7 @@ subroutine qc_check print*,"- SET NON-LAND FLAG FOR TARGET GRID FACSF." call ESMF_FieldGet(facwf_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2847,7 +2847,7 @@ subroutine qc_check print*,"- SET NON-LAND FLAG FOR TARGET GRID MAXIMUM GREENNESS." call ESMF_FieldGet(max_veg_greenness_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2859,7 +2859,7 @@ subroutine qc_check print*,"- SET NON-LAND FLAG FOR TARGET GRID MINIMUM GREENNESS." call ESMF_FieldGet(min_veg_greenness_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2871,7 +2871,7 @@ subroutine qc_check print*,"- SET NON-LAND FLAG FOR TARGET GRID VEGETATION GREENNESS." call ESMF_FieldGet(veg_greenness_target_grid, & farrayPtr=veg_greenness_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2883,7 +2883,7 @@ subroutine qc_check print*,"- SET NON-LAND FLAG FOR TARGET GRID MAX SNOW ALBEDO." call ESMF_FieldGet(mxsno_albedo_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2895,7 +2895,7 @@ subroutine qc_check print*,"- ZERO OUT TARGET GRID CANOPY MOISTURE CONTENT WHERE NO PLANTS." call ESMF_FieldGet(canopy_mc_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2907,25 +2907,25 @@ subroutine qc_check print*,"- CALL FieldGet FOR TARGET GRID ICE SKIN TEMP." call ESMF_FieldGet(seaice_skin_temp_target_grid, & farrayPtr=seaice_skint_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- SET TARGET GRID SKIN TEMP AT ICE POINTS." call ESMF_FieldGet(skin_temp_target_grid, & farrayPtr=skint_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR TARGET GRID SEA ICE FRACTION." call ESMF_FieldGet(seaice_fract_target_grid, & farrayPtr=fice_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- SET TARGET GRID SEA ICE DEPTH TO ZERO AT NON-ICE POINTS." call ESMF_FieldGet(seaice_depth_target_grid, & farrayPtr=hice_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2943,7 +2943,7 @@ subroutine qc_check print*,"- SET TARGET GRID SUBSTRATE TEMP AT ICE." call ESMF_FieldGet(substrate_temp_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2959,7 +2959,7 @@ subroutine qc_check print*,"- ZERO OUT TARGET GRID SNOW DEPTH AT OPEN WATER." call ESMF_FieldGet(snow_depth_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2973,7 +2973,7 @@ subroutine qc_check print*,"- ZERO OUT TARGET GRID SNOW LIQ AT OPEN WATER." call ESMF_FieldGet(snow_liq_equiv_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -2987,13 +2987,13 @@ subroutine qc_check print*,"- SET NON-LAND FLAG VALUE FOR TARGET GRID TOTAL SOIL MOISTURE." call ESMF_FieldGet(soilm_tot_target_grid, & farrayPtr=soilmt_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- SET NON-LAND FLAG VALUE FOR TARGET GRID LIQUID SOIL MOISTURE." call ESMF_FieldGet(soilm_liq_target_grid, & farrayPtr=soilml_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -3009,7 +3009,7 @@ subroutine qc_check print*,"- SET OPEN WATER FLAG FOR TARGET GRID SOIL TEMPERATURE." call ESMF_FieldGet(soil_temp_target_grid, & farrayPtr=data3d_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do j = clb(2), cub(2) @@ -3044,7 +3044,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR TARGET GRID LANDMASK." call ESMF_FieldGet(landmask_target_grid, & farrayPtr=mask_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) ! c_d @@ -3052,7 +3052,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR C_D." call ESMF_FieldGet(c_d_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3062,7 +3062,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR C_0." call ESMF_FieldGet(c_0_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3072,7 +3072,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR D_CONV." call ESMF_FieldGet(d_conv_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3082,7 +3082,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR DT_COOL." call ESMF_FieldGet(dt_cool_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3092,7 +3092,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR IFD." call ESMF_FieldGet(ifd_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3102,7 +3102,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR QRAIN." call ESMF_FieldGet(qrain_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3112,13 +3112,13 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR TREF." call ESMF_FieldGet(tref_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR SKIN T." call ESMF_FieldGet(skin_temp_target_grid, & farrayPtr=skint_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = skint_ptr @@ -3128,7 +3128,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR W_D." call ESMF_FieldGet(w_d_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3138,7 +3138,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR W_0." call ESMF_FieldGet(w_0_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3148,7 +3148,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR XS." call ESMF_FieldGet(xs_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3158,7 +3158,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR XT." call ESMF_FieldGet(xt_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3168,7 +3168,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR XU." call ESMF_FieldGet(xu_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3178,7 +3178,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR XV." call ESMF_FieldGet(xv_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3188,7 +3188,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR XZ." call ESMF_FieldGet(xz_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 30.0 @@ -3198,7 +3198,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR XTTS." call ESMF_FieldGet(xtts_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3208,7 +3208,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR XZTS." call ESMF_FieldGet(xzts_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3218,7 +3218,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR Z_C." call ESMF_FieldGet(z_c_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3228,7 +3228,7 @@ subroutine nst_land_fill print*,"- CALL FieldGet FOR ZM." call ESMF_FieldGet(zm_target_grid, & farrayPtr=data_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) where(mask_ptr /= 0) data_ptr = 0.0 @@ -3250,13 +3250,13 @@ subroutine create_surface_esmf_fields t2m_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid t2m." call ESMF_FieldGet(t2m_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3265,13 +3265,13 @@ subroutine create_surface_esmf_fields q2m_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid q2m." call ESMF_FieldGet(q2m_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3280,13 +3280,13 @@ subroutine create_surface_esmf_fields tprcp_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid tprcp." call ESMF_FieldGet(tprcp_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3295,13 +3295,13 @@ subroutine create_surface_esmf_fields f10m_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid f10m." call ESMF_FieldGet(f10m_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3310,13 +3310,13 @@ subroutine create_surface_esmf_fields ffmm_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid ffmm." call ESMF_FieldGet(ffmm_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3325,13 +3325,13 @@ subroutine create_surface_esmf_fields ustar_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid ustar." call ESMF_FieldGet(ustar_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3340,13 +3340,13 @@ subroutine create_surface_esmf_fields snow_liq_equiv_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid snow liq equiv." call ESMF_FieldGet(snow_liq_equiv_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3355,13 +3355,13 @@ subroutine create_surface_esmf_fields snow_depth_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid snow depth." call ESMF_FieldGet(snow_depth_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3370,13 +3370,13 @@ subroutine create_surface_esmf_fields seaice_fract_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid sea ice fraction." call ESMF_FieldGet(seaice_fract_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3385,13 +3385,13 @@ subroutine create_surface_esmf_fields seaice_depth_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET sea ice depth." call ESMF_FieldGet(seaice_depth_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3400,13 +3400,13 @@ subroutine create_surface_esmf_fields seaice_skin_temp_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET sea ice skin temp." call ESMF_FieldGet(seaice_skin_temp_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3415,13 +3415,13 @@ subroutine create_surface_esmf_fields srflag_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET srflag." call ESMF_FieldGet(srflag_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3430,13 +3430,13 @@ subroutine create_surface_esmf_fields skin_temp_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid skin temp." call ESMF_FieldGet(skin_temp_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3445,13 +3445,13 @@ subroutine create_surface_esmf_fields canopy_mc_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid canopy moisture." call ESMF_FieldGet(canopy_mc_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3460,13 +3460,13 @@ subroutine create_surface_esmf_fields z0_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid z0." call ESMF_FieldGet(z0_target_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3475,13 +3475,13 @@ subroutine create_surface_esmf_fields terrain_from_input_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid interpolated terrain." call ESMF_FieldGet(terrain_from_input_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3490,13 +3490,13 @@ subroutine create_surface_esmf_fields soil_type_from_input_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid soil type" call ESMF_FieldGet(soil_type_from_input_grid, & farrayPtr=target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr = init_val @@ -3507,13 +3507,13 @@ subroutine create_surface_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lsoil_target/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid soil temp" call ESMF_FieldGet(soil_temp_target_grid, & farrayPtr=target_ptr_3d, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr_3d = init_val @@ -3524,13 +3524,13 @@ subroutine create_surface_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lsoil_target/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid soil moist" call ESMF_FieldGet(soilm_tot_target_grid, & farrayPtr=target_ptr_3d, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr_3d = init_val @@ -3541,13 +3541,13 @@ subroutine create_surface_esmf_fields staggerloc=ESMF_STAGGERLOC_CENTER, & ungriddedLBound=(/1/), & ungriddedUBound=(/lsoil_target/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- INITIALIZE TARGET grid soil liq" call ESMF_FieldGet(soilm_liq_target_grid, & farrayPtr=target_ptr_3d, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) target_ptr_3d = init_val @@ -3566,126 +3566,126 @@ subroutine create_nst_esmf_fields c_d_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID C_0." c_0_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID D_CONV." d_conv_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID DT_COOL." dt_cool_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID IFD." ifd_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID QRAIN." qrain_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID TREF." tref_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID W_D." w_d_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID W_0." w_0_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID XS." xs_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID XT." xt_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID XU." xu_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID XV." xv_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID XZ." xz_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID XTTS." xtts_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID XZTS." xzts_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID Z_C." z_c_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR TARGET GRID ZM." zm_target_grid = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) end subroutine create_nst_esmf_fields diff --git a/sorc/chgres_cube.fd/write_data.F90 b/sorc/chgres_cube.fd/write_data.F90 index 69d79a8d1..f51fb5429 100644 --- a/sorc/chgres_cube.fd/write_data.F90 +++ b/sorc/chgres_cube.fd/write_data.F90 @@ -596,7 +596,7 @@ subroutine write_fv3_atm_bndy_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID SURFACE PRESSURE" call ESMF_FieldGather(ps_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -634,7 +634,7 @@ subroutine write_fv3_atm_bndy_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID HEIGHT FOR TILE: ", tile call ESMF_FieldGather(zh_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -678,7 +678,7 @@ subroutine write_fv3_atm_bndy_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID TRACER FOR TILE: ", trim(tracers(n)), tile call ESMF_FieldGather(tracers_target_grid(n), data_one_tile_3d, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -706,7 +706,7 @@ subroutine write_fv3_atm_bndy_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID W FOR TILE: ", tile call ESMF_FieldGather(dzdt_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -732,7 +732,7 @@ subroutine write_fv3_atm_bndy_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID TEMPERATURE FOR TILE: ", tile call ESMF_FieldGather(temp_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -862,7 +862,7 @@ subroutine write_fv3_atm_bndy_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID U_S FOR TILE: ", tile call ESMF_FieldGather(u_s_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -888,7 +888,7 @@ subroutine write_fv3_atm_bndy_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID V_S FOR TILE: ", tile call ESMF_FieldGather(v_s_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -1018,7 +1018,7 @@ subroutine write_fv3_atm_bndy_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID U_W FOR TILE: ", tile call ESMF_FieldGather(u_w_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -1044,7 +1044,7 @@ subroutine write_fv3_atm_bndy_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID V_W FOR TILE: ", tile call ESMF_FieldGather(v_w_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -1242,7 +1242,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) do tile = 1, num_tiles_target_grid print*,"- CALL FieldGather FOR TARGET GRID LONGITUDE FOR TILE: ", tile call ESMF_FieldGather(longitude_target_grid, data_one_tile, rootPet=tile-1, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) enddo @@ -1257,7 +1257,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) do tile = 1, num_tiles_target_grid print*,"- CALL FieldGather FOR TARGET GRID LATITUDE FOR TILE: ", tile call ESMF_FieldGather(latitude_target_grid, data_one_tile, rootPet=tile-1, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) enddo @@ -1272,7 +1272,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) do tile = 1, num_tiles_target_grid print*,"- CALL FieldGather FOR TARGET GRID SURFACE PRESSURE FOR TILE: ", tile call ESMF_FieldGather(ps_target_grid, data_one_tile, rootPet=tile-1, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) enddo @@ -1297,7 +1297,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) do tile = 1, num_tiles_target_grid print*,"- CALL FieldGather FOR TARGET GRID HEIGHT FOR TILE: ", tile call ESMF_FieldGather(zh_target_grid, data_one_tile_3d, rootPet=tile-1, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) enddo @@ -1323,7 +1323,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) do tile = 1, num_tiles_target_grid print*,"- CALL FieldGather FOR TARGET GRID VERTICAL VELOCITY FOR TILE: ", tile call ESMF_FieldGather(dzdt_target_grid, data_one_tile_3d, rootPet=tile-1, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) enddo @@ -1339,7 +1339,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) do tile = 1, num_tiles_target_grid print*,"- CALL FieldGather FOR TARGET GRID DELP FOR TILE: ", tile call ESMF_FieldGather(delp_target_grid, data_one_tile_3d, rootPet=tile-1, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) enddo @@ -1355,7 +1355,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) do tile = 1, num_tiles_target_grid print*,"- CALL FieldGather FOR TARGET GRID TEMPERATURE FOR TILE: ", tile call ESMF_FieldGather(temp_target_grid, data_one_tile_3d, rootPet=tile-1, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) enddo @@ -1373,7 +1373,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) do tile = 1, num_tiles_target_grid print*,"- CALL FieldGather FOR TARGET GRID TRACER ", trim(tracers(n)), " TILE: ", tile call ESMF_FieldGather(tracers_target_grid(n), data_one_tile_3d, rootPet=tile-1, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) enddo @@ -1401,7 +1401,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) do tile = 1, num_tiles_target_grid print*,"- CALL FieldGather FOR TARGET GRID U_S FOR TILE: ", tile call ESMF_FieldGather(u_s_target_grid, data_one_tile_3d, rootPet=tile-1, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) enddo @@ -1417,7 +1417,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) do tile = 1, num_tiles_target_grid print*,"- CALL FieldGather FOR TARGET GRID V_S FOR TILE: ", tile call ESMF_FieldGather(v_s_target_grid, data_one_tile_3d, rootPet=tile-1, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) enddo @@ -1443,7 +1443,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) do tile = 1, num_tiles_target_grid print*,"- CALL FieldGather FOR TARGET GRID U_W FOR TILE: ", tile call ESMF_FieldGather(u_w_target_grid, data_one_tile_3d, rootPet=tile-1, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) enddo @@ -1459,7 +1459,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) do tile = 1, num_tiles_target_grid print*,"- CALL FieldGather FOR TARGET GRID V_W FOR TILE: ", tile call ESMF_FieldGather(v_w_target_grid, data_one_tile_3d, rootPet=tile-1, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) enddo @@ -2075,7 +2075,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID SNOW LIQ EQUIV FOR TILE: ", tile call ESMF_FieldGather(snow_liq_equiv_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2086,7 +2086,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID SNOW DEPTH FOR TILE: ", tile call ESMF_FieldGather(snow_depth_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2097,7 +2097,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID SLOPE TYPE FOR TILE: ", tile call ESMF_FieldGather(slope_type_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2108,7 +2108,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID Z0 FOR TILE: ", tile call ESMF_FieldGather(z0_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2119,7 +2119,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID MAX SNOW ALBEDO FOR TILE: ", tile call ESMF_FieldGather(mxsno_albedo_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2130,7 +2130,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID SOIL TYPE FOR TILE: ", tile call ESMF_FieldGather(soil_type_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2141,7 +2141,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID VEGETATION TYPE FOR TILE: ", tile call ESMF_FieldGather(veg_type_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2152,7 +2152,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID VEGETATION GREENNESS FOR TILE: ", tile call ESMF_FieldGather(veg_greenness_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2163,7 +2163,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID SUBSTRATE TEMPERATURE FOR TILE: ", tile call ESMF_FieldGather(substrate_temp_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2174,7 +2174,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID FACSF FOR TILE: ", tile call ESMF_FieldGather(facsf_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2185,7 +2185,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID FACWF FOR TILE: ", tile call ESMF_FieldGather(facwf_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2196,7 +2196,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID ALNSF FOR TILE: ", tile call ESMF_FieldGather(alnsf_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2207,7 +2207,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID ALNWF FOR TILE: ", tile call ESMF_FieldGather(alnwf_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2218,7 +2218,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID ALVSF FOR TILE: ", tile call ESMF_FieldGather(alvsf_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2229,7 +2229,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID ALVWF FOR TILE: ", tile call ESMF_FieldGather(alvwf_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2240,7 +2240,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID MAX VEGETATION GREENNESS FOR TILE: ", tile call ESMF_FieldGather(max_veg_greenness_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2251,7 +2251,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID MIN VEGETATION GREENNESS FOR TILE: ", tile call ESMF_FieldGather(min_veg_greenness_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2262,7 +2262,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID T2M FOR TILE: ", tile call ESMF_FieldGather(t2m_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2273,7 +2273,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID Q2M FOR TILE: ", tile call ESMF_FieldGather(q2m_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2284,7 +2284,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID TPRCP FOR TILE: ", tile call ESMF_FieldGather(tprcp_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2295,7 +2295,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID F10M FOR TILE: ", tile call ESMF_FieldGather(f10m_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2306,7 +2306,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID FFMM FOR TILE: ", tile call ESMF_FieldGather(ffmm_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2320,7 +2320,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID USTAR FOR TILE: ", tile call ESMF_FieldGather(ustar_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2331,7 +2331,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID SRFLAG FOR TILE: ", tile call ESMF_FieldGather(srflag_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2342,7 +2342,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID SEA ICE FRACTION FOR TILE: ", tile call ESMF_FieldGather(seaice_fract_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2353,7 +2353,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID SEA ICE DEPTH FOR TILE: ", tile call ESMF_FieldGather(seaice_depth_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2364,7 +2364,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID SEA ICE SKIN TEMP FOR TILE: ", tile call ESMF_FieldGather(seaice_skin_temp_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2375,7 +2375,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID SKIN TEMP FOR TILE: ", tile call ESMF_FieldGather(skin_temp_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2386,7 +2386,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID LANDMASK FOR TILE: ", tile call ESMF_FieldGather(landmask_target_grid, idata_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2397,7 +2397,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID CANOPY MOISTURE CONTENT FOR TILE: ", tile call ESMF_FieldGather(canopy_mc_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2410,7 +2410,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID SOIL TEMPERATURE FOR TILE: ", tile call ESMF_FieldGather(soil_temp_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2423,7 +2423,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID TOTAL SOIL MOISTURE FOR TILE: ", tile call ESMF_FieldGather(soilm_tot_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2436,7 +2436,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET GRID LIQUID SOIL MOISTURE FOR TILE: ", tile call ESMF_FieldGather(soilm_liq_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2449,7 +2449,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET C_D FOR TILE: ", tile call ESMF_FieldGather(c_d_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2460,7 +2460,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET C_0 FOR TILE: ", tile call ESMF_FieldGather(c_0_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2471,7 +2471,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET D_CONV FOR TILE: ", tile call ESMF_FieldGather(d_conv_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2482,7 +2482,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET DT_COOL FOR TILE: ", tile call ESMF_FieldGather(dt_cool_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2493,7 +2493,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET IFD FOR TILE: ", tile call ESMF_FieldGather(ifd_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2504,7 +2504,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET QRAIN FOR TILE: ", tile call ESMF_FieldGather(qrain_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2515,7 +2515,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET TREF FOR TILE: ", tile call ESMF_FieldGather(tref_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2526,7 +2526,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET W_D FOR TILE: ", tile call ESMF_FieldGather(w_d_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2537,7 +2537,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET W_0 FOR TILE: ", tile call ESMF_FieldGather(w_0_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2548,7 +2548,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET XS FOR TILE: ", tile call ESMF_FieldGather(xs_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2559,7 +2559,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET XT FOR TILE: ", tile call ESMF_FieldGather(xt_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2570,7 +2570,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET XU FOR TILE: ", tile call ESMF_FieldGather(xu_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2581,7 +2581,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET XV FOR TILE: ", tile call ESMF_FieldGather(xv_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2592,7 +2592,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET XZ FOR TILE: ", tile call ESMF_FieldGather(xz_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2603,7 +2603,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET XTTS FOR TILE: ", tile call ESMF_FieldGather(xtts_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2614,7 +2614,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET XZTS FOR TILE: ", tile call ESMF_FieldGather(xzts_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2625,7 +2625,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET Z_C FOR TILE: ", tile call ESMF_FieldGather(z_c_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then @@ -2636,7 +2636,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) print*,"- CALL FieldGather FOR TARGET ZM FOR TILE: ", tile call ESMF_FieldGather(zm_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) - if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", error) if (localpet == 0) then diff --git a/sorc/sfc_climo_gen.fd/driver.F90 b/sorc/sfc_climo_gen.fd/driver.F90 index 91face832..5e5207190 100644 --- a/sorc/sfc_climo_gen.fd/driver.F90 +++ b/sorc/sfc_climo_gen.fd/driver.F90 @@ -43,17 +43,17 @@ program driver print*,"- INITIALIZE ESMF" call ESMF_Initialize(rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("INITIALIZING ESMF", rc) print*,"- CALL VMGetGlobal" call ESMF_VMGetGlobal(vm, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN VMGetGlobal.", rc) print*,"- CALL VMGet" call ESMF_VMGet(vm, localPet=localpet, petCount=npets, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN VMGet.", rc) print*,'- NPETS IS ',npets diff --git a/sorc/sfc_climo_gen.fd/interp.F90 b/sorc/sfc_climo_gen.fd/interp.F90 index a61450e80..5ed80f14d 100644 --- a/sorc/sfc_climo_gen.fd/interp.F90 +++ b/sorc/sfc_climo_gen.fd/interp.F90 @@ -59,7 +59,7 @@ subroutine interp(localpet, method, input_file) staggerloc=ESMF_STAGGERLOC_CENTER, & name="source data", & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldGet FOR SOURCE GRID DATA." @@ -67,7 +67,7 @@ subroutine interp(localpet, method, input_file) call ESMF_FieldGet(data_field_src, & farrayPtr=data_src_ptr, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL FieldGet FOR MODEL GRID DATA." @@ -77,7 +77,7 @@ subroutine interp(localpet, method, input_file) computationalLBound=clb_mdl, & computationalUBound=cub_mdl, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) if (localpet == 0) then @@ -115,7 +115,7 @@ subroutine interp(localpet, method, input_file) print*,"- CALL FieldScatter FOR SOURCE GRID DATA." call ESMF_FieldScatter(data_field_src, data_src_global, rootPet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter.", rc) isrctermprocessing = 1 @@ -142,7 +142,7 @@ subroutine interp(localpet, method, input_file) regridmethod=method, & unmappedDstList=unmapped_ptr, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridStore.", rc) endif @@ -153,7 +153,7 @@ subroutine interp(localpet, method, input_file) routehandle=regrid_data, & termorderflag=ESMF_TERMORDER_SRCSEQ, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid.", rc) !----------------------------------------------------------------------- @@ -201,19 +201,19 @@ subroutine interp(localpet, method, input_file) print*,"- CALL FieldGather FOR MODEL GRID DATA." call ESMF_FieldGather(data_field_mdl, data_mdl_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather.", rc) print*,"- CALL FieldGather FOR MODEL GRID LAND MASK." call ESMF_FieldGather(mask_field_mdl, mask_mdl_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather.", rc) select case (trim(field_names(n))) case ('substrate_temperature','vegetation_greenness','leaf_area_index','slope_type','soil_type') print*,"- CALL FieldGather FOR MODEL GRID VEG TYPE." call ESMF_FieldGather(vegt_field_mdl, vegt_mdl_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather.", rc) end select @@ -231,7 +231,7 @@ subroutine interp(localpet, method, input_file) if (field_names(n) == 'vegetation_type') then print*,"- CALL FieldScatter FOR MODEL GRID VEGETATION TYPE." call ESMF_FieldScatter(vegt_field_mdl, data_mdl_one_tile, rootPet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter.", rc) endif diff --git a/sorc/sfc_climo_gen.fd/model_grid.F90 b/sorc/sfc_climo_gen.fd/model_grid.F90 index 8bc6453e3..f281b64ea 100644 --- a/sorc/sfc_climo_gen.fd/model_grid.F90 +++ b/sorc/sfc_climo_gen.fd/model_grid.F90 @@ -172,7 +172,7 @@ subroutine define_model_grid(localpet, npets) indexflag=ESMF_INDEX_GLOBAL, & tileFilePath=trim(orog_dir_mdl), & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridCreateMosaic", rc) print*,"- CALL FieldCreate FOR DATA INTERPOLATED TO MODEL GRID." @@ -181,7 +181,7 @@ subroutine define_model_grid(localpet, npets) staggerloc=ESMF_STAGGERLOC_CENTER, & name="data on model grid", & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldCreate FOR VEGETATION TYPE INTERPOLATED TO MODEL GRID." @@ -190,7 +190,7 @@ subroutine define_model_grid(localpet, npets) staggerloc=ESMF_STAGGERLOC_CENTER, & name="veg type on model grid", & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) !----------------------------------------------------------------------- @@ -203,7 +203,7 @@ subroutine define_model_grid(localpet, npets) staggerloc=ESMF_STAGGERLOC_CENTER, & name="model grid land mask", & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) print*,"- CALL FieldGet FOR MODEL GRID LANDMASK." @@ -211,7 +211,7 @@ subroutine define_model_grid(localpet, npets) call ESMF_FieldGet(mask_field_mdl, & farrayPtr=mask_field_mdl_ptr, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) if (localpet == 0) then @@ -227,7 +227,7 @@ subroutine define_model_grid(localpet, npets) endif print*,"- CALL FieldScatter FOR MODEL GRID MASK. TILE IS: ", tile call ESMF_FieldScatter(mask_field_mdl, mask_mdl_one_tile, rootpet=0, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) enddo @@ -238,7 +238,7 @@ subroutine define_model_grid(localpet, npets) itemflag=ESMF_GRIDITEM_MASK, & staggerloc=ESMF_STAGGERLOC_CENTER, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridAddItem", rc) print*,"- CALL GridGetItem FOR MODEL GRID." @@ -247,7 +247,7 @@ subroutine define_model_grid(localpet, npets) itemflag=ESMF_GRIDITEM_MASK, & farrayPtr=mask_mdl_ptr, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridGetItem", rc) mask_mdl_ptr = mask_field_mdl_ptr diff --git a/sorc/sfc_climo_gen.fd/source_grid.F90 b/sorc/sfc_climo_gen.fd/source_grid.F90 index cd4f31bbf..d73e850a1 100644 --- a/sorc/sfc_climo_gen.fd/source_grid.F90 +++ b/sorc/sfc_climo_gen.fd/source_grid.F90 @@ -247,7 +247,7 @@ subroutine define_source_grid(localpet, npets, input_file) regDecomp=(/1,npets/), & name="source_grid", & indexflag=ESMF_INDEX_GLOBAL, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridCreateNoPeriDim.", rc) else @@ -264,7 +264,7 @@ subroutine define_source_grid(localpet, npets, input_file) regDecomp=(/1,npets/), & name="source_grid", & indexflag=ESMF_INDEX_GLOBAL, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridCreate1PeriDim.", rc) endif @@ -275,12 +275,12 @@ subroutine define_source_grid(localpet, npets, input_file) staggerloc=ESMF_STAGGERLOC_CENTER, & name="source grid land mask", & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate.", rc) print*,"- CALL FieldScatter FOR SOURCE GRID MASK." call ESMF_FieldScatter(mask_field, mask_global, rootpet=0, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter.", rc) print*,"- CALL GridAddItem FOR SOURCE GRID MASK." @@ -288,7 +288,7 @@ subroutine define_source_grid(localpet, npets, input_file) itemflag=ESMF_GRIDITEM_MASK, & staggerloc=ESMF_STAGGERLOC_CENTER, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridAddItem.", rc) print*,"- CALL GridGetItem FOR SOURCE GRID MASK." @@ -299,7 +299,7 @@ subroutine define_source_grid(localpet, npets, input_file) totalLBound=clb, & totalUBound=cub, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridGetItem", rc) print*,"- CALL FieldGet FOR SOURCE GRID LANDMASK." @@ -307,7 +307,7 @@ subroutine define_source_grid(localpet, npets, input_file) call ESMF_FieldGet(mask_field, & farrayPtr=mask_field_ptr, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet.", rc) do j = clb(2), cub(2) @@ -324,7 +324,7 @@ subroutine define_source_grid(localpet, npets, input_file) print*,"- CALL FieldDestroy FOR SOURCE GRID LAND MASK." call ESMF_FieldDestroy(mask_field,rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldDestroy.", rc) ! Set lat/lons of grid points @@ -332,7 +332,7 @@ subroutine define_source_grid(localpet, npets, input_file) print*,"- CALL GridAddCoord FOR SOURCE GRID CENTER LOCATION." call ESMF_GridAddCoord(grid_src, & staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridAddCoord.", rc) print*,"- CALL GridGetCoord FOR SOURCE GRID CENTER LONGITUDE." @@ -341,7 +341,7 @@ subroutine define_source_grid(localpet, npets, input_file) staggerLoc=ESMF_STAGGERLOC_CENTER, & coordDim=1, & farrayPtr=lon_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridGetCoord.", rc) print*,"- CALL GridGetCoord FOR SOURCE GRID CENTER LATITUDE." @@ -350,7 +350,7 @@ subroutine define_source_grid(localpet, npets, input_file) staggerLoc=ESMF_STAGGERLOC_CENTER, & coordDim=2, & farrayPtr=lat_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridGetCoord.", rc) do j = clb(2), cub(2) @@ -365,7 +365,7 @@ subroutine define_source_grid(localpet, npets, input_file) call ESMF_GridAddCoord(grid_src, & staggerloc=ESMF_STAGGERLOC_CORNER, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridAddCoord.", rc) print*,"- CALL GridGetCoord FOR SOURCE GRID CORNER LONGITUDE." @@ -375,7 +375,7 @@ subroutine define_source_grid(localpet, npets, input_file) coordDim=1, & farrayPtr=lon_corner_ptr, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridGetCoord.", rc) print*,"- CALL GridGetCoord FOR SOURCE GRID CORNER LATITUDE." @@ -387,7 +387,7 @@ subroutine define_source_grid(localpet, npets, input_file) computationalUBound=cub_corner, & farrayPtr=lat_corner_ptr, & rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__line__,file=__file__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridGetCoord.", rc) do j = clb_corner(2), cub_corner(2) From 0f5d0f175e9f00b89c224f4d3e076f654219e791 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Fri, 24 Jan 2020 08:59:10 -0500 Subject: [PATCH 010/192] chgres_cube grib2 GFS data support (#48) Update chgres_cube program to ingest GFS grib2 data. For more details see issue #7 --- modulefiles/chgres_cube.hera | 3 + modulefiles/chgres_cube.jet | 7 +- modulefiles/chgres_cube.linux.gnu | 24 + modulefiles/chgres_cube.linux.intel | 24 + modulefiles/chgres_cube.odin | 27 + modulefiles/chgres_cube.wcoss_cray | 3 + modulefiles/chgres_cube.wcoss_dell_p3 | 3 + modulefiles/fv3gfs/fre-nctools.wcoss_cray | 0 modulefiles/fv3gfs/fre-nctools.wcoss_dell_p3 | 0 .../modulefile.global_emcsfc_ice_blend.wcoss | 0 ...ulefile.global_emcsfc_ice_blend.wcoss_cray | 0 ...global_emcsfc_ice_blend.wcoss_cray_userlib | 0 ...file.global_emcsfc_ice_blend.wcoss_dell_p3 | 0 .../modulefile.global_emcsfc_snow2mdl.wcoss | 0 ...dulefile.global_emcsfc_snow2mdl.wcoss_cray | 0 ....global_emcsfc_snow2mdl.wcoss_cray_userlib | 0 ...efile.global_emcsfc_snow2mdl.wcoss_dell_p3 | 0 parm/varmap_tables/GFSphys_var_map.txt | 23 + parm/varmap_tables/README | 24 + sorc/build_chgres_cube.sh | 9 +- sorc/chgres_cube.fd/atmosphere.F90 | 36 +- sorc/chgres_cube.fd/chgres.F90 | 13 +- sorc/chgres_cube.fd/grib2_util.F90 | 77 ++ sorc/chgres_cube.fd/input_data.F90 | 1225 ++++++++++++++++- sorc/chgres_cube.fd/makefile | 14 +- sorc/chgres_cube.fd/model_grid.F90 | 189 +++ sorc/chgres_cube.fd/program_setup.f90 | 156 ++- sorc/chgres_cube.fd/search_util.f90 | 2 +- sorc/chgres_cube.fd/surface.F90 | 52 +- sorc/chgres_cube.fd/utils.f90 | 42 + sorc/machine-setup.sh | 2 + 31 files changed, 1897 insertions(+), 58 deletions(-) create mode 100644 modulefiles/chgres_cube.linux.gnu create mode 100644 modulefiles/chgres_cube.linux.intel create mode 100644 modulefiles/chgres_cube.odin mode change 100755 => 100644 modulefiles/fv3gfs/fre-nctools.wcoss_cray mode change 100755 => 100644 modulefiles/fv3gfs/fre-nctools.wcoss_dell_p3 mode change 100755 => 100644 modulefiles/modulefile.global_emcsfc_ice_blend.wcoss mode change 100755 => 100644 modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_cray mode change 100755 => 100644 modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_cray_userlib mode change 100755 => 100644 modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_dell_p3 mode change 100755 => 100644 modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss mode change 100755 => 100644 modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_cray mode change 100755 => 100644 modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_cray_userlib mode change 100755 => 100644 modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_dell_p3 create mode 100644 parm/varmap_tables/GFSphys_var_map.txt create mode 100644 parm/varmap_tables/README create mode 100644 sorc/chgres_cube.fd/grib2_util.F90 mode change 100755 => 100644 sorc/chgres_cube.fd/makefile diff --git a/modulefiles/chgres_cube.hera b/modulefiles/chgres_cube.hera index 72529a510..5bc36f078 100644 --- a/modulefiles/chgres_cube.hera +++ b/modulefiles/chgres_cube.hera @@ -17,6 +17,9 @@ export NCEPLIBS=/scratch1/NCEPDEV/global/gwv/l819/lib module use -a $NCEPLIBS/modulefiles module load esmflocal/8_0_48b.netcdf47 +export WGRIB2API_INC="/apps/wgrib2/2.0.8/intel/18.0.3.222/lib" +export WGRIB2_LIB="/apps/wgrib2/2.0.8/intel/18.0.3.222/lib/libwgrib2.a" + export FCOMP=mpiifort export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" # for debugging diff --git a/modulefiles/chgres_cube.jet b/modulefiles/chgres_cube.jet index 9ec1069dc..6a1f9340e 100644 --- a/modulefiles/chgres_cube.jet +++ b/modulefiles/chgres_cube.jet @@ -4,8 +4,8 @@ module load intel/18.0.5.274 module load impi/2018.4.274 -module load szip -module load hdf5 +module load szip/2.1 +module load hdf5/1.8.9 module load netcdf/4.2.1.1 module load w3nco/v2.0.6 @@ -22,3 +22,6 @@ export FCOMP=mpiifort export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" #debug #export FFLAGS="-O0 -g -traceback -r8 -i4 -qopenmp -convert big_endian -check bounds -warn unused -assume byterecl" + +export WGRIB2API_INC="/mnt/lfs3/projects/hwrfv3/Jili.Dong/wgrib2-2.0.8/grib2/lib" +export WGRIB2_LIB="/mnt/lfs3/projects/hwrfv3/Jili.Dong/wgrib2-2.0.8/grib2/lib/libwgrib2.a" diff --git a/modulefiles/chgres_cube.linux.gnu b/modulefiles/chgres_cube.linux.gnu new file mode 100644 index 000000000..ba76044c2 --- /dev/null +++ b/modulefiles/chgres_cube.linux.gnu @@ -0,0 +1,24 @@ +############################################################# +## chgres_cube component - linux.gnu +############################################################# + +export IP_INCd=${NCEPLIBS}/ip/include_d +export NEMSIO_INC=${NCEPLIBS}/nemsio/include +export SFCIO_INC4=${NCEPLIBS}/sfcio/include_4 +export SIGIO_INC4=${NCEPLIBS}/sigio/include_4 + +export BACIO_LIB4=${NCEPLIBS}/bacio/lib/libbacio_v2.1.0_4.a +export IP_LIBd=${NCEPLIBS}/ip/lib/libip_v3.0.0_d.a +export NEMSIO_LIB=${NCEPLIBS}/nemsio/lib/libnemsio_v2.2.3.a +export SFCIO_LIB4=${NCEPLIBS}/sfcio/lib/libsfcio_v1.1.0_4.a +export SIGIO_LIB4=${NCEPLIBS}/sigio/lib/libsigio_v2.1.0_4.a +export SP_LIBd=${NCEPLIBS}/sp/lib/libsp_v2.0.2_d.a +export W3NCO_LIBd=${NCEPLIBS}/w3nco/lib/libw3nco_v2.0.6_d.a + +export WGRIB2API_INC=${WGRIB2_DIR}/include +export WGRIB2_LIB=${WGRIB2_DIR}/lib/libwgrib2.a + +export FCOMP=mpif90 +export FFLAGS="-O3 -g -fbacktrace -fdefault-real-8 -ffree-line-length-none -fopenmp -fconvert=big-endian" +# for debugging +#export FFLAGS="-O0 -g -fbacktrace -fdefault-real-8 -ffree-line-length-none -fopenmp -fconvert=big-endian" diff --git a/modulefiles/chgres_cube.linux.intel b/modulefiles/chgres_cube.linux.intel new file mode 100644 index 000000000..9af64a3b9 --- /dev/null +++ b/modulefiles/chgres_cube.linux.intel @@ -0,0 +1,24 @@ +############################################################# +## chgres_cube component - linux.intel +############################################################# + +export IP_INCd=${NCEPLIBS}/ip/include_d +export NEMSIO_INC=${NCEPLIBS}/nemsio/include +export SFCIO_INC4=${NCEPLIBS}/sfcio/include_4 +export SIGIO_INC4=${NCEPLIBS}/sigio/include_4 + +export BACIO_LIB4=${NCEPLIBS}/bacio/lib/libbacio_v2.1.0_4.a +export IP_LIBd=${NCEPLIBS}/ip/lib/libip_v3.0.0_d.a +export NEMSIO_LIB=${NCEPLIBS}/nemsio/lib/libnemsio_v2.2.3.a +export SFCIO_LIB4=${NCEPLIBS}/sfcio/lib/libsfcio_v1.1.0_4.a +export SIGIO_LIB4=${NCEPLIBS}/sigio/lib/libsigio_v2.1.0_4.a +export SP_LIBd=${NCEPLIBS}/sp/lib/libsp_v2.0.2_d.a +export W3NCO_LIBd=${NCEPLIBS}/w3nco/lib/libw3nco_v2.0.6_d.a + +export WGRIB2API_INC=${WGRIB2_DIR}/include +export WGRIB2_LIB=${WGRIB2_DIR}/lib/libwgrib2.a + +export FCOMP=mpif90 +export FFLAGS="-O3 -fp-model source -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" +# for debugging +#export FFLAGS="-O0 -g -traceback -r8 -i4 -qopenmp -convert big_endian -check bounds -warn unused -assume byterecl" diff --git a/modulefiles/chgres_cube.odin b/modulefiles/chgres_cube.odin new file mode 100644 index 000000000..ecbc18977 --- /dev/null +++ b/modulefiles/chgres_cube.odin @@ -0,0 +1,27 @@ +#%Module##################################################### +## chgres build module for Odin +############################################################# + +module use /oldscratch/ywang/external/modulefiles +module load esmf/8.0.0bs30 + +module load cray-netcdf-hdf5parallel +module load cray-parallel-netcdf +module load cray-hdf5-parallel +module load w3nco/v2.0.6 +module load nemsio/v2.2.2 +module load bacio/v2.0.2 +module load sp/v2.0.2 +module load sfcio/v1.0.0 +module load sigio/v2.0.1 + + +export FCOMP=ftn +export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" +export WGRIB2API_LIB="/home/larissa.reames/tmp/wgrib2-2/grib2/lib/libwgrib2_api.a" +export WGRIB2API_INC="/home/larissa.reames/tmp/wgrib2-2/grib2/lib" +export WGRIB2_LIB="/home/larissa.reames/tmp/wgrib2-2/grib2/lib/libwgrib2.a" + + +# for debugging +#export FFLAGS="-O0 -g -traceback -r8 -i4 -qopenmp -convert big_endian -check bounds -warn unused -assume byterecl" diff --git a/modulefiles/chgres_cube.wcoss_cray b/modulefiles/chgres_cube.wcoss_cray index 95098edc5..1a9df23b0 100644 --- a/modulefiles/chgres_cube.wcoss_cray +++ b/modulefiles/chgres_cube.wcoss_cray @@ -19,6 +19,9 @@ module load sfcio-intel/1.0.0 # module load esmf/7.1.0r export ESMFMKFILE=/gpfs/hps3/emc/global/noscrub/George.Gayno/esmf/8_0_0_bs20/lib/esmf.mk +export WGRIB2API_INC=/gpfs/hps3/emc/meso/save/Dusan.Jovic/wgrib2/include +export WGRIB2_LIB=/gpfs/hps3/emc/meso/save/Dusan.Jovic/wgrib2/lib/libwgrib2.a + export FCOMP=ftn export FFLAGS="-O3 -fp-model precise -g -r8 -i4 -qopenmp -convert big_endian -assume byterecl" # for debugging diff --git a/modulefiles/chgres_cube.wcoss_dell_p3 b/modulefiles/chgres_cube.wcoss_dell_p3 index 80ccf6589..61297e0cd 100644 --- a/modulefiles/chgres_cube.wcoss_dell_p3 +++ b/modulefiles/chgres_cube.wcoss_dell_p3 @@ -14,6 +14,9 @@ module load bacio/2.0.2 module load sfcio/1.0.0 module load sigio/2.1.0 +export WGRIB2API_INC=/u/Wesley.Ebisuzaki/home/grib2.v2.0.8.intel/lib +export WGRIB2_LIB=/u/Wesley.Ebisuzaki/home/grib2.v2.0.8.intel/lib/libwgrib2.a + export FCOMP=mpif90 export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" # for debugging diff --git a/modulefiles/fv3gfs/fre-nctools.wcoss_cray b/modulefiles/fv3gfs/fre-nctools.wcoss_cray old mode 100755 new mode 100644 diff --git a/modulefiles/fv3gfs/fre-nctools.wcoss_dell_p3 b/modulefiles/fv3gfs/fre-nctools.wcoss_dell_p3 old mode 100755 new mode 100644 diff --git a/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss b/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss old mode 100755 new mode 100644 diff --git a/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_cray b/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_cray old mode 100755 new mode 100644 diff --git a/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_cray_userlib b/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_cray_userlib old mode 100755 new mode 100644 diff --git a/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_dell_p3 b/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_dell_p3 old mode 100755 new mode 100644 diff --git a/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss b/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss old mode 100755 new mode 100644 diff --git a/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_cray b/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_cray old mode 100755 new mode 100644 diff --git a/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_cray_userlib b/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_cray_userlib old mode 100755 new mode 100644 diff --git a/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_dell_p3 b/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_dell_p3 old mode 100755 new mode 100644 diff --git a/parm/varmap_tables/GFSphys_var_map.txt b/parm/varmap_tables/GFSphys_var_map.txt new file mode 100644 index 000000000..838110174 --- /dev/null +++ b/parm/varmap_tables/GFSphys_var_map.txt @@ -0,0 +1,23 @@ +dzdt dzdt set_to_fill 0 D +sphum sphum set_to_fill 1E-7 T +liq_wat liq_wat set_to_fill 0 T +o3mr o3mr set_to_fill 1E-7 T +ice_wat ice_wat set_to_fill 0 T +rainwat rainwat set_to_fill 0 T +snowwat snowwat set_to_fill 0 T +graupel graupel set_to_fill 0 T +vtype vtype skip 0 S +sotype stype skip 0 S +vfrac vfrac skip 0 S +fricv uustar set_to_fill 0 S +sfcr zorl set_to_fill 0.01 S +tprcp tprcp set_to_fill 0.00 S +ffmm ffmm set_to_fill 0.00 S +f10m f10m set_to_fill 0.00 S +soilw smc stop 0 S +soill slc set_to_fill 0.0 S +soilt stc stop 0 S +cnwat cnwat set_to_fill 0.0 S +hice icetk set_to_fill 1.5 S +weasd weasd set_to_fill 0.0 S +snod snod set_to_fill 0.0 S diff --git a/parm/varmap_tables/README b/parm/varmap_tables/README new file mode 100644 index 000000000..360341777 --- /dev/null +++ b/parm/varmap_tables/README @@ -0,0 +1,24 @@ +####################################################### +# Description of varmap_tables # +####################################################### + +These files, each named for the phys_suite variable set in the chgres_cube namelist, +control how chgres_cube, when processing grib2 files, handles variables that might +be missing from the grib2 files. Since there are so many different version of grib2 +files, it's often uncertain what fields are available even if you know what source +model the data is coming from. Each file contains : + +Line 1: number of entries in the table +Column 1: Name the code searches for in the table. Do not change. +Column 2: Name the code will use to save the variable in the output file. Unimplemented. +Comumn 3: Behavior when the code can't find the variable in the input file. Options are: + "skip": Don't write to output file. + "set_to_fill": Set to user-specified field value (see column 4). + "stop": Force an exception and stop code execution. Use this if you absolutely + require a field to be present. +Column 4: If column 3 = "set_to_fill", then this value is used to fill in all points + in the input field. These values may be over-written by the code before + output depending on the variable (esp. for surface variables). Be careful + with these values for surface variables. If you set this value too low + (e.g., -100000), the code may run extremely slowly due to variable replacment + at "missing" points. diff --git a/sorc/build_chgres_cube.sh b/sorc/build_chgres_cube.sh index 752429b47..c13704e1c 100755 --- a/sorc/build_chgres_cube.sh +++ b/sorc/build_chgres_cube.sh @@ -1,7 +1,14 @@ #! /usr/bin/env bash set -eux -source ./machine-setup.sh > /dev/null 2>&1 +target=${target:-"NULL"} + +if [[ $target == "linux.gnu" || $target == "linux.intel" ]]; then + unset -f module +else + source ./machine-setup.sh > /dev/null 2>&1 +fi + cwd=`pwd` USE_PREINST_LIBS=${USE_PREINST_LIBS:-"true"} diff --git a/sorc/chgres_cube.fd/atmosphere.F90 b/sorc/chgres_cube.fd/atmosphere.F90 index 98881d95e..e3cebba4e 100644 --- a/sorc/chgres_cube.fd/atmosphere.F90 +++ b/sorc/chgres_cube.fd/atmosphere.F90 @@ -47,7 +47,7 @@ module atmosphere terrain_target_grid use program_setup, only : vcoord_file_target_grid, & - regional, & + regional, & tracers, num_tracers, & atm_weight_file @@ -218,6 +218,7 @@ subroutine atmosphere_driver(localpet) termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) + enddo print*,"- CALL Field_Regrid FOR VERTICAL VELOCITY." @@ -386,7 +387,7 @@ subroutine atmosphere_driver(localpet) !----------------------------------------------------------------------------------- call convert_winds - + !----------------------------------------------------------------------------------- ! Write target data to file. !----------------------------------------------------------------------------------- @@ -492,7 +493,7 @@ subroutine create_atm_esmf_fields allocate(tracers_target_grid(num_tracers)) do n = 1, num_tracers - print*,"- CALL FieldCreate FOR TARGET GRID TRACERS ", trim(tracers(n)) + print*,"- CALL FieldCreate FOR TARGET GRID TRACERS ", trim(tracers(n)) tracers_target_grid(n) = ESMF_FieldCreate(target_grid, & typekind=ESMF_TYPEKIND_R8, & staggerloc=ESMF_STAGGERLOC_CENTER, & @@ -816,7 +817,7 @@ subroutine newpr1(localpet) call error_handler("IN FieldGet", rc) allocate(pi(clb(1):cub(1),clb(2):cub(2),1:levp1_target)) - + if(idvc.eq.2) then do k=1,levp1_target ak = vcoord_target(k,1) @@ -938,7 +939,7 @@ subroutine newps(localpet) farrayPtr=tptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - + ! Find specific humidity in the array of tracer fields. do ii = 1, num_tracers @@ -950,7 +951,7 @@ subroutine newps(localpet) farrayPtr=qptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - + print*,"- CALL FieldGet FOR SURFACE PRESSURE BEFORE ADJUSTMENT" call ESMF_FieldGet(ps_b4adj_target_grid, & farrayPtr=psptr, rc=rc) @@ -1046,6 +1047,7 @@ subroutine newps(localpet) ! Compute surface pressure over the top. !----------------------------------------------------------------------------------- + if(ls.gt.0) then k=cub(3) gamma=0 @@ -1106,9 +1108,9 @@ subroutine read_vcoord_info print* do k = 1, levp1_target - print*,'VCOORD FOR LEV ', k, 'IS: ', vcoord_target(k,:) + print*,'VCOORD FOR LEV ', k, 'IS: ', vcoord_target(k,:) enddo - + close(14) end subroutine read_vcoord_info @@ -1255,7 +1257,6 @@ SUBROUTINE VINTG CALL TERP3(IM,1,1,1,1,4+NT,(IM*KM1),(IM*KM2), & KM1,IM,IM,Z1,C1,KM2,IM,IM,Z2,C2) - ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! COPY OUTPUT WIND, TEMPERATURE, HUMIDITY AND OTHER TRACERS ! EXCEPT BELOW THE INPUT DOMAIN, LET TEMPERATURE INCREASE WITH A FIXED @@ -1410,7 +1411,7 @@ SUBROUTINE TERP3(IM,IXZ1,IXQ1,IXZ2,IXQ2,NM,NXQ1,NXQ2, & ! REAL(ESMF_KIND_R8) :: J2S ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -! FIND THE SURROUNDING INPUT INTERVAL FOR EACH OUTPUT POINT. +! FIND THE SURROUNDING INPUT INTERVAL FOR EACH OUTPUT POINT. CALL RSEARCH(IM,KM1,IXZ1,KXZ1,Z1,KM2,IXZ2,KXZ2,Z2,1,IM,K1S) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1422,7 +1423,6 @@ SUBROUTINE TERP3(IM,IXZ1,IXQ1,IXZ2,IXQ2,NM,NXQ1,NXQ2, & !$OMP PARALLEL DO DEFAULT(PRIVATE) SHARED(IM,IXZ1,IXQ1,IXZ2), & !$OMP& SHARED(IXQ2,NM,NXQ1,NXQ2,KM1,KXZ1,KXQ1,Z1,Q1,KM2,KXZ2), & !$OMP& SHARED(KXQ2,Z2,Q2,K1S) - DO K2=1,KM2 DO I=1,IM K1=K1S(I,K2) @@ -1490,6 +1490,7 @@ SUBROUTINE TERP3(IM,IXZ1,IXQ1,IXZ2,IXQ2,NM,NXQ1,NXQ2, & ONE/(Z1D-Z1C) ENDIF ENDDO + ! INTERPOLATE. DO N=1,NM DO I=1,IM @@ -1608,23 +1609,24 @@ SUBROUTINE RSEARCH(IM,KM1,IXZ1,KXZ1,Z1,KM2,IXZ2,KXZ2,Z2,IXL2,KXL2,L2) REAL(ESMF_KIND_R8),INTENT(IN) :: Z1(1+(IM-1)*IXZ1+(KM1-1)*KXZ1) REAL(ESMF_KIND_R8),INTENT(IN) :: Z2(1+(IM-1)*IXZ2+(KM2-1)*KXZ2) - INTEGER :: I,K2,L + INTEGER :: I,K2,L REAL(ESMF_KIND_R8) :: Z + ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! FIND THE SURROUNDING INPUT INTERVAL FOR EACH OUTPUT POINT. DO I=1,IM IF (Z1(1+(I-1)*IXZ1).LE.Z1(1+(I-1)*IXZ1+(KM1-1)*KXZ1)) THEN ! INPUT COORDINATE IS MONOTONICALLY ASCENDING. - DO K2=1,KM2 - Z=Z2(1+(I-1)*IXZ2+(K2-1)*KXZ2) + DO K2=1,KM2 + Z=Z2(1+(I-1)*IXZ2+(K2-1)*KXZ2) L=0 DO IF(Z.LT.Z1(1+(I-1)*IXZ1+L*KXZ1)) EXIT L=L+1 IF(L.EQ.KM1) EXIT - ENDDO + ENDDO L2(1+(I-1)*IXL2+(K2-1)*KXL2)=L ENDDO ELSE @@ -1636,7 +1638,7 @@ SUBROUTINE RSEARCH(IM,KM1,IXZ1,KXZ1,Z1,KM2,IXZ2,KXZ2,Z2,IXL2,KXL2,L2) IF(Z.GT.Z1(1+(I-1)*IXZ1+L*KXZ1)) EXIT L=L+1 IF(L.EQ.KM1) EXIT - ENDDO + ENDDO L2(1+(I-1)*IXL2+(K2-1)*KXL2)=L ENDDO ENDIF @@ -1730,7 +1732,7 @@ subroutine compute_zh deallocate(pe0, pn0) end subroutine compute_zh - + subroutine cleanup_target_atm_b4adj_data implicit none diff --git a/sorc/chgres_cube.fd/chgres.F90 b/sorc/chgres_cube.fd/chgres.F90 index 8dedc1122..0d3fcecbd 100644 --- a/sorc/chgres_cube.fd/chgres.F90 +++ b/sorc/chgres_cube.fd/chgres.F90 @@ -14,8 +14,9 @@ program chgres use atmosphere, only : atmosphere_driver use program_setup, only : read_setup_namelist, & + read_varmap, & convert_atm, & - convert_sfc + convert_sfc use model_grid, only : define_target_grid, & define_input_grid, & @@ -60,14 +61,20 @@ program chgres !------------------------------------------------------------------------- call read_setup_namelist + +!------------------------------------------------------------------------- +! Read variable mapping file (used for grib2 input data only). +!------------------------------------------------------------------------- + + call read_varmap !------------------------------------------------------------------------- ! Create esmf grid objects for input and target grids. !------------------------------------------------------------------------- - call define_input_grid(localpet, npets) - call define_target_grid(localpet, npets) + + call define_input_grid(localpet, npets) !------------------------------------------------------------------------- ! Convert atmospheric fields diff --git a/sorc/chgres_cube.fd/grib2_util.F90 b/sorc/chgres_cube.fd/grib2_util.F90 new file mode 100644 index 000000000..64a1cdb71 --- /dev/null +++ b/sorc/chgres_cube.fd/grib2_util.F90 @@ -0,0 +1,77 @@ +module grib2_util + +!-------------------------------------------------------------------------- +! Module: grib2_util +! +! Abstract: Utilities for use when reading grib2 data. +! +!-------------------------------------------------------------------------- + +use esmf + +use model_grid, only : i_input, j_input + +implicit none + +contains + + subroutine rh2spfh(rh_sphum,p,t) + + implicit none + real,parameter :: alpha=-9.477E-4 , & !K^-1, + Tnot=273.15, & !K + Lnot=2.5008E6, & !JKg^-1 + Rv=461.51, & !JKg^-1K^-1 + esnot=611.21 !Pa + + real(esmf_kind_r4), intent(inout), dimension(i_input,j_input) ::rh_sphum + real(esmf_kind_r8), intent(in) :: p, t(i_input,j_input) + + real, dimension(i_input,j_input) :: es, e, rh + + print*,"- CONVERT RH TO SPFH AT LEVEL ", p + + rh = rh_sphum + !print *, 'T = ', T, ' RH = ', RH, ' P = ', P + es = esnot * exp( Lnot/Rv * ((t-Tnot)/(t*tnot) + alpha * LOG(t/Tnot) - alpha * (t-Tnot)/ t)) + !print *, 'es = ', es + e = rh * es / 100.0 + !print *, 'e = ', e + rh_sphum = 0.622 * e / p + !print *, 'q = ', sphum + + !if (P .eq. 100000.0) THEN + ! print *, 'T = ', T, ' RH = ', RH, ' P = ', P, ' es = ', es, ' e = ', e, ' q = ', sphum + !end if + +end subroutine RH2SPFH + +subroutine convert_omega(omega,p,t,q,clb,cub) + + implicit none + real(esmf_kind_r8), pointer :: omega(:,:,:), p(:,:,:), t(:,:,:), q(:,:,:),omtmp,ptmp + + integer :: clb(3), cub(3), i ,j, k + + real, parameter :: Rd = 287.15_esmf_kind_r8, & !JKg^-1K^-1 + Rv=461.51_esmf_kind_r8, & !JKg^-1K^-1 + g = 9.81_esmf_kind_r8 ! ms^-2 + + real(esmf_kind_r8) :: tv, w + + do k = clb(3),cub(3) + do j = clb(2),cub(2) + do i = clb(1),cub(1) + tv = t(i,j,k)*(1+Rd/Rv*q(i,j,k)) + omtmp=>omega(i,j,k) + ptmp=>p(i,j,k) + + w = -1 * omtmp * Rd * tv / (ptmp * g) + omega(i,j,k)=w + enddo + enddo + enddo + +end subroutine convert_omega + + end module grib2_util diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index c813e0a6a..5795fd6f2 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -31,20 +31,23 @@ module input_data nst_files_input_grid, & sfc_files_input_grid, & atm_files_input_grid, & + grib2_file_input_grid, & atm_core_files_input_grid, & atm_tracer_files_input_grid, & convert_nst, & orog_dir_input_grid, & orog_files_input_grid, & tracers_input, num_tracers, & - input_type + input_type, tracers, & + get_var_cond, read_from_input use model_grid, only : input_grid, & i_input, j_input, & ip1_input, jp1_input, & num_tiles_input_grid, & latitude_input_grid, & - longitude_input_grid + longitude_input_grid, & + inv_file implicit none @@ -96,8 +99,10 @@ module input_data type(esmf_field), public :: veg_type_input_grid ! vegetation type type(esmf_field), public :: z0_input_grid ! roughness length - integer, parameter, public :: lsoil_input=4 ! # of soil layers, + integer, public :: lsoil_input=4 ! # of soil layers, ! # hardwire for now + + character(len=50), private, allocatable :: slevs(:) ! Fields associated with the nst model. @@ -150,6 +155,8 @@ subroutine read_input_atm_data(localpet) call read_input_atm_gfs_gaussian_file(localpet) elseif (trim(input_type) == "gfs_spectral") then ! spectral gfs sigio format. call read_input_atm_gfs_spectral_file(localpet) + elseif (trim(input_type) == "grib2") then + call read_input_atm_grib2_file(localpet) endif end subroutine read_input_atm_data @@ -484,6 +491,8 @@ subroutine read_input_sfc_data(localpet) call read_input_sfc_gfs_gaussian_file(localpet) elseif (trim(input_type) == "gfs_spectral") then call read_input_sfc_gfs_sfcio_file(localpet) + elseif (trim(input_type) == "grib2") then + call read_input_sfc_grib2_file(localpet) endif end subroutine read_input_sfc_data @@ -2149,6 +2158,567 @@ subroutine read_input_atm_history_file(localpet) call ESMF_FieldDestroy(dpres_input_grid, rc=rc) end subroutine read_input_atm_history_file + +!--------------------------------------------------------------------------- +! Read input grid atmospheric grib2 files. +!--------------------------------------------------------------------------- + + subroutine read_input_atm_grib2_file(localpet) + + use wgrib2api + + use grib2_util, only : rh2spfh, convert_omega + + implicit none + + integer, intent(in) :: localpet + + integer, parameter :: ntrac_max=14 + + character(len=300) :: the_file + character(len=20) :: vlevtyp, vname, lvl_str,lvl_str_space, & + trac_names_grib_1(ntrac_max), & + trac_names_grib_2(ntrac_max), & + trac_names_vmap(ntrac_max), & + tracers_input_grib_1(num_tracers), & + tracers_input_grib_2(num_tracers), & + tmpstr, & + method, tracers_input_vmap(num_tracers), & + tracers_default(ntrac_max), vname2 + character (len=500) :: metadata + + integer :: i, j, k, n, lvl_str_space_len + integer :: rc, clb(3), cub(3) + integer :: vlev, iret,varnum + + integer :: len_str + logical :: lret + + logical :: conv_omega=.false., & + hasspfh=.true. + + real(esmf_kind_r8), allocatable :: rlevs(:) + real(esmf_kind_r4), allocatable :: dummy2d(:,:) + real(esmf_kind_r8), allocatable :: dummy3d(:,:,:), dummy2d_8(:,:) + real(esmf_kind_r8), pointer :: presptr(:,:,:), psptr(:,:),tptr(:,:,:), & + qptr(:,:,:), wptr(:,:,:), & + uptr(:,:,:), vptr(:,:,:) + real(esmf_kind_r4) :: value + real(esmf_kind_r8), parameter :: p0 = 100000.0 + + + tracers(:) = "NULL" + !trac_names_grib = (/":SPFH:",":CLWR:", "O3MR",":CICE:", ":RWMR:",":SNMR:",":GRLE:", & + ! ":TCDC:", ":NCCICE:",":SPNCR:", ":NCONCD:",":PMTF:",":PMTC:",":TKE:"/) + trac_names_grib_1 = (/":var0_2", ":var0_2", ":var0_2", ":var0_2", ":var0_2",":var0_2", \ + ":var0_2", ":var0_2", ":var0_2", ":var0_2", ":var0_2",":var0_2", \ + ":var0_2", ":var0_2"/) + trac_names_grib_2 = (/"_1_0: ", "_1_22: ", "_14_192:", "_1_23: ", "_1_24: ","_1_25: ", \ + "_1_32: ", "_6_1: ", "_6_29: ", "_1_100: ", "_6_28: ","_13_193:", \ + "_13_192:", "_2_2: "/) + trac_names_vmap = (/"sphum ", "liq_wat ", "o3mr ", "ice_wat ", & + "rainwat ", "snowwat ", "graupel ", "cld_amt ", "ice_nc ", & + "rain_nc ", "water_nc", "liq_aero", "ice_aero", & + "sgs_tke "/) + tracers_default = (/"sphum ", "liq_wat ", "o3mr ", "ice_wat ", & + "rainwat ", "snowwat ", "graupel ", "cld_amt ", "ice_nc ", & + "rain_nc ", "water_nc", "liq_aero", "ice_aero", & + "sgs_tke "/) + + the_file = trim(data_dir_input_grid) // "/" // trim(grib2_file_input_grid) + + print*,"- READ ATMOS DATA FROM GRIB2 FILE: ", trim(the_file) + print*,"- USE INVENTORY FILE ", inv_file + + print*,"- OPEN FILE." + inquire(file=the_file,exist=lret) + if (.not.lret) call error_handler("OPENING GRIB2 ATM FILE.", iret) + + print*,"- READ VERTICAL COORDINATE." + iret = grb2_inq(the_file,inv_file,":var_0_2","_0_0:"," hybrid level:") + + if (iret <= 0) then + lvl_str = "mb:" + lvl_str_space = " mb:" + lvl_str_space_len = 4 + iret = grb2_inq(the_file,inv_file,":UGRD:",lvl_str_space) + lev_input=iret + if (localpet == 0) print*,"- DATA IS ON ", lev_input, " ISOBARIC LEVELS." + else + call error_handler("HYBRID VERTICAL COORD DATA NOT SUPPORTED", -1) + endif + + allocate(slevs(lev_input)) + allocate(rlevs(lev_input)) + levp1_input = lev_input + 1 + +! Get the vertical levels, and search string by sequential reads + + do i = 1,lev_input + iret=grb2_inq(the_file,inv_file,':UGRD:',trim(lvl_str),sequential=i-1,desc=metadata) + if (iret.ne.1) call error_handler(" IN SEQUENTIAL FILE READ.", iret) + + j = index(metadata,':UGRD:') + len(':UGRD:') + k = index(metadata,trim(lvl_str_space)) + len(trim(lvl_str_space))-1 + + read(metadata(j:k),*) rlevs(i) + + slevs(i) = metadata(j-1:k) + rlevs(i) = rlevs(i) * 100.0 + if (localpet==0) print*, "- LEVEL = ", slevs(i) + enddo + +! Jili Dong add sort to re-order isobaric levels. + + call quicksort(rlevs,1,lev_input) + + do i = 1,lev_input + write(slevs(i),"(F20.10)") rlevs(i)/100.0 + len_str = len_trim(slevs(i)) + + do while (slevs(i)(len_str:len_str) .eq. '0') + slevs(i) = slevs(i)(:len_str-1) + len_str = len_str - 1 + end do + + if (slevs(i)(len_str:len_str) .eq. '.') then + slevs(i) = slevs(i)(:len_str-1) + len_str = len_str - 1 + end if + + slevs(i) = trim(slevs(i)) + + slevs(i) = ":"//trim(adjustl(slevs(i)))//" mb:" + if (localpet==0) print*, "- LEVEL AFTER SORT = ",slevs(i) + enddo + + if (localpet == 0) print*,"- FIND SPFH OR RH IN FILE" + iret = grb2_inq(the_file,inv_file,trac_names_grib_1(1),trac_names_grib_2(1),lvl_str_space) + + if (iret <= 0) then + iret = grb2_inq(the_file,inv_file, ':var0_2','_1_1:',lvl_str_space) + if (iret <= 0) call error_handler("READING ATMOSPHERIC WATER VAPOR VARIABLE.", iret) + hasspfh = .false. + trac_names_grib_2(1)='_1_1:' + if (localpet == 0) print*,"- FILE CONTAINS RH." + else + if (localpet == 0) print*,"- FILE CONTAINS SPFH." + endif + + print*,"- COUNT NUMBER OF TRACERS TO BE READ IN BASED ON PHYSICS SUITE TABLE" + do n = 1, num_tracers + + vname = tracers_input(n) + + i = maxloc(merge(1.,0.,trac_names_vmap == vname),dim=1) + + tracers_input_grib_1(n) = trac_names_grib_1(i) + tracers_input_grib_2(n) = trac_names_grib_2(i) + tracers_input_vmap(n)=trac_names_vmap(i) + tracers(n)=tracers_default(i) + + enddo + + if (localpet==0) print*, "- NUMBER OF TRACERS IN FILE = ", num_tracers + + if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID SURFACE PRESSURE." + ps_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID TEMPERATURE." + temp_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_input/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + allocate(tracers_input_grid(num_tracers)) + + do i = 1,num_tracers + if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID TRACER ", trim(tracers_input(i)) + + tracers_input_grid(i) = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_input/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + enddo + + if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID U." + u_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_input/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID V." + v_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_input/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID DZDT." + dzdt_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_input/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID TERRAIN." + terrain_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + if (localpet == 0) then + allocate(dummy2d(i_input,j_input)) + allocate(dummy2d_8(i_input,j_input)) + allocate(dummy3d(i_input,j_input,lev_input)) + else + allocate(dummy2d(0,0)) + allocate(dummy2d_8(0,0)) + allocate(dummy3d(0,0,0)) + endif + +!----------------------------------------------------------------------- +! Fields in non-native files read in from top to bottom. We will +! flip indices later. This program expects bottom to top. +!----------------------------------------------------------------------- + + if (localpet == 0) then + print*,"- READ TEMPERATURE." + vname = ":TMP:" + do vlev = 1, lev_input + iret = grb2_inq(the_file,inv_file,vname,slevs(vlev),data2=dummy2d) + if (iret<=0) then + call error_handler("READING IN TEMPERATURE AT LEVEL "//trim(slevs(vlev)),iret) + endif + dummy3d(:,:,vlev) = real(dummy2d,esmf_kind_r8) + print*,'temp check after read ',vlev, dummy3d(1,1,vlev) + enddo + endif + + if (localpet == 0) print*,"- CALL FieldScatter FOR INPUT GRID TEMPERATURE." + call ESMF_FieldScatter(temp_input_grid, dummy3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + do n = 1, num_tracers + + if (localpet == 0) print*,"- READ ", trim(tracers_input_vmap(n)) + vname = tracers_input_vmap(n) + call get_var_cond(vname,this_miss_var_method=method, this_miss_var_value=value, & + this_field_var_name=tmpstr,loc=varnum) + if (n==1 .and. .not. hasspfh) then + print*,"- CALL FieldGather TEMPERATURE." + call ESMF_FieldGather(temp_input_grid,dummy3d,rootPet=0, tile=1, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + endif + if (localpet == 0) then + vname = trim(tracers_input_grib_1(n)) + vname2 = trim(tracers_input_grib_2(n)) + + do vlev = 1, lev_input + iret = grb2_inq(the_file,inv_file,vname,slevs(vlev),vname2,data2=dummy2d) + + if (iret <= 0) then + call handle_grib_error(vname, slevs(vlev),method,value,varnum,iret,var=dummy2d) + if (iret==1) then ! missing_var_method == skip or no entry + if (trim(vname2)=="_1_0:" .or. trim(vname2) == "_1_1:" .or. & + trim(vname2) == ":14:192:") then + call error_handler("READING IN "//trim(vname)//" AT LEVEL "//trim(slevs(vlev))& + //". SET A FILL VALUE IN THE VARMAP TABLE IF THIS ERROR IS NOT DESIRABLE.",iret) + else + exit + endif + endif + endif + + if (n==1 .and. .not. hasspfh) then + call rh2spfh(dummy2d,rlevs(vlev),dummy3d(:,:,vlev)) + endif + + print*,'tracer ',vlev, maxval(dummy2d),minval(dummy2d) + dummy3d(:,:,vlev) = real(dummy2d,esmf_kind_r8) + enddo + endif + + if (localpet == 0) print*,"- CALL FieldScatter FOR INPUT ", trim(tracers_input_vmap(n)) + call ESMF_FieldScatter(tracers_input_grid(n), dummy3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + enddo + + if (localpet==0) then + do vlev = 1, lev_input + + vname = ":var0_2" + vname2 = "_2_2:" + iret = grb2_inq(the_file,inv_file,vname,vname2,slevs(vlev),data2=dummy2d) + if (iret<=0) then + call error_handler("READING UWIND AT LEVEL "//trim(slevs(vlev)),iret) + endif + + print*, 'max, min U ', minval(dummy2d), maxval(dummy2d) + dummy3d(:,:,vlev) = real(dummy2d,esmf_kind_r8) + + enddo + endif + + if (localpet == 0) print*,"- CALL FieldScatter FOR INPUT U-WIND." + call ESMF_FieldScatter(u_input_grid, dummy3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + if (localpet==0) then + do vlev = 1, lev_input + + vname = ":var0_2" + vname2 = "_2_3:" + iret = grb2_inq(the_file,inv_file,vname,vname2,slevs(vlev),data2=dummy2d) + if (iret<=0) then + call error_handler("READING VWIND AT LEVEL "//trim(slevs(vlev)),iret) + endif + + print*, 'max, min V ', minval(dummy2d), maxval(dummy2d) + dummy3d(:,:,vlev) = real(dummy2d,esmf_kind_r8) + + enddo + endif + + if (localpet == 0) print*,"- CALL FieldScatter FOR INPUT V-WIND." + call ESMF_FieldScatter(v_input_grid, dummy3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ SURFACE PRESSURE." + !vname = ":PRES:" + vname = ":var0_2" + vname2 = "_3_0:" + vlevtyp = ":surface:" + iret = grb2_inq(the_file,inv_file,vname,vname2,vlevtyp,data2=dummy2d) + if (iret <= 0) call error_handler("READING SURFACE PRESSURE RECORD.", iret) + dummy2d_8 = real(dummy2d,esmf_kind_r8) + endif + + if (localpet == 0) print*,"- CALL FieldScatter FOR INPUT GRID SURFACE PRESSURE." + call ESMF_FieldScatter(ps_input_grid, dummy2d_8, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ DZDT." + vname = "dzdt" + call get_var_cond(vname,this_miss_var_method=method, this_miss_var_value=value, & + loc=varnum) + !vname = ":DZDT:" + vname = ":var0_2" + vname2 = "_2_9:" + do vlev = 1, lev_input + iret = grb2_inq(the_file,inv_file,vname,vname2,slevs(vlev),data2=dummy2d) + if (iret <= 0 ) then + print*,"DZDT not available at level ", trim(slevs(vlev)), " so checking for VVEL" + !vname = ":VVEL:" + vname2 = "_2_8:" + iret = grb2_inq(the_file,inv_file,vname,vname2,slevs(vlev),data2=dummy2d) + + + if (iret <= 0) then + call handle_grib_error(vname, slevs(vlev),method,value,varnum,iret,var=dummy2d) + if (iret==1) then ! missing_var_method == skip + cycle + endif + else + conv_omega = .true. + endif + + endif + print*,'dzdt ',vlev, maxval(dummy2d),minval(dummy2d) + dummy3d(:,:,vlev) = dummy2d + enddo + endif + + if (localpet == 0) print*,"- CALL FieldScatter FOR INPUT DZDT." + call ESMF_FieldScatter(dzdt_input_grid, dummy3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ TERRAIN." + !vname = ":HGT:" + vname = ":var0_2" + vname2 = "_3_5:" + vlevtyp = ":surface:" + iret = grb2_inq(the_file,inv_file,vname,vname2,vlevtyp,data2=dummy2d) + if (iret <= 0) call error_handler("READING TERRAIN HEIGHT RECORD.", iret) + dummy2d_8 = real(dummy2d,esmf_kind_r8) + endif + + if (localpet == 0) print*,"- CALL FieldScatter FOR INPUT GRID TERRAIN." + call ESMF_FieldScatter(terrain_input_grid, dummy2d_8, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID PRESSURE." + pres_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_input/), rc=rc) + + deallocate(dummy2d, dummy3d, dummy2d_8) + +!--------------------------------------------------------------------------- +! Flip 'z' indices to all 3-d variables. Data is read in from model +! top to surface. This program expects surface to model top. +!--------------------------------------------------------------------------- + + if (localpet == 0) print*,"- CALL FieldGet FOR SURFACE PRESSURE." + nullify(psptr) + call ESMF_FieldGet(ps_input_grid, & + farrayPtr=psptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + nullify(presptr) + if (localpet == 0) print*,"- CALL FieldGet FOR 3-D PRESSURE." + call ESMF_FieldGet(pres_input_grid, & + computationalLBound=clb, & + computationalUBound=cub, & + farrayPtr=presptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + nullify(tptr) + if (localpet == 0) print*,"- CALL FieldGet TEMPERATURE." + call ESMF_FieldGet(temp_input_grid, & + farrayPtr=tptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + nullify(uptr) + if (localpet == 0) print*,"- CALL FieldGet FOR U" + call ESMF_FieldGet(u_input_grid, & + farrayPtr=uptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + nullify(vptr) + if (localpet == 0) print*,"- CALL FieldGet FOR V" + call ESMF_FieldGet(v_input_grid, & + farrayPtr=vptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + nullify(wptr) + if (localpet == 0) print*,"- CALL FieldGet FOR W" + call ESMF_FieldGet(dzdt_input_grid, & + farrayPtr=wptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + if (localpet == 0) print*,"- CALL FieldGet FOR TRACERS." + do n=1,num_tracers + nullify(qptr) + call ESMF_FieldGet(tracers_input_grid(n), & + farrayPtr=qptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + do i = clb(1),cub(1) + do j = clb(2),cub(2) + qptr(i,j,:) = qptr(i,j,lev_input:1:-1) + end do + end do + end do + + do i = clb(1),cub(1) + do j = clb(2),cub(2) + presptr(i,j,:) = rlevs(lev_input:1:-1) + tptr(i,j,:) = tptr(i,j,lev_input:1:-1) + uptr(i,j,:) = uptr(i,j,lev_input:1:-1) + vptr(i,j,:) = vptr(i,j,lev_input:1:-1) + wptr(i,j,:) = wptr(i,j,lev_input:1:-1) + end do + end do + + if (localpet == 0) then + print*,'psfc is ',clb(1),clb(2),psptr(clb(1),clb(2)) + print*,'pres is ',cub(1),cub(2),presptr(cub(1),cub(2),:) + + print*,'pres check 1',localpet,maxval(presptr(clb(1):cub(1),clb(2):cub(2),1)), & + minval(presptr(clb(1):cub(1),clb(2):cub(2),1)) + print*,'pres check lev',localpet,maxval(presptr(clb(1):cub(1),clb(2):cub(2), & + lev_input)),minval(presptr(clb(1):cub(1),clb(2):cub(2),lev_input)) + endif + +!--------------------------------------------------------------------------- +! Convert from 2-d to 3-d component winds. +!--------------------------------------------------------------------------- + + call convert_winds + +!--------------------------------------------------------------------------- +! Convert dpdt to dzdt if needed +!--------------------------------------------------------------------------- + + if (conv_omega) then + + if (localpet == 0) print*,"- CONVERT FROM OMEGA TO DZDT." + + nullify(tptr) + if (localpet == 0) print*,"- CALL FieldGet TEMPERATURE." + call ESMF_FieldGet(temp_input_grid, & + farrayPtr=tptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + nullify(qptr) + if (localpet == 0) print*,"- CALL FieldGet SPECIFIC HUMIDITY." + call ESMF_FieldGet(tracers_input_grid(1), & + computationalLBound=clb, & + computationalUBound=cub, & + farrayPtr=qptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + nullify(wptr) + if (localpet == 0) print*,"- CALL FieldGet DZDT." + call ESMF_FieldGet(dzdt_input_grid, & + computationalLBound=clb, & + computationalUBound=cub, & + farrayPtr=wptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + nullify(presptr) + call ESMF_FieldGet(pres_input_grid, & + farrayPtr=presptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + call convert_omega(wptr,presptr,tptr,qptr,clb,cub) + + endif + + end subroutine read_input_atm_grib2_file !--------------------------------------------------------------------------- ! Read input grid surface data from a spectral gfs gaussian sfcio file. @@ -3738,6 +4308,516 @@ subroutine read_input_sfc_history_file(localpet) end subroutine read_input_sfc_history_file + subroutine read_input_sfc_grib2_file(localpet) + + use wgrib2api + + implicit none + + integer, intent(in) :: localpet + + character(len=250) :: the_file + character(len=20) :: vname, vname_file,slev + + character(len=50) :: method + + integer :: rc, varnum, iret, i, j,k + integer, parameter :: icet_default = 265.0 + + logical :: exist + + real(esmf_kind_r4) :: value + + real(esmf_kind_r4), allocatable :: dummy2d(:,:),tsk_save(:,:),icec_save(:,:) + real(esmf_kind_r8), allocatable :: dummy2d_8(:,:) + real(esmf_kind_r8), allocatable :: dummy3d(:,:,:) + integer(esmf_kind_i4), allocatable :: slmsk_save(:,:) + + + the_file = trim(data_dir_input_grid) // "/" // trim(grib2_file_input_grid) + + print*,"- READ SFC DATA FROM GRIB2 FILE: ", trim(the_file) + inquire(file=the_file,exist=exist) + if (.not.exist) then + iret = 1 + call error_handler("OPENING GRIB2 FILE.", iret) + end if + + lsoil_input = grb2_inq(the_file, inv_file, ':TSOIL:',' below ground:') + print*, "- FILE HAS ", lsoil_input, " SOIL LEVELS" + if (lsoil_input <= 0) call error_handler("COUNTING SOIL LEVELS.", rc) + + if (localpet == 0) then + allocate(dummy2d(i_input,j_input)) + allocate(slmsk_save(i_input,j_input)) + allocate(tsk_save(i_input,j_input)) + allocate(icec_save(i_input,j_input)) + allocate(dummy2d_8(i_input,j_input)) + allocate(dummy3d(i_input,j_input,lsoil_input)) + else + allocate(dummy3d(0,0,0)) + allocate(dummy2d_8(0,0)) + allocate(dummy2d(0,0)) + + endif + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! These variables are always in grib files, or are required, so no need to check for them + ! in the varmap table. If they can't be found in the input file, then stop the program. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + if (localpet == 0) then + print*,"- READ TERRAIN." + rc = grb2_inq(the_file, inv_file, ':HGT:',':surface:', data2=dummy2d) + if (rc /= 1) call error_handler("READING TERRAIN.", rc) + print*,'orog ',maxval(dummy2d),minval(dummy2d) + endif + + print*,"- CALL FieldScatter FOR INPUT TERRAIN." + call ESMF_FieldScatter(terrain_input_grid, real(dummy2d,esmf_kind_r8),rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + +if (localpet == 0) then + print*,"- READ SEAICE FRACTION." + rc = grb2_inq(the_file, inv_file, ':ICEC:',':surface:', data2=dummy2d) + if (rc /= 1) call error_handler("READING SEAICE FRACTION.", rc) + !dummy2d = dummy2d(i_input:1:-1,j_input:1:-1) + print*,'icec ',maxval(dummy2d),minval(dummy2d) + icec_save = dummy2d + endif + + print*,"- CALL FieldScatter FOR INPUT GRID SEAICE FRACTION." + call ESMF_FieldScatter(seaice_fract_input_grid,real(dummy2d,esmf_kind_r8),rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + +!---------------------------------------------------------------------------------- +! GFS v14 and v15.2 grib data has two land masks. LANDN is created by +! nearest neighbor interpolation. LAND is created by bilinear interpolation. +! LANDN matches the bitmap. So use it first. For other GFS versions, use LAND. +! Mask in grib file is '1' (land), '0' (not land). Add sea/lake ice category +! '2' based on ice concentration. +!---------------------------------------------------------------------------------- + + if (localpet == 0) then + print*,"- READ LANDSEA MASK." + rc = grb2_inq(the_file, inv_file, ':LANDN:',':surface:', data2=dummy2d) + + if (rc /= 1) then + rc = grb2_inq(the_file, inv_file, ':LAND:',':surface:', data2=dummy2d) + if (rc /= 1) call error_handler("READING LANDSEA MASK.", rc) + endif + + do j = 1, j_input + do i = 1, i_input + if(dummy2d(i,j) < 0.5_esmf_kind_r4) dummy2d(i,j)=0.0_esmf_kind_r4 + if(icec_save(i,j) > 0.15_esmf_kind_r4) then + !if (dummy2d(i,j) == 0.0_esmf_kind_r4) print*, "CONVERTING WATER TO SEA/LAKE ICE AT ", i, j + dummy2d(i,j) = 2.0_esmf_kind_r4 + endif + enddo + enddo + + slmsk_save = nint(dummy2d) + + deallocate(icec_save) + endif + + print*,"- CALL FieldScatter FOR INPUT LANDSEA MASK." + call ESMF_FieldScatter(landsea_mask_input_grid,real(dummy2d,esmf_kind_r8),rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ SEAICE SKIN TEMPERATURE." + rc = grb2_inq(the_file, inv_file, ':TMP:',':surface:', data2=dummy2d) + if (rc /= 1) call error_handler("READING SEAICE SKIN TEMP.", rc) + print*,'ti ',maxval(dummy2d),minval(dummy2d) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID SEAICE SKIN TEMPERATURE." + call ESMF_FieldScatter(seaice_skin_temp_input_grid,real(dummy2d,esmf_kind_r8),rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + +!---------------------------------------------------------------------------------- +! Read snow fields. Zero out at non-land points and undefined points (points +! removed using the bitmap). Program expects depth and liquid equivalent +! in mm. +!---------------------------------------------------------------------------------- + + if (localpet == 0) then + print*,"- READ SNOW LIQUID EQUIVALENT." + rc = grb2_inq(the_file, inv_file, ':WEASD:',':surface:',':anl:',data2=dummy2d) + if (rc /= 1) then + rc = grb2_inq(the_file, inv_file, ':WEASD:',':surface:','hour fcst:',data2=dummy2d) + if (rc /= 1) call error_handler("READING SNOW LIQUID EQUIVALENT.", rc) + endif + do j = 1, j_input + do i = 1, i_input + if(slmsk_save(i,j) == 0) dummy2d(i,j) = 0.0_esmf_kind_r4 + if(dummy2d(i,j) == grb2_UNDEFINED) dummy2d(i,j) = 0.0_esmf_kind_r4 + enddo + enddo +! print*,'weasd ',maxval(dummy2d),minval(dummy2d) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID SNOW LIQUID EQUIVALENT." + call ESMF_FieldScatter(snow_liq_equiv_input_grid,real(dummy2d,esmf_kind_r8),rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ SNOW DEPTH." + rc = grb2_inq(the_file, inv_file, ':SNOD:',':surface:', data2=dummy2d) + if (rc /= 1) call error_handler("READING SNOW DEPTH.", rc) + where(dummy2d == grb2_UNDEFINED) dummy2d = 0.0_esmf_kind_r4 + dummy2d = dummy2d*1000.0 ! Grib2 files have snow depth in (m), fv3 expects it in mm + where(slmsk_save == 0) dummy2d = 0.0_esmf_kind_r4 +! print*,'snod ',maxval(dummy2d),minval(dummy2d) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID SNOW DEPTH." + call ESMF_FieldScatter(snow_depth_input_grid,real(dummy2d,esmf_kind_r8),rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ T2M." + rc = grb2_inq(the_file, inv_file, ':TMP:',':2 m above ground:',data2=dummy2d) + if (rc <= 0) call error_handler("READING T2M.", rc) + + print*,'t2m ',maxval(dummy2d),minval(dummy2d) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID T2M." + call ESMF_FieldScatter(t2m_input_grid,real(dummy2d,esmf_kind_r8), rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ Q2M." + rc = grb2_inq(the_file, inv_file, ':SPFH:',':2 m above ground:',data2=dummy2d) + if (rc <=0) call error_handler("READING Q2M.", rc) + print*,'q2m ',maxval(dummy2d),minval(dummy2d) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID Q2M." + call ESMF_FieldScatter(q2m_input_grid,real(dummy2d,esmf_kind_r8), rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + +if (localpet == 0) then + print*,"- READ SKIN TEMPERATURE." + rc = grb2_inq(the_file, inv_file, ':TMP:',':surface:', data2=dummy2d) + if (rc <= 0 ) call error_handler("READING SKIN TEMPERATURE.", rc) + tsk_save(:,:) = dummy2d + dummy2d_8 = real(dummy2d,esmf_kind_r8) + + print*,'tmp ',maxval(dummy2d),minval(dummy2d) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID SKIN TEMPERATURE" + call ESMF_FieldScatter(skin_temp_input_grid,real(dummy2d,esmf_kind_r8),rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) dummy2d = 0.0 + + print*,"- CALL FieldScatter FOR INPUT GRID SRFLAG" + call ESMF_FieldScatter(srflag_input_grid,real(dummy2d,esmf_kind_r8), rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + +! Soil type is not available. Set to a large negative fill value. + + dummy2d_8 = -99999.0_esmf_kind_r8 + + print*,"- CALL FieldScatter FOR INPUT GRID SOIL TYPE." + call ESMF_FieldScatter(soil_type_input_grid,dummy2d_8, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! Begin variables whose presence in grib2 files varies, but no climatological + ! data is + ! available, so we have to account for values in the varmap table + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + if (localpet == 0) then + print*,"- READ SEAICE DEPTH." + vname="hice" + slev=":surface:" + call get_var_cond(vname,this_miss_var_method=method,this_miss_var_value=value, & + loc=varnum) + vname=":ICETK:" + rc= grb2_inq(the_file, inv_file, vname,slev, data2=dummy2d) + if (rc <= 0) then + call handle_grib_error(vname, slev ,method,value,varnum,rc, var= dummy2d) + if (rc==1) then ! missing_var_method == skip or no entry in varmap table + print*, "WARNING: "//trim(vname)//" NOT AVAILABLE IN FILE. THIS FIELD WILL BE"//& + " REPLACED WITH CLIMO. SET A FILL "// & + "VALUE IN THE VARMAP TABLE IF THIS IS NOT DESIRABLE." + dummy2d(:,:) = 0.0_esmf_kind_r4 + endif + endif + dummy2d_8= real(dummy2d,esmf_kind_r8) + print*,'hice ',maxval(dummy2d),minval(dummy2d) + + endif + + print*,"- CALL FieldScatter FOR INPUT GRID SEAICE DEPTH." + call ESMF_FieldScatter(seaice_depth_input_grid,dummy2d_8, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ TPRCP." + vname="tprcp" + slev=":surface:" + call get_var_cond(vname,this_miss_var_method=method,this_miss_var_value=value, & + loc=varnum) + vname=":TPRCP:" + rc= grb2_inq(the_file, inv_file, vname,slev, data2=dummy2d) + if (rc <= 0) then + call handle_grib_error(vname, slev ,method,value,varnum,rc, var= dummy2d) + if (rc==1) then ! missing_var_method == skip or no entry in varmap table + print*, "WARNING: "//trim(vname)//" NOT AVAILABLE IN FILE. THIS FIELD WILL NOT"//& + " BE WRITTEN TO THE INPUT FILE. SET A FILL "// & + "VALUE IN THE VARMAP TABLE IF THIS IS NOT DESIRABLE." + dummy2d(:,:) = 0.0_esmf_kind_r4 + endif + endif + dummy2d_8= real(dummy2d,esmf_kind_r8) + print*,'tprcp ',maxval(dummy2d),minval(dummy2d) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID TPRCP." + call ESMF_FieldScatter(tprcp_input_grid,dummy2d_8, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ FFMM." + vname="ffmm" + slev=":surface:" + call get_var_cond(vname,this_miss_var_method=method,this_miss_var_value=value, & + loc=varnum) + vname=":FFMM:" + rc= grb2_inq(the_file, inv_file, vname,slev, data2=dummy2d) + if (rc <= 0) then + call handle_grib_error(vname, slev ,method,value,varnum,rc, var= dummy2d) + if (rc==1) then ! missing_var_method == skip or no entry in varmap table + print*, "WARNING: "//trim(vname)//" NOT AVAILABLE IN FILE. THIS FIELD WILL NOT"//& + " BE WRITTEN TO THE INPUT FILE. SET A FILL "// & + "VALUE IN THE VARMAP TABLE IF THIS IS NOT DESIRABLE." + dummy2d(:,:) = 0.0_esmf_kind_r4 + endif + endif + dummy2d_8= real(dummy2d,esmf_kind_r8) + print*,'ffmm ',maxval(dummy2d),minval(dummy2d) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID FFMM" + call ESMF_FieldScatter(ffmm_input_grid,dummy2d_8, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ USTAR." + vname="fricv" + slev=":surface:" + call get_var_cond(vname,this_miss_var_method=method,this_miss_var_value=value, & + loc=varnum) + vname=":FRICV:" + rc= grb2_inq(the_file, inv_file, vname,slev, data2=dummy2d) + if (rc <= 0) then + call handle_grib_error(vname, slev ,method,value,varnum,rc, var= dummy2d) + if (rc==1) then ! missing_var_method == skip or no entry in varmap table + print*, "WARNING: "//trim(vname)//" NOT AVAILABLE IN FILE. THIS FIELD WILL "//& + "REPLACED WITH CLIMO. SET A FILL "// & + "VALUE IN THE VARMAP TABLE IF THIS IS NOT DESIRABLE." + dummy2d(:,:) = 0.0_esmf_kind_r4 + endif + endif + dummy2d_8= real(dummy2d,esmf_kind_r8) + print*,'fricv ',maxval(dummy2d),minval(dummy2d) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID USTAR" + call ESMF_FieldScatter(ustar_input_grid,dummy2d_8, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ F10M." + vname="f10m" + slev=":10 m above ground:" + call get_var_cond(vname,this_miss_var_method=method,this_miss_var_value=value, & + loc=varnum) + vname=":F10M:" + rc= grb2_inq(the_file, inv_file, vname,slev, data2=dummy2d) + if (rc <= 0) then + call handle_grib_error(vname, slev ,method,value,varnum,rc, var= dummy2d) + if (rc==1) then ! missing_var_method == skip or no entry in varmap table + print*, "WARNING: "//trim(vname)//" NOT AVAILABLE IN FILE. THIS FIELD WILL NOT"//& + " BE WRITTEN TO THE INPUT FILE. SET A FILL "// & + "VALUE IN THE VARMAP TABLE IF THIS IS NOT DESIRABLE." + dummy2d(:,:) = 0.0_esmf_kind_r4 + endif + endif + dummy2d_8= real(dummy2d,esmf_kind_r8) + print*,'f10m ',maxval(dummy2d),minval(dummy2d) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID F10M." + call ESMF_FieldScatter(f10m_input_grid,dummy2d_8, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ CANOPY MOISTURE CONTENT." + vname="cnwat" + slev=":surface:" + call get_var_cond(vname,this_miss_var_method=method,this_miss_var_value=value, & + loc=varnum) + vname=":CNWAT:" + rc= grb2_inq(the_file, inv_file, vname,slev, data2=dummy2d) + if (rc <= 0) then + call handle_grib_error(vname, slev ,method,value,varnum,rc, var= dummy2d) + if (rc==1) then ! missing_var_method == skip or no entry in varmap table + print*, "WARNING: "//trim(vname)//" NOT AVAILABLE IN FILE. THIS FIELD WILL"//& + " REPLACED WITH CLIMO. SET A FILL "// & + "VALUE IN THE VARMAP TABLE IF THIS IS NOT DESIRABLE." + dummy2d(:,:) = 0.0_esmf_kind_r4 + endif + endif + dummy2d_8= real(dummy2d,esmf_kind_r8) + print*,'cnwat ',maxval(dummy2d),minval(dummy2d) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID CANOPY MOISTURE CONTENT." + call ESMF_FieldScatter(canopy_mc_input_grid,dummy2d_8, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ Z0." + vname="sfcr" + slev=":surface:" + call get_var_cond(vname,this_miss_var_method=method,this_miss_var_value=value, & + loc=varnum) + vname=":SFCR:" + rc= grb2_inq(the_file, inv_file, vname,slev, data2=dummy2d) + if (rc <= 0) then + call handle_grib_error(vname, slev ,method,value,varnum,rc, var= dummy2d) + if (rc==1) then ! missing_var_method == skip or no entry in varmap table + print*, "WARNING: "//trim(vname)//" NOT AVAILABLE IN FILE. THIS FIELD WILL BE"//& + " REPLACED WITH CLIMO. SET A FILL "// & + "VALUE IN THE VARMAP TABLE IF THIS IS NOT DESIRABLE." + dummy2d(:,:) = 0.0_esmf_kind_r4 + endif + else + ! Grib files have z0 (m), but fv3 expects z0(cm) + dummy2d(:,:) = dummy2d(:,:)*10.0 + endif + dummy2d_8= real(dummy2d,esmf_kind_r8) + print*,'sfcr ',maxval(dummy2d),minval(dummy2d) + + endif + + print*,"- CALL FieldScatter FOR INPUT GRID Z0." + call ESMF_FieldScatter(z0_input_grid,dummy2d_8, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + deallocate(dummy2d) + + if (localpet == 0) then + print*,"- READ LIQUID SOIL MOISTURE." + vname = "soill" + vname_file = ":SOILL:" + call read_grib_soil(the_file,inv_file,vname,vname_file,dummy3d,rc) !!! NEEDTO HANDLE + !!! SOIL LEVELS + print*,'soill ',maxval(dummy3d),minval(dummy3d) + endif + + print*,"- CALL FieldScatter FOR INPUT LIQUID SOIL MOISTURE." + call ESMF_FieldScatter(soilm_liq_input_grid, dummy3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ TOTAL SOIL MOISTURE." + vname = "soilw" + !vname_file = "var2_2_1_7_0_192" !Some files don't recognize this as soilw,so use + vname_file = "var2_2_1_" ! the var number instead + call read_grib_soil(the_file,inv_file,vname,vname_file,dummy3d,rc) + print*,'soilm ',maxval(dummy3d),minval(dummy3d) + endif + +!----------------------------------------------------------------------- +! Vegetation type is not available. However, it is needed to identify +! permanent land ice points. At land ice, the total soil moisture +! is a flag value of '1'. Use this flag as a temporary solution. +!----------------------------------------------------------------------- + + if (localpet == 0) then + dummy2d_8(:,:) = 0.0_esmf_kind_r8 + do j = 1, j_input + do i = 1, i_input + if(slmsk_save(i,j) == 1_esmf_kind_i4 .and. dummy3d(i,j,1) > 0.99) & + dummy2d_8(i,j) = real(veg_type_landice_input,esmf_kind_r8) + enddo + enddo + endif + + print*,"- CALL FieldScatter FOR INPUT VEG TYPE." + call ESMF_FieldScatter(veg_type_input_grid, dummy2d_8, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + print*,"- CALL FieldScatter FOR INPUT TOTAL SOIL MOISTURE." + call ESMF_FieldScatter(soilm_tot_input_grid, dummy3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + +!--------------------------------------------------------------------------------- +! At open water (slmsk==0), the soil temperature array is not used and set +! to the filler value of SST. At lake/sea ice points (slmsk=2), the soil +! temperature array holds ice column temperature. That field is not available +! in GFS grib data, so set to a default value. +!--------------------------------------------------------------------------------- + + if (localpet == 0) then + print*,"- READ SOIL TEMPERATURE." + vname = "soilt" + vname_file = ":TSOIL:" + call read_grib_soil(the_file,inv_file,vname,vname_file,dummy3d,rc) + do k=1,lsoil_input + do j = 1, j_input + do i = 1, i_input + if (slmsk_save(i,j) == 0_esmf_kind_i4 ) dummy3d(i,j,k) = tsk_save(i,j) + if (slmsk_save(i,j) == 2_esmf_kind_i4 ) dummy3d(i,j,k) = icet_default + enddo + enddo + enddo + print*,'soilt ',maxval(dummy3d),minval(dummy3d) + + deallocate(tsk_save, slmsk_save) + endif + + print*,"- CALL FieldScatter FOR INPUT SOIL TEMPERATURE." + call ESMF_FieldScatter(soil_temp_input_grid, dummy3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + deallocate(dummy3d) + deallocate(dummy2d_8) + + end subroutine read_input_sfc_grib2_file + !--------------------------------------------------------------------------- ! Read nst data from tiled history or restart files. !--------------------------------------------------------------------------- @@ -4402,6 +5482,114 @@ subroutine convert_winds call ESMF_FieldDestroy(v_input_grid, rc=rc) end subroutine convert_winds + +subroutine handle_grib_error(vname,lev,method,value,varnum, iret,var,var8,var3d) + + use, intrinsic :: ieee_arithmetic + + implicit none + + real(esmf_kind_r4), intent(in) :: value + real(esmf_kind_r4), intent(inout), optional :: var(:,:) + real(esmf_kind_r8), intent(inout), optional :: var8(:,:) + real(esmf_kind_r8), intent(inout), optional :: var3d(:,:,:) + + character(len=20), intent(in) :: vname, lev, method + + integer, intent(in) :: varnum + integer, intent(inout) :: iret + + iret = 0 + if (varnum == 9999) then + print*, "WARNING: ", trim(vname), " NOT FOUND AT LEVEL ", lev, " IN EXTERNAL FILE ", & + "AND NO ENTRY EXISTS IN VARMAP TABLE. VARIABLE WILL NOT BE USED." + iret = 1 + + return + endif + + if (trim(method) == "skip" ) then + print*, "WARNING: SKIPPING ", trim(vname), " IN FILE" + read_from_input(varnum) = .false. + iret = 1 + elseif (trim(method) == "set_to_fill") then + print*, "WARNING: ,", trim(vname), " NOT AVILABLE AT LEVEL ", trim(lev), & + ". SETTING EQUAL TO FILL VALUE OF ", value + if(present(var)) var(:,:) = value + if(present(var8)) var8(:,:) = value + if(present(var3d)) var3d(:,:,:) = value + elseif (trim(method) == "set_to_NaN") then + print*, "WARNING: ,", trim(vname), " NOT AVILABLE AT LEVEL ", trim(lev), & + ". SETTING EQUAL TO NaNs" + if(present(var)) var(:,:) = ieee_value(var,IEEE_QUIET_NAN) + if(present(var8)) var8(:,:) = ieee_value(var8,IEEE_QUIET_NAN) + if(present(var3d)) var3d(:,:,:) = ieee_value(var3d,IEEE_QUIET_NAN) + elseif (trim(method) == "stop") then + call error_handler("READING "//trim(vname)// " at level "//lev//". TO MAKE THIS NON- & + FATAL, CHANGE STOP TO SKIP FOR THIS VARIABLE IN YOUR VARMAP & + FILE.", iret) + else + call error_handler("ERROR USING MISSING_VAR_METHOD. PLEASE SET VALUES IN" // & + " VARMAP TABLE TO ONE OF: set_to_fill, set_to_NaN,"// & + " , skip, or stop.") + endif + +end subroutine handle_grib_error + +subroutine read_grib_soil(the_file,inv_file,vname,vname_file,dummy3d,rc) + + use wgrib2api + implicit none + + character(len=*), intent(in) :: the_file, inv_file + character(len=20), intent(in) :: vname,vname_file + + integer, intent(out) :: rc + + real(esmf_kind_r8), intent(inout) :: dummy3d(:,:,:) + + real(esmf_kind_r4), allocatable :: dummy2d(:,:) + real(esmf_kind_r4) :: value + integer :: varnum,i + character(len=50) :: slevs(lsoil_input) + character(len=50) :: method + + allocate(dummy2d(i_input,j_input)) + + if(lsoil_input == 4) then + slevs = (/character(24)::':0-0.1 m below ground:', ':0.1-0.4 m below ground:', & + ':0.4-1 m below ground:', ':1-2 m below ground:'/) + else + rc = -1 + call error_handler("reading soil levels. File must have 4 soil levels.") + endif + + call get_var_cond(vname,this_miss_var_method=method,this_miss_var_value=value, & + loc=varnum) + do i = 1,lsoil_input + if (vname_file=="var2_2_1_") then + rc = grb2_inq(the_file,inv_file,vname_file,"_0_192:",slevs(i),data2=dummy2d) + else + rc = grb2_inq(the_file,inv_file,vname_file,slevs(i),data2=dummy2d) + endif + if (rc <= 0) then + call handle_grib_error(vname_file, slevs(i),method,value,varnum,rc,var=dummy2d) + if (rc==1 .and. trim(vname) /= "soill") then + ! missing_var_method == skip or no entry in varmap table + call error_handler("READING IN "//trim(vname)//". SET A FILL "// & + "VALUE IN THE VARMAP TABLE IF THIS ERROR IS NOT DESIRABLE.",rc) + elseif (rc==1) then + dummy3d(:,:,:) = 0.0_esmf_kind_r8 + exit + endif + endif + + dummy3d(:,:,i) = real(dummy2d,esmf_kind_r8) + end do + + deallocate(dummy2d) + + end subroutine read_grib_soil subroutine cleanup_input_atm_data @@ -4490,4 +5678,35 @@ subroutine cleanup_input_sfc_data end subroutine cleanup_input_sfc_data +! Jili Dong add sort subroutine +! quicksort.f -*-f90-*- +! Author: t-nissie +! License: GPLv3 +! Gist: https://gist.github.com/t-nissie/479f0f16966925fa29ea +!! +recursive subroutine quicksort(a, first, last) + implicit none + real*8 a(*), x, t + integer first, last + integer i, j + + x = a( (first+last) / 2 ) + i = first + j = last + do + do while (a(i) < x) + i=i+1 + end do + do while (x < a(j)) + j=j-1 + end do + if (i >= j) exit + t = a(i); a(i) = a(j); a(j) = t + i=i+1 + j=j-1 + end do + if (first < i-1) call quicksort(a, first, i-1) + if (j+1 < last) call quicksort(a, j+1, last) +end subroutine quicksort + end module input_data diff --git a/sorc/chgres_cube.fd/makefile b/sorc/chgres_cube.fd/makefile old mode 100755 new mode 100644 index d7aca1d9b..a247c85b7 --- a/sorc/chgres_cube.fd/makefile +++ b/sorc/chgres_cube.fd/makefile @@ -13,17 +13,21 @@ OBJS = chgres.o \ write_data.o \ search_util.o \ static_data.o \ - utils.o + utils.o \ + grib2_util.o $(CMD): $(OBJS) - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -o $(CMD) $(OBJS) $(SP_LIBd) $(NEMSIO_LIB) $(BACIO_LIB4) $(W3NCO_LIBd) $(SFCIO_LIB4) $(SIGIO_LIB4) $(ESMF_F90LINKPATHS) $(ESMF_F90ESMFLINKRPATHS) $(ESMF_F90ESMFLINKLIBS) -g -traceback + $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -o $(CMD) $(OBJS) $(SP_LIBd) $(NEMSIO_LIB) $(BACIO_LIB4) $(W3NCO_LIBd) $(SFCIO_LIB4) $(SIGIO_LIB4) $(ESMF_F90LINKPATHS) $(ESMF_F90ESMFLINKRPATHS) $(ESMF_F90ESMFLINKLIBS) $(WGRIB2_LIB) model_grid.o: program_setup.o model_grid.F90 - $(FCOMP) $(FFLAGS) -I$(NEMSIO_INC) -I$(SFCIO_INC4) -I$(SIGIO_INC4) $(ESMF_F90COMPILEPATHS) -c model_grid.F90 + $(FCOMP) $(FFLAGS) -I$(NEMSIO_INC) -I$(SFCIO_INC4) -I$(SIGIO_INC4) -I$(WGRIB2API_INC) $(ESMF_F90COMPILEPATHS) -c model_grid.F90 utils.o: utils.f90 $(FCOMP) $(FFLAGS) -c $(ESMF_F90COMPILEPATHS) utils.f90 +grib2_util.o: model_grid.o program_setup.o grib2_util.F90 + $(FCOMP) $(FFLAGS) -c $(ESMF_F90COMPILEPATHS) grib2_util.F90 + program_setup.o: program_setup.f90 $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c program_setup.f90 @@ -36,8 +40,8 @@ chgres.o: atmosphere.o model_grid.o program_setup.o surface.o chgres.F90 write_data.o: atmosphere.o model_grid.o program_setup.o surface.o static_data.o write_data.F90 $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c write_data.F90 -input_data.o: program_setup.o model_grid.o input_data.F90 - $(FCOMP) $(FFLAGS) -I$(NEMSIO_INC) -I$(SIGIO_INC4) -I$(SFCIO_INC4) $(ESMF_F90COMPILEPATHS) -c input_data.F90 +input_data.o: program_setup.o model_grid.o grib2_util.o input_data.F90 + $(FCOMP) $(FFLAGS) -I$(NEMSIO_INC) -I$(SIGIO_INC4) -I$(SFCIO_INC4) -I$(WGRIB2API_INC) $(ESMF_F90COMPILEPATHS) -c input_data.F90 surface.o: search_util.o model_grid.o input_data.o program_setup.o static_data.o surface.F90 $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c surface.F90 diff --git a/sorc/chgres_cube.fd/model_grid.F90 b/sorc/chgres_cube.fd/model_grid.F90 index bcf4e8ace..8ee22c231 100644 --- a/sorc/chgres_cube.fd/model_grid.F90 +++ b/sorc/chgres_cube.fd/model_grid.F90 @@ -62,6 +62,7 @@ module model_grid private character(len=5), allocatable, public :: tiles_target_grid(:) + character(len=10), public :: inv_file = "chgres.inv" integer, parameter, public :: lsoil_target = 4 ! # soil layers integer, public :: i_input, j_input @@ -118,6 +119,8 @@ subroutine define_input_grid(localpet, npets) trim(input_type) == "gfs_gaussian" .or. & trim(input_type) == "gfs_spectral") then call define_input_grid_gaussian(localpet, npets) + elseif (trim(input_type) == "grib2") then + call define_input_grid_gfs_grib2(localpet,npets) else call define_input_grid_mosaic(localpet, npets) endif @@ -570,6 +573,192 @@ subroutine define_input_grid_mosaic(localpet, npets) end subroutine define_input_grid_mosaic +!-------------------------------------------------------------------------- +! Define grid object for GFS grib2 data. Only works for data on +! global lat/lon or gaussian grids. +!-------------------------------------------------------------------------- + + subroutine define_input_grid_gfs_grib2(localpet, npets) + + use wgrib2api + + use program_setup, only : data_dir_input_grid, & + grib2_file_input_grid + + implicit none + + integer, intent(in) :: localpet, npets + + character(len=250) :: the_file + + integer :: i, j, rc, clb(2), cub(2) + + real(esmf_kind_r8), allocatable :: latitude(:,:) + real(esmf_kind_r8), allocatable :: longitude(:,:) + real(esmf_kind_r4), allocatable :: lat4(:,:), lon4(:,:) + real(esmf_kind_r8), pointer :: lat_src_ptr(:,:) + real(esmf_kind_r8), pointer :: lon_src_ptr(:,:) + real(esmf_kind_r8), pointer :: lat_corner_src_ptr(:,:) + real(esmf_kind_r8), pointer :: lon_corner_src_ptr(:,:) + real(esmf_kind_r8) :: deltalon + + type(esmf_polekind_flag) :: polekindflag(2) + + print*,"- DEFINE INPUT GRID OBJECT FOR INPUT GRIB2 DATA." + + num_tiles_input_grid = 1 + + the_file = trim(data_dir_input_grid) // "/" // grib2_file_input_grid + print*,'- OPEN AND INVENTORY GRIB2 FILE: ',trim(the_file) + rc=grb2_mk_inv(the_file,inv_file) + if (rc /=0) call error_handler("OPENING GRIB2 FILE",rc) + + rc = grb2_inq(the_file,inv_file,':PRES:',':surface:',nx=i_input, ny=j_input, & + lat=lat4, lon=lon4) + if (rc /= 1) call error_handler("READING GRIB2 FILE", rc) + + ip1_input = i_input + 1 + jp1_input = j_input + 1 + + polekindflag(1:2) = ESMF_POLEKIND_MONOPOLE + + print*,"- CALL GridCreate1PeriDim FOR INPUT GRID." + input_grid = ESMF_GridCreate1PeriDim(minIndex=(/1,1/), & + maxIndex=(/i_input,j_input/), & + polekindflag=polekindflag, & + periodicDim=1, & + poleDim=2, & + coordSys=ESMF_COORDSYS_SPH_DEG, & + regDecomp=(/1,npets/), & + indexflag=ESMF_INDEX_GLOBAL, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridCreate1PeriDim", rc) + + print*,"- CALL FieldCreate FOR INPUT GRID LATITUDE." + latitude_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + name="input_grid_latitude", rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- CALL FieldCreate FOR INPUT GRID LONGITUDE." + longitude_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + name="input_grid_longitude", rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + allocate(longitude(i_input,j_input)) + allocate(latitude(i_input,j_input)) + + do i = 1, i_input + longitude(i,:) = real(lon4(i,:),kind=esmf_kind_r8) + enddo + + do i = 1, j_input + latitude(:,i) = real(lat4(:,i),kind=esmf_kind_r8) + enddo + + deallocate(lat4, lon4) + + deltalon = abs(longitude(2,1)-longitude(1,1)) + if(localpet==0) print*, "deltalon = ", deltalon + + print*,"- CALL FieldScatter FOR INPUT GRID LONGITUDE." + call ESMF_FieldScatter(longitude_input_grid, longitude, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + print*,"- CALL FieldScatter FOR INPUT GRID LATITUDE." + call ESMF_FieldScatter(latitude_input_grid, latitude, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + print*,"- CALL GridAddCoord FOR INPUT GRID." + call ESMF_GridAddCoord(input_grid, & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridAddCoord", rc) + + print*,"- CALL GridGetCoord FOR INPUT GRID X-COORD." + nullify(lon_src_ptr) + call ESMF_GridGetCoord(input_grid, & + staggerLoc=ESMF_STAGGERLOC_CENTER, & + coordDim=1, & + farrayPtr=lon_src_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridGetCoord", rc) + + print*,"- CALL GridGetCoord FOR INPUT GRID Y-COORD." + nullify(lat_src_ptr) + call ESMF_GridGetCoord(input_grid, & + staggerLoc=ESMF_STAGGERLOC_CENTER, & + coordDim=2, & + computationalLBound=clb, & + computationalUBound=cub, & + farrayPtr=lat_src_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridGetCoord", rc) + + do j = clb(2), cub(2) + do i = clb(1), cub(1) + lon_src_ptr(i,j) = longitude(i,j) + if (lon_src_ptr(i,j) > 360.0_esmf_kind_r8) lon_src_ptr(i,j) = lon_src_ptr(i,j) - 360.0_esmf_kind_r8 + lat_src_ptr(i,j) = latitude(i,j) + enddo + enddo + + if(localpet==0) print*, "lon first = ", lon_src_ptr(1:10,1) + if(localpet==0) print*, "lat first = ", lat_src_ptr(1,1:10) + + print*,"- CALL GridAddCoord FOR INPUT GRID." + call ESMF_GridAddCoord(input_grid, & + staggerloc=ESMF_STAGGERLOC_CORNER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridAddCoord", rc) + + print*,"- CALL GridGetCoord FOR INPUT GRID X-COORD." + nullify(lon_corner_src_ptr) + call ESMF_GridGetCoord(input_grid, & + staggerLoc=ESMF_STAGGERLOC_CORNER, & + coordDim=1, & + farrayPtr=lon_corner_src_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridGetCoord", rc) + + print*,"- CALL GridGetCoord FOR INPUT GRID Y-COORD." + nullify(lat_corner_src_ptr) + call ESMF_GridGetCoord(input_grid, & + staggerLoc=ESMF_STAGGERLOC_CORNER, & + coordDim=2, & + computationalLBound=clb, & + computationalUBound=cub, & + farrayPtr=lat_corner_src_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridGetCoord", rc) + + do j = clb(2), cub(2) + do i = clb(1), cub(1) + lon_corner_src_ptr(i,j) = longitude(i,1) - (0.5_esmf_kind_r8*deltalon) + if (lon_corner_src_ptr(i,j) > 360.0_esmf_kind_r8) lon_corner_src_ptr(i,j) = lon_corner_src_ptr(i,j) - 360.0_esmf_kind_r8 + if (j == 1) then + lat_corner_src_ptr(i,j) = -90.0_esmf_kind_r8 + cycle + endif + if (j == jp1_input) then + lat_corner_src_ptr(i,j) = +90.0_esmf_kind_r8 + cycle + endif + lat_corner_src_ptr(i,j) = 0.5_esmf_kind_r8 * (latitude(i,j-1)+ latitude(i,j)) + enddo + enddo + + deallocate(latitude,longitude) + + end subroutine define_input_grid_gfs_grib2 + subroutine define_target_grid(localpet, npets) use netcdf diff --git a/sorc/chgres_cube.fd/program_setup.f90 b/sorc/chgres_cube.fd/program_setup.f90 index 001be72d4..25ac2f33f 100644 --- a/sorc/chgres_cube.fd/program_setup.f90 +++ b/sorc/chgres_cube.fd/program_setup.f90 @@ -94,7 +94,8 @@ module program_setup implicit none private - + + character(len=500), public :: varmap_file = "NULL" character(len=500), public :: atm_files_input_grid(6) = "NULL" character(len=500), public :: atm_core_files_input_grid(7) = "NULL" character(len=500), public :: atm_tracer_files_input_grid(6) = "NULL" @@ -103,21 +104,30 @@ module program_setup character(len=500), public :: mosaic_file_input_grid = "NULL" character(len=500), public :: mosaic_file_target_grid = "NULL" character(len=500), public :: nst_files_input_grid = "NULL" + character(len=500), public :: grib2_file_input_grid = "NULL" character(len=500), public :: orog_dir_input_grid = "NULL" character(len=500), public :: orog_files_input_grid(6) = "NULL" character(len=500), public :: orog_dir_target_grid = "NULL" character(len=500), public :: orog_files_target_grid(6) = "NULL" character(len=500), public :: sfc_files_input_grid(6) = "NULL" character(len=500), public :: vcoord_file_target_grid = "NULL" - character(len=6), public :: cres_target_grid = " " + character(len=6), public :: cres_target_grid = "NULL" character(len=500), public :: atm_weight_file="NULL" character(len=20), public :: input_type="restart" + character(len=20), public :: phys_suite="GFS" !Default to gfs physics suite integer, parameter, public :: max_tracers=100 - integer, public :: num_tracers + integer, public :: num_tracers, num_tracers_input + + logical, allocatable, public :: read_from_input(:) + character(len=20), public :: tracers(max_tracers)="NULL" character(len=20), public :: tracers_input(max_tracers)="NULL" - + character(len=20), allocatable, public :: missing_var_methods(:) + character(len=20), allocatable, public :: chgres_var_names(:) + character(len=20), allocatable, public :: field_var_names(:) + + integer, public :: cycle_mon = -999 integer, public :: cycle_day = -999 integer, public :: cycle_hour = -999 @@ -129,24 +139,33 @@ module program_setup logical, public :: convert_nst = .false. logical, public :: convert_sfc = .false. + real, allocatable, public :: drysmc_input(:), drysmc_target(:) real, allocatable, public :: maxsmc_input(:), maxsmc_target(:) real, allocatable, public :: refsmc_input(:), refsmc_target(:) real, allocatable, public :: wltsmc_input(:), wltsmc_target(:) real, allocatable, public :: bb_target(:), satpsi_target(:) + real, allocatable, public :: missing_var_values(:) + public :: read_setup_namelist public :: calc_soil_params_driver + public :: read_varmap + public :: get_var_cond contains subroutine read_setup_namelist - + implicit none + + integer :: is, ie, ierr - namelist /config/ mosaic_file_target_grid, & + + namelist /config/ varmap_file, & + mosaic_file_target_grid, & fix_dir_target_grid, & orog_dir_target_grid, & orog_files_target_grid, & @@ -158,6 +177,7 @@ subroutine read_setup_namelist atm_files_input_grid, & atm_core_files_input_grid, & atm_tracer_files_input_grid, & + grib2_file_input_grid, & data_dir_input_grid, & vcoord_file_target_grid, & cycle_mon, cycle_day, & @@ -165,7 +185,9 @@ subroutine read_setup_namelist convert_nst, convert_sfc, & regional, input_type, & atm_weight_file, tracers, & - tracers_input, halo_bndy, halo_blend + tracers_input,phys_suite, & + halo_bndy, & + halo_blend print*,"- READ SETUP NAMELIST" @@ -174,7 +196,10 @@ subroutine read_setup_namelist read(41, nml=config, iostat=ierr) if (ierr /= 0) call error_handler("READING SETUP NAMELIST.", ierr) close (41) - + + call to_lower(input_type) + call to_upper(phys_suite) + orog_dir_target_grid = trim(orog_dir_target_grid) // '/' orog_dir_input_grid = trim(orog_dir_input_grid) // '/' @@ -217,6 +242,13 @@ subroutine read_setup_namelist num_tracers = num_tracers + 1 print*,"- WILL PROCESS TRACER ", trim(tracers(is)) enddo + + num_tracers_input = 0 + do is = 1, max_tracers + if (trim(tracers_input(is)) == "NULL") exit + num_tracers_input = num_tracers_input + 1 + print*,"- WILL PROCESS INPUT TRACER ", trim(tracers_input(is)) + enddo !------------------------------------------------------------------------- ! Ensure program recognizes the input data type. @@ -233,14 +265,118 @@ subroutine read_setup_namelist print*,'- INPUT DATA FROM SPECTRAL GFS GAUSSIAN NEMSIO FILE.' case ("gfs_spectral") print*,'- INPUT DATA FROM SPECTRAL GFS SIGIO/SFCIO FILE.' + case ("grib2") + print*,'- INPUT DATA FROM A GRIB2 FILE' case default call error_handler("UNRECOGNIZED INPUT DATA TYPE.", 1) end select + +!------------------------------------------------------------------------- +! Ensure proper file variable provided for grib2 input +!------------------------------------------------------------------------- - return - + if (trim(input_type) == "grib2") then + if (trim(grib2_file_input_grid) == "NULL" .or. trim(grib2_file_input_grid) == "") then + call error_handler("FOR GRIB2 DATA, PLEASE PROVIDE GRIB2_FILE_INPUT_GRID") + endif + endif + end subroutine read_setup_namelist +subroutine read_varmap + + implicit none + + integer :: istat, k, nvars + character(len=500) :: line + character(len=20),allocatable :: var_type(:) + + if (trim(input_type) == "grib2") then + + print*,"OPEN VARIABLE MAPPING FILE: ", trim(varmap_file) + open(14, file=trim(varmap_file), form='formatted', iostat=istat) + if (istat /= 0) then + call error_handler("OPENING VARIABLE MAPPING FILE", istat) + endif + + num_tracers = 0 + nvars = 0 + + !Loop over lines of file to count the number of variables + do + read(14, '(A)', iostat=istat) line !chgres_var_names_tmp(k)!, field_var_names(k) , & + ! missing_var_methods(k), missing_var_values(k), var_type(k) + if (istat/=0) exit + if ( trim(line) .eq. '' ) cycle + nvars = nvars+1 + enddo + + + allocate(chgres_var_names(nvars)) + allocate(field_var_names(nvars)) + allocate(missing_var_methods(nvars)) + allocate(missing_var_values(nvars)) + allocate(read_from_input(nvars)) + allocate(var_type(nvars)) + + read_from_input(:) = .true. + rewind(14) + do k = 1,nvars + read(14, *, iostat=istat) chgres_var_names(k), field_var_names(k) , & + missing_var_methods(k), missing_var_values(k), var_type(k) + if (istat /= 0) call error_handler("READING VARIABLE MAPPING FILE", istat) + if(trim(var_type(k))=='T') then + num_tracers = num_tracers + 1 + tracers_input(num_tracers)=chgres_var_names(k) + endif + enddo + close(14) + endif +end subroutine read_varmap + +! ---------------------------------------------------------------------------------------- +! Find conditions for handling missing variables from varmap arrays +! ---------------------------------------------------------------------------------------- + +subroutine get_var_cond(var_name,this_miss_var_method,this_miss_var_value, & + this_field_var_name, loc) + use esmf + + implicit none + character(len=20) :: var_name + + character(len=20), optional, intent(out) :: this_miss_var_method, & + this_field_var_name + real(esmf_kind_r4), optional, intent(out):: this_miss_var_value + + integer, optional, intent(out) :: loc + + integer :: i, tmp(size(missing_var_methods)) + + i=0 + + tmp(:)=0 + where(chgres_var_names==var_name) tmp=1 + + i = maxloc(merge(1.,0.,chgres_var_names == var_name),dim=1) !findloc(chgres_var_names,var_name) + print*, i + if (maxval(tmp).eq.0) then + print*, "WARNING: NO ENTRY FOR ", trim(var_name), " IN VARMAP TABLE. WILL SKIP " // & + "VARIABLE IF NOT FOUND IN EXTERNAL MODEL FILE" + + if(present(this_miss_var_method)) this_miss_var_method = "skip" + if(present(this_miss_var_value)) this_miss_var_value = -9999.9_esmf_kind_r4 + if(present(this_field_var_name)) this_field_var_name = "NULL" + if(present(loc)) loc = 9999 + else + if(present(this_miss_var_method)) this_miss_var_method = missing_var_methods(i) + if(present(this_miss_var_value)) this_miss_var_value = missing_var_values(i) + if(present(this_field_var_name)) this_field_var_name = field_var_names(i) + if(present(loc)) loc = i + endif + +end subroutine get_var_cond + subroutine calc_soil_params_driver(localpet) implicit none diff --git a/sorc/chgres_cube.fd/search_util.f90 b/sorc/chgres_cube.fd/search_util.f90 index 7f67286f9..0810b0b9b 100644 --- a/sorc/chgres_cube.fd/search_util.f90 +++ b/sorc/chgres_cube.fd/search_util.f90 @@ -133,7 +133,7 @@ subroutine search (field, mask, idim, jdim, tile, field_num, latitude) if (mask(ii,jj) == 1 .and. field_save(ii,jj) > -9999.0) then field(i,j) = field_save(ii,jj) -! write(6,100) tile,i,j,ii,jj,field(i,j) + write(6,100) tile,i,j,ii,jj,field(i,j) cycle I_LOOP endif diff --git a/sorc/chgres_cube.fd/surface.F90 b/sorc/chgres_cube.fd/surface.F90 index d566e2bc9..436fc30e8 100644 --- a/sorc/chgres_cube.fd/surface.F90 +++ b/sorc/chgres_cube.fd/surface.F90 @@ -292,9 +292,10 @@ subroutine interp(localpet) seamask_target_grid, & latitude_target_grid - use program_setup, only : convert_nst + use program_setup, only : convert_nst, input_type - use static_data, only : veg_type_target_grid + use static_data, only : veg_type_target_grid, & + soil_type_target_grid use search_util @@ -318,6 +319,7 @@ subroutine interp(localpet) integer(esmf_kind_i8), pointer :: seamask_target_ptr(:,:) real(esmf_kind_r8), allocatable :: data_one_tile(:,:) + real(esmf_kind_r8), allocatable :: data_one_tile2(:,:) real(esmf_kind_r8), allocatable :: data_one_tile_3d(:,:,:) real(esmf_kind_r8), allocatable :: latitude_one_tile(:,:) real(esmf_kind_r8), pointer :: canopy_mc_target_ptr(:,:) @@ -514,6 +516,18 @@ subroutine interp(localpet) ! Interpolate. !----------------------------------------------------------------------- + if (localpet == 0) then + allocate(data_one_tile(i_target,j_target)) + allocate(data_one_tile2(i_target,j_target)) + allocate(data_one_tile_3d(i_target,j_target,lsoil_target)) + allocate(mask_target_one_tile(i_target,j_target)) + else + allocate(data_one_tile(0,0)) + allocate(data_one_tile2(0,0)) + allocate(data_one_tile_3d(0,0,0)) + allocate(mask_target_one_tile(0,0)) + endif + method=ESMF_REGRIDMETHOD_CONSERVE isrctermprocessing = 1 @@ -541,16 +555,6 @@ subroutine interp(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) - if (localpet == 0) then - allocate(data_one_tile(i_target,j_target)) - allocate(data_one_tile_3d(i_target,j_target,lsoil_target)) - allocate(mask_target_one_tile(i_target,j_target)) - else - allocate(data_one_tile(0,0)) - allocate(data_one_tile_3d(0,0,0)) - allocate(mask_target_one_tile(0,0)) - endif - print*,"- CALL FieldGet FOR TARGET grid sea ice fraction." call ESMF_FieldGet(seaice_fract_target_grid, & farrayPtr=seaice_fract_target_ptr, rc=rc) @@ -600,6 +604,7 @@ subroutine interp(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) + if (localpet == 0) then do j = 1, j_target do i = 1, i_target @@ -709,7 +714,7 @@ subroutine interp(localpet) print*,"- CALL FieldGet FOR TARGET grid snow depth." call ESMF_FieldGet(snow_depth_target_grid, & farrayPtr=snow_depth_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN FieldGet", rc) print*,"- CALL Field_Regrid for snow liq equiv." @@ -1969,7 +1974,7 @@ subroutine interp(localpet) do ij = l(1), u(1) call ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j) - soilm_tot_target_ptr(i,j,:) = -9999.9 + soilm_tot_target_ptr(i,j,:) = -9999.9 soil_temp_target_ptr(i,j,:) = -9999.9 skin_temp_target_ptr(i,j) = -9999.9 terrain_from_input_ptr(i,j) = -9999.9 @@ -2028,8 +2033,23 @@ subroutine interp(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) + print*,"- CALL FieldGather FOR SOIL TYPE TARGET GRID, TILE: ", tile + call ESMF_FieldGather(soil_type_target_grid, data_one_tile2, rootPet=0,tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldGather", rc) + +!--------------------------------------------------------------------------------------- +! grib2 data does not have soil type. Set soil type interpolated from input +! grid to the target (model) grid soil type. This turns off the soil moisture +! rescaling. +!--------------------------------------------------------------------------------------- + if (localpet == 0) then - call search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 224) + if (trim(input_type) .ne. "grib2") then + call search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 224) + else + data_one_tile = data_one_tile2 + endif endif print*,"- CALL FieldScatter FOR SOIL TYPE FROM INPUT GRID, TILE: ", tile @@ -2082,7 +2102,7 @@ subroutine interp(localpet) deallocate(veg_type_target_one_tile) - deallocate(data_one_tile) + deallocate(data_one_tile, data_one_tile2) deallocate(data_one_tile_3d) deallocate(mask_target_one_tile) diff --git a/sorc/chgres_cube.fd/utils.f90 b/sorc/chgres_cube.fd/utils.f90 index a99b0b5d7..ddda0bb90 100644 --- a/sorc/chgres_cube.fd/utils.f90 +++ b/sorc/chgres_cube.fd/utils.f90 @@ -32,3 +32,45 @@ subroutine netcdf_err( err, string ) return end subroutine netcdf_err + + subroutine to_upper(strIn) +! Adapted from http://www.star.le.ac.uk/~cgp/fortran.html (25 May 2012) +! Original author: Clive Page + + implicit none + + character(len=*), intent(inout) :: strIn + character(len=len(strIn)) :: strOut + integer :: i,j + + do i = 1, len(strIn) + j = iachar(strIn(i:i)) + if (j>= iachar("a") .and. j<=iachar("z") ) then + strOut(i:i) = achar(iachar(strIn(i:i))-32) + else + strOut(i:i) = strIn(i:i) + end if + end do + strIn(:) = strOut(:) +end subroutine to_upper + +subroutine to_lower(strIn) +! Adapted from http://www.star.le.ac.uk/~cgp/fortran.html (25 May 2012) +! Original author: Clive Page + + implicit none + + character(len=*), intent(inout) :: strIn + character(len=len(strIn)) :: strOut + integer :: i,j + + do i = 1, len(strIn) + j = iachar(strIn(i:i)) + if (j>= iachar("A") .and. j<=iachar("Z") ) then + strOut(i:i) = achar(iachar(strIn(i:i))+32) + else + strOut(i:i) = strIn(i:i) + end if + end do + strIn(:) = strOut(:) +end subroutine to_lower diff --git a/sorc/machine-setup.sh b/sorc/machine-setup.sh index f518f2617..48b2ee1bf 100644 --- a/sorc/machine-setup.sh +++ b/sorc/machine-setup.sh @@ -109,6 +109,8 @@ elif [[ -d /lustre && -d /ncrc ]] ; then fi target=gaea module purge +elif [[ "$(hostname)" =~ "odin" ]]; then + target="odin" else echo WARNING: UNKNOWN PLATFORM 1>&2 fi From 2112a72fb7387003cdb6c104a0fa70230f58c58f Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Wed, 5 Feb 2020 09:18:26 -0500 Subject: [PATCH 011/192] Account code update for Cray/Dell (#52) Replace obsolete account code 'FV3GFS-T2O' with new code 'GFS-DEV' in all Cray and Dell scripts. --- driver_scripts/driver_grid.cray.sh | 2 +- driver_scripts/driver_grid.dell.sh | 2 +- driver_scripts/driver_grid.hera.sh | 0 driver_scripts/driver_grid.jet.sh | 0 ush/fv3gfs_chgres.sh | 8 ++++---- 5 files changed, 6 insertions(+), 6 deletions(-) mode change 100644 => 100755 driver_scripts/driver_grid.cray.sh mode change 100644 => 100755 driver_scripts/driver_grid.dell.sh mode change 100644 => 100755 driver_scripts/driver_grid.hera.sh mode change 100644 => 100755 driver_scripts/driver_grid.jet.sh diff --git a/driver_scripts/driver_grid.cray.sh b/driver_scripts/driver_grid.cray.sh old mode 100644 new mode 100755 index ec813e9f3..6e8708a21 --- a/driver_scripts/driver_grid.cray.sh +++ b/driver_scripts/driver_grid.cray.sh @@ -1,7 +1,7 @@ #!/bin/bash #BSUB -L /bin/sh -#BSUB -P FV3GFS-T2O +#BSUB -P GFS-DEV #BSUB -oo log.grid.%J #BSUB -eo log.grid.%J #BSUB -J grid_fv3 diff --git a/driver_scripts/driver_grid.dell.sh b/driver_scripts/driver_grid.dell.sh old mode 100644 new mode 100755 index 74f38b53a..f193c4027 --- a/driver_scripts/driver_grid.dell.sh +++ b/driver_scripts/driver_grid.dell.sh @@ -3,7 +3,7 @@ #BSUB -oo log.grid.%J #BSUB -eo log.grid.%J #BSUB -q debug -#BSUB -P FV3GFS-T2O +#BSUB -P GFS-DEV #BSUB -J grid_fv3 #BSUB -W 0:30 #BSUB -x # run not shared diff --git a/driver_scripts/driver_grid.hera.sh b/driver_scripts/driver_grid.hera.sh old mode 100644 new mode 100755 diff --git a/driver_scripts/driver_grid.jet.sh b/driver_scripts/driver_grid.jet.sh old mode 100644 new mode 100755 diff --git a/ush/fv3gfs_chgres.sh b/ush/fv3gfs_chgres.sh index 8e22ba648..a798ff59a 100755 --- a/ush/fv3gfs_chgres.sh +++ b/ush/fv3gfs_chgres.sh @@ -36,7 +36,7 @@ #------------------------------------------------------------------------ #----WCOSS_DELL JOBCARD -#BSUB -P FV3GFS-T2O +#BSUB -P GFS-DEV #BSUB -o log.chgres.%J #BSUB -e log.chgres.%J #BSUB -J fv3_chgres @@ -49,7 +49,7 @@ export machine=WCOSS_DELL_P3 #----WCOSS_CRAY JOBCARD ##BSUB -L /bin/sh -##BSUB -P FV3GFS-T2O +##BSUB -P GFS-DEV ##BSUB -oo log.chgres.%J ##BSUB -eo log.chgres.%J ##BSUB -J fv3_chgres @@ -137,7 +137,7 @@ if [ $machine = WCOSS_C ]; then export APRUNC="aprun -n 1 -N 1 -j 1 -d $OMP_NUM_THREADS_CH -cc depth" export APRUNTF='aprun -q -j1 -n1 -N1 -d1 -cc depth' export SUB=$LS_SUBCWD/../util/sub_wcoss_c - export ACCOUNT=FV3GFS-T2O + export ACCOUNT=GFS-DEV export QUEUE=dev export QUEUE_TRANS=dev_transfer elif [ $machine = WCOSS_DELL_P3 ]; then @@ -146,7 +146,7 @@ elif [ $machine = WCOSS_DELL_P3 ]; then export APRUNC="time" export APRUNTF="time" export SUB=$LS_SUBCWD/../util/sub_wcoss_d - export ACCOUNT=FV3GFS-T2O + export ACCOUNT=GFS-DEV export QUEUE=dev export QUEUE_TRANS=dev_transfer elif [ $machine = HERA ]; then From 5eeb1a79d438ffba1f79589c8ee7a6430096d6aa Mon Sep 17 00:00:00 2001 From: Jili Dong Date: Thu, 6 Feb 2020 09:21:13 -0500 Subject: [PATCH 012/192] Update fre-nctools build module on Jet Update the fre-nctools build module on Jet to use Intel v18 and impi 2018.4.274. Per request of HAFS team. --- modulefiles/fv3gfs/fre-nctools.jet | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modulefiles/fv3gfs/fre-nctools.jet b/modulefiles/fv3gfs/fre-nctools.jet index ed2d64763..9ba89bf9f 100644 --- a/modulefiles/fv3gfs/fre-nctools.jet +++ b/modulefiles/fv3gfs/fre-nctools.jet @@ -1,8 +1,8 @@ #%Module##################################################### ## Module file for fre-nctools ############################################################# -module load intel/15.0.3.187 -module load impi/5.0.3.048 +module load intel/18.0.5.274 +module load impi/2018.4.274 module load szip/2.1 module load hdf5/1.8.9 module load netcdf/4.2.1.1 From e339b2682a4d2286994274c24de660a2b411be83 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Tue, 18 Feb 2020 07:42:34 -0500 Subject: [PATCH 013/192] Update serial chgres and global cycle to use parallel netcdf 4.7.4 Update the old serial chgres and global_cycle programs to use hdf5_parallel v1.10.6 and netcdf parallel v4.7.4 on Hera and Dell. Supports GFS V16. See issue #26 for more details. Also, fix an out-of-bounds array in serial chgres discovered by Dusan. --- modulefiles/fv3gfs/global_chgres.hera | 7 +------ modulefiles/fv3gfs/global_chgres.wcoss_dell_p3 | 4 ++-- modulefiles/fv3gfs/global_cycle.hera | 6 +----- modulefiles/fv3gfs/global_cycle.wcoss_dell_p3 | 4 +++- modulefiles/module_base.hera | 5 +++-- modulefiles/module_base.wcoss_dell_p3 | 8 ++++---- sorc/global_chgres.fd/chgres.f90 | 2 +- 7 files changed, 15 insertions(+), 21 deletions(-) diff --git a/modulefiles/fv3gfs/global_chgres.hera b/modulefiles/fv3gfs/global_chgres.hera index b91ac5e09..564a51b5d 100644 --- a/modulefiles/fv3gfs/global_chgres.hera +++ b/modulefiles/fv3gfs/global_chgres.hera @@ -6,9 +6,6 @@ module load intel/18.0.5.274 module load impi/2018.0.4 -module load netcdf/4.7.0 -module load hdf5/1.10.5 - # Loding nceplibs modules module use -a $MOD_PATH module load sigio/2.1.0 @@ -22,8 +19,6 @@ module load ip/3.0.1 module load sfcio/1.1.0 module load gfsio/1.1.0 module load landsfcutil/2.1.0 - -export NETCDF_INCLUDE="-I${NETCDF}/include" -export NETCDF_LDFLAGS_F="-L${NETCDF}/lib -lnetcdf -lnetcdff -L${HDF5}/lib -lhdf5 -lhdf5_fortran" +module load netcdf_parallel/4.7.4 set FCMP ifort diff --git a/modulefiles/fv3gfs/global_chgres.wcoss_dell_p3 b/modulefiles/fv3gfs/global_chgres.wcoss_dell_p3 index 660c5ec00..56de3b799 100644 --- a/modulefiles/fv3gfs/global_chgres.wcoss_dell_p3 +++ b/modulefiles/fv3gfs/global_chgres.wcoss_dell_p3 @@ -4,8 +4,6 @@ module load ips/18.0.1.163 module load impi/18.0.1 -module load NetCDF/4.5.0 - module load w3nco/2.0.6 module load w3emc/2.3.0 module load sp/2.0.2 @@ -18,6 +16,8 @@ module load landsfcutil/2.1.0 module load bacio/2.0.2 module load sigio/2.1.0 +module use /usrx/local/nceplibs/dev/NCEPLIBS/modulefiles +module load netcdf_parallel/4.7.4 # export FCMP=ifort diff --git a/modulefiles/fv3gfs/global_cycle.hera b/modulefiles/fv3gfs/global_cycle.hera index 5f3afa8d5..db85174d5 100644 --- a/modulefiles/fv3gfs/global_cycle.hera +++ b/modulefiles/fv3gfs/global_cycle.hera @@ -6,16 +6,12 @@ module load intel/18.0.5.274 module load impi/2018.0.4 -module load netcdf/4.7.0 -module load hdf5/1.10.5 -export NETCDF_INCLUDE="-I${NETCDF}/include" -export NETCDF_LDFLAGS_F="-L${NETCDF}/lib -lnetcdf -lnetcdff -L${HDF5}/lib -lhdf5 -lhdf5_fortran" - # Loding nceplibs modules module use -a $MOD_PATH module load w3nco/2.0.6 module load sp/2.0.2 module load bacio/2.0.2 module load ip/3.0.1 +module load netcdf_parallel/4.7.4 export FCMP=mpiifort diff --git a/modulefiles/fv3gfs/global_cycle.wcoss_dell_p3 b/modulefiles/fv3gfs/global_cycle.wcoss_dell_p3 index 3e1ff1e9a..eb9681dcc 100644 --- a/modulefiles/fv3gfs/global_cycle.wcoss_dell_p3 +++ b/modulefiles/fv3gfs/global_cycle.wcoss_dell_p3 @@ -5,11 +5,13 @@ module load ips/18.0.1.163 module load impi/18.0.1 -module load NetCDF/4.5.0 module load w3nco/2.0.6 module load sp/2.0.2 module load ip/3.0.1 module load bacio/2.0.2 +module use /usrx/local/nceplibs/dev/NCEPLIBS/modulefiles +module load netcdf_parallel/4.7.4 + export FCMP=mpif90 diff --git a/modulefiles/module_base.hera b/modulefiles/module_base.hera index 07e78cfc9..25c9f4756 100644 --- a/modulefiles/module_base.hera +++ b/modulefiles/module_base.hera @@ -6,6 +6,7 @@ module load intel/18.0.5.274 module load impi/2018.0.4 module load hpss/hpss -module load netcdf/4.7.0 module load nco/4.7.0 -module load hdf5/1.10.5 +module use /scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles +module load netcdf_parallel/4.7.4 +module load hdf5_parallel/1.10.6 diff --git a/modulefiles/module_base.wcoss_dell_p3 b/modulefiles/module_base.wcoss_dell_p3 index 56600f37f..af1761978 100644 --- a/modulefiles/module_base.wcoss_dell_p3 +++ b/modulefiles/module_base.wcoss_dell_p3 @@ -19,15 +19,15 @@ module unload grib_util/1.0.6 module load grib_util/1.1.0 module load NCO/4.7.0 -module load HDF5-serial/1.10.1 -module load NetCDF/4.5.0 module load CFP/2.0.1 setenv USE_CFP YES +module use -a /usrx/local/nceplibs/dev/NCEPLIBS/modulefiles +module load hdf5_parallel/1.10.6 +module load netcdf_parallel/4.7.4 + # modules used by vrfy module load pm5 module use -a /gpfs/dell1/nco/ops/nwprod/modulefiles/ module load gempak/7.3.1 - - diff --git a/sorc/global_chgres.fd/chgres.f90 b/sorc/global_chgres.fd/chgres.f90 index a7d2099de..f41ff7590 100755 --- a/sorc/global_chgres.fd/chgres.f90 +++ b/sorc/global_chgres.fd/chgres.f90 @@ -927,7 +927,7 @@ END SUBROUTINE WRITE_FV3_SFC_DATA_NETCDF ENDIF ALLOCATE(VCOORDI(LEVSI+1,GFSHEADI%NVCOORD)) - VCOORDI(:,:) = GFSHEADVI%VCOORD(:,:,1) + VCOORDI(:,:) = GFSHEADVI%VCOORD(:,1:GFSHEADI%NVCOORD,1) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! READ INPUT NEMSIO DATA ARRAY From 72c636c0fd7f52551eb6f4a4bb9bcb7ed6c3a6e2 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Mon, 24 Feb 2020 12:38:24 -0500 Subject: [PATCH 014/192] Add GRIB2 regression test for CHGRES_CUBE Add GRIB2 regression test for CHGRES_CUBE. See #64 for details. Update ./ush/chgres_cube.sh for GRIB2 option. Fix legacy Fortran extension in 'write_data.F90' that was identified when compiling with gfortran. Dusan opened issue #61 for this fix. For convenience, add the fix here. --- reg_tests/chgres_cube/c192.fv3.history.sh | 2 +- reg_tests/chgres_cube/c192.gfs.grib2.sh | 71 +++++++++++++++++++++++ reg_tests/chgres_cube/driver.cray.sh | 17 +++--- reg_tests/chgres_cube/driver.dell.sh | 16 ++--- reg_tests/chgres_cube/driver.hera.sh | 9 ++- reg_tests/chgres_cube/driver.jet.sh | 9 ++- sorc/chgres_cube.fd/write_data.F90 | 4 +- ush/chgres_cube.sh | 23 ++++++-- 8 files changed, 127 insertions(+), 24 deletions(-) create mode 100755 reg_tests/chgres_cube/c192.gfs.grib2.sh diff --git a/reg_tests/chgres_cube/c192.fv3.history.sh b/reg_tests/chgres_cube/c192.fv3.history.sh index 72776b833..9ffb4398e 100755 --- a/reg_tests/chgres_cube/c192.fv3.history.sh +++ b/reg_tests/chgres_cube/c192.fv3.history.sh @@ -41,7 +41,7 @@ ${HOMEufs}/ush/chgres_cube.sh iret=$? if [ $iret -ne 0 ]; then - echo "<<< C96 FV3 GAUSSIAN NEMSIO TEST FAILED. <<<" + echo "<<< C192 FV3 HISTORY TEST FAILED. <<<" exit $iret fi diff --git a/reg_tests/chgres_cube/c192.gfs.grib2.sh b/reg_tests/chgres_cube/c192.gfs.grib2.sh new file mode 100755 index 000000000..2c382c7a0 --- /dev/null +++ b/reg_tests/chgres_cube/c192.gfs.grib2.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# Invoke chgres to create C192 coldstart files using GFS GRIB2 data +# as input. The coldstart files are then compared to baseline files +# using the 'nccmp' utility. This script is run by the machine specific +# driver script. +#----------------------------------------------------------------------------- + +set -x + +export DATA=$OUTDIR/c192_gfs_grib2 +rm -fr $DATA + +export CRES=192 +export FIXfv3=${HOMEreg}/fix/C192 +export COMIN=${HOMEreg}/input_data/gfs.grib2 + +export GRIB2_FILE_INPUT=gfs.t00z.pgrb2.0p50.f000 +export VCOORD_FILE=${HOMEufs}/fix/fix_am/global_hyblev.l65.txt +export VARMAP_FILE=${HOMEufs}/parm/varmap_tables/GFSphys_var_map.txt +export INPUT_TYPE='grib2' +export CONVERT_NST=".false." + +export CDATE=2019110400 + +export OMP_NUM_THREADS_CY=1 + +#----------------------------------------------------------------------------- +# Invoke chgres program. +#----------------------------------------------------------------------------- + +echo "Starting at: " `date` + +${HOMEufs}/ush/chgres_cube.sh + +iret=$? +if [ $iret -ne 0 ]; then + echo "<<< C192 GFS GRIB2 TEST FAILED. <<<" + exit $iret +fi + +echo "Ending at: " `date` + +#----------------------------------------------------------------------------- +# Compare output from chgres to baseline set of data. +#----------------------------------------------------------------------------- + +cd $DATA + +test_failed=0 +for files in *.nc +do + if [ -f $files ]; then + echo CHECK $files + $NCCMP -dmfqS $files $HOMEreg/baseline_data/c192_gfs_grib2/$files + iret=$? + if [ $iret -ne 0 ]; then + test_failed=1 + fi + fi +done + +set +x +if [ $test_failed -ne 0 ]; then + echo "<<< C192 GFS GRIB2 TEST FAILED. >>>" +else + echo "<<< C192 GFS GRIB2 TEST PASSED. >>>" +fi + +exit 0 diff --git a/reg_tests/chgres_cube/driver.cray.sh b/reg_tests/chgres_cube/driver.cray.sh index 005812149..d9558d2a2 100755 --- a/reg_tests/chgres_cube/driver.cray.sh +++ b/reg_tests/chgres_cube/driver.cray.sh @@ -64,7 +64,6 @@ export KMP_AFFINITY=disabled export OMP_NUM_THREADS=1 export APRUN="aprun -j 1 -n 6 -N 6 -d ${OMP_NUM_THREADS} -cc depth" -export INPUT_DATA=${HOMEreg}/input_data/fv3.restart bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.fv3.restart -M 1000 -W 0:15 -extsched 'CRAYLINUX[]' \ "export NODES=1; $PWD/c96.fv3.restart.sh" @@ -74,7 +73,6 @@ bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.fv3.restart -M export OMP_NUM_THREADS=1 export APRUN="aprun -j 1 -n 6 -N 6 -d ${OMP_NUM_THREADS} -cc depth" -export INPUT_DATA=${HOMEreg}/input_data/fv3.history bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c192.fv3.history -M 1000 -W 0:15 -extsched 'CRAYLINUX[]' \ -w 'ended(c96.fv3.restart)' "export NODES=1; $PWD/c192.fv3.history.sh" @@ -84,7 +82,6 @@ bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c192.fv3.history -M export OMP_NUM_THREADS=1 export APRUN="aprun -j 1 -n 6 -N 6 -d ${OMP_NUM_THREADS} -cc depth" -export INPUT_DATA=${HOMEreg}/input_data/fv3.nemsio bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.fv3.nemsio -M 1000 -W 0:15 -extsched 'CRAYLINUX[]' \ -w 'ended(c192.fv3.history)' "export NODES=1; $PWD/c96.fv3.nemsio.sh" @@ -94,7 +91,6 @@ bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.fv3.nemsio -M 1 export OMP_NUM_THREADS=4 export APRUN="aprun -j 1 -n 6 -N 6 -d ${OMP_NUM_THREADS} -cc depth" -export INPUT_DATA=${HOMEreg}/input_data/gfs.sigio bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.gfs.sigio -M 1000 -W 0:15 -extsched 'CRAYLINUX[]' \ -w 'ended(c96.fv3.nemsio)' "export NODES=1; $PWD/c96.gfs.sigio.sh" @@ -104,7 +100,6 @@ bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.gfs.sigio -M 10 export OMP_NUM_THREADS=1 export APRUN="aprun -j 1 -n 6 -N 6 -d ${OMP_NUM_THREADS} -cc depth" -export INPUT_DATA=${HOMEreg}/input_data/gfs.nemsio bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.gfs.nemsio -M 1000 -W 0:15 -extsched 'CRAYLINUX[]' \ -w 'ended(c96.gfs.sigio)' "export NODES=1; $PWD/c96.gfs.nemsio.sh" @@ -114,14 +109,22 @@ bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.gfs.nemsio -M 1 export OMP_NUM_THREADS=1 export APRUN="aprun -j 1 -n 6 -N 6 -d ${OMP_NUM_THREADS} -cc depth" -export INPUT_DATA=${HOMEreg}/input_data/fv3.nemsio bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.regional -M 1000 -W 0:15 -extsched 'CRAYLINUX[]' \ -w 'ended(c96.gfs.nemsio)' "export NODES=1; $PWD/c96.regional.sh" +#----------------------------------------------------------------------------- +# Initialize global C192 using GFS GRIB2 data. +#----------------------------------------------------------------------------- + +export OMP_NUM_THREADS=1 +export APRUN="aprun -j 1 -n 6 -N 6 -d ${OMP_NUM_THREADS} -cc depth" +bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c192.gfs.grib2 -M 1000 -W 0:05 -extsched 'CRAYLINUX[]' \ + -w 'ended(c96.regional)' "export NODES=1; $PWD/c192.gfs.grib2.sh" + #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- -bsub -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J summary -R "rusage[mem=100]" -W 0:01 -w 'ended(c96.regional)' "grep -a '<<<' $LOG_FILE >> $SUM_FILE" +bsub -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J summary -R "rusage[mem=100]" -W 0:01 -w 'ended(c192.gfs.grib2)' "grep -a '<<<' $LOG_FILE >> $SUM_FILE" exit diff --git a/reg_tests/chgres_cube/driver.dell.sh b/reg_tests/chgres_cube/driver.dell.sh index a8fcb7cf2..6b17d0be0 100755 --- a/reg_tests/chgres_cube/driver.dell.sh +++ b/reg_tests/chgres_cube/driver.dell.sh @@ -62,7 +62,6 @@ export APRUN=mpirun #----------------------------------------------------------------------------- export OMP_NUM_THREADS=1 -export INPUT_DATA=${HOMEreg}/input_data/fv3.restart bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.fv3.restart -W 0:15 -x -n 6 \ -R "span[ptile=6]" -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" "$PWD/c96.fv3.restart.sh" @@ -71,7 +70,6 @@ bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.fv3.restart -W #----------------------------------------------------------------------------- export OMP_NUM_THREADS=1 -export INPUT_DATA=${HOMEreg}/input_data/fv3.history bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c192.fv3.history -W 0:15 -x -n 6 -w 'ended(c96.fv3.restart)' \ -R "span[ptile=6]" -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" "$PWD/c192.fv3.history.sh" @@ -80,7 +78,6 @@ bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c192.fv3.history -W #----------------------------------------------------------------------------- export OMP_NUM_THREADS=1 -export INPUT_DATA=${HOMEreg}/input_data/fv3.nemsio bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.fv3.nemsio -W 0:15 -x -n 6 -w 'ended(c192.fv3.history)' \ -R "span[ptile=6]" -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" "$PWD/c96.fv3.nemsio.sh" @@ -89,7 +86,6 @@ bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.fv3.nemsio -W 0 #----------------------------------------------------------------------------- export OMP_NUM_THREADS=4 -export INPUT_DATA=${HOMEreg}/input_data/gfs.sigio bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.gfs.sigio -W 0:15 -x -n 6 -w 'ended(c96.fv3.nemsio)' \ -R "span[ptile=6]" -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" "$PWD/c96.gfs.sigio.sh" @@ -98,7 +94,6 @@ bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.gfs.sigio -W 0 #----------------------------------------------------------------------------- export OMP_NUM_THREADS=1 -export INPUT_DATA=${HOMEreg}/input_data/gfs.nemsio bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.gfs.nemsio -W 0:15 -x -n 6 -w 'ended(c96.gfs.sigio)' \ -R "span[ptile=6]" -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" "$PWD/c96.gfs.nemsio.sh" @@ -107,15 +102,22 @@ bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.gfs.nemsio -W #----------------------------------------------------------------------------- export OMP_NUM_THREADS=1 -export INPUT_DATA=${HOMEreg}/input_data/fv3.nemsio bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.regional -W 0:15 -x -n 6 -w 'ended(c96.gfs.nemsio)' \ -R "span[ptile=6]" -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" "$PWD/c96.regional.sh" +#----------------------------------------------------------------------------- +# Initialize global C192 using GFS GRIB2 file. +#----------------------------------------------------------------------------- + +export OMP_NUM_THREADS=1 +bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c192.gfs.grib2 -W 0:05 -x -n 6 -w 'ended(c96.regional)' \ + -R "span[ptile=6]" -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" "$PWD/c192.gfs.grib2.sh" + #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- bsub -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J summary -R "affinity[core(1)]" -R "rusage[mem=100]" -W 0:01 \ - -w 'ended(c96.regional)' "grep -a '<<<' $LOG_FILE >> $SUM_FILE" + -w 'ended(c192.gfs.grib2)' "grep -a '<<<' $LOG_FILE >> $SUM_FILE" exit diff --git a/reg_tests/chgres_cube/driver.hera.sh b/reg_tests/chgres_cube/driver.hera.sh index ba58b3b15..5ae2882d6 100755 --- a/reg_tests/chgres_cube/driver.hera.sh +++ b/reg_tests/chgres_cube/driver.hera.sh @@ -99,12 +99,19 @@ TEST5=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_C TEST6=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.regional \ -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST5 ./c96.regional.sh) +#----------------------------------------------------------------------------- +# Initialize global C192 using GFS GRIB2 files. +#----------------------------------------------------------------------------- + +TEST7=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.gfs.grib2 \ + -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST6 ./c192.gfs.grib2.sh) + #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ - --open-mode=append -q $QUEUE -d afterok:$TEST6 << EOF + --open-mode=append -q $QUEUE -d afterok:$TEST7 << EOF #!/bin/sh grep -a '<<<' $LOG_FILE > $SUM_FILE EOF diff --git a/reg_tests/chgres_cube/driver.jet.sh b/reg_tests/chgres_cube/driver.jet.sh index 7fe60ee71..0b97ec20d 100755 --- a/reg_tests/chgres_cube/driver.jet.sh +++ b/reg_tests/chgres_cube/driver.jet.sh @@ -101,12 +101,19 @@ TEST5=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:10 TEST6=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.regional \ -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST5 ./c96.regional.sh) +#----------------------------------------------------------------------------- +# Initialize C192 using GFS GRIB2 data. +#----------------------------------------------------------------------------- + +TEST7=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.gfs.grib2 \ + -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST6 ./c192.gfs.grib2.sh) + #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- sbatch --partition=xjet --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ - --open-mode=append -q $QUEUE -d afterok:$TEST6 << EOF + --open-mode=append -q $QUEUE -d afterok:$TEST7 << EOF #!/bin/sh grep -a '<<<' $LOG_FILE > $SUM_FILE EOF diff --git a/sorc/chgres_cube.fd/write_data.F90 b/sorc/chgres_cube.fd/write_data.F90 index f51fb5429..f14c5c912 100644 --- a/sorc/chgres_cube.fd/write_data.F90 +++ b/sorc/chgres_cube.fd/write_data.F90 @@ -1164,7 +1164,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) HEADER : if (localpet < num_tiles_target_grid) then tile = localpet + 1 - WRITE(OUTFILE, '(A, I1, A)'), 'out.atm.tile', tile, '.nc' + WRITE(OUTFILE, '(A, I1, A)') 'out.atm.tile', tile, '.nc' !--- open the file error = nf90_create(outfile, IOR(NF90_NETCDF4,NF90_CLASSIC_MODEL), & @@ -1634,7 +1634,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) LOCAL_PET : if (localpet == 0) then - WRITE(OUTFILE, '(A, I1, A)'), 'out.sfc.tile', tile, '.nc' + WRITE(OUTFILE, '(A, I1, A)') 'out.sfc.tile', tile, '.nc' !--- open the file error = nf90_create(outfile, IOR(NF90_NETCDF4,NF90_CLASSIC_MODEL), & diff --git a/ush/chgres_cube.sh b/ush/chgres_cube.sh index 26ab7fc19..dec2797c9 100755 --- a/ush/chgres_cube.sh +++ b/ush/chgres_cube.sh @@ -66,7 +66,7 @@ HALO_BLEND=${HALO_BLEND:-0} # 'restart' for tiled fv3 warm restart files. 'gfs_gaussian' # for spectral gfs nemsio files. 'gfs_spectral' for # for spectral gfs sigio/sfcio files. 'gaussian' for fv3 -# gaussian nemsio files. +# gaussian nemsio files. 'grib2' for gfs grib2 files. # # MOSAIC_FILE_INPUT_GRID - Path/Name of mosaic file for input grid. Only # used for 'history' and 'restart' INPUT_TYPE. @@ -101,7 +101,7 @@ COMIN=${COMIN:-$PWD} #---------------------------------------------------------------------------- # ATM_FILES_INPUT - Input atmospheric data file(s). Not used for 'restart' -# INPUT_TYPE. +# and 'grib2' INPUT_TYPE. # # ATM_CORE_FILES - Input atmospheric core files. Used for 'restart' # INPUT_TYPE only. The first six entries are the tiled @@ -111,11 +111,16 @@ COMIN=${COMIN:-$PWD} # ATM_TRACER_FILES_INPUT - Input atmospheric tracer files for each tile. # Used for 'restart' INPUT_TYPE only. # -# SFC_FILES_INPUT - Input surface data file(s). +# SFC_FILES_INPUT - Input surface data file(s). Not used for 'grib2' +# INPUT_TYPE. # # NST_FILES_INPUT - Input nst data file. 'gfs_gaussian' INPUT_TYPE only. # +# GRIB2_FILE_INPUT - Input gfs grib2 data file. Only used for 'grib2' +# INPUT_TYPE. +# # TRACERS_INPUT - List of input atmospheric tracer records to be processed. +# Not used for 'grib2' INPUT_TYPE. #---------------------------------------------------------------------------- ATM_FILES_INPUT=${ATM_FILES_INPUT:-NULL} @@ -123,13 +128,17 @@ ATM_CORE_FILES_INPUT=${ATM_CORE_FILES_INPUT:-NULL} ATM_TRACER_FILES_INPUT=${ATM_TRACER_FILES_INPUT:-NULL} SFC_FILES_INPUT=${SFC_FILES_INPUT:-NULL} NST_FILES_INPUT=${NST_FILES_INPUT:-NULL} +GRIB2_FILE_INPUT=${GRIB2_FILE_INPUT:-NULL} TRACERS_INPUT=${TRACERS_INPUT:-'"spfh","clwmr","o3mr","icmr","rwmr","snmr","grle"'} #---------------------------------------------------------------------------- +# +# VARMAP_FILE - Variable mapping table. Only used for 'grib2' INPUT_TYPE. +# # TRACERS_TARGET - List of target tracer records. Must corresponde with -# with TRACERS_INPUT. +# with TRACERS_INPUT. Not used for 'grib2' INPUT_TYPE. # -# VCOORD_FILE - File containing vertical coordinate defintion for target +# VCOORD_FILE - File containing vertical coordinate definition for target # grid. # # MOSAIC FILE_TARGET_GRID - Mosaic file for target grid (include path). @@ -140,6 +149,8 @@ TRACERS_INPUT=${TRACERS_INPUT:-'"spfh","clwmr","o3mr","icmr","rwmr","snmr","grle # be located in FIXfv3. #---------------------------------------------------------------------------- +VARMAP_FILE=${VARMAP_FILE:-NULL} + TRACERS_TARGET=${TRACERS_TARGET:-'"sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel"'} VCOORD_FILE=${VCOORD_FILE:-${FIXam}/global_hyblev.l65.txt} @@ -196,6 +207,8 @@ cat << EOF > ./fort.41 atm_tracer_files_input_grid="${ATM_TRACER_FILES_INPUT}" sfc_files_input_grid="${SFC_FILES_INPUT}" nst_files_input_grid="${NST_FILES_INPUT}" + grib2_file_input_grid="${GRIB2_FILE_INPUT}" + varmap_file="${VARMAP_FILE}" cycle_mon=$im cycle_day=$id cycle_hour=$ih From aeca7796981e86a7697da9053308cb16c0bd31da Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Tue, 25 Feb 2020 09:17:50 -0500 Subject: [PATCH 015/192] Add LGPL license to repository. (#70) NOAA legal approved licenses for our component repositories. For EMC components we are using the LGPL. --- LICENSE.md | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 000000000..8021e518a --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,166 @@ +# GNU LESSER GENERAL PUBLIC LICENSE +Version 3, 29 June 2007 + +Copyright (C) 2007 [Free Software Foundation, Inc.](https://fsf.org/) + +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + + +This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + +## 0. Additional Definitions. + +As used herein, *this License* refers to version 3 of the GNU Lesser +General Public License, and the *GNU GPL* refers to version 3 of the GNU +General Public License. + +*The Library* refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + +An *Application* is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + +A *Combined Work* is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the *Linked +Version*. + +The *Minimal Corresponding Source* for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + +The *Corresponding Application Code* for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + +## 1. Exception to Section 3 of the GNU GPL. + +You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + +## 2. Conveying Modified Versions. + +If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + - a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + - b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + +## 3. Object Code Incorporating Material from Library Header Files. + +The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + - a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + - b) Accompany the object code with a copy of the GNU GPL and this license + document. + +## 4. Combined Works. + +You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + - a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + - b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + - c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + - d) Do one of the following: + + - 0\) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + - 1\) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + - e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + +## 5. Combined Libraries. + +You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + - a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + - b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + +## 6. Revised Versions of the GNU Lesser General Public License. + +The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License *or any later version* +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + +If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. From 5b422ceaf71a56b164db6e6a4ec69af25a6708a3 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Fri, 28 Feb 2020 13:36:14 -0500 Subject: [PATCH 016/192] GDAS initialization scripts Baseline set of utility scripts to start a GDAS/ENKF cycle using FV3GFS data as input. The scripts pull the needed data from HPSS and run the chgres_cube program for the high-res and ENKF members. chgres_cube - Fix three argument mismatches in call to error handler routine (see #69 for details). Update Cray build module to point to my own copy of the wgrib2 api instead of Dusan's. Point to official version of ESMF v8 on Cray and Dell. This commit references #33. --- modulefiles/chgres_cube.wcoss_cray | 15 +-- modulefiles/chgres_cube.wcoss_dell_p3 | 5 +- reg_tests/chgres_cube/driver.cray.sh | 2 +- sorc/chgres_cube.fd/input_data.F90 | 4 +- sorc/chgres_cube.fd/program_setup.f90 | 2 +- util/gdas_init/config | 80 ++++++++++++++ util/gdas_init/driver.cray.sh | 147 ++++++++++++++++++++++++++ util/gdas_init/driver.dell.sh | 143 +++++++++++++++++++++++++ util/gdas_init/driver.hera.sh | 137 ++++++++++++++++++++++++ util/gdas_init/get_pre-v14.data.sh | 93 ++++++++++++++++ util/gdas_init/get_v14.data.sh | 83 +++++++++++++++ util/gdas_init/get_v15.data.sh | 114 ++++++++++++++++++++ util/gdas_init/run_pre-v14.chgres.sh | 101 ++++++++++++++++++ util/gdas_init/run_v14.chgres.sh | 103 ++++++++++++++++++ util/gdas_init/run_v15.chgres.sh | 100 ++++++++++++++++++ 15 files changed, 1117 insertions(+), 12 deletions(-) create mode 100644 util/gdas_init/config create mode 100755 util/gdas_init/driver.cray.sh create mode 100755 util/gdas_init/driver.dell.sh create mode 100755 util/gdas_init/driver.hera.sh create mode 100755 util/gdas_init/get_pre-v14.data.sh create mode 100755 util/gdas_init/get_v14.data.sh create mode 100755 util/gdas_init/get_v15.data.sh create mode 100755 util/gdas_init/run_pre-v14.chgres.sh create mode 100755 util/gdas_init/run_v14.chgres.sh create mode 100755 util/gdas_init/run_v15.chgres.sh diff --git a/modulefiles/chgres_cube.wcoss_cray b/modulefiles/chgres_cube.wcoss_cray index 1a9df23b0..d80eaaa35 100644 --- a/modulefiles/chgres_cube.wcoss_cray +++ b/modulefiles/chgres_cube.wcoss_cray @@ -7,7 +7,8 @@ module rm intel module load intel/16.3.210 module load cray-mpich/7.2.0 module load craype-haswell -module load cray-netcdf +module load cray-netcdf/4.3.3.1 +module load cray-hdf5/1.8.14 module load w3nco-intel/2.0.6 module load nemsio-intel/2.2.3 module load bacio-intel/2.0.2 @@ -15,12 +16,14 @@ module load sp-intel/2.0.2 module load sigio-intel/2.1.0 module load sfcio-intel/1.0.0 -# module use /gpfs/hps3/emc/nems/noscrub/emc.nemspara/soft/modulefiles -# module load esmf/7.1.0r -export ESMFMKFILE=/gpfs/hps3/emc/global/noscrub/George.Gayno/esmf/8_0_0_bs20/lib/esmf.mk +module use /gpfs/hps3/emc/nems/noscrub/emc.nemspara/soft/modulefiles +module load esmf/8.0.0 +module rm gcc +module load gcc/4.9.2 -export WGRIB2API_INC=/gpfs/hps3/emc/meso/save/Dusan.Jovic/wgrib2/include -export WGRIB2_LIB=/gpfs/hps3/emc/meso/save/Dusan.Jovic/wgrib2/lib/libwgrib2.a + +export WGRIB2API_INC=/gpfs/hps3/emc/global/noscrub/George.Gayno/wgrib2/include +export WGRIB2_LIB=/gpfs/hps3/emc/global/noscrub/George.Gayno/wgrib2/lib/libwgrib2.a export FCOMP=ftn export FFLAGS="-O3 -fp-model precise -g -r8 -i4 -qopenmp -convert big_endian -assume byterecl" diff --git a/modulefiles/chgres_cube.wcoss_dell_p3 b/modulefiles/chgres_cube.wcoss_dell_p3 index 61297e0cd..02c8e36e6 100644 --- a/modulefiles/chgres_cube.wcoss_dell_p3 +++ b/modulefiles/chgres_cube.wcoss_dell_p3 @@ -5,8 +5,6 @@ module load ips/18.0.1.163 module load impi/18.0.1 module load NetCDF/4.5.0 -# module load ESMF/7_1_0r -export ESMFMKFILE=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/esmf_lib/8_0_0bs20/lib/libO/Linux.intel.64.intelmpi.default/esmf.mk module load w3nco/2.0.6 module load sp/2.0.2 module load nemsio/2.2.3 @@ -14,6 +12,9 @@ module load bacio/2.0.2 module load sfcio/1.0.0 module load sigio/2.1.0 +module use /gpfs/dell2/emc/modeling/noscrub/emc.nemspara/soft/modulefiles +module load esmf/8.0.0 + export WGRIB2API_INC=/u/Wesley.Ebisuzaki/home/grib2.v2.0.8.intel/lib export WGRIB2_LIB=/u/Wesley.Ebisuzaki/home/grib2.v2.0.8.intel/lib/libwgrib2.a diff --git a/reg_tests/chgres_cube/driver.cray.sh b/reg_tests/chgres_cube/driver.cray.sh index d9558d2a2..2ffd353e8 100755 --- a/reg_tests/chgres_cube/driver.cray.sh +++ b/reg_tests/chgres_cube/driver.cray.sh @@ -28,7 +28,7 @@ module rm intel module load intel/16.3.210 module load cray-mpich/7.2.0 module load craype-haswell -module load cray-netcdf +module load cray-netcdf/4.3.3.1 module load xt-lsfhpc/9.1.3 module list diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index 5795fd6f2..76a20623a 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -5531,7 +5531,7 @@ subroutine handle_grib_error(vname,lev,method,value,varnum, iret,var,var8,var3d) else call error_handler("ERROR USING MISSING_VAR_METHOD. PLEASE SET VALUES IN" // & " VARMAP TABLE TO ONE OF: set_to_fill, set_to_NaN,"// & - " , skip, or stop.") + " , skip, or stop.", 1) endif end subroutine handle_grib_error @@ -5561,7 +5561,7 @@ subroutine read_grib_soil(the_file,inv_file,vname,vname_file,dummy3d,rc) ':0.4-1 m below ground:', ':1-2 m below ground:'/) else rc = -1 - call error_handler("reading soil levels. File must have 4 soil levels.") + call error_handler("reading soil levels. File must have 4 soil levels.", rc) endif call get_var_cond(vname,this_miss_var_method=method,this_miss_var_value=value, & diff --git a/sorc/chgres_cube.fd/program_setup.f90 b/sorc/chgres_cube.fd/program_setup.f90 index 25ac2f33f..f81d20d11 100644 --- a/sorc/chgres_cube.fd/program_setup.f90 +++ b/sorc/chgres_cube.fd/program_setup.f90 @@ -277,7 +277,7 @@ subroutine read_setup_namelist if (trim(input_type) == "grib2") then if (trim(grib2_file_input_grid) == "NULL" .or. trim(grib2_file_input_grid) == "") then - call error_handler("FOR GRIB2 DATA, PLEASE PROVIDE GRIB2_FILE_INPUT_GRID") + call error_handler("FOR GRIB2 DATA, PLEASE PROVIDE GRIB2_FILE_INPUT_GRID", 1) endif endif diff --git a/util/gdas_init/config b/util/gdas_init/config new file mode 100644 index 000000000..2b4892eff --- /dev/null +++ b/util/gdas_init/config @@ -0,0 +1,80 @@ +#----------------------------------------------------------- +# +# 1) Compile the chgres_cube program. Invoke +# ./sorc/build_chgres_cube.sh +# +# 2) Ensure links to the 'fixed' directories are +# set. See the ./sorc/link_fixdirs.sh script prolog +# for details. +# +# 3) Set all config variables. See definitions +# below. +# +# 4) Invoke the driver script for your machine (with no +# arguments). +# +# Variable definitions: +# -------------------- +# EXTRACT_DIR - directory where data extracted from HPSS +# is stored. +# EXTRACT_DATA - Set to 'yes' to extract data from HPSS. +# If data has been extracted and is located +# in EXTRACT_DIR, set to 'no'. +# RUN_CHGRES - To run chgres, set to 'yes'. To extract +# data only, set to 'no'. +# yy/mm/dd/hh - The year/month/day/hour of your desired +# experiment. Currently, does not support +# pre-ENKF GFS data, prior to +# 2012 May 21 00z. +# LEVS - Number of hybrid levels plus 1. To +# run with 64 levels, set LEVS to 65. +# CRES_HIRES - Resolution of the hires component of +# your experiment. +# CRES_ENKF - Resolution of the enkf component of the +# your experiment. +# UFS_DIR - Location of your checked out UFS_UTILS +# repo. +# OUTDIR - Directory where data output from chgres is stored. +# +#----------------------------------------------------------- + +EXTRACT_DIR=/gpfs/dell1/stmp/$USER/gdas.init/input +EXTRACT_DATA=yes + +RUN_CHGRES=yes + +yy=2017 +mm=07 +dd=19 +hh=18 + +LEVS=65 + +CRES_HIRES=C192 +CRES_ENKF=C96 + +UFS_DIR=$PWD/../.. + +OUTDIR=/gpfs/dell1/stmp/$USER/gdas.init/output + +#--------------------------------------------------------- +# Dont touch anything below here. +#--------------------------------------------------------- + +gfs_ver=v15 + +# No ENKF data prior to 2012/05/21/00z +if [ $yy$mm$dd$hh -lt 2012052100 ]; then + set +x + echo FATAL ERROR: SCRIPTS DO NOT SUPPORT OLD GFS DATA + exit 2 +elif [ $yy$mm$dd$hh -lt 2016051000 ]; then + gfs_ver=v12 +elif [ $yy$mm$dd$hh -lt 2017072000 ]; then + gfs_ver=v13 +elif [ $yy$mm$dd$hh -lt 2019061200 ]; then + gfs_ver=v14 +fi + +export EXTRACT_DIR yy mm dd hh UFS_DIR OUTDIR CRES_HIRES CRES_ENKF RUN_CHGRES +export LEVS gfs_ver diff --git a/util/gdas_init/driver.cray.sh b/util/gdas_init/driver.cray.sh new file mode 100755 index 000000000..99e9bd057 --- /dev/null +++ b/util/gdas_init/driver.cray.sh @@ -0,0 +1,147 @@ +#!/bin/bash + +#---------------------------------------------------------------------- +# Driver script for running on Cray. +# +# Edit the 'config' file before running. +#---------------------------------------------------------------------- + +set -x + +module purge +module load PrgEnv-intel/5.2.56 +module rm intel +module load intel/16.3.210 +module load cray-mpich/7.2.0 +module load craype-haswell +module load cray-netcdf/4.3.3.1 +module load xt-lsfhpc/9.1.3 +module load prod_util/1.1.0 +module load hpss/4.1.0.3 +module list + +PROJECT_CODE=GFS-DEV + +source config + +if [ $EXTRACT_DATA == yes ]; then + + rm -fr $EXTRACT_DIR + mkdir -p $EXTRACT_DIR + + QUEUE=dev_transfer + + MEM=6000 + WALLT="2:00" + + case $gfs_ver in + v12 | v13) + bsub -o log.data.hires -e log.data.hires -q $QUEUE -P $PROJECT_CODE -J get.data.hires -W $WALLT \ + -R "rusage[mem=$MEM]" "./get_pre-v14.data.sh hires" + bsub -o log.data.enkf -e log.data.enkf -q $QUEUE -P $PROJECT_CODE -J get.data.enkf -W $WALLT \ + -R "rusage[mem=$MEM]" "./get_pre-v14.data.sh enkf" + DEPEND="-w ended(get.data.*)" + ;; + v14) + bsub -o log.data.hires -e log.data.hires -q $QUEUE -P $PROJECT_CODE -J get.data.hires -W $WALLT \ + -R "rusage[mem=$MEM]" "./get_v14.data.sh hires" + bsub -o log.data.enkf -e log.data.enkf -q $QUEUE -P $PROJECT_CODE -J get.data.enkf -W $WALLT \ + -R "rusage[mem=$MEM]" "./get_v14.data.sh enkf" + DEPEND="-w ended(get.data.*)" + ;; + v15) + bsub -o log.data.hires -e log.data.hires -q $QUEUE -P $PROJECT_CODE -J get.data.hires -W $WALLT \ + -R "rusage[mem=$MEM]" "./get_v15.data.sh hires" + bsub -o log.data.grp1 -e log.data.grp1 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf1 -W $WALLT \ + -R "rusage[mem=$MEM]" "./get_v15.data.sh grp1" + bsub -o log.data.grp2 -e log.data.grp2 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf2 -W $WALLT \ + -R "rusage[mem=$MEM]" "./get_v15.data.sh grp2" + bsub -o log.data.grp3 -e log.data.grp3 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf3 -W $WALLT \ + -R "rusage[mem=$MEM]" "./get_v15.data.sh grp3" + bsub -o log.data.grp4 -e log.data.grp4 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf4 -W $WALLT \ + -R "rusage[mem=$MEM]" "./get_v15.data.sh grp4" + bsub -o log.data.grp5 -e log.data.grp5 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf5 -W $WALLT \ + -R "rusage[mem=$MEM]" "./get_v15.data.sh grp5" + bsub -o log.data.grp6 -e log.data.grp6 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf6 -W $WALLT \ + -R "rusage[mem=$MEM]" "./get_v15.data.sh grp6" + bsub -o log.data.grp7 -e log.data.grp7 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf7 -W $WALLT \ + -R "rusage[mem=$MEM]" "./get_v15.data.sh grp7" + bsub -o log.data.grp8 -e log.data.grp8 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf8 -W $WALLT \ + -R "rusage[mem=$MEM]" "./get_v15.data.sh grp8" + DEPEND="-w ended(get.data.*)" + ;; + esac + +else + + DEPEND=' ' + +fi + +if [ $RUN_CHGRES == yes ]; then + MEM=2000 + QUEUE=dev + MEMBER=hires + WALLT="0:15" + NUM_NODES=1 + case $gfs_ver in + v12 | v13) + export OMP_NUM_THREADS=2 + export OMP_STACKSIZE=1024M + ;; + *) + export OMP_NUM_THREADS=1 + ;; + esac + export APRUN="aprun -j 1 -n 12 -N 12 -d ${OMP_NUM_THREADS} -cc depth" + if [ $CRES_HIRES == 'C768' ] ; then + WALLT="0:20" + NUM_NODES=3 + export APRUN="aprun -j 1 -n 36 -N 12 -d ${OMP_NUM_THREADS} -cc depth" + elif [ $CRES_HIRES == 'C1152' ] ; then + WALLT="0:20" + NUM_NODES=4 + export APRUN="aprun -j 1 -n 48 -N 12 -d ${OMP_NUM_THREADS} -cc depth" + fi + case $gfs_ver in + v12 | v13) + bsub -e log.${MEMBER} -o log.${MEMBER} -q $QUEUE -P $PROJECT_CODE -J chgres_${MEMBER} -M $MEM -W $WALLT \ + -extsched 'CRAYLINUX[]' $DEPEND "export NODES=$NUM_NODES; ./run_pre-v14.chgres.sh ${MEMBER}" + ;; + v14) + bsub -e log.${MEMBER} -o log.${MEMBER} -q $QUEUE -P $PROJECT_CODE -J chgres_${MEMBER} -M $MEM -W $WALLT \ + -extsched 'CRAYLINUX[]' $DEPEND "export NODES=$NUM_NODES; ./run_v14.chgres.sh ${MEMBER}" + ;; + v15) + bsub -e log.${MEMBER} -o log.${MEMBER} -q $QUEUE -P $PROJECT_CODE -J chgres_${MEMBER} -M $MEM -W $WALLT \ + -extsched 'CRAYLINUX[]' $DEPEND "export NODES=$NUM_NODES; ./run_v15.chgres.sh ${MEMBER}" + ;; + esac + + WALLT="0:15" + NUM_NODES=1 + export APRUN="aprun -j 1 -n 12 -N 12 -d ${OMP_NUM_THREADS} -cc depth" + MEMBER=1 + while [ $MEMBER -le 80 ]; do + if [ $MEMBER -lt 10 ]; then + MEMBER_CH="00${MEMBER}" + else + MEMBER_CH="0${MEMBER}" + fi + case $gfs_ver in + v12 | v13) + bsub -e log.${MEMBER_CH} -o log.${MEMBER_CH} -q $QUEUE -P $PROJECT_CODE -J chgres_${MEMBER_CH} -M $MEM -W $WALLT \ + -extsched 'CRAYLINUX[]' $DEPEND "export NODES=$NUM_NODES; ./run_pre-v14.chgres.sh ${MEMBER_CH}" + ;; + v14) + bsub -e log.${MEMBER_CH} -o log.${MEMBER_CH} -q $QUEUE -P $PROJECT_CODE -J chgres_${MEMBER_CH} -M $MEM -W $WALLT \ + -extsched 'CRAYLINUX[]' $DEPEND "export NODES=$NUM_NODES; ./run_v14.chgres.sh ${MEMBER_CH}" + ;; + v15) + bsub -e log.${MEMBER_CH} -o log.${MEMBER_CH} -q $QUEUE -P $PROJECT_CODE -J chgres_${MEMBER_CH} -M $MEM -W $WALLT \ + -extsched 'CRAYLINUX[]' $DEPEND "export NODES=$NUM_NODES; ./run_v15.chgres.sh ${MEMBER_CH}" + ;; + esac + MEMBER=$(( $MEMBER + 1 )) + done +fi diff --git a/util/gdas_init/driver.dell.sh b/util/gdas_init/driver.dell.sh new file mode 100755 index 000000000..27af36e35 --- /dev/null +++ b/util/gdas_init/driver.dell.sh @@ -0,0 +1,143 @@ +#!/bin/bash + +#---------------------------------------------------------------------- +# Driver script for running on Dell. +# +# Edit the 'config' file before running. +#---------------------------------------------------------------------- + +set -x + +module purge +module load EnvVars/1.0.2 +module load ips/18.0.1.163 +module load impi/18.0.1 +module load lsf/10.1 +module load HPSS/5.0.2.5 +module use /usrx/local/dev/modulefiles +module load NetCDF/4.5.0 +module load prod_util/1.1.3 +module list + +PROJECT_CODE=GFS-DEV + +source config + +if [ $EXTRACT_DATA == yes ]; then + + rm -fr $EXTRACT_DIR + mkdir -p $EXTRACT_DIR + + QUEUE=dev_transfer + + MEM=6000M + WALLT="2:00" + + case $gfs_ver in + v12 | v13 ) + bsub -o log.data.hires -e log.data.hires -q $QUEUE -P $PROJECT_CODE -J get.data.hires -W $WALLT \ + -R "affinity[core(1)]" -M $MEM "./get_pre-v14.data.sh hires" + bsub -o log.data.enkf -e log.data.enkf -q $QUEUE -P $PROJECT_CODE -J get.data.enkf -W $WALLT \ + -R "affinity[core(1)]" -M $MEM "./get_pre-v14.data.sh enkf" + DEPEND="-w ended(get.data.*)" + ;; + v14) + bsub -o log.data.hires -e log.data.hires -q $QUEUE -P $PROJECT_CODE -J get.data.hires -W $WALLT \ + -R "affinity[core(1)]" -M $MEM "./get_v14.data.sh hires" + bsub -o log.data.enkf -e log.data.enkf -q $QUEUE -P $PROJECT_CODE -J get.data.enkf -W $WALLT \ + -R "affinity[core(1)]" -M $MEM "./get_v14.data.sh enkf" + DEPEND="-w ended(get.data.*)" + ;; + v15) + bsub -o log.data.hires -e log.data.hires -q $QUEUE -P $PROJECT_CODE -J get.data.hires -W $WALLT \ + -R "affinity[core(1)]" -M $MEM "./get_v15.data.sh hires" + bsub -o log.data.grp1 -e log.data.grp1 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf1 -W $WALLT \ + -R "affinity[core(1)]" -M $MEM "./get_v15.data.sh grp1" + bsub -o log.data.grp2 -e log.data.grp2 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf2 -W $WALLT \ + -R "affinity[core(1)]" -M $MEM "./get_v15.data.sh grp2" + bsub -o log.data.grp3 -e log.data.grp3 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf3 -W $WALLT \ + -R "affinity[core(1)]" -M $MEM "./get_v15.data.sh grp3" + bsub -o log.data.grp4 -e log.data.grp4 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf4 -W $WALLT \ + -R "affinity[core(1)]" -M $MEM "./get_v15.data.sh grp4" + bsub -o log.data.grp5 -e log.data.grp5 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf5 -W $WALLT \ + -R "affinity[core(1)]" -M $MEM "./get_v15.data.sh grp5" + bsub -o log.data.grp6 -e log.data.grp6 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf6 -W $WALLT \ + -R "affinity[core(1)]" -M $MEM "./get_v15.data.sh grp6" + bsub -o log.data.grp7 -e log.data.grp7 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf7 -W $WALLT \ + -R "affinity[core(1)]" -M $MEM "./get_v15.data.sh grp7" + bsub -o log.data.grp8 -e log.data.grp8 -q $QUEUE -P $PROJECT_CODE -J get.data.enkf8 -W $WALLT \ + -R "affinity[core(1)]" -M $MEM "./get_v15.data.sh grp8" + DEPEND="-w ended(get.data.*)" + ;; + esac + +else + + DEPEND=' ' + +fi + +if [ $RUN_CHGRES == yes ]; then + QUEUE=dev + MEMBER=hires + WALLT="0:15" + export OMP_NUM_THREADS=1 + NODES="-n 18 -R "span[ptile=9]"" + export APRUN="mpirun" + if [ $CRES_HIRES == 'C768' ] ; then + NODES="-n 24 -R "span[ptile=6]"" + elif [ $CRES_HIRES == 'C1152' ] ; then + NODES="-n 36 -R "span[ptile=6]"" + WALLT="0:20" + fi + case $gfs_ver in + v12 | v13) + export OMP_STACKSIZE=1024M + export OMP_NUM_THREADS=2 + bsub -e log.${MEMBER} -o log.${MEMBER} -q $QUEUE -P $PROJECT_CODE -J chgres_${MEMBER} -W $WALLT \ + -x $NODES -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" $DEPEND \ + "./run_pre-v14.chgres.sh ${MEMBER}" + ;; + v14) + bsub -e log.${MEMBER} -o log.${MEMBER} -q $QUEUE -P $PROJECT_CODE -J chgres_${MEMBER} -W $WALLT \ + -x $NODES -R "affinity[core(1):distribute=balance]" $DEPEND \ + "./run_v14.chgres.sh ${MEMBER}" + ;; + v15) + bsub -e log.${MEMBER} -o log.${MEMBER} -q $QUEUE -P $PROJECT_CODE -J chgres_${MEMBER} -W $WALLT \ + -x $NODES -R "affinity[core(1):distribute=balance]" $DEPEND \ + "./run_v15.chgres.sh ${MEMBER}" + ;; + esac + + NODES="-n 18 -R "span[ptile=9]"" + WALLT="0:15" + MEMBER=1 + while [ $MEMBER -le 80 ]; do + if [ $MEMBER -lt 10 ]; then + MEMBER_CH="00${MEMBER}" + else + MEMBER_CH="0${MEMBER}" + fi + case $gfs_ver in + v12 | v13) + export OMP_STACKSIZE=1024M + export OMP_NUM_THREADS=2 + bsub -e log.${MEMBER_CH} -o log.${MEMBER_CH} -q $QUEUE -P $PROJECT_CODE -J chgres_${MEMBER_CH} -W $WALLT \ + -x $NODES -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" $DEPEND \ + "./run_pre-v14.chgres.sh ${MEMBER_CH}" + ;; + v14) + bsub -e log.${MEMBER_CH} -o log.${MEMBER_CH} -q $QUEUE -P $PROJECT_CODE -J chgres_${MEMBER_CH} -W $WALLT \ + -x $NODES -R "affinity[core(1):distribute=balance]" $DEPEND \ + "./run_v14.chgres.sh ${MEMBER_CH}" + ;; + v15) + bsub -e log.${MEMBER_CH} -o log.${MEMBER_CH} -q $QUEUE -P $PROJECT_CODE -J chgres_${MEMBER_CH} -W $WALLT \ + -x $NODES -R "affinity[core(1):distribute=balance]" $DEPEND \ + "./run_v15.chgres.sh ${MEMBER_CH}" + ;; + esac + MEMBER=$(( $MEMBER + 1 )) + done +fi diff --git a/util/gdas_init/driver.hera.sh b/util/gdas_init/driver.hera.sh new file mode 100755 index 000000000..711bab9a0 --- /dev/null +++ b/util/gdas_init/driver.hera.sh @@ -0,0 +1,137 @@ +#!/bin/bash + +#--------------------------------------------------------------------- +# Driver script for running on Hera. +# +# Edit the 'config' file before running. +#--------------------------------------------------------------------- + +set -x + +source /apps/lmod/lmod/init/sh +module purge +module use -a /scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles +module load intel/18.0.5.274 +module load impi/2018.0.4 +module load netcdf/4.7.0 +module load hpss +module load prod_util +module load nco/4.7.0 +module list + +PROJECT_CODE=fv3-cpu +QUEUE=batch + +source config + +if [ $EXTRACT_DATA == yes ]; then + + rm -fr $EXTRACT_DIR + mkdir -p $EXTRACT_DIR + + MEM=6000M + WALLT="2:00:00" + + case $gfs_ver in + v12 | v13) + DATAH=$(sbatch --parsable --partition=service --ntasks=1 --mem=$MEM -t $WALLT -A $PROJECT_CODE -q $QUEUE -J get_hires \ + -o log.data.hires -e log.data.hires ./get_pre-v14.data.sh hires) + DATA1=$(sbatch --parsable --partition=service --ntasks=1 --mem=$MEM -t $WALLT -A $PROJECT_CODE -q $QUEUE -J get_enkf \ + -o log.data.enkf -e log.data.enkf ./get_pre-v14.data.sh enkf) + DEPEND="-d afterok:$DATAH:$DATA1" + ;; + v14) + DATAH=$(sbatch --parsable --partition=service --ntasks=1 --mem=$MEM -t $WALLT -A $PROJECT_CODE -q $QUEUE -J get_hires \ + -o log.data.hires -e log.data.hires ./get_v14.data.sh hires) + DATA1=$(sbatch --parsable --partition=service --ntasks=1 --mem=$MEM -t $WALLT -A $PROJECT_CODE -q $QUEUE -J get_enkf \ + -o log.data.enkf -e log.data.enkf ./get_v14.data.sh enkf) + DEPEND="-d afterok:$DATAH:$DATA1" + ;; + v15) + DATAH=$(sbatch --parsable --partition=service --ntasks=1 --mem=$MEM -t $WALLT -A $PROJECT_CODE -q $QUEUE -J get_hires \ + -o log.data.hires -e log.data.hires ./get_v15.data.sh hires) + DATA1=$(sbatch --parsable --partition=service --ntasks=1 --mem=$MEM -t $WALLT -A $PROJECT_CODE -q $QUEUE -J get_grp1 \ + -o log.data.grp1 -e log.data.grp1 ./get_v15.data.sh grp1) + DATA2=$(sbatch --parsable --partition=service --ntasks=1 --mem=$MEM -t $WALLT -A $PROJECT_CODE -q $QUEUE -J get_grp2 \ + -o log.data.grp2 -e log.data.grp2 ./get_v15.data.sh grp2) + DATA3=$(sbatch --parsable --partition=service --ntasks=1 --mem=$MEM -t $WALLT -A $PROJECT_CODE -q $QUEUE -J get_grp3 \ + -o log.data.grp3 -e log.data.grp3 ./get_v15.data.sh grp3) + DATA4=$(sbatch --parsable --partition=service --ntasks=1 --mem=$MEM -t $WALLT -A $PROJECT_CODE -q $QUEUE -J get_grp4 \ + -o log.data.grp4 -e log.data.grp4 ./get_v15.data.sh grp4) + DATA5=$(sbatch --parsable --partition=service --ntasks=1 --mem=$MEM -t $WALLT -A $PROJECT_CODE -q $QUEUE -J get_grp5 \ + -o log.data.grp5 -e log.data.grp5 ./get_v15.data.sh grp5) + DATA6=$(sbatch --parsable --partition=service --ntasks=1 --mem=$MEM -t $WALLT -A $PROJECT_CODE -q $QUEUE -J get_grp6 \ + -o log.data.grp6 -e log.data.grp6 ./get_v15.data.sh grp6) + DATA7=$(sbatch --parsable --partition=service --ntasks=1 --mem=$MEM -t $WALLT -A $PROJECT_CODE -q $QUEUE -J get_grp7 \ + -o log.data.grp7 -e log.data.grp7 ./get_v15.data.sh grp7) + DATA8=$(sbatch --parsable --partition=service --ntasks=1 --mem=$MEM -t $WALLT -A $PROJECT_CODE -q $QUEUE -J get_grp8 \ + -o log.data.grp8 -e log.data.grp8 ./get_v15.data.sh grp8) + DEPEND="-d afterok:$DATAH:$DATA1:$DATA2:$DATA3:$DATA4:$DATA5:$DATA6:$DATA7:$DATA8" + ;; + esac + +else + + DEPEND=' ' + +fi + +if [ $RUN_CHGRES == yes ]; then + export APRUN=srun + MEMBER=hires + NODES=3 + WALLT="0:15:00" + export OMP_NUM_THREADS=1 + if [ $CRES_HIRES == 'C768' ] ; then + NODES=5 + elif [ $CRES_HIRES == 'C1152' ] ; then + NODES=8 + WALLT="0:20:00" + fi + case $gfs_ver in + v12 | v13) + export OMP_NUM_THREADS=4 + export OMP_STACKSIZE=1024M + sbatch --parsable --ntasks-per-node=6 --nodes=${NODES} --cpus-per-task=$OMP_NUM_THREADS \ + -t $WALLT -A $PROJECT_CODE -q $QUEUE -J chgres_${MEMBER} \ + -o log.${MEMBER} -e log.${MEMBER} ${DEPEND} run_pre-v14.chgres.sh ${MEMBER} + ;; + v14) + sbatch --parsable --ntasks-per-node=6 --nodes=${NODES} -t $WALLT -A $PROJECT_CODE -q $QUEUE -J chgres_${MEMBER} \ + -o log.${MEMBER} -e log.${MEMBER} ${DEPEND} run_v14.chgres.sh ${MEMBER} + ;; + v15) + sbatch --parsable --ntasks-per-node=6 --nodes=${NODES} -t $WALLT -A $PROJECT_CODE -q $QUEUE -J chgres_${MEMBER} \ + -o log.${MEMBER} -e log.${MEMBER} ${DEPEND} run_v15.chgres.sh ${MEMBER} + ;; + esac + + WALLT="0:15:00" + MEMBER=1 + while [ $MEMBER -le 80 ]; do + if [ $MEMBER -lt 10 ]; then + MEMBER_CH="00${MEMBER}" + else + MEMBER_CH="0${MEMBER}" + fi + case $gfs_ver in + v12 | v13) + export OMP_NUM_THREADS=2 + export OMP_STACKSIZE=1024M + sbatch --parsable --ntasks-per-node=12 --nodes=1 --cpus-per-task=$OMP_NUM_THREADS \ + -t $WALLT -A $PROJECT_CODE -q $QUEUE -J chgres_${MEMBER_CH} \ + -o log.${MEMBER_CH} -e log.${MEMBER_CH} ${DEPEND} run_pre-v14.chgres.sh ${MEMBER_CH} + ;; + v14) + sbatch --parsable --ntasks-per-node=12 --nodes=1 -t $WALLT -A $PROJECT_CODE -q $QUEUE -J chgres_${MEMBER_CH} \ + -o log.${MEMBER_CH} -e log.${MEMBER_CH} ${DEPEND} run_v14.chgres.sh ${MEMBER_CH} + ;; + v15) + sbatch --parsable --ntasks-per-node=12 --nodes=1 -t $WALLT -A $PROJECT_CODE -q $QUEUE -J chgres_${MEMBER_CH} \ + -o log.${MEMBER_CH} -e log.${MEMBER_CH} ${DEPEND} run_v15.chgres.sh ${MEMBER_CH} + ;; + esac + MEMBER=$(( $MEMBER + 1 )) + done + +fi diff --git a/util/gdas_init/get_pre-v14.data.sh b/util/gdas_init/get_pre-v14.data.sh new file mode 100755 index 000000000..386d672c0 --- /dev/null +++ b/util/gdas_init/get_pre-v14.data.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +#----------------------------------------------------------- +# Retrieve data prior to v14 (the old sigio/sfcio data +# from the spectral gfs). +# +# Script works for data between 00z May 21, 2012 +# and 06z July 19, 2017. +#----------------------------------------------------------- + +bundle=$1 + +set -x + +if [ $bundle = 'hires' ]; then + + mkdir -p $EXTRACT_DIR/gdas.${yy}${mm}${dd}/${hh} + cd $EXTRACT_DIR/gdas.${yy}${mm}${dd}/${hh} + + directory=/NCEPPROD/hpssprod/runhistory/rh${yy}/${yy}${mm}/${yy}${mm}${dd} + if [ $gfs_ver = 'v12' ]; then + file=com_gfs_prod_gdas.${yy}${mm}${dd}${hh}.tar + else + file=com2_gfs_prod_gdas.${yy}${mm}${dd}${hh}.tar + fi + + htar -xvf $directory/$file ./gdas1.t${hh}z.radstat + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas1.t${hh}z.abias_air + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas1.t${hh}z.abias + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas1.t${hh}z.abias_pc + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas1.t${hh}z.sanl + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas1.t${hh}z.sfcanl + rc=$? + [ $rc != 0 ] && exit $rc + +elif [ $bundle = 'enkf' ]; then + +#---------------------------------------------------------------------- +# Get the enkf tiled restart files for all members. +#---------------------------------------------------------------------- + + mkdir -p $EXTRACT_DIR/enkf.${yy}${mm}${dd}/${hh} + cd $EXTRACT_DIR/enkf.${yy}${mm}${dd}/${hh} + + directory=/NCEPPROD/hpssprod/runhistory/rh${yy}/${yy}${mm}/${yy}${mm}${dd} + if [ $gfs_ver = 'v12' ]; then + file=com_gfs_prod_enkf.${yy}${mm}${dd}_${hh}.anl.tar + else + file=com2_gfs_prod_enkf.${yy}${mm}${dd}_${hh}.anl.tar + fi + + rm -f ./list*.${bundle} + htar -tvf $directory/$file > ./list1.${bundle} + grep siganl ./list1.${bundle} > ./list2.${bundle} + grep sfcanl ./list1.${bundle} >> ./list2.${bundle} + while read -r line + do + echo ${line##*' '} >> ./list3.${bundle} + done < "./list2.${bundle}" + htar -xvf $directory/$file -L ./list3.${bundle} + rc=$? + [ $rc != 0 ] && exit $rc + + MEMBER=1 + while [ $MEMBER -le 80 ]; do + if [ $MEMBER -lt 10 ]; then + MEMBER_CH="00${MEMBER}" + else + MEMBER_CH="0${MEMBER}" + fi + mkdir -p mem${MEMBER_CH} + mv *_mem${MEMBER_CH}* ./mem${MEMBER_CH} + MEMBER=$(( $MEMBER + 1 )) + done + + rm -f *ensmean + +fi + +set +x +echo DATA PULL FOR $bundle DONE + +exit 0 diff --git a/util/gdas_init/get_v14.data.sh b/util/gdas_init/get_v14.data.sh new file mode 100755 index 000000000..3908e31df --- /dev/null +++ b/util/gdas_init/get_v14.data.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +#----------------------------------------------------------- +# Retrieve gfs v14 data from hpss. +# +# v14 data starts July 19, 2017 at 12z +#----------------------------------------------------------- + +bundle=$1 + +set -x + +if [ $bundle = 'hires' ]; then + + mkdir -p $EXTRACT_DIR/gdas.${yy}${mm}${dd}/${hh} + cd $EXTRACT_DIR/gdas.${yy}${mm}${dd}/${hh} + + directory=/NCEPPROD/hpssprod/runhistory/rh${yy}/${yy}${mm}/${yy}${mm}${dd} + file=gpfs_hps_nco_ops_com_gfs_prod_gdas.${yy}${mm}${dd}${hh}.tar + + htar -xvf $directory/$file ./gdas.t${hh}z.radstat + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas.t${hh}z.abias_air + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas.t${hh}z.abias + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas.t${hh}z.abias_pc + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas.t${hh}z.atmanl.nemsio + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas.t${hh}z.nstanl.nemsio + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas.t${hh}z.sfcanl.nemsio + rc=$? + [ $rc != 0 ] && exit $rc + + set +x + echo DATA PULL FOR $bundle DONE + + exit 0 + +elif [ $bundle = 'enkf' ]; then + +#---------------------------------------------------------------------- +# Get the enkf tiled restart files for all members. +#---------------------------------------------------------------------- + + mkdir -p $EXTRACT_DIR/enkf.${yy}${mm}${dd}/${hh} + cd $EXTRACT_DIR/enkf.${yy}${mm}${dd}/${hh} + + directory=/NCEPPROD/hpssprod/runhistory/rh${yy}/${yy}${mm}/${yy}${mm}${dd} + file=gpfs_hps_nco_ops_com_gfs_prod_enkf.${yy}${mm}${dd}_${hh}.anl.tar + + htar -xvf $directory/$file + rc=$? + [ $rc != 0 ] && exit $rc + + MEMBER=1 + while [ $MEMBER -le 80 ]; do + if [ $MEMBER -lt 10 ]; then + MEMBER_CH="00${MEMBER}" + else + MEMBER_CH="0${MEMBER}" + fi + mkdir -p mem${MEMBER_CH} + mv *.mem${MEMBER_CH}* ./mem${MEMBER_CH} + MEMBER=$(( $MEMBER + 1 )) + done + + rm -f gdas.* + +fi + +set +x +echo DATA PULL FOR $bundle DONE + +exit 0 diff --git a/util/gdas_init/get_v15.data.sh b/util/gdas_init/get_v15.data.sh new file mode 100755 index 000000000..5326080a6 --- /dev/null +++ b/util/gdas_init/get_v15.data.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +#---------------------------------------------------------------------- +# Retrieve gfs v15 data from hpss. +# +# Data available after 2019061206. +#---------------------------------------------------------------------- + +bundle=$1 + +set -x + +cd $EXTRACT_DIR + +date10_m6=`$NDATE -6 $yy$mm$dd$hh` + +echo $date10_m6 +yy_m6=$(echo $date10_m6 | cut -c1-4) +mm_m6=$(echo $date10_m6 | cut -c5-6) +dd_m6=$(echo $date10_m6 | cut -c7-8) +hh_m6=$(echo $date10_m6 | cut -c9-10) + +#---------------------------------------------------------------------- +# Get the hires tiled restart files. Need to use the 6-hour forecast files from +# the previous cycle. +#---------------------------------------------------------------------- + +if [ $bundle = 'hires' ]; then + + directory=/NCEPPROD/hpssprod/runhistory/rh${yy_m6}/${yy_m6}${mm_m6}/${yy_m6}${mm_m6}${dd_m6} + if [ $date10_m6 -lt 2020022600 ]; then + file=gpfs_dell1_nco_ops_com_gfs_prod_gdas.${yy_m6}${mm_m6}${dd_m6}_${hh_m6}.gdas_restart.tar + else + file=com_gfs_prod_gdas.${yy_m6}${mm_m6}${dd_m6}_${hh_m6}.gdas_restart.tar + fi + + rm -f ./list.hires* + touch ./list.hires3 + htar -tvf $directory/$file > ./list.hires1 + grep ${yy}${mm}${dd}.${hh} ./list.hires1 > ./list.hires2 + while read -r line + do + echo ${line##*' '} >> ./list.hires3 + done < "./list.hires2" + + htar -xvf $directory/$file -L ./list.hires3 + rc=$? + [ $rc != 0 ] && exit $rc + +#---------------------------------------------------------------------- +# Get the 'abias' and 'radstat' files from current cycle +#---------------------------------------------------------------------- + + directory=/NCEPPROD/hpssprod/runhistory/rh${yy}/${yy}${mm}/${yy}${mm}${dd} + if [ ${yy}${mm}${dd}${hh} -lt 2020022600 ]; then + file=gpfs_dell1_nco_ops_com_gfs_prod_gdas.${yy}${mm}${dd}_${hh}.gdas.tar + else + file=com_gfs_prod_gdas.${yy}${mm}${dd}_${hh}.gdas.tar + fi + + htar -xvf $directory/$file ./gdas.${yy}${mm}${dd}/${hh}/gdas.t${hh}z.radstat + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas.${yy}${mm}${dd}/${hh}/gdas.t${hh}z.abias + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas.${yy}${mm}${dd}/${hh}/gdas.t${hh}z.abias_air + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas.${yy}${mm}${dd}/${hh}/gdas.t${hh}z.abias_int + rc=$? + [ $rc != 0 ] && exit $rc + htar -xvf $directory/$file ./gdas.${yy}${mm}${dd}/${hh}/gdas.t${hh}z.abias_pc + rc=$? + [ $rc != 0 ] && exit $rc + + rm -f ./list.hires* + +#---------------------------------------------------------------------- +# Get the enkf tiled restart files for all members. +#---------------------------------------------------------------------- + +else + + for group in $bundle + do + + directory=/NCEPPROD/hpssprod/runhistory/rh${yy_m6}/${yy_m6}${mm_m6}/${yy_m6}${mm_m6}${dd_m6} + if [ $date10_m6 -lt 2020022600 ]; then + file=gpfs_dell1_nco_ops_com_gfs_prod_enkfgdas.${yy_m6}${mm_m6}${dd_m6}_${hh_m6}.enkfgdas_restart_${group}.tar + else + file=com_gfs_prod_enkfgdas.${yy_m6}${mm_m6}${dd_m6}_${hh_m6}.enkfgdas_restart_${group}.tar + fi + + rm -f ./list*.${group} + htar -tvf $directory/$file > ./list1.${group} + grep ${yy}${mm}${dd}.${hh} ./list1.${group} > ./list2.${group} + while read -r line + do + echo ${line##*' '} >> ./list3.${group} + done < "./list2.${group}" + htar -xvf $directory/$file -L ./list3.${group} + rc=$? + [ $rc != 0 ] && exit $rc + rm -f ./list*.${group} + + done + +fi + +set +x +echo DATA PULL FOR $bundle DONE + +exit 0 diff --git a/util/gdas_init/run_pre-v14.chgres.sh b/util/gdas_init/run_pre-v14.chgres.sh new file mode 100755 index 000000000..95e5276f0 --- /dev/null +++ b/util/gdas_init/run_pre-v14.chgres.sh @@ -0,0 +1,101 @@ +#!/bin/bash + +#---------------------------------------------------------------- +# Run chgres using pre-v14 gfs data (sigio/sfcio format +# from the spectral gfs). +#---------------------------------------------------------------- + +set -x + +MEMBER=$1 + +FIX_FV3=$UFS_DIR/fix +FIX_ORO=${FIX_FV3}/fix_fv3_gmted2010 +FIX_AM=${FIX_FV3}/fix_am + +date10=$yy$mm$dd$hh +yy=$(echo $date10 | cut -c1-4) +mm=$(echo $date10 | cut -c5-6) +dd=$(echo $date10 | cut -c7-8) +hh=$(echo $date10 | cut -c9-10) + +YMDH=${yy}${mm}${dd}.${hh}0000 + +WORKDIR=$OUTDIR/work.$MEMBER + +if [ ${MEMBER} == 'hires' ]; then + CTAR=${CRES_HIRES} + INPUT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy}${mm}${dd}/${hh}" + RADSTAT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy}${mm}${dd}/${hh}" + OUTDIR=$OUTDIR/gdas.${yy}${mm}${dd}/${hh} + ATMFILE="gdas1.t${hh}z.sanl" + SFCFILE="gdas1.t${hh}z.sfcanl" +else + CTAR=${CRES_ENKF} + INPUT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}" + RADSTAT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}" + OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER} + ATMFILE="siganl_${yy}${mm}${dd}${hh}_mem${MEMBER}" + SFCFILE="sfcanl_${yy}${mm}${dd}${hh}_mem${MEMBER}" +fi + +rm -fr $WORKDIR +mkdir -p $WORKDIR +cd $WORKDIR + +rm -fr $OUTDIR +mkdir -p $OUTDIR +mkdir -p $OUTDIR/INPUT + +cat << EOF > fort.41 + +&config + fix_dir_target_grid="${FIX_ORO}/${CTAR}/fix_sfc" + mosaic_file_target_grid="${FIX_ORO}/${CTAR}/${CTAR}_mosaic.nc" + orog_dir_target_grid="${FIX_ORO}/${CTAR}" + orog_files_target_grid="${CTAR}_oro_data.tile1.nc","${CTAR}_oro_data.tile2.nc","${CTAR}_oro_data.tile3.nc","${CTAR}_oro_data.tile4.nc","${CTAR}_oro_data.tile5.nc","${CTAR}_oro_data.tile6.nc" + data_dir_input_grid="${INPUT_DATA_DIR}" + atm_files_input_grid="$ATMFILE" + sfc_files_input_grid="$SFCFILE" + vcoord_file_target_grid="${FIX_AM}/global_hyblev.l${LEVS}.txt" + cycle_mon=$mm + cycle_day=$dd + cycle_hour=$hh + convert_atm=.true. + convert_sfc=.true. + convert_nst=.false. + input_type="gfs_spectral" + tracers_input="spfh","o3mr","clwmr" + tracers="sphum","o3mr","liq_wat" +/ +EOF + +$APRUN $UFS_DIR/exec/chgres_cube.exe +rc=$? + +if [ $rc != 0 ]; then + exit $rc +fi + +mv gfs_ctrl.nc ${OUTDIR}/INPUT + +for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6' +do + mv out.atm.${tile}.nc ${OUTDIR}/INPUT/gfs_data.${tile}.nc + mv out.sfc.${tile}.nc ${OUTDIR}/INPUT/sfc_data.${tile}.nc +done + +if [ ${MEMBER} == 'hires' ]; then + cp ${RADSTAT_DATA_DIR}/*radstat* $OUTDIR + cp ${RADSTAT_DATA_DIR}/*abias* $OUTDIR + touch $OUTDIR/gdas.t${hh}z.loginc.txt +else + touch $OUTDIR/enkfgdas.t${hh}z.loginc.txt +fi + +rm -fr $WORKDIR + +set +x +echo CHGRES COMPLETED FOR MEMBER $MEMBER + +exit 0 diff --git a/util/gdas_init/run_v14.chgres.sh b/util/gdas_init/run_v14.chgres.sh new file mode 100755 index 000000000..9cd611648 --- /dev/null +++ b/util/gdas_init/run_v14.chgres.sh @@ -0,0 +1,103 @@ +#!/bin/bash + +#---------------------------------------------------------------- +# Run chgres using gfs v14 data as input. +#---------------------------------------------------------------- + +set -x + +MEMBER=$1 + +FIX_FV3=$UFS_DIR/fix +FIX_ORO=${FIX_FV3}/fix_fv3_gmted2010 +FIX_AM=${FIX_FV3}/fix_am + +date10=$yy$mm$dd$hh +yy=$(echo $date10 | cut -c1-4) +mm=$(echo $date10 | cut -c5-6) +dd=$(echo $date10 | cut -c7-8) +hh=$(echo $date10 | cut -c9-10) + +YMDH=${yy}${mm}${dd}.${hh}0000 + +WORKDIR=$OUTDIR/work.$MEMBER + +if [ ${MEMBER} == 'hires' ]; then + CTAR=${CRES_HIRES} + INPUT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy}${mm}${dd}/${hh}" + RADSTAT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy}${mm}${dd}/${hh}" + OUTDIR=$OUTDIR/gdas.${yy}${mm}${dd}/${hh} + ATMFILE="gdas.t${hh}z.atmanl.nemsio" + SFCFILE="gdas.t${hh}z.sfcanl.nemsio" + NSTFILE="gdas.t${hh}z.nstanl.nemsio" +else + CTAR=${CRES_ENKF} + INPUT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}" + RADSTAT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}" + OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER} + ATMFILE="gdas.t${hh}z.ratmanl.mem${MEMBER}.nemsio" + SFCFILE="gdas.t${hh}z.sfcanl.mem${MEMBER}.nemsio" + NSTFILE="gdas.t${hh}z.nstanl.mem${MEMBER}.nemsio" +fi + +rm -fr $WORKDIR +mkdir -p $WORKDIR +cd $WORKDIR + +rm -fr $OUTDIR +mkdir -p $OUTDIR +mkdir -p $OUTDIR/INPUT + +cat << EOF > fort.41 + +&config + fix_dir_target_grid="${FIX_ORO}/${CTAR}/fix_sfc" + mosaic_file_target_grid="${FIX_ORO}/${CTAR}/${CTAR}_mosaic.nc" + orog_dir_target_grid="${FIX_ORO}/${CTAR}" + orog_files_target_grid="${CTAR}_oro_data.tile1.nc","${CTAR}_oro_data.tile2.nc","${CTAR}_oro_data.tile3.nc","${CTAR}_oro_data.tile4.nc","${CTAR}_oro_data.tile5.nc","${CTAR}_oro_data.tile6.nc" + data_dir_input_grid="${INPUT_DATA_DIR}" + atm_files_input_grid="$ATMFILE" + sfc_files_input_grid="$SFCFILE" + nst_files_input_grid="$NSTFILE" + vcoord_file_target_grid="${FIX_AM}/global_hyblev.l${LEVS}.txt" + cycle_mon=$mm + cycle_day=$dd + cycle_hour=$hh + convert_atm=.true. + convert_sfc=.true. + convert_nst=.true. + input_type="gfs_gaussian" + tracers="sphum","liq_wat","o3mr" + tracers_input="spfh","clwmr","o3mr" +/ +EOF + +$APRUN $UFS_DIR/exec/chgres_cube.exe +rc=$? + +if [ $rc != 0 ]; then + exit $rc +fi + +mv gfs_ctrl.nc ${OUTDIR}/INPUT + +for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6' +do + mv out.atm.${tile}.nc ${OUTDIR}/INPUT/gfs_data.${tile}.nc + mv out.sfc.${tile}.nc ${OUTDIR}/INPUT/sfc_data.${tile}.nc +done + +if [ ${MEMBER} == 'hires' ]; then + cp ${RADSTAT_DATA_DIR}/*radstat* $OUTDIR + cp ${RADSTAT_DATA_DIR}/*abias* $OUTDIR + touch $OUTDIR/gdas.t${hh}z.loginc.txt +else + touch $OUTDIR/enkfgdas.t${hh}z.loginc.txt +fi + +rm -fr $WORKDIR + +set +x +echo CHGRES COMPLETED FOR MEMBER $MEMBER + +exit 0 diff --git a/util/gdas_init/run_v15.chgres.sh b/util/gdas_init/run_v15.chgres.sh new file mode 100755 index 000000000..22cf94d93 --- /dev/null +++ b/util/gdas_init/run_v15.chgres.sh @@ -0,0 +1,100 @@ +#!/bin/bash + +#--------------------------------------------------------------------------- +# Run chgres using gfs v15 data as input. +#--------------------------------------------------------------------------- + +set -x + +MEMBER=$1 + +FIX_FV3=$UFS_DIR/fix +FIX_ORO=${FIX_FV3}/fix_fv3_gmted2010 +FIX_AM=${FIX_FV3}/fix_am + +date10=`$NDATE -6 $yy$mm$dd$hh` +yy_d=$(echo $date10 | cut -c1-4) +mm_d=$(echo $date10 | cut -c5-6) +dd_d=$(echo $date10 | cut -c7-8) +hh_d=$(echo $date10 | cut -c9-10) + +YMDH=${yy}${mm}${dd}.${hh}0000 + +WORKDIR=$OUTDIR/work.$MEMBER + +if [ ${MEMBER} == 'hires' ]; then + CINP=C768 + CTAR=${CRES_HIRES} + INPUT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy_d}${mm_d}${dd_d}/${hh_d}/RESTART" + RADSTAT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy}${mm}${dd}/${hh}" + OUTDIR=$OUTDIR/gdas.${yy}${mm}${dd}/${hh} +else + CINP=C384 + CTAR=${CRES_ENKF} + INPUT_DATA_DIR="${EXTRACT_DIR}/enkfgdas.${yy_d}${mm_d}${dd_d}/${hh_d}/mem${MEMBER}/RESTART" + RADSTAT_DATA_DIR="${EXTRACT_DIR}/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER}" + OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER} +fi + +rm -fr $WORKDIR +mkdir -p $WORKDIR +cd $WORKDIR + +rm -fr $OUTDIR +mkdir -p $OUTDIR +mkdir -p $OUTDIR/INPUT + +cat << EOF > fort.41 + +&config + fix_dir_target_grid="${FIX_ORO}/${CTAR}/fix_sfc" + mosaic_file_target_grid="${FIX_ORO}/${CTAR}/${CTAR}_mosaic.nc" + orog_dir_target_grid="${FIX_ORO}/${CTAR}" + orog_files_target_grid="${CTAR}_oro_data.tile1.nc","${CTAR}_oro_data.tile2.nc","${CTAR}_oro_data.tile3.nc","${CTAR}_oro_data.tile4.nc","${CTAR}_oro_data.tile5.nc","${CTAR}_oro_data.tile6.nc" + mosaic_file_input_grid="${FIX_ORO}/${CINP}/${CINP}_mosaic.nc" + orog_dir_input_grid="${FIX_ORO}/${CINP}" + orog_files_input_grid="${CINP}_oro_data.tile1.nc","${CINP}_oro_data.tile2.nc","${CINP}_oro_data.tile3.nc","${CINP}_oro_data.tile4.nc","${CINP}_oro_data.tile5.nc","${CINP}_oro_data.tile6.nc" + data_dir_input_grid="${INPUT_DATA_DIR}" + atm_core_files_input_grid="${YMDH}.fv_core.res.tile1.nc","${YMDH}.fv_core.res.tile2.nc","${YMDH}.fv_core.res.tile3.nc","${YMDH}.fv_core.res.tile4.nc","${YMDH}.fv_core.res.tile5.nc","${YMDH}.fv_core.res.tile6.nc","${YMDH}.fv_core.res.nc" + atm_tracer_files_input_grid="${YMDH}.fv_tracer.res.tile1.nc","${YMDH}.fv_tracer.res.tile2.nc","${YMDH}.fv_tracer.res.tile3.nc","${YMDH}.fv_tracer.res.tile4.nc","${YMDH}.fv_tracer.res.tile5.nc","${YMDH}.fv_tracer.res.tile6.nc" + vcoord_file_target_grid="${FIX_AM}/global_hyblev.l${LEVS}.txt" + sfc_files_input_grid="${YMDH}.sfc_data.tile1.nc","${YMDH}.sfc_data.tile2.nc","${YMDH}.sfc_data.tile3.nc","${YMDH}.sfc_data.tile4.nc","${YMDH}.sfc_data.tile5.nc","${YMDH}.sfc_data.tile6.nc" + cycle_mon=$mm + cycle_day=$dd + cycle_hour=$hh + convert_atm=.true. + convert_sfc=.true. + convert_nst=.true. + tracers="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" + tracers_input="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" +/ +EOF + +$APRUN $UFS_DIR/exec/chgres_cube.exe +rc=$? + +if [ $rc != 0 ]; then + exit $rc +fi + +mv gfs_ctrl.nc ${OUTDIR}/INPUT + +for tile in 'tile1' 'tile2' 'tile3' 'tile4' 'tile5' 'tile6' +do + mv out.atm.${tile}.nc ${OUTDIR}/INPUT/gfs_data.${tile}.nc + mv out.sfc.${tile}.nc ${OUTDIR}/INPUT/sfc_data.${tile}.nc +done + +if [ ${MEMBER} == 'hires' ]; then + cp ${RADSTAT_DATA_DIR}/* $OUTDIR + touch $OUTDIR/gdas.t${hh}z.loginc.txt +else + touch $OUTDIR/enkfgdas.t${hh}z.loginc.txt +fi + +rm -fr $WORKDIR + +set +x +echo CHGRES COMPLETED FOR MEMBER $MEMBER + +exit 0 From 6bf5373256de7983e6fb6cbb3eb8388a7ca5a79f Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Tue, 24 Mar 2020 13:31:02 -0400 Subject: [PATCH 017/192] Update documentation Update/add documentation from v1.0.0 of the public release branch. Update LICENSE.md. Add VERSION file and docs directory. See issue #87 for more details. --- LICENSE.md | 183 +++--------------------- VERSION | 1 + docs/Makefile | 19 +++ docs/requirements.txt | 1 + docs/source/chgres_cube.rst | 276 ++++++++++++++++++++++++++++++++++++ docs/source/conf.py | 205 ++++++++++++++++++++++++++ docs/source/index.rst | 13 ++ fix/.gitignore | 5 + 8 files changed, 537 insertions(+), 166 deletions(-) create mode 100644 VERSION create mode 100644 docs/Makefile create mode 100644 docs/requirements.txt create mode 100644 docs/source/chgres_cube.rst create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst diff --git a/LICENSE.md b/LICENSE.md index 8021e518a..b7395d372 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,166 +1,17 @@ -# GNU LESSER GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright (C) 2007 [Free Software Foundation, Inc.](https://fsf.org/) - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - - -This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - -## 0. Additional Definitions. - -As used herein, *this License* refers to version 3 of the GNU Lesser -General Public License, and the *GNU GPL* refers to version 3 of the GNU -General Public License. - -*The Library* refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - -An *Application* is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - -A *Combined Work* is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the *Linked -Version*. - -The *Minimal Corresponding Source* for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - -The *Corresponding Application Code* for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - -## 1. Exception to Section 3 of the GNU GPL. - -You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - -## 2. Conveying Modified Versions. - -If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - -## 3. Object Code Incorporating Material from Library Header Files. - -The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - -## 4. Combined Works. - -You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - - d) Do one of the following: - - - 0\) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - - 1\) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - -## 5. Combined Libraries. - -You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - -## 6. Revised Versions of the GNU Lesser General Public License. - -The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License *or any later version* -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - -If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. +Copyright 2020 National Oceanic and Atmospheric Administration (by assignment from I. M. Systems Group) + +The ufs_utils code incorporated in the Unified Forecast System (UFS) was jointly developed by the +National Oceanic and Atmospheric Administration and the I. M. Systems Group. The gold standard copy +of the Code will be maintained by NOAA at https://github.com/NOAA-EMC/UFS_UTILS + +The National Oceanic and Atmospheric Administration is releasing this code under the GNU Lesser +General Public License v3.0 (the "License"); you may not use this code except in compliance +with the License. + +You may obtain a copy of the License at + https://www.gnu.org/licenses/lgpl-3.0.en.html + +Unless required by applicable law or agreed to in writing, software distributed under the License +is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +express or implied. See the License for the specific language governing permissions and +limitations under the License. diff --git a/VERSION b/VERSION new file mode 100644 index 000000000..3eefcb9dd --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +1.0.0 diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 000000000..69fe55ecf --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,19 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +SOURCEDIR = source +BUILDDIR = build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 000000000..ef36addc6 --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1 @@ +sphinxcontrib-bibtex diff --git a/docs/source/chgres_cube.rst b/docs/source/chgres_cube.rst new file mode 100644 index 000000000..f0285b869 --- /dev/null +++ b/docs/source/chgres_cube.rst @@ -0,0 +1,276 @@ +.. _chgres_cube: + +************************ +Introduction +************************ + +The chgres_cube program creates initial condition files to “coldstart” the forecast model. The initial conditions are created from either Global Forecast System (GFS) gridded binary version 2 (GRIB2) or NOAA Environmental Modeling System Input/Output (NEMSIO) data. + +************************************************ +Where to find GFS GRIB2 and NEMSIO data +************************************************ + +**GRIB2:** + + * 0.25-degree data (last 10 days only) - Use the **gfs.tHHz.pgrb2.0p25.f000** files in subdirectory gfs.YYYYMMDD/HH `here `_.` + + * 0.5-degree data - Use the **gfs_4_YYYYMMDD_00HH_000.grb2** file, under **GFS Forecasts 004 (0.5-deg)** here: `NCDC - Global Forecast System `__. Note: *Tests were not done with the AVN, MRF or analysis data*. + + * 1.0-degree data - Use the **gfs_3_YYYYMMDD_00HH_000.grb2 file**, under **GFS Forecasts 003 (1-deg)** here: `NCDC - Global Forecast System `__. Note: *Tests were not done with the AVN, MRF or analysis data*. + +**NEMSIO:** + + * T1534 gaussian (last 10 days only) - Use the **gfs.tHHz.atmanl.nemsio** (atmospheric fields) and **gfs.tHHz.sfcanl.nemsio** (surface fields) files in subdirectory gfs.YYYYMMDD/HH `here `_. + + +************************************************ +Initializing with GRIB2 data - some caveats +************************************************ + + +Keep this in mind when using GFS GRIB2 data for model initialization: + + * GRIB2 data does not contain the fields needed for the Near Sea Surface Temperature (NSST) scheme. See the next section for options on running the forecast model in this situation. + * Data is coarse (in vertical and horizontal) compared to the NCEP operational GFS . May not provide a good initialization (especially for the surface). Recommendations: + + * C96 - use 0.25, 0.5 or 1.0-degree GRIB2 data + * C192 - use 0.25 or 0.5-degree GRIB2 data + * C384 - use 0.25-degree GRIB2 data + * C768 - try the 0.25-degree GRIB2 data. But it may not work well. + * Sea/lake ice thickness and column temperatures are not available. So, nominal values of 1.5 m and 265 K are used. + * 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. + +**Near Sea Surface Temperature (NSST) data and GRIB2 initialization** + +The issue with not having NSST data is important. In GFS we use the foundation temperature (Tref) and add a diurnal warming/cooling layer using NSST. This is the surface temperature that is passed to the atmospheric boundary layer. This is a critical feature, especially when we are doing Data Assimilation. + +When using NEMSIO data to initialize the model, both the foundation and surface temperature are available and the atmospheric model should be run using the NSST option as this will properly account for in the forward run of the model. + +In GRIB2 files only the Tsfc is stored and that is set as foundation temperature as well. So the diurnal heating / cooling is baked into the initial condition for the extent of the run. This can be critical if the model is being initialized when the ocean is warm and initialization is occuring at the peak of the diurnal warming. That warm ocean will be baked in for the extent of the run and may spawn off a number of fake hurricanes. The user has two options -- either to use a spin up cycle to spin up NSST (set **nstf_name** = [2,1,0,0,0] in **input.nml** of the model namelist file. This will create a diurnal cycle after 24 hours of spin up), or to run the model without any NSST option ( set **nstf_name** = [0,0,0,0,0] in **input.nml** of the model namelist file. The user will also have to choose one of the no NSST physics suite options in **input.nml**). + +Note, that neither of these two options will get rid of the underlying baked in heating/cooling in the surface temperature fields. For most cases this may not be an issue, but where it is then the user will either have to initialize the model with NEMSIO data or replace the surface temperature in the GRIB2 fields with independently obtained foundation temperature. + +************************************************ +chgres_cube namelist options +************************************************ + +Namelist variables with “input” in their name refer to data input to chgres_cube. Namelist variables with “target” in their name refer to the FV3 horizontal and vertical grid (i.e., the target grid chgres_cube is mapping to). + +When using GRIB2 data as input to chgres_cube, set namelist as follows: + + * fix_dir_target_grid - Path to the tiled FV3 surface climatological files (such as albedo). + * mosaic_file_target_grid - Path and name of the FV3 mosaic file. + * orog_dir_target_grid - directory containing the tiled FV3 orography and grid files (NetCDF). + * orog_files_target_grid - names of the six tiled FV3 orography files. + * vcoord_file_target_grid - path and name of the model vertical coordinate definition file (“global_hyblev.l$LEVS.txt). + * data_dir_input_grid - directory containing the GRIB2 initial conditions data + * grib2_file_input_grid - name of the GRIB2 input data file + * varmap_file - path and name of the variable mapping (VARMAP) table. See below for details on this table. + * input_type - input data type. Set to ‘grib2’ + * cycle_mon/day/hour - month/day/hour of your model initialization + * convert_atm - set to ‘true’ to process the atmospheric fields + * convert_sfc - set to ‘true’ to process the surface fields + +When using NEMSIO data as input to chgres_cube, set namelist as follows: + + * fix_dir_target_grid - Path to the tiled FV3 surface climatological files (such as albedo). + * mosaic_file_target_grid - Path and name of the FV3 mosaic file. + * orog_dir_target_grid - directory containing the tiled FV3 orography and grid files (NetCDF). + * orog_files_target_grid - names of the six tiled FV3 orography files. + * vcoord_file_target_grid - path and name of the model vertical coordinate definition file (“global_hyblev.l$LEVS.txt). + * data_dir_input_grid - directory containing the NEMSIO input data + * atm_files_input_grid - name of the NEMSIO input atmospheric data file + * sfc_files_input_grid - name of the NEMSIO input surface/Near Sea Surface Temperature (NSST) data file + * input_type - input data type. Set to ‘gaussian’. + * cycle_mon/day/hour - month/day/hour of your model run + * convert_atm - set to ‘true’ to process the atmospheric fields + * convert_sfc - set to ‘true’ to process the surface fields + * convert_nst - set to ‘true’ to process NSST fields + * tracers_input - names of tracer records in input file. For GFDL microphysics, set to “spfh”,”clwmr”,”o3mr”,”icmr”,”rwmr”,”snmr”,”grle”. + * tracers - names of tracer records in output file expected by model. For GFDL microphysics, set to “sphum”,”liq_wat”,”o3mr”,”ice_wat”,”rainwat”,”snowwat”,”graupel”. + +************************ +Compiling the program +************************ + +chgres_cube requires cmake 3.12 or higher. It can be built as part of the NCEPLIBS unified build system that includes two separate build systems -- one for the third party libraries that are needed and the other for the libraries and utilities themselves. See https://github.com/NOAA-EMC/NCEPLIBS-external/wiki for more detailed information. + +If the NCEPLIBS have been installed and the user wants to compile chgres_cube again + + * make sure paths are set to hdf5, compiler, mpi and cmake + * In a bash environment run + * cd /path/to/nceplibs/installed + * source bin/setenv_nceplibs.sh (this will set all necessary environments) + * set cmake compiler - export FC=ifort (if ifort is the compiler chosen) + * cd to where you checked out the UFS_Utils + * mkdir build and cd build + * cmake .. -DCMAKE_INSTALL_PREFIX=/path/where/you/want/the/code/installed + * make -j x (where x is a number that can be chosen to speed up the make, usually 8) + * make install + +************************************************ +Program inputs and outputs +************************************************ + +**Inputs** + +The following four sets of files are located here: https://ftp.emc.ncep.noaa.gov/EIB/UFS/global/fix/fix_fv3_gmted2010.v20191213/ + + * FV3 mosaic file - (NetCDF format) + * CRES_mosaic.nc + + * FV3 grid files - (NetCDF format) + * CRES_grid.tile1.nc + * CRES_grid.tile2.nc + * CRES_grid.tile3.nc + * CRES_grid.tile4.nc + * CRES_grid.tile5.nc + * CRES_grid.tile6.nc + + * FV3 orography files - (NetCDF format) + * CRES_oro_data.tile1.nc + * CRES_oro_data.tile2.nc + * CRES_oro_data.tile3.nc + * CRES_oro_data.tile4.nc + * CRES_oro_data.tile5.nc + * CRES_oro_data.tile6.nc + + * FV3 surface climatological files - Located under the ./fix_sfc sub-directory. One file for each tile. NetCDF format. + * CRES.facsf.tileX.nc (fractional coverage for strong/weak zenith angle dependent albedo) + * CRES.maximum_snow_albedo.tileX.nc (maximum snow albedo) + * CRES.slope_type.tileX.nc (slope type) + * CRES.snowfree_albedo.tileX.nc (snow-free albedo) + * CRES.soil_type.tileX.nc (soil type) + * CRES.subtrate_temperature.tileX.nc (soil substrate temperature) + * CRES.vegetation_greenness.tileX.nc (vegetation greenness) + * CRES.vegetation_type.tileX.nc (vegetation type) + + * FV3 vertical coordinate file. Text file. Located here: https://ftp.emc.ncep.noaa.gov/EIB/UFS/global/fix/fix_am.v20191213/ + * global_hyblev.l$LEVS.txt + + * Input data files. GRIB2 or NEMSIO. See above section for how to find this data. + +**Outputs** + + * Atmospheric “coldstart” files. NetCDF. + * out.atm.tile1.nc + * out.atm.tile2.nc + * out.atm.tile3.nc + * out.atm.tile4.nc + * out.atm.tile5.nc + * out.atm.tile6.nc + + * Surface/Near Sea Surface Temperature (NSST) “coldstart” files. NetCDF + * out.sfc.tile1.nc + * out.sfc.tile1.nc + * out.sfc.tile1.nc + * out.sfc.tile1.nc + * out.sfc.tile1.nc + * out.sfc.tile1.nc + +************************************************ +Running the program stand alone +************************************************ + + * Locate your input files. See above for a list. + * Set the namelist for your experiment. See above for an explanation of the namelist entries. + * Link the namelist to Fortran unit number 41, i.e.” + * ln -fs your-namelist-file ./fort.41 + * Load any required runtime libraries. For example, you may need to load libraries for NetCDF and/or your Fortran compiler. + * Run the program with an MPI task count that is a multiple of six. This is an ESMF library requirement when processing a six-tiled global grid. + +************************ +Code structure +************************ + +Note on variable names: “input” refers to the data input to the program (i.e., GRIB2, NEMSIO). “Target” refers to the target or FV3 model grid. See routine doc blocks for more details. + + * chgres.F90 - This is the main driver routine. + * program_setup.F90 - Sets up the program execution. + * Reads program namelist + * Computes required soil parameters + * Reads the variable mapping (VARMAP) table. + * model_grid.F90 - Sets up the ESMF grid objects for the input data grid and target FV3 grid. + * static_data.F90 - Reads static surface climatological data for the target FV3 grid (such as soil type and vegetation type). Time interpolates time-varying fields, such as monthly plant greenness, to the model run time. Data for each target FV3 resolution resides in the ‘fixed’ directory. Set path via the fix_dir_target_grid namelist variable. + * write_data.F90 - Writes the tiled and header files expected by the forecast model. + * input_data.F90 - Contains routines to read atmospheric and surface data from GRIB2 and NEMSIO files. + * utils.f90 - Contains utility routines, such as error handling. + * grib2_util.F90 - Routines to (1) convert from RH to specific humidity; (2) convert from omega to dzdt. Required for GRIB2 input data. + * atmosphere.F90 - Process atmospheric fields. Horizontally interpolate from input to target FV3 grid using ESMF regridding. Adjust surface pressure according to terrain differences between input and target grid. Vertically interpolate to target FV3 grid vertical levels. Description of main routines: + * read_vcoord_info - Reads model vertical coordinate definition file (as specified by namelist variable vcoord_file_target_grid). + * newps - computes adjusted surface pressure given a new terrain height. + * newpr1 - computes 3-D pressure given an adjusted surface pressure. + * vintg - vertically interpolate atmospheric fields to target FV3 grid. + * surface.F90 - process land, sea/lake ice, open water/Near Sea Surface Temperature (NSST) fields. Assumes the input land data are Noah LSM-based, and the fv3 run will use the Noah LSM. NSST fields are not available when using GRIB2 input data. Description of main routines: + * interp - horizontally interpolate fields from input to target FV3 grid. + * calc_liq_soil_moisture - compute liquid portion of total soil moisture. + * adjust_soilt_for_terrain - adjust soil temperature for large differences between input and target FV3 grids. + * rescale_soil_moisture - adjust total soil moisture for differences between soil type on input and target FV3 grids. Required to preserve latent/sensible heat fluxes. Assumes Noah LSM. + * roughness - set roughness length at land and sea/lake ice. At land, a vegetation type-based lookup table is used. + * qc_check - some consistency checks. + * search_util.f90 - searches for the nearest valid land/non-land data where the input and target fv3 land-mask differ. Example: when the target FV3 grid depicts an island that is not resolved by the input data. If nearby valid data is not found, a default value is used. + +************************************************ +Making changes to the chgres_cube program +************************************************ + +chgres_cube is part of the UFS_UTILS repository (https://github.com/NOAA-EMC/UFS_UTILS). When wanting to contribute to this repository developers shall follow the Gitflow software development process + + * Developers shall create their own fork of the UFS_UTILS repository + * Developers shall create a ‘feature’ branch off ‘develop’ in their fork for all changes. + * Developers shall open an issue and reference it in all commits. + +For more details, see the UFS_UTILS wiki page: https://github.com/NOAA-EMC/UFS_UTILS/wiki + +Changes that support current or future NCEP operations will be given priority for inclusion into the authoritative repository. + +************************************************ +Variable Mapping (VARMAP) table +************************************************ + +The VARMAP table, set in the chgres_cube namelist (variable varmap_file), controls how chgres_cube handles variables that might be missing from the GRIB2 files. Since there are so many different versions of GRIB2 files, it's often uncertain what fields are available even if you know what source model the data is coming from. Each file contains the following: (Note, only the GFS physics suite is currently supported.) + +Column 1: Name the code searches for in the table. Do not change. Some definitions: + + * dzdt - vertical velocity + * sphum - specific humidity + * liq_wat - liquid water mixing ratio + * o3mr - ozone mixing ratio + * ice_wat - ice water mixing ratio + * rainwat - rain water mixing ratio + * snowwat - snow water mixing ratio + * graupel - graupel mixing ratio + * vtype - vegetation type + * sotype - soil type + * vfrac - plant greenness fraction + * fricv - friction velocity + * sfcr - roughness length + * tprcp - precipitation rate + * ffmm - surface exchange coefficient for momentum + * ffhh - surface exchange coefficient for heat + * f10m - log((sfcr+10)/sfcr) + * soilw - total volumetric soil moisture + * soill - liquid volumetric soil moisture + * soilt - soil column temperature + * cnwat - plant canopy water content + * hice - sea/lake ice thickness + * weasd - snow liquid equivalent + * snod - physical snow depth + +Column 2: Name of the variable in the output “coldstart” files. Unimplemented. + +Column 3: Behavior when the code can't find the variable in the input file. Options are: + + * "skip": Don't write to the output file. + * "set_to_fill": Set to user-specified field value (see column 4). + * "stop": Force an exception and stop code execution. Use this if you absolutely require a field to be present. + +Column 4: If column 3 = "set_to_fill", then this value is used to fill in all points in the input field. These values may be overwritten by the code before output depending on the variable (especially for surface variables). + +Column 5: Variable type descriptor. Variable names designated as tracers are used to populate the list of tracers to read from the GRIB2 file and write to output, so make sure all tracers you wish to read have an entry. Note that if you wish to add a tracer name that is not already included in the appropriate VARMAP file, this will require modification of the chgres_cube code. Valid choices are: + + * “T”: 3-dimensional tracer array + * “D”: 3-dimensional non-tracer array + * “S”: 2-dimensional surface array diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 000000000..e265c4dc4 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,205 @@ +# -*- coding: utf-8 -*- +# +# Configuration file for the Sphinx documentation builder. +# +# This file does only contain a selection of the most common options. For a +# full list see the documentation: +# http://www.sphinx-doc.org/en/master/config + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'chgres' +copyright = '2020 ' +author = 'George Gayno and others' + +# The short X.Y version +version = '' +# The full version, including alpha/beta/rc tags +release = '' + +numfig = True + + +# -- General configuration --------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.doctest', + 'sphinx.ext.intersphinx', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.mathjax', + 'sphinx.ext.ifconfig', + 'sphinx.ext.viewcode', + 'sphinx.ext.githubpages', + 'sphinx.ext.napoleon', + 'sphinxcontrib.bibtex' +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [] + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = None + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'classic' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} +html_theme_options = {"body_max_width": "none"} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +def setup(app): + app.add_stylesheet('custom.css') # may also be an URL + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. +# +# html_sidebars = {} + + +# -- Options for HTMLHelp output --------------------------------------------- + +# Output file base name for HTML help builder. +htmlhelp_basename = 'chgres' + + +# -- Options for LaTeX output ------------------------------------------------ + +latex_engine = 'pdflatex' +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', + # 'maketitle': r'\newcommand\sphinxbackoftitlepage{For referencing this document please use: \newline \break Gayno, G. and others, 2020. Title. Avilaable at https:}\sphinxmaketitle' +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'chgres.tex', 'chgres Documentation', + author,'manual'), +] + + +# -- Options for manual page output ------------------------------------------ + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'chgres', 'chgres Documentation', + [author], 1) +] + + +# -- Options for Texinfo output ---------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'chgres', 'chgres Documentation', + 'author, chgres', 'One line description of project.', + 'Miscellaneous'), +] + + +# -- Options for Epub output ------------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = project + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +# +# epub_identifier = '' + +# A unique identification for the text. +# +# epub_uid = '' + +# A list of files that should not be packed into the epub file. +epub_exclude_files = ['search.html'] + + +# -- Extension configuration ------------------------------------------------- + +# -- Options for intersphinx extension --------------------------------------- + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'https://docs.python.org/': None} + +# -- Options for todo extension ---------------------------------------------- + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 000000000..2e7513ee2 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,13 @@ +.. chgres_cube documentation master file, created by + sphinx-quickstart on Tue Feb 12 08:48:32 2019. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +chgres_cube Documentation +============================ + +.. toctree:: + :numbered: + :maxdepth: 3 + + chgres_cube diff --git a/fix/.gitignore b/fix/.gitignore index e69de29bb..4636ed709 100644 --- a/fix/.gitignore +++ b/fix/.gitignore @@ -0,0 +1,5 @@ +fix_am +fix_fv3 +fix_fv3_gmted2010 +fix_orog +fix_sfc_climo From 2d7f796322f4a49653bdd821fa96c18b9d5388fe Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Fri, 27 Mar 2020 10:16:38 -0400 Subject: [PATCH 018/192] CHGRES_CUBE: range check SST when using GFS GRIB2 input data Add range check to remove bad SST values (< 271.2K or > 310K) when using v14, v15.1 and v15.2 GFS GRIB2 data. Bad values are the result of bi-linear interpolation from the gaussian master files to the lat/lon "pgb" files. As a result, coastal points (even those identified as water by the mask) can be a mixture of land and non-land. This also fixes a model failure discovered when testing v1 of the public release. See issue #59 for more details. --- sorc/chgres_cube.fd/input_data.F90 | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index 76a20623a..9ba0d25bb 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -4508,14 +4508,24 @@ subroutine read_input_sfc_grib2_file(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN FieldScatter", rc) -if (localpet == 0) then + if (localpet == 0) then print*,"- READ SKIN TEMPERATURE." rc = grb2_inq(the_file, inv_file, ':TMP:',':surface:', data2=dummy2d) if (rc <= 0 ) call error_handler("READING SKIN TEMPERATURE.", rc) tsk_save(:,:) = dummy2d dummy2d_8 = real(dummy2d,esmf_kind_r8) - - print*,'tmp ',maxval(dummy2d),minval(dummy2d) + do j = 1, j_input + do i = 1, i_input + if(slmsk_save(i,j) == 0 .and. dummy2d(i,j) < 271.2) then +! print*,'too cool SST ',i,j,dummy2d(i,j) + dummy2d(i,j) = 271.2 + endif + if(slmsk_save(i,j) == 0 .and. dummy2d(i,j) > 310.) then +! print*,'too hot SST ',i,j,dummy2d(i,j) + dummy2d(i,j) = 310.0 + endif + enddo + enddo endif print*,"- CALL FieldScatter FOR INPUT GRID SKIN TEMPERATURE" From ad909edb3b8122918b3a6741cae57526e2b1f401 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Mon, 27 Apr 2020 16:09:20 -0400 Subject: [PATCH 019/192] chgres_cube - GFS v16 netcdf history file option Update chgres_cube to ingest GFS v16 gaussian netcdf history files. Input type "gaussian_netcdf". Add regression test for new option. For clarity, rename these input types (gaussian -> gaussian_nemsio; gfs_gaussian -> gfs_gaussian_nemsio; gfs_spectral -> gfs_sigio). Update all scripts and the GDAS initialization utility accordingly. --- reg_tests/chgres_cube/c192.fv3.history.sh | 3 +- reg_tests/chgres_cube/c192.gfs.grib2.sh | 3 +- reg_tests/chgres_cube/c96.fv3.nemsio.sh | 3 +- reg_tests/chgres_cube/c96.fv3.netcdf.sh | 69 ++ reg_tests/chgres_cube/c96.fv3.restart.sh | 3 +- reg_tests/chgres_cube/c96.gfs.nemsio.sh | 5 +- reg_tests/chgres_cube/c96.gfs.sigio.sh | 5 +- reg_tests/chgres_cube/c96.regional.sh | 3 +- reg_tests/chgres_cube/driver.cray.sh | 11 +- reg_tests/chgres_cube/driver.dell.sh | 10 +- reg_tests/chgres_cube/driver.hera.sh | 25 +- reg_tests/chgres_cube/driver.jet.sh | 21 +- sorc/chgres_cube.fd/input_data.F90 | 1229 ++++++++++++--------- sorc/chgres_cube.fd/model_grid.F90 | 32 +- sorc/chgres_cube.fd/program_setup.f90 | 76 +- sorc/chgres_cube.fd/write_data.F90 | 20 +- ush/chgres_cube.sh | 23 +- util/gdas_init/run_pre-v14.chgres.sh | 2 +- util/gdas_init/run_v14.chgres.sh | 2 +- 19 files changed, 943 insertions(+), 602 deletions(-) create mode 100755 reg_tests/chgres_cube/c96.fv3.netcdf.sh diff --git a/reg_tests/chgres_cube/c192.fv3.history.sh b/reg_tests/chgres_cube/c192.fv3.history.sh index 9ffb4398e..b29c66303 100755 --- a/reg_tests/chgres_cube/c192.fv3.history.sh +++ b/reg_tests/chgres_cube/c192.fv3.history.sh @@ -29,7 +29,7 @@ export TRACERS_INPUT='"spfh","clwmr","o3mr"' export CDATE=2018100300 -export OMP_NUM_THREADS_CY=1 +export OMP_NUM_THREADS_CH=${OMP_NUM_THREADS:-1} #----------------------------------------------------------------------------- # Invoke chgres program. @@ -41,6 +41,7 @@ ${HOMEufs}/ush/chgres_cube.sh iret=$? if [ $iret -ne 0 ]; then + set +x echo "<<< C192 FV3 HISTORY TEST FAILED. <<<" exit $iret fi diff --git a/reg_tests/chgres_cube/c192.gfs.grib2.sh b/reg_tests/chgres_cube/c192.gfs.grib2.sh index 2c382c7a0..1ec76820f 100755 --- a/reg_tests/chgres_cube/c192.gfs.grib2.sh +++ b/reg_tests/chgres_cube/c192.gfs.grib2.sh @@ -24,7 +24,7 @@ export CONVERT_NST=".false." export CDATE=2019110400 -export OMP_NUM_THREADS_CY=1 +export OMP_NUM_THREADS_CH=${OMP_NUM_THREADS:-1} #----------------------------------------------------------------------------- # Invoke chgres program. @@ -36,6 +36,7 @@ ${HOMEufs}/ush/chgres_cube.sh iret=$? if [ $iret -ne 0 ]; then + set +x echo "<<< C192 GFS GRIB2 TEST FAILED. <<<" exit $iret fi diff --git a/reg_tests/chgres_cube/c96.fv3.nemsio.sh b/reg_tests/chgres_cube/c96.fv3.nemsio.sh index a056eabed..43da0dc6d 100755 --- a/reg_tests/chgres_cube/c96.fv3.nemsio.sh +++ b/reg_tests/chgres_cube/c96.fv3.nemsio.sh @@ -20,7 +20,7 @@ export VCOORD_FILE=${HOMEufs}/fix/fix_am/global_hyblev.l64.txt export CDATE=2019070412 -export OMP_NUM_THREADS_CY=1 +export OMP_NUM_THREADS_CH=${OMP_NUM_THREADS:-1} #----------------------------------------------------------------------------- # Invoke chgres program. @@ -32,6 +32,7 @@ ${HOMEufs}/ush/chgres_cube.sh iret=$? if [ $iret -ne 0 ]; then + set +x echo "<<< C96 FV3 GAUSSIAN NEMSIO TEST FAILED. <<<" exit $iret fi diff --git a/reg_tests/chgres_cube/c96.fv3.netcdf.sh b/reg_tests/chgres_cube/c96.fv3.netcdf.sh new file mode 100755 index 000000000..8000f592c --- /dev/null +++ b/reg_tests/chgres_cube/c96.fv3.netcdf.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# Invoke chgres to create C96 coldstart files using FV3 gaussian netcdf files +# (gfs v16) as input. The coldstart files are then compared to baseline files +# using the 'nccmp' utility. This script is run by the machine specific +# driver script. +#----------------------------------------------------------------------------- + +set -x + +export DATA=$OUTDIR/c96_fv3_netcdf +rm -fr $DATA + +export FIXfv3=${HOMEreg}/fix/C96 +export COMIN=${HOMEreg}/input_data/fv3.netcdf +export ATM_FILES_INPUT=gfs.t00z.atmf000.nc +export SFC_FILES_INPUT=gfs.t00z.sfcf000.nc +export VCOORD_FILE=${HOMEufs}/fix/fix_am/global_hyblev.l64.txt +export INPUT_TYPE="gaussian_netcdf" + +export CDATE=2020020200 + +export OMP_NUM_THREADS_CH=${OMP_NUM_THREADS:-1} + +#----------------------------------------------------------------------------- +# Invoke chgres program. +#----------------------------------------------------------------------------- + +echo "Starting at: " `date` + +${HOMEufs}/ush/chgres_cube.sh + +iret=$? +if [ $iret -ne 0 ]; then + set +x + echo "<<< C96 FV3 GAUSSIAN NETCDF TEST FAILED. <<<" + exit $iret +fi + +echo "Ending at: " `date` + +#----------------------------------------------------------------------------- +# Compare output from chgres to baseline set of data. +#----------------------------------------------------------------------------- + +cd $DATA + +test_failed=0 +for files in *.nc +do + if [ -f $files ]; then + echo CHECK $files + $NCCMP -dmfqS $files $HOMEreg/baseline_data/c96_fv3_netcdf/$files + iret=$? + if [ $iret -ne 0 ]; then + test_failed=1 + fi + fi +done + +set +x +if [ $test_failed -ne 0 ]; then + echo "<<< C96 FV3 GAUSSIAN NETCDF TEST FAILED. >>>" +else + echo "<<< C96 FV3 GAUSSIAN NETCDF TEST PASSED. >>>" +fi + +exit 0 diff --git a/reg_tests/chgres_cube/c96.fv3.restart.sh b/reg_tests/chgres_cube/c96.fv3.restart.sh index e16f5f273..6e7107e5b 100755 --- a/reg_tests/chgres_cube/c96.fv3.restart.sh +++ b/reg_tests/chgres_cube/c96.fv3.restart.sh @@ -30,7 +30,7 @@ export TRACERS_INPUT='"sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","gr export CDATE=2019070612 -export OMP_NUM_THREADS_CY=1 +export OMP_NUM_THREADS_CH=${OMP_NUM_THREADS:-1} #----------------------------------------------------------------------------- # Invoke chgres program. @@ -42,6 +42,7 @@ ${HOMEufs}/ush/chgres_cube.sh iret=$? if [ $iret -ne 0 ]; then + set +x echo "<<< C96 FV3 GAUSSIAN NEMSIO TEST FAILED. <<<" exit $iret fi diff --git a/reg_tests/chgres_cube/c96.gfs.nemsio.sh b/reg_tests/chgres_cube/c96.gfs.nemsio.sh index a3d3a4d59..a6d51a0b5 100755 --- a/reg_tests/chgres_cube/c96.gfs.nemsio.sh +++ b/reg_tests/chgres_cube/c96.gfs.nemsio.sh @@ -18,13 +18,13 @@ export ATM_FILES_INPUT=gfnanl.gdas.2017071700 export SFC_FILES_INPUT=sfnanl.gdas.2017071700 export NST_FILES_INPUT=nsnanl.gdas.2017071700 export VCOORD_FILE=${HOMEufs}/fix/fix_am/global_hyblev.l64.txt -export INPUT_TYPE="gfs_gaussian" +export INPUT_TYPE="gfs_gaussian_nemsio" # dont start/end with double quotes. export TRACERS_TARGET='"sphum","liq_wat","o3mr"' export TRACERS_INPUT='"spfh","clwmr","o3mr"' export CDATE=2017071700 -export OMP_NUM_THREADS_CY=1 +export OMP_NUM_THREADS_CH=${OMP_NUM_THREADS:-1} #----------------------------------------------------------------------------- # Invoke chgres program. @@ -36,6 +36,7 @@ ${HOMEufs}/ush/chgres_cube.sh iret=$? if [ $iret -ne 0 ]; then + set +x echo "<<< C96 GFS GAUSSIAN NEMSIO TEST FAILED. <<<" exit $iret fi diff --git a/reg_tests/chgres_cube/c96.gfs.sigio.sh b/reg_tests/chgres_cube/c96.gfs.sigio.sh index c2ea31e52..840dbf9eb 100755 --- a/reg_tests/chgres_cube/c96.gfs.sigio.sh +++ b/reg_tests/chgres_cube/c96.gfs.sigio.sh @@ -18,13 +18,13 @@ export ATM_FILES_INPUT=gdas.t00z.sanl export SFC_FILES_INPUT=gdas.t00z.sfcanl export CONVERT_NST='.false.' export VCOORD_FILE=${HOMEufs}/fix/fix_am/global_hyblev.l64.txt -export INPUT_TYPE="gfs_spectral" +export INPUT_TYPE="gfs_sigio" # dont start/end with double quotes export TRACERS_TARGET='"sphum","o3mr","liq_wat"' export TRACERS_INPUT='"spfh","o3mr","clwmr"' export CDATE=2017071700 -export OMP_NUM_THREADS_CY=6 +export OMP_NUM_THREADS_CH=${OMP_NUM_THREADS:-1} echo "Starting at: " `date` @@ -32,6 +32,7 @@ ${HOMEufs}/ush/chgres_cube.sh iret=$? if [ $iret -ne 0 ]; then + set +x echo "<<< C96 GFS SIGIO TEST FAILED. <<<" exit $iret fi diff --git a/reg_tests/chgres_cube/c96.regional.sh b/reg_tests/chgres_cube/c96.regional.sh index 51a201f19..9d15e9533 100755 --- a/reg_tests/chgres_cube/c96.regional.sh +++ b/reg_tests/chgres_cube/c96.regional.sh @@ -26,7 +26,7 @@ export HALO_BNDY=4 export CDATE=2019070412 -export OMP_NUM_THREADS_CY=1 +export OMP_NUM_THREADS_CH=${OMP_NUM_THREADS:-1} #----------------------------------------------------------------------------- # Invoke chgres program. @@ -38,6 +38,7 @@ ${HOMEufs}/ush/chgres_cube.sh iret=$? if [ $iret -ne 0 ]; then + set +x echo "<<< C96 REGIONAL TEST FAILED. <<<" exit $iret fi diff --git a/reg_tests/chgres_cube/driver.cray.sh b/reg_tests/chgres_cube/driver.cray.sh index 2ffd353e8..3381b98e4 100755 --- a/reg_tests/chgres_cube/driver.cray.sh +++ b/reg_tests/chgres_cube/driver.cray.sh @@ -112,6 +112,15 @@ export APRUN="aprun -j 1 -n 6 -N 6 -d ${OMP_NUM_THREADS} -cc depth" bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.regional -M 1000 -W 0:15 -extsched 'CRAYLINUX[]' \ -w 'ended(c96.gfs.nemsio)' "export NODES=1; $PWD/c96.regional.sh" +#----------------------------------------------------------------------------- +# Initialize C96 using FV3 gaussian netcdf files. +#----------------------------------------------------------------------------- + +export OMP_NUM_THREADS=1 +export APRUN="aprun -j 1 -n 12 -N 6 -d ${OMP_NUM_THREADS} -cc depth" +bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.fv3.netcdf -M 1000 -W 0:15 -extsched 'CRAYLINUX[]' \ + -w 'ended(c96.regional)' "export NODES=2; $PWD/c96.fv3.netcdf.sh" + #----------------------------------------------------------------------------- # Initialize global C192 using GFS GRIB2 data. #----------------------------------------------------------------------------- @@ -119,7 +128,7 @@ bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.regional -M 100 export OMP_NUM_THREADS=1 export APRUN="aprun -j 1 -n 6 -N 6 -d ${OMP_NUM_THREADS} -cc depth" bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c192.gfs.grib2 -M 1000 -W 0:05 -extsched 'CRAYLINUX[]' \ - -w 'ended(c96.regional)' "export NODES=1; $PWD/c192.gfs.grib2.sh" + -w 'ended(c96.fv3.netcdf)' "export NODES=1; $PWD/c192.gfs.grib2.sh" #----------------------------------------------------------------------------- # Create summary log. diff --git a/reg_tests/chgres_cube/driver.dell.sh b/reg_tests/chgres_cube/driver.dell.sh index 6b17d0be0..7c774fcff 100755 --- a/reg_tests/chgres_cube/driver.dell.sh +++ b/reg_tests/chgres_cube/driver.dell.sh @@ -105,12 +105,20 @@ export OMP_NUM_THREADS=1 bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.regional -W 0:15 -x -n 6 -w 'ended(c96.gfs.nemsio)' \ -R "span[ptile=6]" -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" "$PWD/c96.regional.sh" +#----------------------------------------------------------------------------- +# Initialize C96 using FV3 gaussian netcdf files. +#----------------------------------------------------------------------------- + +export OMP_NUM_THREADS=1 +bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.fv3.netcdf -W 0:15 -x -n 12 -w 'ended(c96.regional)' \ + -R "span[ptile=6]" -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" "$PWD/c96.fv3.netcdf.sh" + #----------------------------------------------------------------------------- # Initialize global C192 using GFS GRIB2 file. #----------------------------------------------------------------------------- export OMP_NUM_THREADS=1 -bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c192.gfs.grib2 -W 0:05 -x -n 6 -w 'ended(c96.regional)' \ +bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c192.gfs.grib2 -W 0:05 -x -n 6 -w 'ended(c96.fv3.netcdf)' \ -R "span[ptile=6]" -R "affinity[core(${OMP_NUM_THREADS}):distribute=balance]" "$PWD/c192.gfs.grib2.sh" #----------------------------------------------------------------------------- diff --git a/reg_tests/chgres_cube/driver.hera.sh b/reg_tests/chgres_cube/driver.hera.sh index 5ae2882d6..79e3a172c 100755 --- a/reg_tests/chgres_cube/driver.hera.sh +++ b/reg_tests/chgres_cube/driver.hera.sh @@ -33,7 +33,7 @@ module list export OUTDIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/chgres_reg_tests PROJECT_CODE="fv3-cpu" -QUEUE="debug" +QUEUE="batch" #----------------------------------------------------------------------------- # Should not have to change anything below here. HOMEufs is the root @@ -61,6 +61,7 @@ rm -fr $OUTDIR # Initialize C96 using FV3 warm restart files. #----------------------------------------------------------------------------- +export OMP_NUM_THREADS=1 # should match cpus-per-task TEST1=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.restart \ -o $LOG_FILE -e $LOG_FILE ./c96.fv3.restart.sh) @@ -68,6 +69,7 @@ TEST1=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_C # Initialize C192 using FV3 tiled history files. #----------------------------------------------------------------------------- +export OMP_NUM_THREADS=1 # should match cpus-per-task TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c192.fv3.history \ -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST1 ./c192.fv3.history.sh) @@ -75,6 +77,7 @@ TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_C # Initialize C96 using FV3 gaussian nemsio files. #----------------------------------------------------------------------------- +export OMP_NUM_THREADS=1 # should match cpus-per-task TEST3=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.nemsio \ -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST2 ./c96.fv3.nemsio.sh) @@ -82,13 +85,15 @@ TEST3=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_C # Initialize C96 using spectral GFS sigio/sfcio files. #----------------------------------------------------------------------------- -TEST4=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.gfs.sigio \ +export OMP_NUM_THREADS=6 # should match cpus-per-task +TEST4=$(sbatch --parsable --ntasks-per-node=3 --cpus-per-task=6 --nodes=2 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.gfs.sigio \ -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST3 ./c96.gfs.sigio.sh) #----------------------------------------------------------------------------- # Initialize C96 using spectral GFS gaussian nemsio files. #----------------------------------------------------------------------------- +export OMP_NUM_THREADS=1 # should match cpus-per-task TEST5=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.gfs.nemsio \ -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST4 ./c96.gfs.nemsio.sh) @@ -96,22 +101,32 @@ TEST5=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_C # Initialize regional C96 using FV3 gaussian nemsio files. #----------------------------------------------------------------------------- +export OMP_NUM_THREADS=1 # should match cpus-per-task TEST6=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.regional \ -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST5 ./c96.regional.sh) +#----------------------------------------------------------------------------- +# Initialize C96 using FV3 gaussian netcdf files. +#----------------------------------------------------------------------------- + +export OMP_NUM_THREADS=1 # should match cpus-per-task +TEST7=$(sbatch --parsable --ntasks-per-node=12 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.netcdf \ + -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST6 ./c96.fv3.netcdf.sh) + #----------------------------------------------------------------------------- # Initialize global C192 using GFS GRIB2 files. #----------------------------------------------------------------------------- -TEST7=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.gfs.grib2 \ - -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST6 ./c192.gfs.grib2.sh) +export OMP_NUM_THREADS=1 # should match cpus-per-task +TEST8=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.gfs.grib2 \ + -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST7 ./c192.gfs.grib2.sh) #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ - --open-mode=append -q $QUEUE -d afterok:$TEST7 << EOF + --open-mode=append -q $QUEUE -d afterok:$TEST8 << EOF #!/bin/sh grep -a '<<<' $LOG_FILE > $SUM_FILE EOF diff --git a/reg_tests/chgres_cube/driver.jet.sh b/reg_tests/chgres_cube/driver.jet.sh index 0b97ec20d..f6b565224 100755 --- a/reg_tests/chgres_cube/driver.jet.sh +++ b/reg_tests/chgres_cube/driver.jet.sh @@ -63,6 +63,7 @@ rm -fr $OUTDIR # Initialize C96 using FV3 warm restart files. #----------------------------------------------------------------------------- +export OMP_NUM_THREADS=1 TEST1=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.restart \ -o $LOG_FILE -e $LOG_FILE ./c96.fv3.restart.sh) @@ -70,6 +71,7 @@ TEST1=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:10 # Initialize C192 using FV3 tiled history files. #----------------------------------------------------------------------------- +export OMP_NUM_THREADS=1 TEST2=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c192.fv3.history \ -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST1 ./c192.fv3.history.sh) @@ -77,6 +79,7 @@ TEST2=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:10 # Initialize C96 using FV3 gaussian nemsio files. #----------------------------------------------------------------------------- +export OMP_NUM_THREADS=1 TEST3=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.nemsio \ -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST2 ./c96.fv3.nemsio.sh) @@ -84,6 +87,7 @@ TEST3=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:10 # Initialize C96 using spectral GFS sigio/sfcio files. #----------------------------------------------------------------------------- +export OMP_NUM_THREADS=6 # should match cpus-per-task TEST4=$(sbatch --parsable --partition=xjet --nodes=2 --ntasks-per-node=3 --cpus-per-task=6 -t 0:15:00 \ -A $PROJECT_CODE -q $QUEUE -J c96.gfs.sigio -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST3 ./c96.gfs.sigio.sh) @@ -91,6 +95,7 @@ TEST4=$(sbatch --parsable --partition=xjet --nodes=2 --ntasks-per-node=3 --cpus- # Initialize C96 using spectral GFS gaussian nemsio files. #----------------------------------------------------------------------------- +export OMP_NUM_THREADS=1 TEST5=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.gfs.nemsio \ -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST4 ./c96.gfs.nemsio.sh) @@ -98,22 +103,32 @@ TEST5=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:10 # Initialize regional C96 using FV3 gaussian nemsio files. #----------------------------------------------------------------------------- +export OMP_NUM_THREADS=1 TEST6=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.regional \ -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST5 ./c96.regional.sh) +#----------------------------------------------------------------------------- +# Initialize C96 using FV3 gaussian netcdf files. +#----------------------------------------------------------------------------- + +export OMP_NUM_THREADS=1 +TEST7=$(sbatch --parsable --partition=xjet --nodes=2 --ntasks-per-node=6 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.netcdf \ + -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST6 ./c96.fv3.netcdf.sh) + #----------------------------------------------------------------------------- # Initialize C192 using GFS GRIB2 data. #----------------------------------------------------------------------------- -TEST7=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.gfs.grib2 \ - -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST6 ./c192.gfs.grib2.sh) +export OMP_NUM_THREADS=1 +TEST8=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.gfs.grib2 \ + -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST7 ./c192.gfs.grib2.sh) #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- sbatch --partition=xjet --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ - --open-mode=append -q $QUEUE -d afterok:$TEST7 << EOF + --open-mode=append -q $QUEUE -d afterok:$TEST8 << EOF #!/bin/sh grep -a '<<<' $LOG_FILE > $SUM_FILE EOF diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index 9ba0d25bb..6f324d1c3 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -144,19 +144,62 @@ subroutine read_input_atm_data(localpet) integer, intent(in) :: localpet +!------------------------------------------------------------------------------- +! Read the tiled 'warm' restart files. +!------------------------------------------------------------------------------- + if (trim(input_type) == "restart") then + call read_input_atm_restart_file(localpet) + +!------------------------------------------------------------------------------- +! Read the gaussian history files in netcdf format. +!------------------------------------------------------------------------------- + + elseif (trim(input_type) == "gaussian_netcdf") then + + call read_input_atm_gaussian_netcdf_file(localpet) + +!------------------------------------------------------------------------------- +! Read the tiled history files in netcdf format. +!------------------------------------------------------------------------------- + elseif (trim(input_type) == "history") then - call read_input_atm_history_file(localpet) - elseif (trim(input_type) == "gaussian") then ! fv3gfs gaussian nemsio - call read_input_atm_gaussian_file(localpet) - elseif (trim(input_type) == "gfs_gaussian") then ! spectral gfs gaussian - ! nemsio. - call read_input_atm_gfs_gaussian_file(localpet) - elseif (trim(input_type) == "gfs_spectral") then ! spectral gfs sigio format. - call read_input_atm_gfs_spectral_file(localpet) + + call read_input_atm_tiled_history_file(localpet) + +!------------------------------------------------------------------------------- +! Read the gaussian history files in nemsio format. +!------------------------------------------------------------------------------- + + elseif (trim(input_type) == "gaussian_nemsio") then ! fv3gfs gaussian nemsio + + call read_input_atm_gaussian_nemsio_file(localpet) + +!------------------------------------------------------------------------------- +! Read the spectral gfs gaussian history files in nemsio format. +!------------------------------------------------------------------------------- + + elseif (trim(input_type) == "gfs_gaussian_nemsio") then ! spectral gfs gaussian + ! nemsio. + call read_input_atm_gfs_gaussian_nemsio_file(localpet) + +!------------------------------------------------------------------------------- +! Read the spectral gfs gaussian history files in sigio format. +!------------------------------------------------------------------------------- + + elseif (trim(input_type) == "gfs_sigio") then ! spectral gfs sigio format. + + call read_input_atm_gfs_sigio_file(localpet) + +!------------------------------------------------------------------------------- +! Read fv3gfs data in grib2 format. +!------------------------------------------------------------------------------- + elseif (trim(input_type) == "grib2") then + call read_input_atm_grib2_file(localpet) + endif end subroutine read_input_atm_data @@ -301,10 +344,24 @@ subroutine read_input_nst_data(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) - if (trim(input_type) == "gaussian" .or. trim(input_type) == "gfs_gaussian") then - call read_input_nst_gaussian_file(localpet) +!-------------------------------------------------------------------------- +! Read input grid nst data from a fv3 gaussian nemsio history file or +! spectral GFS nemsio file. +!-------------------------------------------------------------------------- + + if (trim(input_type) == "gaussian_nemsio" .or. trim(input_type) == "gfs_gaussian_nemsio") then + + call read_input_nst_nemsio_file(localpet) + +!--------------------------------------------------------------------------- +! Read nst data from these netcdf formatted fv3 files: tiled history, +! tiled warm restart, and gaussian history. +!--------------------------------------------------------------------------- + else - call read_input_nst_tile_file(localpet) + + call read_input_nst_netcdf_file(localpet) + endif end subroutine read_input_nst_data @@ -481,85 +538,80 @@ subroutine read_input_sfc_data(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) +!------------------------------------------------------------------------------- +! Read the tiled 'warm' restart files. +!------------------------------------------------------------------------------- + if (trim(input_type) == "restart") then + call read_input_sfc_restart_file(localpet) - elseif (trim(input_type) == "history") then - call read_input_sfc_history_file(localpet) - elseif (trim(input_type) == "gaussian") then - call read_input_sfc_gaussian_file(localpet) - elseif (trim(input_type) == "gfs_gaussian") then - call read_input_sfc_gfs_gaussian_file(localpet) - elseif (trim(input_type) == "gfs_spectral") then - call read_input_sfc_gfs_sfcio_file(localpet) - elseif (trim(input_type) == "grib2") then - call read_input_sfc_grib2_file(localpet) - endif - end subroutine read_input_sfc_data +!------------------------------------------------------------------------------- +! Read the tiled or gaussian history files in netcdf format. +!------------------------------------------------------------------------------- -!--------------------------------------------------------------------------- -! Read input atmospheric data from spectral gfs (old sigio format). -! Used prior to July 19, 2017. -!--------------------------------------------------------------------------- + elseif (trim(input_type) == "history" .or. trim(input_type) == & + "gaussian_netcdf") then - subroutine read_input_atm_gfs_spectral_file(localpet) + call read_input_sfc_netcdf_file(localpet) - use sigio_module +!------------------------------------------------------------------------------- +! Read the gaussian history files in nemsio format. +!------------------------------------------------------------------------------- - implicit none + elseif (trim(input_type) == "gaussian_nemsio") then - integer, intent(in) :: localpet + call read_input_sfc_gaussian_nemsio_file(localpet) - character(len=300) :: the_file +!------------------------------------------------------------------------------- +! Read the spectral gfs gaussian history files in nemsio format. +!------------------------------------------------------------------------------- - integer(sigio_intkind) :: iret - integer :: rc, i, j, k - integer :: clb(3), cub(3) + elseif (trim(input_type) == "gfs_gaussian_nemsio") then - real(esmf_kind_r8) :: ak, bk - real(esmf_kind_r8), allocatable :: dummy2d(:,:) - real(esmf_kind_r8), allocatable :: dummy3d(:,:,:) - real(esmf_kind_r8), allocatable :: dummy3d2(:,:,:) - real(esmf_kind_r8), pointer :: pptr(:,:,:), psptr(:,:) - real(esmf_kind_r8), allocatable :: pi(:,:,:) + call read_input_sfc_gfs_gaussian_nemsio_file(localpet) - type(sigio_head) :: sighead - type(sigio_dbta) :: sigdata +!------------------------------------------------------------------------------- +! Read the spectral gfs gaussian history files in sfcio format. +!------------------------------------------------------------------------------- - the_file = trim(data_dir_input_grid) // "/" // trim(atm_files_input_grid(1)) + elseif (trim(input_type) == "gfs_sigio") then - print*,"- ATMOSPHERIC DATA IN SIGIO FORMAT." - print*,"- OPEN AND READ: ", trim(the_file) + call read_input_sfc_gfs_sfcio_file(localpet) - call sigio_sropen(21, trim(the_file), iret) - if (iret /= 0) then - rc = iret - call error_handler("OPENING SPECTRAL GFS SIGIO FILE.", rc) - endif - call sigio_srhead(21, sighead, iret) - if (iret /= 0) then - rc = iret - call error_handler("READING SPECTRAL GFS SIGIO FILE.", rc) - endif +!------------------------------------------------------------------------------- +! Read fv3gfs surface data in grib2 format. +!------------------------------------------------------------------------------- - lev_input = sighead%levs - levp1_input = lev_input + 1 + elseif (trim(input_type) == "grib2") then - if (num_tracers /= sighead%ntrac) then - call error_handler("WRONG NUMBER OF TRACERS EXPECTED.", 99) - endif + call read_input_sfc_grib2_file(localpet) - if (sighead%idvt == 0 .or. sighead%idvt == 21) then - if (trim(tracers_input(1)) /= 'spfh' .or. & - trim(tracers_input(2)) /= 'o3mr' .or. & - trim(tracers_input(3)) /= 'clwmr') then - call error_handler("TRACERS SELECTED DO NOT MATCH FILE CONTENTS.", 99) - endif - else - print*,'- UNRECOGNIZED IDVT: ', sighead%idvt - call error_handler("UNRECOGNIZED IDVT", 99) endif + end subroutine read_input_sfc_data + +!--------------------------------------------------------------------------- +! Create atmospheric esmf fields. +!--------------------------------------------------------------------------- + + subroutine init_atm_esmf_fields + + implicit none + + integer :: i, rc + + print*,"- INITIALIZE ATMOSPHERIC ESMF FIELDS." + + print*,"- CALL FieldCreate FOR INPUT GRID 3-D WIND." + wind_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1,1/), & + ungriddedUBound=(/lev_input,3/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + print*,"- CALL FieldCreate FOR INPUT GRID SURFACE PRESSURE." ps_input_grid = ESMF_FieldCreate(input_grid, & typekind=ESMF_TYPEKIND_R8, & @@ -623,6 +675,86 @@ subroutine read_input_atm_gfs_spectral_file(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) + print*,"- CALL FieldCreate FOR INPUT GRID PRESSURE." + pres_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_input/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + end subroutine init_atm_esmf_fields + +!--------------------------------------------------------------------------- +! Read input atmospheric data from spectral gfs (old sigio format). +! Used prior to July 19, 2017. +!--------------------------------------------------------------------------- + + subroutine read_input_atm_gfs_sigio_file(localpet) + + use sigio_module + + implicit none + + integer, intent(in) :: localpet + + character(len=300) :: the_file + + integer(sigio_intkind) :: iret + integer :: rc, i, j, k + integer :: clb(3), cub(3) + + real(esmf_kind_r8) :: ak, bk + real(esmf_kind_r8), allocatable :: dummy2d(:,:) + real(esmf_kind_r8), allocatable :: dummy3d(:,:,:) + real(esmf_kind_r8), allocatable :: dummy3d2(:,:,:) + real(esmf_kind_r8), pointer :: pptr(:,:,:), psptr(:,:) + real(esmf_kind_r8), allocatable :: pi(:,:,:) + + type(sigio_head) :: sighead + type(sigio_dbta) :: sigdata + + the_file = trim(data_dir_input_grid) // "/" // trim(atm_files_input_grid(1)) + + print*,"- ATMOSPHERIC DATA IN SIGIO FORMAT." + print*,"- OPEN AND READ: ", trim(the_file) + + call sigio_sropen(21, trim(the_file), iret) + if (iret /= 0) then + rc = iret + call error_handler("OPENING SPECTRAL GFS SIGIO FILE.", rc) + endif + call sigio_srhead(21, sighead, iret) + if (iret /= 0) then + rc = iret + call error_handler("READING SPECTRAL GFS SIGIO FILE.", rc) + endif + + lev_input = sighead%levs + levp1_input = lev_input + 1 + + if (num_tracers /= sighead%ntrac) then + call error_handler("WRONG NUMBER OF TRACERS EXPECTED.", 99) + endif + + if (sighead%idvt == 0 .or. sighead%idvt == 21) then + if (trim(tracers_input(1)) /= 'spfh' .or. & + trim(tracers_input(2)) /= 'o3mr' .or. & + trim(tracers_input(3)) /= 'clwmr') then + call error_handler("TRACERS SELECTED DO NOT MATCH FILE CONTENTS.", 99) + endif + else + print*,'- UNRECOGNIZED IDVT: ', sighead%idvt + call error_handler("UNRECOGNIZED IDVT", 99) + endif + +!--------------------------------------------------------------------------- +! Initialize esmf atmospheric fields. +!--------------------------------------------------------------------------- + + call init_atm_esmf_fields + if (localpet == 0) then allocate(dummy2d(i_input,j_input)) allocate(dummy3d(i_input,j_input,lev_input)) @@ -737,14 +869,6 @@ subroutine read_input_atm_gfs_spectral_file(localpet) print*,"- COMPUTE 3-D PRESSURE." - print*,"- CALL FieldCreate FOR INPUT GRID PRESSURE." - pres_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - print*,"- CALL FieldGet FOR 3-D PRES." nullify(pptr) call ESMF_FieldGet(pres_input_grid, & @@ -799,14 +923,14 @@ subroutine read_input_atm_gfs_spectral_file(localpet) print*,'pres ',psptr(clb(1),clb(2)),pptr(clb(1),clb(2),:) endif - end subroutine read_input_atm_gfs_spectral_file + end subroutine read_input_atm_gfs_sigio_file !--------------------------------------------------------------------------- ! Read input atmospheric data from spectral gfs (global gaussian in ! nemsio format. Starting July 19, 2017). !--------------------------------------------------------------------------- - subroutine read_input_atm_gfs_gaussian_file(localpet) + subroutine read_input_atm_gfs_gaussian_nemsio_file(localpet) implicit none @@ -849,68 +973,11 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) call nemsio_getfilehead(gfile, iret=iret, vcoord=vcoord) if (iret /= 0) call error_handler("READING VERTICAL COORDINATE INFO.", iret) - print*,"- CALL FieldCreate FOR INPUT GRID SURFACE PRESSURE." - ps_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - print*,"- CALL FieldCreate FOR INPUT GRID TEMPERATURE." - temp_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - allocate(tracers_input_grid(num_tracers)) - - do i = 1, num_tracers - print*,"- CALL FieldCreate FOR INPUT GRID TRACER ", trim(tracers_input(i)) - tracers_input_grid(i) = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - enddo - - print*,"- CALL FieldCreate FOR INPUT GRID U." - u_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - print*,"- CALL FieldCreate FOR INPUT GRID V." - v_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - print*,"- CALL FieldCreate FOR INPUT GRID DZDT." - dzdt_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) +!--------------------------------------------------------------------------- +! Initialize esmf atmospheric fields. +!--------------------------------------------------------------------------- - print*,"- CALL FieldCreate FOR INPUT GRID TERRAIN." - terrain_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) + call init_atm_esmf_fields if (localpet == 0) then allocate(dummy(i_input*j_input)) @@ -1062,14 +1129,6 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) print*,"- COMPUTE 3-D PRESSURE." - print*,"- CALL FieldCreate FOR INPUT GRID PRESSURE." - pres_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - print*,"- CALL FieldGet FOR 3-D PRES." nullify(pptr) call ESMF_FieldGet(pres_input_grid, & @@ -1118,13 +1177,13 @@ subroutine read_input_atm_gfs_gaussian_file(localpet) deallocate(pi) - end subroutine read_input_atm_gfs_gaussian_file + end subroutine read_input_atm_gfs_gaussian_nemsio_file !--------------------------------------------------------------------------- -! Read input grid atmospheric fv3 gaussian history files (nemsio format). +! Read input grid atmospheric fv3 gaussian nemsio files. !--------------------------------------------------------------------------- - subroutine read_input_atm_gaussian_file(localpet) + subroutine read_input_atm_gaussian_nemsio_file(localpet) implicit none @@ -1167,52 +1226,11 @@ subroutine read_input_atm_gaussian_file(localpet) call nemsio_getfilehead(gfile, iret=iret, vcoord=vcoord) if (iret /= 0) call error_handler("READING VERTICAL COORDINATE INFO.", iret) - print*,"- CALL FieldCreate FOR INPUT GRID SURFACE PRESSURE." - ps_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - print*,"- CALL FieldCreate FOR INPUT GRID TEMPERATURE." - temp_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - allocate(tracers_input_grid(num_tracers)) - - do i = 1, num_tracers - print*,"- CALL FieldCreate FOR INPUT GRID TRACER ", trim(tracers_input(i)) - tracers_input_grid(i) = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - enddo - - print*,"- CALL FieldCreate FOR INPUT GRID U." - u_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) +!--------------------------------------------------------------------------- +! Initialize esmf atmospheric fields. +!--------------------------------------------------------------------------- - print*,"- CALL FieldCreate FOR INPUT GRID V." - v_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) + call init_atm_esmf_fields print*,"- CALL FieldCreate FOR INPUT DPRES." dpres_input_grid = ESMF_FieldCreate(input_grid, & @@ -1223,22 +1241,6 @@ subroutine read_input_atm_gaussian_file(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) - print*,"- CALL FieldCreate FOR INPUT GRID DZDT." - dzdt_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - print*,"- CALL FieldCreate FOR INPUT GRID TERRAIN." - terrain_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - if (localpet == 0) then allocate(dummy(i_input*j_input)) allocate(dummy2d(i_input,j_input)) @@ -1396,15 +1398,6 @@ subroutine read_input_atm_gaussian_file(localpet) print*,"- COMPUTE 3-D PRESSURE." - print*,"- CALL FieldCreate FOR INPUT GRID PRESSURE." - pres_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - print*,"- CALL FieldGet FOR DELTA PRESSURE." nullify(dpresptr) call ESMF_FieldGet(dpres_input_grid, & @@ -1463,10 +1456,10 @@ subroutine read_input_atm_gaussian_file(localpet) call ESMF_FieldDestroy(dpres_input_grid, rc=rc) - end subroutine read_input_atm_gaussian_file + end subroutine read_input_atm_gaussian_nemsio_file !--------------------------------------------------------------------------- -! Read input grid fv3 atmospheric data restart files. +! Read input grid fv3 atmospheric data 'warm' restart files. ! ! Routine reads tiled files in parallel. Tile 1 is read by ! localpet 0; tile 2 by localpet 1, etc. The number of pets @@ -1519,41 +1512,11 @@ subroutine read_input_atm_restart_file(localpet) error = nf90_close(ncid) - print*,"- CALL FieldCreate FOR INPUT GRID U." - u_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - print*,"- CALL FieldCreate FOR INPUT GRID V." - v_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - print*,"- CALL FieldCreate FOR INPUT GRID DZDT." - dzdt_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) +!--------------------------------------------------------------------------- +! Initialize esmf atmospheric fields. +!--------------------------------------------------------------------------- - print*,"- CALL FieldCreate FOR INPUT GRID TEMPERATURE." - temp_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) + call init_atm_esmf_fields print*,"- CALL FieldCreate FOR INPUT GRID DELTA PRESSURE." dpres_input_grid = ESMF_FieldCreate(input_grid, & @@ -1564,28 +1527,6 @@ subroutine read_input_atm_restart_file(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) - print*,"- CALL FieldCreate FOR INPUT GRID TERRAIN." - terrain_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - allocate(tracers_input_grid(num_tracers)) - - do i = 1, num_tracers - - print*,"- CALL FieldCreate FOR INPUT GRID TRACER ", trim(tracers_input(i)) - tracers_input_grid(i) = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - enddo - if (localpet < num_tiles_input_grid) then allocate(data_one_tile_3d(i_input,j_input,lev_input)) allocate(data_one_tile(i_input,j_input)) @@ -1680,51 +1621,421 @@ subroutine read_input_atm_restart_file(localpet) call error_handler("IN FieldScatter", rc) enddo - if (localpet < num_tiles_input_grid) then - error=nf90_inq_varid(ncid, 'va', id_var) - call netcdf_err(error, 'reading field id' ) - error=nf90_get_var(ncid, id_var, data_one_tile_3d) - call netcdf_err(error, 'reading field' ) - data_one_tile_3d(:,:,1:lev_input) = data_one_tile_3d(:,:,lev_input:1:-1) + if (localpet < num_tiles_input_grid) then + error=nf90_inq_varid(ncid, 'va', id_var) + call netcdf_err(error, 'reading field id' ) + error=nf90_get_var(ncid, id_var, data_one_tile_3d) + call netcdf_err(error, 'reading field' ) + data_one_tile_3d(:,:,1:lev_input) = data_one_tile_3d(:,:,lev_input:1:-1) + endif + + do tile = 1, num_tiles_input_grid + print*,"- CALL FieldScatter FOR INPUT GRID V." + call ESMF_FieldScatter(v_input_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + enddo + + if (localpet < num_tiles_input_grid) error = nf90_close(ncid) + + if (localpet < num_tiles_input_grid) then + tile = localpet+1 + tilefile= trim(data_dir_input_grid) // "/" // trim(atm_tracer_files_input_grid(tile)) + print*,"- READ ATMOSPHERIC TRACER FILE: ", trim(tilefile) + error=nf90_open(trim(tilefile),nf90_nowrite,ncid) + call netcdf_err(error, 'opening: '//trim(tilefile) ) + endif + + do i = 1, num_tracers + + if (localpet < num_tiles_input_grid) then + error=nf90_inq_varid(ncid, tracers_input(i), id_var) + call netcdf_err(error, 'reading field id' ) + error=nf90_get_var(ncid, id_var, data_one_tile_3d) + call netcdf_err(error, 'reading field' ) + data_one_tile_3d(:,:,1:lev_input) = data_one_tile_3d(:,:,lev_input:1:-1) + endif + + do tile = 1, num_tiles_input_grid + print*,"- CALL FieldScatter FOR INPUT ", trim(tracers_input(i)) + call ESMF_FieldScatter(tracers_input_grid(i), data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + enddo + + enddo + + if (localpet < num_tiles_input_grid) error=nf90_close(ncid) + +!--------------------------------------------------------------------------- +! Convert from 2-d to 3-d cartesian winds. +!--------------------------------------------------------------------------- + + call convert_winds + +!--------------------------------------------------------------------------- +! Compute pressures +!--------------------------------------------------------------------------- + + print*,"- CALL FieldGet FOR SURFACE PRESSURE." + call ESMF_FieldGet(ps_input_grid, & + farrayPtr=psptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR PRESSURE." + call ESMF_FieldGet(pres_input_grid, & + computationalLBound=clb, & + computationalUBound=cub, & + farrayPtr=presptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR DELTA PRESSURE." + call ESMF_FieldGet(dpres_input_grid, & + farrayPtr=dpresptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + allocate(pres_interface(levp1_input)) + + do i = clb(1), cub(1) + do j = clb(2), cub(2) + pres_interface(levp1_input) = ak(1) ! model top in Pa + do k = (levp1_input-1), 1, -1 + pres_interface(k) = pres_interface(k+1) + dpresptr(i,j,k) + enddo + do k = 1, lev_input + presptr(i,j,k) = (pres_interface(k) + pres_interface(k+1)) / 2.0_8 + enddo + psptr(i,j) = pres_interface(1) + enddo + enddo + + deallocate(ak) + deallocate(pres_interface) + + call ESMF_FieldDestroy(dpres_input_grid, rc=rc) + + deallocate(data_one_tile_3d, data_one_tile) + + end subroutine read_input_atm_restart_file + +!--------------------------------------------------------------------------- +! Read fv3 netcdf gaussian history file. Each task reads a horizontal +! slice. +!--------------------------------------------------------------------------- + + subroutine read_input_atm_gaussian_netcdf_file(localpet) + + implicit none + + include 'mpif.h' + + integer, intent(in) :: localpet + + character(len=500) :: tilefile + + integer :: start(3), count(3), iscnt + integer :: error, ncid, num_tracers_file + integer :: id_dim, idim_input, jdim_input + integer :: id_var, rc, nprocs, max_procs + integer :: kdim, remainder, myrank, i, j, k, n + integer :: clb(3), cub(3) + integer, allocatable :: kcount(:), startk(:), displ(:) + integer, allocatable :: ircnt(:) + + real(esmf_kind_r8), allocatable :: phalf(:) + real(esmf_kind_r8), allocatable :: pres_interface(:) + real(kind=4), allocatable :: dummy3d(:,:,:) + real(kind=4), allocatable :: dummy3dall(:,:,:) + real(esmf_kind_r8), allocatable :: dummy3dflip(:,:,:) + real(esmf_kind_r8), allocatable :: dummy(:,:) + real(esmf_kind_r8), pointer :: presptr(:,:,:), dpresptr(:,:,:) + real(esmf_kind_r8), pointer :: psptr(:,:) + + print*,"- READ INPUT ATMOS DATA FROM GAUSSIAN NETCDF FILE." + + tilefile = trim(data_dir_input_grid) // "/" // trim(atm_files_input_grid(1)) + error=nf90_open(trim(tilefile),nf90_nowrite,ncid) + call netcdf_err(error, 'opening: '//trim(tilefile) ) + + error=nf90_inq_dimid(ncid, 'grid_xt', id_dim) + call netcdf_err(error, 'reading grid_xt id' ) + error=nf90_inquire_dimension(ncid,id_dim,len=idim_input) + call netcdf_err(error, 'reading grid_xt value' ) + + error=nf90_inq_dimid(ncid, 'grid_yt', id_dim) + call netcdf_err(error, 'reading grid_yt id' ) + error=nf90_inquire_dimension(ncid,id_dim,len=jdim_input) + call netcdf_err(error, 'reading grid_yt value' ) + + if (idim_input /= i_input .or. jdim_input /= j_input) then + call error_handler("DIMENSION MISMATCH BETWEEN SFC AND OROG FILES.", 2) + endif + + error=nf90_inq_dimid(ncid, 'pfull', id_dim) + call netcdf_err(error, 'reading pfull id' ) + error=nf90_inquire_dimension(ncid,id_dim,len=lev_input) + call netcdf_err(error, 'reading pfull value' ) + + error=nf90_inq_dimid(ncid, 'phalf', id_dim) + call netcdf_err(error, 'reading phalf id' ) + error=nf90_inquire_dimension(ncid,id_dim,len=levp1_input) + call netcdf_err(error, 'reading phalf value' ) + allocate(phalf(levp1_input)) + error=nf90_inq_varid(ncid, 'phalf', id_var) + call netcdf_err(error, 'getting phalf varid' ) + error=nf90_get_var(ncid, id_var, phalf) + call netcdf_err(error, 'reading phalf varid' ) + + error=nf90_get_att(ncid, nf90_global, 'ncnsto', num_tracers_file) + call netcdf_err(error, 'reading ntracer value' ) + + call mpi_comm_size(mpi_comm_world, nprocs, error) + print*,'- Running with ', nprocs, ' processors' + + call mpi_comm_rank(mpi_comm_world, myrank, error) + print*,'- myrank/localpet is ',myrank,localpet + + max_procs = nprocs + if (nprocs > lev_input) then + max_procs = lev_input + endif + + kdim = lev_input / max_procs + remainder = lev_input - (max_procs*kdim) + + allocate(kcount(0:nprocs-1)) + kcount=0 + allocate(startk(0:nprocs-1)) + startk=0 + allocate(displ(0:nprocs-1)) + displ=0 + allocate(ircnt(0:nprocs-1)) + ircnt=0 + + do k = 0, max_procs-2 + kcount(k) = kdim + enddo + kcount(max_procs-1) = kdim + remainder + + startk(0) = 1 + do k = 1, max_procs-1 + startk(k) = startk(k-1) + kcount(k-1) + enddo + + ircnt(:) = idim_input * jdim_input * kcount(:) + + displ(0) = 0 + do k = 1, max_procs-1 + displ(k) = displ(k-1) + ircnt(k-1) + enddo + + iscnt=idim_input*jdim_input*kcount(myrank) + +! Account for case if number of tasks exceeds the number of vert levels. + + if (myrank <= max_procs-1) then + allocate(dummy3d(idim_input,jdim_input,kcount(myrank))) + else + allocate(dummy3d(0,0,0)) + endif + + if (myrank == 0) then + allocate(dummy3dall(idim_input,jdim_input,lev_input)) + dummy3dall = 0.0 + allocate(dummy3dflip(idim_input,jdim_input,lev_input)) + dummy3dflip = 0.0 + allocate(dummy(idim_input,jdim_input)) + dummy = 0.0 + else + allocate(dummy3dall(0,0,0)) + allocate(dummy3dflip(0,0,0)) + allocate(dummy(0,0)) + endif + +!--------------------------------------------------------------------------- +! Initialize esmf atmospheric fields. +!--------------------------------------------------------------------------- + + call init_atm_esmf_fields + + print*,"- CALL FieldCreate FOR INPUT GRID DELTA PRESSURE." + dpres_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_input/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + +! Temperature + + if (myrank <= max_procs-1) then + start = (/1,1,startk(myrank)/) + count = (/idim_input,jdim_input,kcount(myrank)/) + error=nf90_inq_varid(ncid, 'tmp', id_var) + call netcdf_err(error, 'reading tmp field id' ) + error=nf90_get_var(ncid, id_var, dummy3d, start=start, count=count) + call netcdf_err(error, 'reading tmp field' ) + endif + + call mpi_gatherv(dummy3d, iscnt, mpi_real, & + dummy3dall, ircnt, displ, mpi_real, & + 0, mpi_comm_world, error) + if (error /= 0) call error_handler("IN mpi_gatherv of temperature", error) + + if (myrank == 0) then + dummy3dflip(:,:,1:lev_input) = dummy3dall(:,:,lev_input:1:-1) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID TEMPERATURE " + call ESMF_FieldScatter(temp_input_grid, dummy3dflip, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + +! dpres + + if (myrank <= max_procs-1) then + error=nf90_inq_varid(ncid, 'dpres', id_var) + call netcdf_err(error, 'reading dpres field id' ) + error=nf90_get_var(ncid, id_var, dummy3d, start=start, count=count) + call netcdf_err(error, 'reading dpres field' ) + endif + + call mpi_gatherv(dummy3d, iscnt, mpi_real, & + dummy3dall, ircnt, displ, mpi_real, & + 0, mpi_comm_world, error) + if (error /= 0) call error_handler("IN mpi_gatherv of dpres", error) + + if (myrank == 0) then + dummy3dflip(:,:,1:lev_input) = dummy3dall(:,:,lev_input:1:-1) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID DPRES " + call ESMF_FieldScatter(dpres_input_grid, dummy3dflip, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + +! ugrd + + if (myrank <= max_procs-1) then + error=nf90_inq_varid(ncid, 'ugrd', id_var) + call netcdf_err(error, 'reading ugrd field id' ) + error=nf90_get_var(ncid, id_var, dummy3d, start=start, count=count) + call netcdf_err(error, 'reading ugrd field' ) + endif + + call mpi_gatherv(dummy3d, iscnt, mpi_real, & + dummy3dall, ircnt, displ, mpi_real, & + 0, mpi_comm_world, error) + if (error /= 0) call error_handler("IN mpi_gatherv of ugrd", error) + + if (myrank == 0) then + dummy3dflip(:,:,1:lev_input) = dummy3dall(:,:,lev_input:1:-1) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID UGRD " + call ESMF_FieldScatter(u_input_grid, dummy3dflip, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + +! vgrd + + if (myrank <= max_procs-1) then + error=nf90_inq_varid(ncid, 'vgrd', id_var) + call netcdf_err(error, 'reading vgrd field id' ) + error=nf90_get_var(ncid, id_var, dummy3d, start=start, count=count) + call netcdf_err(error, 'reading vgrd field' ) + endif + + call mpi_gatherv(dummy3d, iscnt, mpi_real, & + dummy3dall, ircnt, displ, mpi_real, & + 0, mpi_comm_world, error) + if (error /= 0) call error_handler("IN mpi_gatherv of vgrd", error) + + if (myrank == 0) then + dummy3dflip(:,:,1:lev_input) = dummy3dall(:,:,lev_input:1:-1) + endif + + print*,"- CALL FieldScatter FOR INPUT GRID VGRD " + call ESMF_FieldScatter(v_input_grid, dummy3dflip, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + +! tracers + + do n = 1, num_tracers + + if (myrank <= max_procs-1) then + error=nf90_inq_varid(ncid, tracers_input(n), id_var) + call netcdf_err(error, 'reading tracer field id' ) + error=nf90_get_var(ncid, id_var, dummy3d, start=start, count=count) + call netcdf_err(error, 'reading tracer field' ) + endif + + call mpi_gatherv(dummy3d, iscnt, mpi_real, & + dummy3dall, ircnt, displ, mpi_real, & + 0, mpi_comm_world, error) + if (error /= 0) call error_handler("IN mpi_gatherv of tracer", error) + + if (myrank == 0) then + dummy3dflip(:,:,1:lev_input) = dummy3dall(:,:,lev_input:1:-1) + where(dummy3dflip < 0.0) dummy3dflip = 0.0 + endif + + print*,"- CALL FieldScatter FOR INPUT GRID ", tracers_input(n) + call ESMF_FieldScatter(tracers_input_grid(n), dummy3dflip, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + enddo + +! dzdt set to zero for now. + + if (myrank == 0) then + dummy3dflip = 0.0 endif - do tile = 1, num_tiles_input_grid - print*,"- CALL FieldScatter FOR INPUT GRID V." - call ESMF_FieldScatter(v_input_grid, data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + print*,"- CALL FieldScatter FOR INPUT GRID DZDT" + call ESMF_FieldScatter(dzdt_input_grid, dummy3dflip, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) - enddo + + deallocate(dummy3dflip, dummy3dall, dummy3d) - if (localpet < num_tiles_input_grid) error = nf90_close(ncid) +! terrain - if (localpet < num_tiles_input_grid) then - tile = localpet+1 - tilefile= trim(data_dir_input_grid) // "/" // trim(atm_tracer_files_input_grid(tile)) - print*,"- READ ATMOSPHERIC TRACER FILE: ", trim(tilefile) - error=nf90_open(trim(tilefile),nf90_nowrite,ncid) - call netcdf_err(error, 'opening: '//trim(tilefile) ) + if (myrank==0) then + print*,"- READ TERRAIN." + error=nf90_inq_varid(ncid, 'hgtsfc', id_var) + call netcdf_err(error, 'reading hgtsfc field id' ) + error=nf90_get_var(ncid, id_var, dummy) + call netcdf_err(error, 'reading hgtsfc field' ) endif - do i = 1, num_tracers + print*,"- CALL FieldScatter FOR INPUT GRID TERRAIN." + call ESMF_FieldScatter(terrain_input_grid, dummy, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) - if (localpet < num_tiles_input_grid) then - error=nf90_inq_varid(ncid, tracers_input(i), id_var) - call netcdf_err(error, 'reading field id' ) - error=nf90_get_var(ncid, id_var, data_one_tile_3d) - call netcdf_err(error, 'reading field' ) - data_one_tile_3d(:,:,1:lev_input) = data_one_tile_3d(:,:,lev_input:1:-1) - endif +! surface pressure - do tile = 1, num_tiles_input_grid - print*,"- CALL FieldScatter FOR INPUT ", trim(tracers_input(i)) - call ESMF_FieldScatter(tracers_input_grid(i), data_one_tile_3d, rootpet=tile-1, tile=tile, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldScatter", rc) - enddo + if (myrank==0) then + print*,"- READ SURFACE P." + error=nf90_inq_varid(ncid, 'pressfc', id_var) + call netcdf_err(error, 'reading pressfc field id' ) + error=nf90_get_var(ncid, id_var, dummy) + call netcdf_err(error, 'reading pressfc field' ) + endif - enddo + print*,"- CALL FieldScatter FOR INPUT GRID SURFACE P." + call ESMF_FieldScatter(ps_input_grid, dummy, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) - if (localpet < num_tiles_input_grid) error=nf90_close(ncid) + deallocate(kcount, startk, displ, ircnt, dummy) !--------------------------------------------------------------------------- ! Convert from 2-d to 3-d cartesian winds. @@ -1733,31 +2044,9 @@ subroutine read_input_atm_restart_file(localpet) call convert_winds !--------------------------------------------------------------------------- -! Compute pressures +! Compute pressure. !--------------------------------------------------------------------------- - print*,"- CALL FieldCreate FOR INPUT GRID SURFACE PRESSURE." - ps_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - print*,"- CALL FieldGet FOR SURFACE PRESSURE." - call ESMF_FieldGet(ps_input_grid, & - farrayPtr=psptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldGet", rc) - - print*,"- CALL FieldCreate FOR INPUT GRID PRESSURE." - pres_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - print*,"- CALL FieldGet FOR PRESSURE." call ESMF_FieldGet(pres_input_grid, & computationalLBound=clb, & @@ -1772,40 +2061,55 @@ subroutine read_input_atm_restart_file(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) + print*,"- CALL FieldGet FOR SURFACE PRESSURE." + call ESMF_FieldGet(ps_input_grid, & + farrayPtr=psptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + allocate(pres_interface(levp1_input)) +!--------------------------------------------------------------------------- +! Compute 3-d pressure. +!--------------------------------------------------------------------------- + +!--------------------------------------------------------------------------- +! When ingesting gaussian netcdf files, the mid-layer +! surface pressure are computed top down from delta-p +! The surface pressure in the file is not used. According +! to Jun Wang, after the model's write component interpolates from the +! cubed-sphere grid to the gaussian grid, the surface pressure is +! no longer consistent with the delta p. +!--------------------------------------------------------------------------- + do i = clb(1), cub(1) do j = clb(2), cub(2) - pres_interface(levp1_input) = ak(1) ! model top in Pa - do k = (levp1_input-1), 1, -1 + pres_interface(levp1_input) = phalf(1) * 100.0_8 + do k = lev_input, 1, -1 pres_interface(k) = pres_interface(k+1) + dpresptr(i,j,k) enddo + psptr(i,j) = pres_interface(1) do k = 1, lev_input presptr(i,j,k) = (pres_interface(k) + pres_interface(k+1)) / 2.0_8 enddo - psptr(i,j) = pres_interface(1) enddo enddo - deallocate(ak) - deallocate(pres_interface) + deallocate(pres_interface, phalf) call ESMF_FieldDestroy(dpres_input_grid, rc=rc) - deallocate(data_one_tile_3d, data_one_tile) - - end subroutine read_input_atm_restart_file + end subroutine read_input_atm_gaussian_netcdf_file !--------------------------------------------------------------------------- -! Read input grid fv3 atmospheric history files. +! Read input grid fv3 atmospheric tiled history files in netcdf format. ! ! Routine reads tiled files in parallel. Tile 1 is read by ! localpet 0; tile 2 by localpet 1, etc. The number of pets ! must be equal to or greater than the number of tiled files. -! Logic only tested with global input data of six tiles. !--------------------------------------------------------------------------- - subroutine read_input_atm_history_file(localpet) + subroutine read_input_atm_tiled_history_file(localpet) implicit none @@ -1824,7 +2128,7 @@ subroutine read_input_atm_history_file(localpet) real(esmf_kind_r8), allocatable :: data_one_tile_3d(:,:,:) real(esmf_kind_r8), pointer :: presptr(:,:,:), dpresptr(:,:,:) real(esmf_kind_r8), pointer :: psptr(:,:) - real(esmf_kind_r8), allocatable :: pres_interface(:) + real(esmf_kind_r8), allocatable :: pres_interface(:), phalf(:) print*,"- READ INPUT ATMOS DATA FROM TILED HISTORY FILES." @@ -1855,6 +2159,11 @@ subroutine read_input_atm_history_file(localpet) call netcdf_err(error, 'reading phalf id' ) error=nf90_inquire_dimension(ncid,id_dim,len=levp1_input) call netcdf_err(error, 'reading phalf value' ) + allocate(phalf(levp1_input)) + error=nf90_inq_varid(ncid, 'phalf', id_var) + call netcdf_err(error, 'getting phalf varid' ) + error=nf90_get_var(ncid, id_var, phalf) + call netcdf_err(error, 'reading phalf varid' ) error=nf90_get_att(ncid, nf90_global, 'ncnsto', num_tracers_file) call netcdf_err(error, 'reading ntracer value' ) @@ -1864,29 +2173,11 @@ subroutine read_input_atm_history_file(localpet) print*,'- FILE HAS ', num_tracers_file, ' TRACERS.' print*,'- WILL PROCESS ', num_tracers, ' TRACERS.' - allocate(tracers_input_grid(num_tracers)) - - do i = 1, num_tracers - - print*,"- CALL FieldCreate FOR INPUT GRID TRACER ", trim(tracers_input(i)) - tracers_input_grid(i) = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - enddo +!--------------------------------------------------------------------------- +! Initialize esmf atmospheric fields. +!--------------------------------------------------------------------------- - print*,"- CALL FieldCreate FOR INPUT GRID DZDT." - dzdt_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) + call init_atm_esmf_fields print*,"- CALL FieldCreate FOR INPUT GRID DELTA PRESSURE." dpres_input_grid = ESMF_FieldCreate(input_grid, & @@ -1897,47 +2188,6 @@ subroutine read_input_atm_history_file(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) - print*,"- CALL FieldCreate FOR INPUT GRID TEMPERATURE." - temp_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - print*,"- CALL FieldCreate FOR INPUT GRID U." - u_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - print*,"- CALL FieldCreate FOR INPUT GRID V." - v_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - print*,"- CALL FieldCreate FOR INPUT GRID SURFACE PRESSURE." - ps_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - print*,"- CALL FieldCreate FOR INPUT GRID TERRAIN." - terrain_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - if (localpet < num_tiles_input_grid) then allocate(data_one_tile(i_input,j_input)) allocate(data_one_tile_3d(i_input,j_input,lev_input)) @@ -2102,15 +2352,6 @@ subroutine read_input_atm_history_file(localpet) ! Compute pressure. !--------------------------------------------------------------------------- - print*,"- CALL FieldCreate FOR INPUT GRID PRESSURE." - pres_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - print*,"- CALL FieldGet FOR PRESSURE." call ESMF_FieldGet(pres_input_grid, & computationalLBound=clb, & @@ -2133,9 +2374,9 @@ subroutine read_input_atm_history_file(localpet) allocate(pres_interface(levp1_input)) - if (localpet == 0) then - print*,'dpres is ',dpresptr(1,1,:) - endif +!--------------------------------------------------------------------------- +! Compute 3-d pressure. +!--------------------------------------------------------------------------- do i = clb(1), cub(1) do j = clb(2), cub(2) @@ -2149,18 +2390,14 @@ subroutine read_input_atm_history_file(localpet) enddo enddo - if (localpet == 0) then - print*,'pres is ',presptr(1,1,:) - endif - - deallocate(pres_interface) + deallocate(pres_interface, phalf) call ESMF_FieldDestroy(dpres_input_grid, rc=rc) - end subroutine read_input_atm_history_file + end subroutine read_input_atm_tiled_history_file !--------------------------------------------------------------------------- -! Read input grid atmospheric grib2 files. +! Read input grid atmospheric fv3gfs grib2 files. !--------------------------------------------------------------------------- subroutine read_input_atm_grib2_file(localpet) @@ -2321,69 +2558,11 @@ subroutine read_input_atm_grib2_file(localpet) if (localpet==0) print*, "- NUMBER OF TRACERS IN FILE = ", num_tracers - if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID SURFACE PRESSURE." - ps_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID TEMPERATURE." - temp_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - allocate(tracers_input_grid(num_tracers)) - - do i = 1,num_tracers - if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID TRACER ", trim(tracers_input(i)) - - tracers_input_grid(i) = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - enddo - - if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID U." - u_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID V." - v_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - - if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID DZDT." - dzdt_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) +!--------------------------------------------------------------------------- +! Initialize esmf atmospheric fields. +!--------------------------------------------------------------------------- - if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID TERRAIN." - terrain_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) + call init_atm_esmf_fields if (localpet == 0) then allocate(dummy2d(i_input,j_input)) @@ -2576,13 +2755,6 @@ subroutine read_input_atm_grib2_file(localpet) call ESMF_FieldScatter(terrain_input_grid, dummy2d_8, rootpet=0, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) - - if (localpet == 0) print*,"- CALL FieldCreate FOR INPUT GRID PRESSURE." - pres_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1/), & - ungriddedUBound=(/lev_input/), rc=rc) deallocate(dummy2d, dummy3d, dummy2d_8) @@ -2947,7 +3119,7 @@ end subroutine read_input_sfc_gfs_sfcio_file ! Format used by gfs starting July 19, 2017. !--------------------------------------------------------------------------- - subroutine read_input_sfc_gfs_gaussian_file(localpet) + subroutine read_input_sfc_gfs_gaussian_nemsio_file(localpet) implicit none @@ -3290,13 +3462,13 @@ subroutine read_input_sfc_gfs_gaussian_file(localpet) if (localpet == 0) call nemsio_close(gfile) - end subroutine read_input_sfc_gfs_gaussian_file + end subroutine read_input_sfc_gfs_gaussian_nemsio_file !--------------------------------------------------------------------------- -! Read input grid surface data from an fv3 gaussian history file. +! Read input grid surface data from an fv3 gaussian nemsio file. !--------------------------------------------------------------------------- - subroutine read_input_sfc_gaussian_file(localpet) + subroutine read_input_sfc_gaussian_nemsio_file(localpet) implicit none @@ -3639,10 +3811,10 @@ subroutine read_input_sfc_gaussian_file(localpet) if (localpet == 0) call nemsio_close(gfile) - end subroutine read_input_sfc_gaussian_file + end subroutine read_input_sfc_gaussian_nemsio_file !--------------------------------------------------------------------------- -! Read input grid surface data tiled 'restart' files. +! Read input grid surface data tiled warm 'restart' files. !--------------------------------------------------------------------------- subroutine read_input_sfc_restart_file(localpet) @@ -3958,10 +4130,11 @@ subroutine read_input_sfc_restart_file(localpet) end subroutine read_input_sfc_restart_file !--------------------------------------------------------------------------- -! Read input grid surface tiled 'history' files. +! Read input grid surface data from tiled 'history' files (netcdf) or +! gaussian netcdf files. !--------------------------------------------------------------------------- - subroutine read_input_sfc_history_file(localpet) + subroutine read_input_sfc_netcdf_file(localpet) implicit none @@ -4012,6 +4185,14 @@ subroutine read_input_sfc_history_file(localpet) TERRAIN_LOOP: do tile = 1, num_tiles_input_grid + if (trim(input_type) == "gaussian_netcdf") then + if (localpet == 0) then + call read_fv3_grid_data_netcdf('orog', tile, idim_input, jdim_input, & + lsoil_input, sfcdata=data_one_tile) + endif + + else + if (localpet == 0) then tilefile = trim(orog_dir_input_grid) // trim(orog_files_input_grid(tile)) print*,'- OPEN OROGRAPHY FILE: ', trim(tilefile) @@ -4025,6 +4206,8 @@ subroutine read_input_sfc_history_file(localpet) error=nf90_close(ncid) endif + endif + print*,"- CALL FieldScatter FOR INPUT TERRAIN." call ESMF_FieldScatter(terrain_input_grid, data_one_tile, rootpet=0, tile=tile, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -4306,7 +4489,11 @@ subroutine read_input_sfc_history_file(localpet) deallocate(data_one_tile, data_one_tile_3d) - end subroutine read_input_sfc_history_file + end subroutine read_input_sfc_netcdf_file + +!--------------------------------------------------------------------------- +! Read surface data from an fv3gfs grib2 file. +!--------------------------------------------------------------------------- subroutine read_input_sfc_grib2_file(localpet) @@ -4829,10 +5016,11 @@ subroutine read_input_sfc_grib2_file(localpet) end subroutine read_input_sfc_grib2_file !--------------------------------------------------------------------------- -! Read nst data from tiled history or restart files. +! Read nst data from these netcdf formatted fv3 files: tiled history, +! tiled warm restart, and gaussian history. !--------------------------------------------------------------------------- - subroutine read_input_nst_tile_file(localpet) + subroutine read_input_nst_netcdf_file(localpet) implicit none @@ -5105,7 +5293,7 @@ subroutine read_input_nst_tile_file(localpet) deallocate(data_one_tile) - end subroutine read_input_nst_tile_file + end subroutine read_input_nst_netcdf_file !-------------------------------------------------------------------------- ! Read input grid nst data from fv3 gaussian nemsio history file or @@ -5114,7 +5302,7 @@ end subroutine read_input_nst_tile_file ! single file. !-------------------------------------------------------------------------- - subroutine read_input_nst_gaussian_file(localpet) + subroutine read_input_nst_nemsio_file(localpet) implicit none @@ -5129,8 +5317,8 @@ subroutine read_input_nst_gaussian_file(localpet) type(nemsio_gfile) :: gfile - if (trim(input_type) == "gfs_gaussian") then ! spectral gfs nemsio in - ! separate file. + if (trim(input_type) == "gfs_gaussian_nemsio") then ! spectral gfs nemsio in + ! separate file. the_file = trim(data_dir_input_grid) // "/" // trim(nst_files_input_grid) else the_file = trim(data_dir_input_grid) // "/" // trim(sfc_files_input_grid(1)) @@ -5377,7 +5565,7 @@ subroutine read_input_nst_gaussian_file(localpet) if (localpet == 0) call nemsio_close(gfile) - end subroutine read_input_nst_gaussian_file + end subroutine read_input_nst_nemsio_file SUBROUTINE READ_FV3_GRID_DATA_NETCDF(FIELD,TILE_NUM,IMO,JMO,LMO, & SFCDATA, SFCDATA_3D) @@ -5435,15 +5623,6 @@ subroutine convert_winds real(esmf_kind_r8), pointer :: latptr(:,:) real(esmf_kind_r8), pointer :: lonptr(:,:) - print*,"- CALL FieldCreate FOR INPUT GRID 3-D WIND." - wind_input_grid = ESMF_FieldCreate(input_grid, & - typekind=ESMF_TYPEKIND_R8, & - staggerloc=ESMF_STAGGERLOC_CENTER, & - ungriddedLBound=(/1,1/), & - ungriddedUBound=(/lev_input,3/), rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & - call error_handler("IN FieldCreate", rc) - print*,"- CALL FieldGet FOR 3-D WIND." call ESMF_FieldGet(wind_input_grid, & computationalLBound=clb, & diff --git a/sorc/chgres_cube.fd/model_grid.F90 b/sorc/chgres_cube.fd/model_grid.F90 index 8ee22c231..9beb96c3b 100644 --- a/sorc/chgres_cube.fd/model_grid.F90 +++ b/sorc/chgres_cube.fd/model_grid.F90 @@ -115,9 +115,10 @@ subroutine define_input_grid(localpet, npets) integer, intent(in) :: localpet, npets - if (trim(input_type) == "gaussian" .or. & - trim(input_type) == "gfs_gaussian" .or. & - trim(input_type) == "gfs_spectral") then + if (trim(input_type) == "gaussian_nemsio" .or. & + trim(input_type) == "gfs_gaussian_nemsio" .or. & + trim(input_type) == "gfs_sigio" .or. & + trim(input_type) == "gaussian_netcdf") then call define_input_grid_gaussian(localpet, npets) elseif (trim(input_type) == "grib2") then call define_input_grid_gfs_grib2(localpet,npets) @@ -149,6 +150,7 @@ subroutine define_input_grid_gaussian(localpet, npets) use sfcio_module use sigio_module + use netcdf implicit none @@ -156,7 +158,7 @@ subroutine define_input_grid_gaussian(localpet, npets) character(len=250) :: the_file - integer :: i, j, rc, clb(2), cub(2) + integer :: i, j, rc, clb(2), cub(2), ncid, id_grid integer(sfcio_intkind) :: rc2 integer(sigio_intkind) :: rc3 @@ -184,7 +186,7 @@ subroutine define_input_grid_gaussian(localpet, npets) the_file=trim(data_dir_input_grid) // "/" // trim(atm_files_input_grid(1)) endif - if (trim(input_type) == "gfs_spectral") then ! sigio/sfcio format, used by + if (trim(input_type) == "gfs_sigio") then ! sigio/sfcio format, used by ! spectral gfs prior to 7/19/2017. if (convert_sfc) then ! sfcio format @@ -207,6 +209,26 @@ subroutine define_input_grid_gaussian(localpet, npets) j_input = sighead%latb endif + elseif (trim(input_type) == "gaussian_netcdf") then + + print*,'- OPEN AND READ: ',trim(the_file) + rc=nf90_open(trim(the_file),nf90_nowrite,ncid) + call netcdf_err(rc, 'opening file') + + print*,"- READ grid_xt" + rc=nf90_inq_dimid(ncid, 'grid_xt', id_grid) + call netcdf_err(rc, 'reading grid_xt id') + rc=nf90_inquire_dimension(ncid,id_grid,len=i_input) + call netcdf_err(rc, 'reading grid_xt') + + print*,"- READ grid_yt" + rc=nf90_inq_dimid(ncid, 'grid_yt', id_grid) + call netcdf_err(rc, 'reading grid_yt id') + rc=nf90_inquire_dimension(ncid,id_grid,len=j_input) + call netcdf_err(rc, 'reading grid_yt') + + rc = nf90_close(ncid) + else ! nemsio format call nemsio_init(iret=rc) diff --git a/sorc/chgres_cube.fd/program_setup.f90 b/sorc/chgres_cube.fd/program_setup.f90 index f81d20d11..fb38e362d 100644 --- a/sorc/chgres_cube.fd/program_setup.f90 +++ b/sorc/chgres_cube.fd/program_setup.f90 @@ -12,12 +12,15 @@ module program_setup ! ! Public variables: ! ----------------- -! atm_file_input_grid File names of input atmospheric data. -! History or gaussian input type only. +! atm_files_input_grid File names of input atmospheric data. +! Not used for "grib2" or "restart" +! input types. ! atm_core_files_input_grid File names of input atmospheric restart -! core files. +! core files. Only used for 'restart' +! input type. ! atm_tracer_files_input_grid File names of input atmospheric restart -! tracer files. +! tracer files. Only used for 'restart' +! input type. ! atm_weight_file File containing pre-computed weights ! to horizontally interpolate ! atmospheric fields. @@ -33,6 +36,10 @@ module program_setup ! target grids. ! fix_dir_target_grid Directory containing target grid ! pre-computed fixed data (ex: soil type) +! grib2_file_input_grid File name of grib2 input data. +! Assumes atmospheric and surface data +! are in a single file. 'grib2' input +! type only. ! halo_blend Number of row/cols of blending halo, ! where model tendencies and lateral ! boundary tendencies are applied. @@ -40,30 +47,36 @@ module program_setup ! halo_bndy Number of row/cols of lateral halo, ! where pure lateral bndy conditions are ! applied (regional target grids). -! input_type Input data type: "restart" for fv3 -! tiled restart files; "history" for fv3 -! tiled history files; "gaussian" -! for fv3 gaussian nemsio files; -! "gfs_gaussian" for spectral gfs gaussian -! nemsio files. +! input_type Input data type: +! (1) "restart" for fv3 tiled warm restart +! files (netcdf). +! (2) "history" for fv3 tiled history files +! (netcdf). +! (3) "gaussian_nemsio" for fv3 gaussian +! nemsio files; +! (4) "gaussian_netcdf" for fv3 gaussian +! netcdf files. +! (5) "grib2" for fv3gfs grib2 files. +! (6) "gfs_gaussian_nemsio" for spectral gfs +! gaussian nemsio files +! (7) "gfs_sigio" for spectral gfs +! gfs sigio/sfcio files. ! max_tracers Maximum number of atmospheric tracers ! processed ! maxsmc_input/target Maximum soil moisture content input/ ! target grids -! mosaic_file_input_grid Input grid mosaic file. Not used -! with "gaussian" or "gfs_gaussian" -! input type. +! mosaic_file_input_grid Input grid mosaic file. Only used for +! "restart" or "history" input type. ! mosaic_file_target_grid Target grid mosaic file ! nst_files_input_grid File name of input nst data. Only -! used for input_type "gfs_gaussian". +! used for input_type "gfs_gaussian_nemsio". ! num_tracers Number of atmospheric tracers to ! be processed. ! orog_dir_input_grid Directory containing the input grid -! orography files. Not used for "gaussian" -! or "gfs_gaussian" input types. -! orog_files_input_grid Input grid orography files. Not used -! for "gaussian" or "gfs_gaussian" -! input types. +! orography files. Only used for "restart" +! or "history" input types. +! orog_files_input_grid Input grid orography files. Only used for +! "restart" or "history" input types. ! orog_dir_target_grid Directory containing the target grid ! orography files. ! orog_files_target_grid Target grid orography files. @@ -78,6 +91,7 @@ module program_setup ! Default is '0' (global grids). ! satpsi_target Saturated soil potential, target grid ! sfc_files_input_grid File names containing input surface data. +! Not used for 'grib2' input type. ! tracers Name of each atmos tracer to be processed. ! These names will be used to identify ! the tracer records in the output files. @@ -113,7 +127,7 @@ module program_setup character(len=500), public :: vcoord_file_target_grid = "NULL" character(len=6), public :: cres_target_grid = "NULL" character(len=500), public :: atm_weight_file="NULL" - character(len=20), public :: input_type="restart" + character(len=25), public :: input_type="restart" character(len=20), public :: phys_suite="GFS" !Default to gfs physics suite integer, parameter, public :: max_tracers=100 @@ -259,28 +273,20 @@ subroutine read_setup_namelist print*,'- INPUT DATA FROM FV3 TILED RESTART FILES.' case ("history") print*,'- INPUT DATA FROM FV3 TILED HISTORY FILES.' - case ("gaussian") + case ("gaussian_nemsio") print*,'- INPUT DATA FROM FV3 GAUSSIAN NEMSIO FILE.' - case ("gfs_gaussian") + case ("gfs_gaussian_nemsio") print*,'- INPUT DATA FROM SPECTRAL GFS GAUSSIAN NEMSIO FILE.' - case ("gfs_spectral") + case ("gfs_sigio") print*,'- INPUT DATA FROM SPECTRAL GFS SIGIO/SFCIO FILE.' + case ("gaussian_netcdf") + print*,'- INPUT DATA FROM FV3 GAUSSIAN NETCDF FILE.' case ("grib2") print*,'- INPUT DATA FROM A GRIB2 FILE' case default call error_handler("UNRECOGNIZED INPUT DATA TYPE.", 1) end select -!------------------------------------------------------------------------- -! Ensure proper file variable provided for grib2 input -!------------------------------------------------------------------------- - - if (trim(input_type) == "grib2") then - if (trim(grib2_file_input_grid) == "NULL" .or. trim(grib2_file_input_grid) == "") then - call error_handler("FOR GRIB2 DATA, PLEASE PROVIDE GRIB2_FILE_INPUT_GRID", 1) - endif - endif - end subroutine read_setup_namelist subroutine read_varmap @@ -445,7 +451,7 @@ subroutine calc_soil_params_driver(localpet) !------------------------------------------------------------------------- select case (trim(input_type)) - case ("gfs_spectral") + case ("gfs_sigio") print*,'- INPUT GRID USED ZOBLER SOIL TYPES.' num_soil_cats = num_zobler case default @@ -464,7 +470,7 @@ subroutine calc_soil_params_driver(localpet) allocate(f11(num_soil_cats)) select case (trim(input_type)) - case ("gfs_spectral") + case ("gfs_sigio") smlow = smlow_zobler smhigh = smhigh_zobler maxsmc_input = maxsmc_zobler diff --git a/sorc/chgres_cube.fd/write_data.F90 b/sorc/chgres_cube.fd/write_data.F90 index f14c5c912..a5bd97552 100644 --- a/sorc/chgres_cube.fd/write_data.F90 +++ b/sorc/chgres_cube.fd/write_data.F90 @@ -471,16 +471,20 @@ subroutine write_fv3_atm_bndy_data_netcdf(localpet) call netcdf_err(error, 'DEFINING V_S_LEFT') !--- define global attributes - if (trim(input_type) == "gaussian") then + if (trim(input_type) == "gaussian_nemsio") then error = nf90_put_att(ncid, nf90_global, 'source', 'FV3GFS GAUSSIAN NEMSIO FILE') - elseif (trim(input_type) == "gfs_gaussian") then + elseif (trim(input_type) == "gfs_gaussian_nemsio") then error = nf90_put_att(ncid, nf90_global, 'source', 'SPECTRAL GFS GAUSSIAN NEMSIO FILE') - elseif (trim(input_type) == "gfs_spectral") then + elseif (trim(input_type) == "gfs_sigio") then error = nf90_put_att(ncid, nf90_global, 'source', 'SPECTRAL GFS SIGIO FILE') elseif (trim(input_type) == "history") then error = nf90_put_att(ncid, nf90_global, 'source', 'FV3GFS TILED HISTORY FILE') elseif (trim(input_type) == "restart") then error = nf90_put_att(ncid, nf90_global, 'source', 'FV3GFS TILED RESTART FILE') + elseif (trim(input_type) == "gaussian_netcdf") then + error = nf90_put_att(ncid, nf90_global, 'source', 'FV3GFS GAUSSIAN NETCDF FILE') + elseif (trim(input_type) == "grib2") then + error = nf90_put_att(ncid, nf90_global, 'source', 'FV3GFS GRIB2 FILE') endif error = nf90_enddef(ncid, header_buffer_val,4,0,4) @@ -1188,16 +1192,20 @@ subroutine write_fv3_atm_data_netcdf(localpet) call netcdf_err(error, 'DEFINING NTRACER DIMENSION' ) !--- define global attributes - if (trim(input_type) == "gaussian") then + if (trim(input_type) == "gaussian_nemsio") then error = nf90_put_att(ncid, nf90_global, 'source', 'FV3GFS GAUSSIAN NEMSIO FILE') - elseif (trim(input_type) == "gfs_gaussian") then + elseif (trim(input_type) == "gaussian_netcdf") then + error = nf90_put_att(ncid, nf90_global, 'source', 'FV3GFS GAUSSIAN NETCDF FILE') + elseif (trim(input_type) == "gfs_gaussian_nemsio") then error = nf90_put_att(ncid, nf90_global, 'source', 'SPECTRAL GFS GAUSSIAN NEMSIO FILE') - elseif (trim(input_type) == "gfs_spectral") then + elseif (trim(input_type) == "gfs_sigio") then error = nf90_put_att(ncid, nf90_global, 'source', 'SPECTRAL GFS SIGIO FILE') elseif (trim(input_type) == "history") then error = nf90_put_att(ncid, nf90_global, 'source', 'FV3GFS TILED HISTORY FILE') elseif (trim(input_type) == "restart") then error = nf90_put_att(ncid, nf90_global, 'source', 'FV3GFS TILED RESTART FILE') + elseif (trim(input_type) == "grib2") then + error = nf90_put_att(ncid, nf90_global, 'source', 'FV3GFS GRIB2 FILE') endif !--- define field diff --git a/ush/chgres_cube.sh b/ush/chgres_cube.sh index dec2797c9..b29f785c4 100755 --- a/ush/chgres_cube.sh +++ b/ush/chgres_cube.sh @@ -62,11 +62,14 @@ HALO_BNDY=${HALO_BNDY:-0} HALO_BLEND=${HALO_BLEND:-0} #---------------------------------------------------------------------------- -# INPUT_TYPE - Input data type. 'history' for tiled fv3 history files. -# 'restart' for tiled fv3 warm restart files. 'gfs_gaussian' -# for spectral gfs nemsio files. 'gfs_spectral' for -# for spectral gfs sigio/sfcio files. 'gaussian' for fv3 -# gaussian nemsio files. 'grib2' for gfs grib2 files. +# INPUT_TYPE - Input data type: +# 'restart' for tiled fv3 warm restart files. +# 'history' for tiled fv3 history files. +# 'gaussian_nemsio' for fv3 gaussian nemsio files. +# 'gaussian_netcdf' for fv3 gaussian netcdf files. +# 'grib2' for fv3gfs grib2 files. +# 'gfs_gaussain_nemsio' for spectral gfs nemsio files. +# 'gfs_sigio' for spectral gfs sigio/sfcio files. # # MOSAIC_FILE_INPUT_GRID - Path/Name of mosaic file for input grid. Only # used for 'history' and 'restart' INPUT_TYPE. @@ -81,7 +84,7 @@ HALO_BLEND=${HALO_BLEND:-0} # Set to NULL otherwise. #---------------------------------------------------------------------------- -INPUT_TYPE=${INPUT_TYPE:-"gaussian"} +INPUT_TYPE=${INPUT_TYPE:-"gaussian_nemsio"} MOSAIC_FILE_INPUT_GRID=${MOSAIC_FILE_INPUT_GRID:-NULL} OROG_DIR_INPUT_GRID=${OROG_DIR_INPUT_GRID:-NULL} OROG_FILES_INPUT_GRID=${OROG_FILES_INPUT_GRID:-NULL} @@ -101,7 +104,7 @@ COMIN=${COMIN:-$PWD} #---------------------------------------------------------------------------- # ATM_FILES_INPUT - Input atmospheric data file(s). Not used for 'restart' -# and 'grib2' INPUT_TYPE. +# or 'grib2' INPUT_TYPE. # # ATM_CORE_FILES - Input atmospheric core files. Used for 'restart' # INPUT_TYPE only. The first six entries are the tiled @@ -114,7 +117,7 @@ COMIN=${COMIN:-$PWD} # SFC_FILES_INPUT - Input surface data file(s). Not used for 'grib2' # INPUT_TYPE. # -# NST_FILES_INPUT - Input nst data file. 'gfs_gaussian' INPUT_TYPE only. +# NST_FILES_INPUT - Input nst data file. 'gfs_gaussian_nemsio' INPUT_TYPE only. # # GRIB2_FILE_INPUT - Input gfs grib2 data file. Only used for 'grib2' # INPUT_TYPE. @@ -167,7 +170,7 @@ fi #---------------------------------------------------------------------------- # APRUN - machine specific command to run program. # CHGRESEXEC - program executable. -# OMP_NUM_THREADS - threads most useful for 'gfs_spectral' INPUT_TYPE. +# OMP_NUM_THREADS - threads most useful for 'gfs_sigio' INPUT_TYPE. # DATA - working directory. # PGMOUT - standard output file # PGMERR - standard error file @@ -178,7 +181,7 @@ fi APRUN=${APRUN:-time} CHGRESEXEC=${CHGRESEXEC:-${EXECufs}/chgres_cube.exe} -export OMP_NUM_THREADS=${OMP_NUM_THREADS_CY:-1} +export OMP_NUM_THREADS=${OMP_NUM_THREADS_CH:-1} PGMOUT=${PGMOUT:-${pgmout:-'&1'}} PGMERR=${PGMERR:-${pgmerr:-'&2'}} diff --git a/util/gdas_init/run_pre-v14.chgres.sh b/util/gdas_init/run_pre-v14.chgres.sh index 95e5276f0..0598bd75b 100755 --- a/util/gdas_init/run_pre-v14.chgres.sh +++ b/util/gdas_init/run_pre-v14.chgres.sh @@ -64,7 +64,7 @@ cat << EOF > fort.41 convert_atm=.true. convert_sfc=.true. convert_nst=.false. - input_type="gfs_spectral" + input_type="gfs_sigio" tracers_input="spfh","o3mr","clwmr" tracers="sphum","o3mr","liq_wat" / diff --git a/util/gdas_init/run_v14.chgres.sh b/util/gdas_init/run_v14.chgres.sh index 9cd611648..301657385 100755 --- a/util/gdas_init/run_v14.chgres.sh +++ b/util/gdas_init/run_v14.chgres.sh @@ -66,7 +66,7 @@ cat << EOF > fort.41 convert_atm=.true. convert_sfc=.true. convert_nst=.true. - input_type="gfs_gaussian" + input_type="gfs_gaussian_nemsio" tracers="sphum","liq_wat","o3mr" tracers_input="spfh","clwmr","o3mr" / From 270f9dcf72b5e6e1197e0089784067a78e4643df Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Fri, 1 May 2020 15:13:11 -0400 Subject: [PATCH 020/192] Regression tests for global_cycle, emcsfc and grid programs. New regression tests for global_cycle, emcsfc_ice_blend, emcsfc_snow2mdl and all programs associated with the grid generation. --- reg_tests/global_cycle/C768.fv3gfs.sh | 82 +++++++++++++++++++++++++++ reg_tests/global_cycle/driver.cray.sh | 61 ++++++++++++++++++++ reg_tests/global_cycle/driver.dell.sh | 69 ++++++++++++++++++++++ reg_tests/global_cycle/driver.hera.sh | 66 +++++++++++++++++++++ reg_tests/global_cycle/driver.jet.sh | 66 +++++++++++++++++++++ reg_tests/grid_gen/c96.regional.sh | 69 ++++++++++++++++++++++ reg_tests/grid_gen/c96.uniform.sh | 60 ++++++++++++++++++++ reg_tests/grid_gen/driver.cray.sh | 73 ++++++++++++++++++++++++ reg_tests/grid_gen/driver.dell.sh | 76 +++++++++++++++++++++++++ reg_tests/grid_gen/driver.hera.sh | 81 ++++++++++++++++++++++++++ reg_tests/grid_gen/driver.jet.sh | 82 +++++++++++++++++++++++++++ reg_tests/ice_blend/driver.cray.sh | 53 +++++++++++++++++ reg_tests/ice_blend/driver.dell.sh | 50 ++++++++++++++++ reg_tests/ice_blend/driver.hera.sh | 53 +++++++++++++++++ reg_tests/ice_blend/driver.jet.sh | 52 +++++++++++++++++ reg_tests/ice_blend/ice_blend.sh | 43 ++++++++++++++ reg_tests/snow2mdl/driver.cray.sh | 49 ++++++++++++++++ reg_tests/snow2mdl/driver.dell.sh | 46 +++++++++++++++ reg_tests/snow2mdl/driver.hera.sh | 49 ++++++++++++++++ reg_tests/snow2mdl/driver.jet.sh | 50 ++++++++++++++++ reg_tests/snow2mdl/snow2mdl.sh | 55 ++++++++++++++++++ 21 files changed, 1285 insertions(+) create mode 100755 reg_tests/global_cycle/C768.fv3gfs.sh create mode 100755 reg_tests/global_cycle/driver.cray.sh create mode 100755 reg_tests/global_cycle/driver.dell.sh create mode 100755 reg_tests/global_cycle/driver.hera.sh create mode 100755 reg_tests/global_cycle/driver.jet.sh create mode 100755 reg_tests/grid_gen/c96.regional.sh create mode 100755 reg_tests/grid_gen/c96.uniform.sh create mode 100755 reg_tests/grid_gen/driver.cray.sh create mode 100755 reg_tests/grid_gen/driver.dell.sh create mode 100755 reg_tests/grid_gen/driver.hera.sh create mode 100755 reg_tests/grid_gen/driver.jet.sh create mode 100755 reg_tests/ice_blend/driver.cray.sh create mode 100755 reg_tests/ice_blend/driver.dell.sh create mode 100755 reg_tests/ice_blend/driver.hera.sh create mode 100755 reg_tests/ice_blend/driver.jet.sh create mode 100755 reg_tests/ice_blend/ice_blend.sh create mode 100755 reg_tests/snow2mdl/driver.cray.sh create mode 100755 reg_tests/snow2mdl/driver.dell.sh create mode 100755 reg_tests/snow2mdl/driver.hera.sh create mode 100755 reg_tests/snow2mdl/driver.jet.sh create mode 100755 reg_tests/snow2mdl/snow2mdl.sh diff --git a/reg_tests/global_cycle/C768.fv3gfs.sh b/reg_tests/global_cycle/C768.fv3gfs.sh new file mode 100755 index 000000000..20909b6f3 --- /dev/null +++ b/reg_tests/global_cycle/C768.fv3gfs.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +#------------------------------------------------------------------ +# Run global_cycle for a C768 test case. Compare output +# to a baseline set of files using the 'nccmp' utility. +#------------------------------------------------------------------ + +set -x + +export MAX_TASKS_CY=6 + +export HOMEgfs=$NWPROD +export BASE_GSM=$NWPROD + +export CYCLEXEC=$BASE_GSM/exec/global_cycle + +export CDATE=2019073000 +export FHOUR=00 +export DELTSFC=6 + +export CASE=C768 + +export COMIN=$HOMEreg/input_data +export FNTSFA=$COMIN/gdas.t00z.rtgssthr.grb +export FNSNOA=$COMIN/gdas.t00z.snogrb_t1534.3072.1536 +export FNACNA=$COMIN/gdas.t00z.seaice.5min.blend.grb +export GSI_FILE=$COMIN/gdas.t00z.dtfanl.nc + +export JCAP=1534 +export LONB=3072 +export LATB=1536 + +export FIXgsm=$BASE_GSM/fix/fix_am + +export DONST="YES" +export use_ufo=.true. + +export VERBOSE=YES +export CYCLVARS=FSNOL=-2.,FSNOS=99999., + + +$BASE_GSM/ush/global_cycle_driver.sh + +iret=$? +if [ $iret -ne 0 ]; then + set +x + echo "<<< GLOBAL CYCLE TEST FAILED. <<<" + echo "<<< GLOBAL CYCLE TEST FAILED. <<<" > ./summary.log + exit $iret +fi + +test_failed=0 + +cd $DATA +for files in *tile*.nc +do + if [ -f $files ]; then + echo CHECK $files + $NCCMP -dmfqS $files $HOMEreg/baseline_data/$files + iret=$? + if [ $iret -ne 0 ]; then + test_failed=1 + fi + fi +done + +set +x +if [ $test_failed -ne 0 ]; then + echo + echo "*********************************" + echo "<<< GLOBAL CYCLE TEST FAILED. >>>" + echo "*********************************" + echo "<<< GLOBAL CYCLE TEST FAILED. >>>" > ./summary.log +else + echo + echo "*********************************" + echo "<<< GLOBAL CYCLE TEST PASSED. >>>" + echo "*********************************" + echo "<<< GLOBAL CYCLE TEST PASSED. >>>" > ./summary.log +fi + +exit diff --git a/reg_tests/global_cycle/driver.cray.sh b/reg_tests/global_cycle/driver.cray.sh new file mode 100755 index 000000000..438d9670a --- /dev/null +++ b/reg_tests/global_cycle/driver.cray.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run global_cycle regression test on WCOSS-Cray. +# +# Set $DATA to your working directory. Set the project code (BSUB -P) +# and queue (BSUB -q) as appropriate. +# +# Invoke the script as follows: cat $script | bsub +# +# Log output is placed in regression.log. A summary is +# placed in summary.log +# +# The test fails when its output does not match the baseline files +# as determined by the 'nccmp' utility. This baseline files are +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#BSUB -oo regression.log +#BSUB -eo regression.log +#BSUB -q debug +#BSUB -P GDAS-T2O +#BSUB -J cycle_regt +#BSUB -M 2400 +#BSUB -W 00:05 +#BSUB -extsched 'CRAYLINUX[]' + +module load PrgEnv-intel cfp-intel-sandybridge/1.1.0 +module list + +export DATA=/gpfs/hps3/stmp/$LOGNAME/reg_tests.cycle + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +export NODES=1 + +export HOMEreg=/gpfs/hps3/emc/global/noscrub/George.Gayno/ufs_utils.git/reg_tests/global_cycle + +export OMP_NUM_THREADS_CY=4 + +export KMP_AFFINITY=disabled + +export APRUNCY="aprun -n 6 -N 6 -j 1 -d $OMP_NUM_THREADS_CY -cc depth" + +export NWPROD=$PWD/../.. + +export COMOUT=$DATA + +export NCCMP=/gpfs/hps3/emc/global/noscrub/George.Gayno/util/netcdf/nccmp + +reg_dir=$PWD + +./C768.fv3gfs.sh + +cp $DATA/summary.log $reg_dir + +exit diff --git a/reg_tests/global_cycle/driver.dell.sh b/reg_tests/global_cycle/driver.dell.sh new file mode 100755 index 000000000..5264d0012 --- /dev/null +++ b/reg_tests/global_cycle/driver.dell.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run global_cycle regression test on WCOSS-Dell. +# +# Set $DATA to your working directory. Set the project code (BSUB -P) +# and queue (BSUB -q) as appropriate. +# +# Invoke the script as follows: cat $script | bsub +# +# Log output is placed in regression.log. A summary is +# placed in summary.log +# +# The test fails when its output does not match the baseline files +# as determined by the 'nccmp' utility. This baseline files are +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#BSUB -W 00:05 +#BSUB -n 6 +#BSUB -R span[ptile=6] +#BSUB -x +#BSUB -o regression.log +#BSUB -e regression.log +#BSUB -R "affinity[core(1)]" +#BSUB -M 2400 +#BSUB -J glc_regt +#BSUB -q debug +#BSUB -P GFS-DEV + +set -x + +module purge +module load EnvVars/1.0.2 +module load ips/18.0.1.163 +module load lsf/10.1 +module load impi/18.0.1 +module use /usrx/local/nceplibs/dev/NCEPLIBS/modulefiles +module load netcdf_parallel/4.7.4 + +set -x + +export DATA=/gpfs/dell1/stmp/$LOGNAME/reg_tests.cycle + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +export HOMEreg=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/ufs_utils.git/reg_tests/global_cycle + +export OMP_NUM_THREADS_CY=2 + +export APRUNCY="mpirun -l" + +export NWPROD=$PWD/../.. + +export COMOUT=$DATA + +export NCCMP=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/util/nccmp/nccmp-nc4.7.4/src/nccmp + +reg_dir=$PWD + +./C768.fv3gfs.sh + +cp $DATA/summary.log $reg_dir + +exit diff --git a/reg_tests/global_cycle/driver.hera.sh b/reg_tests/global_cycle/driver.hera.sh new file mode 100755 index 000000000..4a7196e6b --- /dev/null +++ b/reg_tests/global_cycle/driver.hera.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run global_cycle regression test on Hera. +# +# Set $DATA to your working directory. Set the project code (SBATCH -A) +# and queue (SBATCH -q) as appropriate. +# +# Invoke the script as follows: sbatch $script +# +# Log output is placed in regression.log. A summary is +# placed in summary.log +# +# The test fails when its output does not match the baseline files +# as determined by the 'nccmp' utility. This baseline files are +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#SBATCH -J cycle_reg_test +#SBATCH -A fv3-cpu +#SBATCH --open-mode=truncate +#SBATCH -o regression.log +#SBATCH -e regression.log +#SBATCH --nodes=1 --ntasks-per-node=6 +#SBATCH -q debug +#SBATCH -t 00:05:00 + +set -x + +. /apps/lmod/lmod/init/sh +module purge +module load intel/18.0.5.274 +module load impi/2018.0.4 +module load szip/2.1 +module load hdf5/1.10.5 +module use /scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles +module load netcdf_parallel/4.7.4 +module list + +export DATA=/scratch2/NCEPDEV/stmp1/$LOGNAME/reg_tests.cycle + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +export HOMEreg=/scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/global_cycle + +export OMP_NUM_THREADS_CY=2 + +export APRUNCY="srun" + +export NWPROD=$PWD/../.. + +export COMOUT=$DATA + +export NCCMP=/apps/nccmp/1.8.5/intel/18.0.3.051/bin/nccmp + +reg_dir=$PWD + +./C768.fv3gfs.sh + +cp $DATA/summary.log $reg_dir + +exit diff --git a/reg_tests/global_cycle/driver.jet.sh b/reg_tests/global_cycle/driver.jet.sh new file mode 100755 index 000000000..7f2f85863 --- /dev/null +++ b/reg_tests/global_cycle/driver.jet.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run global_cycle regression test on Jet. +# +# Set $DATA to your working directory. Set the project code (SBATCH -A) +# and queue (SBATCH -q) as appropriate. +# +# Invoke the script as follows: sbatch $script +# +# Log output is placed in regression.log. A summary is +# placed in summary.log +# +# The test fails when its output does not match the baseline files +# as determined by the 'nccmp' utility. This baseline files are +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#SBATCH -J cycle_reg_test +#SBATCH -A emcda +#SBATCH --open-mode=truncate +#SBATCH -o regression.log +#SBATCH -e regression.log +#SBATCH --nodes=1 --ntasks-per-node=6 +#SBATCH --partition=xjet +#SBATCH -q windfall +#SBATCH -t 00:05:00 + +set -x + +. /apps/lmod/lmod/init/sh +module purge +module load intel/18.0.5.274 +module load impi/2018.4.274 +module load szip +module load hdf5 +module load netcdf/4.2.1.1 +module list + +export DATA=/lfs3/HFIP/emcda/$LOGNAME/stmp/reg_tests.cycle + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +export HOMEreg=/lfs3/HFIP/emcda/George.Gayno/reg_tests/global_cycle + +export OMP_NUM_THREADS_CY=2 + +export APRUNCY="srun" + +export NWPROD=$PWD/../.. + +export COMOUT=$DATA + +export NCCMP=/apps/nccmp/1.8.2.1/intel/18.0.3.222/bin/nccmp + +reg_dir=$PWD + +./C768.fv3gfs.sh + +cp $DATA/summary.log $reg_dir + +exit diff --git a/reg_tests/grid_gen/c96.regional.sh b/reg_tests/grid_gen/c96.regional.sh new file mode 100755 index 000000000..39a7e54d4 --- /dev/null +++ b/reg_tests/grid_gen/c96.regional.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +#----------------------------------------------------------------------- +# Create a C96 regional grid. Compare output to a set +# of baseline files using the 'nccmp' utility. This script is +# run by the machine specific driver script. +#----------------------------------------------------------------------- + +set -x + +export TMPDIR=${WORK_DIR}/c96.regional.work +export out_dir=${WORK_DIR}/c96.regional + +export res=96 +export gtype=regional +export stretch_fac=1.5 # Stretching factor for the grid +export target_lon=-97.5 # Center longitude of the highest resolution tile +export target_lat=35.5 # Center latitude of the highest resolution tile +export refine_ratio=3 # The refinement ratio +export istart_nest=27 # Starting i-direction index of nest grid in parent tile supergrid +export jstart_nest=37 # Starting j-direction index of nest grid in parent tile supergrid +export iend_nest=166 # Ending i-direction index of nest grid in parent tile supergrid +export jend_nest=164 # Ending j-direction index of nest grid in parent tile supergrid +export halo=3 + +#----------------------------------------------------------------------- +# Start script. +#----------------------------------------------------------------------- + +echo "Starting at: " `date` + +$home_dir/ush/fv3gfs_driver_grid.sh + +iret=$? +if [ $iret -ne 0 ]; then + set +x + echo "<<< C96 REGIONAL TEST FAILED. <<<" + exit $iret +fi + +echo "Ending at: " `date` + +#----------------------------------------------------------------------------- +# Compare output to baseline set of data. +#----------------------------------------------------------------------------- + +cd $out_dir + +test_failed=0 +for files in *tile*.nc ./fix_sfc/*tile*.nc +do + if [ -f $files ]; then + echo CHECK $files + $NCCMP -dmfqS $files $HOMEreg/c96.regional/$files + iret=$? + if [ $iret -ne 0 ]; then + test_failed=1 + fi + fi +done + +set +x +if [ $test_failed -ne 0 ]; then + echo "<<< C96 REGIONAL TEST FAILED. >>>" +else + echo "<<< C96 REGIONAL TEST PASSED. >>>" +fi + +exit 0 diff --git a/reg_tests/grid_gen/c96.uniform.sh b/reg_tests/grid_gen/c96.uniform.sh new file mode 100755 index 000000000..61f28009d --- /dev/null +++ b/reg_tests/grid_gen/c96.uniform.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +#----------------------------------------------------------------------- +# Create a C96 global uniform grid. Compare output to a set +# of baseline files using the 'nccmp' utility. This script is +# run by the machine specific driver script. +#----------------------------------------------------------------------- + +set -x + +export TMPDIR=${WORK_DIR}/c96.uniform.work +export out_dir=${WORK_DIR}/c96.uniform + +export res=96 +export gtype=uniform + +#----------------------------------------------------------------------- +# Start script. +#----------------------------------------------------------------------- + +echo "Starting at: " `date` + +$home_dir/ush/fv3gfs_driver_grid.sh + +iret=$? +if [ $iret -ne 0 ]; then + set +x + echo "<<< C96 UNIFORM TEST FAILED. <<<" + exit $iret +fi + +echo "Ending at: " `date` + +#----------------------------------------------------------------------------- +# Compare output to baseline set of data. +#----------------------------------------------------------------------------- + +cd $out_dir + +test_failed=0 +for files in *tile*.nc ./fix_sfc/*tile*.nc +do + if [ -f $files ]; then + echo CHECK $files + $NCCMP -dmfqS $files $HOMEreg/c96.uniform/$files + iret=$? + if [ $iret -ne 0 ]; then + test_failed=1 + fi + fi +done + +set +x +if [ $test_failed -ne 0 ]; then + echo "<<< C96 UNIFORM TEST FAILED. >>>" +else + echo "<<< C96 UNIFORM TEST PASSED. >>>" +fi + +exit 0 diff --git a/reg_tests/grid_gen/driver.cray.sh b/reg_tests/grid_gen/driver.cray.sh new file mode 100755 index 000000000..47c331297 --- /dev/null +++ b/reg_tests/grid_gen/driver.cray.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run grid generation regression tests on WCOSS-Cray. +# +# Set WORK_DIR to your working directory. Set the PROJECT_CODE and QUEUE +# as appropriate. +# +# Invoke the script with no arguments. A series of daily- +# chained jobs will be submitted. To check the queue, type: "bjobs". +# +# Log output from the suite will be in LOG_FILE. Once the suite +# has completed, a summary is placed in SUM_FILE. +# +# A test fails when its output does not match the baseline files as +# determined by the "nccmp" utility. The baseline files are stored in +# HOMEreg +# +#----------------------------------------------------------------------------- + +. $MODULESHOME/init/sh +module load PrgEnv-intel cfp-intel-sandybridge/1.1.0 +module list + +set -x + +QUEUE="debug" +PROJECT_CODE="GFS-DEV" +export WORK_DIR=/gpfs/hps3/stmp/$LOGNAME/reg_tests.grid + +#----------------------------------------------------------------------------- +# Should not have to change anything below here. +#----------------------------------------------------------------------------- + +export home_dir=$PWD/../.. +LOG_FILE=regression.log +SUM_FILE=summary.log +export APRUN="aprun -n 1 -N 1 -j 1 -d 1 -cc depth" +export APRUN_SFC="aprun -j 1 -n 24 -N 24" +export OMP_STACKSIZE=2048m +export OMP_NUM_THREADS=6 +export machine=WCOSS_C +export KMP_AFFINITY=disabled +export NCCMP=/gpfs/hps3/emc/global/noscrub/George.Gayno/util/netcdf/nccmp +export HOMEreg=/gpfs/hps3/emc/global/noscrub/George.Gayno/ufs_utils.git/reg_tests/grid_gen/baseline_data + +rm -fr $WORK_DIR + +ulimit -a +ulimit -s unlimited + +#----------------------------------------------------------------------------- +# C96 uniform grid +#----------------------------------------------------------------------------- + +bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.uniform -W 0:15 -M 2400 \ + -extsched 'CRAYLINUX[]' "export NODES=1; $PWD/c96.uniform.sh" + +#----------------------------------------------------------------------------- +# C96 regional grid +#----------------------------------------------------------------------------- + +bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.regional -W 0:10 -M 2400 \ + -w 'ended(c96.uniform)' -extsched 'CRAYLINUX[]' "export NODES=1; $PWD/c96.regional.sh" + +#----------------------------------------------------------------------------- +# Create summary log. +#----------------------------------------------------------------------------- + +bsub -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J summary -R "rusage[mem=100]" -W 0:01 -w 'ended(c96.regional)' "grep -a '<<<' $LOG_FILE >> $SUM_FILE" + +exit diff --git a/reg_tests/grid_gen/driver.dell.sh b/reg_tests/grid_gen/driver.dell.sh new file mode 100755 index 000000000..14f87fa2d --- /dev/null +++ b/reg_tests/grid_gen/driver.dell.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run grid generation regression tests on WCOSS-Dell. +# +# Set WORK_DIR to your working directory. Set the PROJECT_CODE and QUEUE +# as appropriate. +# +# Invoke the script with no arguments. A series of daily- +# chained jobs will be submitted. To check the queue, type: "bjobs". +# +# Log output from the suite will be in LOG_FILE. Once the suite +# has completed, a summary is placed in SUM_FILE. +# +# A test fails when its output does not match the baseline files as +# determined by the "nccmp" utility. The baseline files are stored in +# HOMEreg +# +#----------------------------------------------------------------------------- + +module purge +module load EnvVars/1.0.2 +module load lsf/10.1 +module load ips/18.0.1.163 +module load impi/18.0.1 +module load NetCDF/4.5.0 +module load HDF5-serial/1.10.1 +module list + +set -x + +QUEUE="debug" +PROJECT_CODE="GFS-DEV" +export WORK_DIR=/gpfs/dell1/stmp/$LOGNAME/reg_tests.grid + +#----------------------------------------------------------------------------- +# Should not have to change anything below here. +#----------------------------------------------------------------------------- + +LOG_FILE=regression.log +SUM_FILE=summary.log +export home_dir=$PWD/../.. +export APRUN=time +export APRUN_SFC="mpirun -l" +export OMP_STACKSIZE=2048m +export machine=WCOSS_DELL_P3 +export NCCMP=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/util/nccmp/nccmp-1.8.5.0/src/nccmp +export HOMEreg=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/ufs_utils.git/reg_tests/grid_gen/baseline_data +export OMP_NUM_THREADS=24 + +rm -fr $WORK_DIR + +ulimit -a +ulimit -s unlimited + +#----------------------------------------------------------------------------- +# C96 uniform grid +#----------------------------------------------------------------------------- + +bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.uniform -W 0:15 -x -n 24 \ + -R "span[ptile=24]" -R "affinity[core(1):distribute=balance]" "$PWD/c96.uniform.sh" + +#----------------------------------------------------------------------------- +# C96 regional grid +#----------------------------------------------------------------------------- + +bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.regional -W 0:10 -x -n 24 -w 'ended(c96.uniform)' \ + -R "span[ptile=24]" -R "affinity[core(1):distribute=balance]" "$PWD/c96.regional.sh" + +#----------------------------------------------------------------------------- +# Create summary log. +#----------------------------------------------------------------------------- + +bsub -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J summary -R "affinity[core(1)]" -R "rusage[mem=100]" -W 0:01 \ + -w 'ended(c96.regional)' "grep -a '<<<' $LOG_FILE >> $SUM_FILE" diff --git a/reg_tests/grid_gen/driver.hera.sh b/reg_tests/grid_gen/driver.hera.sh new file mode 100755 index 000000000..72791e01b --- /dev/null +++ b/reg_tests/grid_gen/driver.hera.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run grid generation regression tests on Hera. +# +# Set WORK_DIR to your working directory. Set the PROJECT_CODE and QUEUE +# as appropriate. To see which projects you are authorized to use, +# type "account_params". +# +# Invoke the script with no arguments. A series of daily- +# chained jobs will be submitted. To check the queue, type: +# "squeue -u USERNAME". +# +# Log output from the suite will be in LOG_FILE. Once the suite +# has completed, a summary is placed in SUM_FILE. +# +# A test fails when its output does not match the baseline files as +# determined by the "nccmp" utility. The baseline files are stored in +# HOMEreg +# +#----------------------------------------------------------------------------- + +. /apps/lmod/lmod/init/sh +module purge +module load intel/18.0.5.274 +module load impi/2018.0.4 +module load hdf5/1.10.5 +module load netcdf/4.7.0 +module list + +set -x + +export WORK_DIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/reg_tests.grid +QUEUE="batch" +PROJECT_CODE="fv3-cpu" + +#----------------------------------------------------------------------------- +# Should not have to change anything below here. +#----------------------------------------------------------------------------- + +LOG_FILE=regression.log +SUM_FILE=summary.log +export home_dir=$PWD/../.. +export APRUN=time +export APRUN_SFC=srun +export OMP_STACKSIZE=2048m +export machine=HERA +export NCCMP=/apps/nccmp/1.8.5/intel/18.0.3.051/bin/nccmp +export HOMEreg=/scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/grid_gen/baseline_data + +ulimit -a +#ulimit -s unlimited + +rm -fr $WORK_DIR + +export OMP_NUM_THREADS=24 + +#----------------------------------------------------------------------------- +# C96 uniform grid +#----------------------------------------------------------------------------- + +TEST1=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.uniform \ + -o $LOG_FILE -e $LOG_FILE ./c96.uniform.sh) + +#----------------------------------------------------------------------------- +# C96 regional grid +#----------------------------------------------------------------------------- + +TEST2=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.regional \ + -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST1 ./c96.regional.sh) + +#----------------------------------------------------------------------------- +# Create summary log. +#----------------------------------------------------------------------------- + +sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J grid_summary -o $LOG_FILE -e $LOG_FILE \ + --open-mode=append -q $QUEUE -d afterok:$TEST2 << EOF +#!/bin/sh +grep -a '<<<' $LOG_FILE > $SUM_FILE +EOF diff --git a/reg_tests/grid_gen/driver.jet.sh b/reg_tests/grid_gen/driver.jet.sh new file mode 100755 index 000000000..b78ca688e --- /dev/null +++ b/reg_tests/grid_gen/driver.jet.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run grid generation regression tests on Jet. +# +# Set WORK_DIR to your working directory. Set the PROJECT_CODE and QUEUE +# as appropriate. To see which projects you are authorized to use, +# type "account_params". +# +# Invoke the script with no arguments. A series of daily- +# chained jobs will be submitted. To check the queue, type: +# "squeue -u USERNAME". +# +# Log output from the suite will be in LOG_FILE. Once the suite +# has completed, a summary is placed in SUM_FILE. +# +# A test fails when its output does not match the baseline files as +# determined by the "nccmp" utility. The baseline files are stored in +# HOMEreg +# +#----------------------------------------------------------------------------- + +. /apps/lmod/lmod/init/sh +module purge +module load intel/18.0.5.274 +module load impi/2018.4.274 +module load szip +module load hdf5 +module load netcdf/4.2.1.1 +module list + +set -x + +QUEUE="windfall" +PROJECT_CODE="emcda" +export WORK_DIR=/mnt/lfs3/projects/emcda/$LOGNAME/stmp/reg_tests.grid + +#----------------------------------------------------------------------------- +# Should not have to change anything below here. +#----------------------------------------------------------------------------- + +LOG_FILE=regression.log +SUM_FILE=summary.log +export home_dir=$PWD/../.. +export APRUN=time +export APRUN_SFC=srun +export OMP_STACKSIZE=2048m +export machine=JET +export NCCMP=/apps/nccmp/1.8.2.1/intel/18.0.3.222/bin/nccmp +export HOMEreg=/mnt/lfs3/projects/emcda/George.Gayno/reg_tests/grid_gen/baseline_data + +ulimit -a +ulimit -s unlimited + +rm -fr $WORK_DIR + +export OMP_NUM_THREADS=24 + +#----------------------------------------------------------------------------- +# C96 uniform grid +#----------------------------------------------------------------------------- + +TEST1=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.uniform \ + --partition=xjet -o $LOG_FILE -e $LOG_FILE ./c96.uniform.sh) + +#----------------------------------------------------------------------------- +# C96 regional grid +#----------------------------------------------------------------------------- + +TEST2=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.regional \ + --partition=xjet -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST1 ./c96.regional.sh) + +#----------------------------------------------------------------------------- +# Create summary log. +#----------------------------------------------------------------------------- + +sbatch --partition=xjet --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J grid_summary -o $LOG_FILE -e $LOG_FILE \ + --open-mode=append -q $QUEUE -d afterok:$TEST2 << EOF +#!/bin/sh +grep -a '<<<' $LOG_FILE > $SUM_FILE +EOF diff --git a/reg_tests/ice_blend/driver.cray.sh b/reg_tests/ice_blend/driver.cray.sh new file mode 100755 index 000000000..ab0b4825a --- /dev/null +++ b/reg_tests/ice_blend/driver.cray.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run ice_blend regression test on WCOSS-Cray. +# +# Set $DATA to your working directory. Set the project code (BSUB -P) +# and queue (BSUB -q) as appropriate. +# +# Invoke the script as follows: cat $script | bsub +# +# Log output is placed in regression.log. A summary is +# placed in summary.log. +# +# The test fails when its output does not match the baseline file +# as determined by the 'cmp' command. The baseline file is +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#BSUB -W 0:02 +#BSUB -o regression.log +#BSUB -e regression.log +#BSUB -J iceb_regt +#BSUB -q debug +#BSUB -R "rusage[mem=2000]" +#BSUB -P GFS-DEV + +set -x + +module load PrgEnv-intel +module list + +export DATA=/gpfs/hps3/stmp/$LOGNAME/reg_tests.ice_blend + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +export WGRIB=/gpfs/hps/nco/ops/nwprod/grib_util.v1.0.5/exec/wgrib +export WGRIB2=/gpfs/hps/nco/ops/nwprod/grib_util.v1.0.5/exec/wgrib2 +export COPYGB2=/gpfs/hps/nco/ops/nwprod/grib_util.v1.0.5/exec/copygb2 +export COPYGB=/gpfs/hps/nco/ops/nwprod/grib_util.v1.0.5/exec/copygb +export CNVGRIB=/gpfs/hps/nco/ops/nwprod/grib_util.v1.0.5/exec/cnvgrib + +export HOMEreg=/gpfs/hps3/emc/global/noscrub/George.Gayno/ufs_utils.git/reg_tests/ice_blend +export HOMEgfs=$PWD/../.. + +rm -fr $DATA + +./ice_blend.sh + +exit 0 diff --git a/reg_tests/ice_blend/driver.dell.sh b/reg_tests/ice_blend/driver.dell.sh new file mode 100755 index 000000000..e200aff09 --- /dev/null +++ b/reg_tests/ice_blend/driver.dell.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run ice_blend regression test on WCOSS-Dell. +# +# Set $DATA to your working directory. Set the project code (BSUB -P) +# and queue (BSUB -q) as appropriate. +# +# Invoke the script as follows: cat $script | bsub +# +# Log output is placed in regression.log. A summary is +# placed in summary.log +# +# The test fails when its output does not match the baseline file +# as determined by the 'cmp' command. The baseline file is +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#BSUB -W 0:02 +#BSUB -o regression.log +#BSUB -e regression.log +#BSUB -J iceb_regt +#BSUB -q debug +#BSUB -R "affinity[core(1)]" +#BSUB -P GFS-DEV + +set -x + +export DATA=/gpfs/dell1/stmp/$LOGNAME/reg_tests.ice_blend + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +export WGRIB="/gpfs/dell1/nco/ops/nwprod/grib_util.v1.1.1/exec/wgrib" +export WGRIB2="/gpfs/dell1/nco/ops/nwprod/grib_util.v1.1.1/exec/wgrib2" +export COPYGB2="/gpfs/dell1/nco/ops/nwprod/grib_util.v1.1.1/exec/copygb2" +export COPYGB="/gpfs/dell1/nco/ops/nwprod/grib_util.v1.1.1/exec/copygb" +export CNVGRIB="/gpfs/dell1/nco/ops/nwprod/grib_util.v1.1.1/exec/cnvgrib" + +export HOMEreg=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/ufs_utils.git/reg_tests/ice_blend +export HOMEgfs=$PWD/../.. + +rm -fr $DATA + +./ice_blend.sh + +exit 0 diff --git a/reg_tests/ice_blend/driver.hera.sh b/reg_tests/ice_blend/driver.hera.sh new file mode 100755 index 000000000..9dd1ab3c7 --- /dev/null +++ b/reg_tests/ice_blend/driver.hera.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run ice_blend regression test on Hera. +# +# Set $DATA to your working directory. Set the project code (SBATCH -A) +# and queue (SBATCH -q) as appropriate. +# +# Invoke the script as follows: sbatch $script +# +# Log output is placed in regression.log. A summary is +# placed in summary.log +# +# The test fails when its output does not match the baseline file +# as determined by the 'cmp' command. The baseline file is +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#SBATCH -J ice_blend +#SBATCH -A fv3-cpu +#SBATCH --open-mode=truncate +#SBATCH -o regression.log +#SBATCH -e regression.log +#SBATCH --ntasks=1 +#SBATCH -q debug +#SBATCH -t 00:03:00 + +set -x + +module load intel + +export DATA="/scratch2/NCEPDEV/stmp1/$LOGNAME/reg_test.ice_blend" + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +export WGRIB=/scratch2/NCEPDEV/nwprod/NCEPLIBS/utils/grib_util.v1.1.1/exec/wgrib +export WGRIB2=/scratch2/NCEPDEV/nwprod/NCEPLIBS/utils/grib_util.v1.1.1/exec/wgrib2 +export COPYGB=/scratch2/NCEPDEV/nwprod/NCEPLIBS/utils/grib_util.v1.1.1/exec/copygb +export COPYGB2=/scratch2/NCEPDEV/nwprod/NCEPLIBS/utils/grib_util.v1.1.1/exec/copygb2 +export CNVGRIB=/scratch2/NCEPDEV/nwprod/NCEPLIBS/utils/grib_util.v1.1.1/exec/cnvgrib + +export HOMEreg=/scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/ice_blend +export HOMEgfs=$PWD/../.. + +rm -fr $DATA + +./ice_blend.sh + +exit 0 diff --git a/reg_tests/ice_blend/driver.jet.sh b/reg_tests/ice_blend/driver.jet.sh new file mode 100755 index 000000000..cf61e18f1 --- /dev/null +++ b/reg_tests/ice_blend/driver.jet.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run ice_blend regression test on Jet. +# +# Set $DATA to your working directory. Set the project code (SBATCH -A) +# and queue (SBATCH -q) as appropriate. +# +# Invoke the script as follows: sbatch $script +# +# Log output is placed in regression.log. A summary is +# placed in summary.log +# +# The test fails when its output does not match the baseline file +# as determined by the 'cmp' command. The baseline file is +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#SBATCH --nodes=1 +#SBATCH --partition=sjet +#SBATCH --time 0:01 +#SBATCH --account=emcda +#SBATCH --job-name=ice_blnd +#SBATCH -o regression.log +#SBATCH -e regression.log + +set -x + +module load intel + +export DATA="/mnt/lfs3/projects/emcda/$LOGNAME/stmp/reg_test.ice_blend" + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +export WGRIB=/apps/wgrib/1.8.1.0b/bin/wgrib +export WGRIB2=/apps/wgrib2/0.1.9.6a/bin/wgrib2 +export COPYGB=/mnt/lfs3/projects/emcda/George.Gayno/ufs_utils.git/jet_port/grib_util/copygb +export COPYGB2=/mnt/lfs3/projects/emcda/George.Gayno/ufs_utils.git/jet_port/grib_util/copygb2 +export CNVGRIB=/apps/cnvgrib/1.4.0/bin/cnvgrib + +export HOMEreg=/lfs3/HFIP/emcda/George.Gayno/reg_tests/ice_blend +export HOMEgfs=$PWD/../.. + +rm -fr $DATA + +./ice_blend.sh + +exit 0 diff --git a/reg_tests/ice_blend/ice_blend.sh b/reg_tests/ice_blend/ice_blend.sh new file mode 100755 index 000000000..94c9e846a --- /dev/null +++ b/reg_tests/ice_blend/ice_blend.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# Run ice_blend regression test. This script called from it machine-specific +# driver script. +#----------------------------------------------------------------------------- + +export IMS_FILE=$HOMEreg/input_data/imssnow96.grib2.gdas.2018120618 +export FIVE_MIN_ICE_FILE=$HOMEreg/input_data/seaice.5min.grib2.gdas.2018120618 + +${HOMEgfs}/ush/emcsfc_ice_blend.sh + +iret=$? +if [ $iret -ne 0 ]; then + set +x + echo "<<< ICE_BLEND TEST FAILED. <<<" + echo "<<< ICE_BLEND TEST FAILED. <<<" > ./summary.log + exit $iret +fi + +cmp ${DATA}/seaice.5min.blend $HOMEreg/baseline_data/seaice.5min.blend +iret=$? +test_failed=0 +if [ $iret -ne 0 ]; then + test_failed=1 +fi + +set +x +if [ $test_failed -ne 0 ]; then + echo + echo "*********************************" + echo "<<< ICE BLEND TEST FAILED. >>>" + echo "*********************************" + echo "<<< ICE BLEND TEST FAILED. >>>" > ./summary.log +else + echo + echo "*********************************" + echo "<<< ICE BLEND TEST PASSED. >>>" + echo "*********************************" + echo "<<< ICE BLEND TEST PASSED. >>>" > ./summary.log +fi + +exit 0 diff --git a/reg_tests/snow2mdl/driver.cray.sh b/reg_tests/snow2mdl/driver.cray.sh new file mode 100755 index 000000000..7069afc57 --- /dev/null +++ b/reg_tests/snow2mdl/driver.cray.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run snow2mdl regression test on WCOSS-Cray. +# +# Set $DATA to your working directory. Set the project code (BSUB -P) +# and queue (BSUB -q) as appropriate. +# +# Invoke the script as follows: cat $script | bsub +# +# Log output is placed in regression.log. A summary is +# placed in summary.log +# +# The test fails when its output does not match the baseline file +# as determined by the 'cmp' command. The baseline file is +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#BSUB -W 0:02 +#BSUB -o regression.log +#BSUB -e regression.log +#BSUB -J s2m_regt +#BSUB -q debug +#BSUB -R "rusage[mem=2000]" +#BSUB -P GFS-DEV + +set -x + +module load PrgEnv-intel +module list + +export DATA=/gpfs/hps3/stmp/$LOGNAME/reg_tests.snow2mdl + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +export HOMEreg=/gpfs/hps3/emc/global/noscrub/George.Gayno/ufs_utils.git/reg_tests/snow2mdl +export HOMEgfs=$PWD/../.. +export WGRIB=/gpfs/hps/nco/ops/nwprod/grib_util.v1.0.2/exec/wgrib +export WGRIB2=/gpfs/hps/nco/ops/nwprod/grib_util.v1.0.2/exec/wgrib2 + +rm -fr $DATA + +./snow2mdl.sh + +exit 0 diff --git a/reg_tests/snow2mdl/driver.dell.sh b/reg_tests/snow2mdl/driver.dell.sh new file mode 100755 index 000000000..4b5f520ec --- /dev/null +++ b/reg_tests/snow2mdl/driver.dell.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run snow2mdl regression test on WCOSS-Dell. +# +# Set $DATA to your working directory. Set the project code (BSUB -P) +# and queue (BSUB -q) as appropriate. +# +# Invoke the script as follows: cat $script | bsub +# +# Log output is placed in regression.log. A summary is +# placed in summary.log +# +# The test fails when its output does not match the baseline file +# as determined by the 'cmp' command. The baseline file is +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#BSUB -W 0:02 +#BSUB -o regression.log +#BSUB -e regression.log +#BSUB -J s2m_regt +#BSUB -q debug +#BSUB -R "affinity[core(1)]" +#BSUB -P GFS-DEV + +set -x + +export DATA=/gpfs/dell1/stmp/$LOGNAME/reg_tests.snow2mdl + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +export HOMEreg=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/ufs_utils.git/reg_tests/snow2mdl +export HOMEgfs=$PWD/../.. +export WGRIB=/gpfs/dell1/nco/ops/nwprod/grib_util.v1.0.6/exec/wgrib +export WGRIB2=/gpfs/dell1/nco/ops/nwprod/grib_util.v1.0.6/exec/wgrib2 + +rm -fr $DATA + +./snow2mdl.sh + +exit 0 diff --git a/reg_tests/snow2mdl/driver.hera.sh b/reg_tests/snow2mdl/driver.hera.sh new file mode 100755 index 000000000..49b049990 --- /dev/null +++ b/reg_tests/snow2mdl/driver.hera.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run snow2mdl regression test on Hera. +# +# Set $DATA to your working directory. Set the project code (SBATCH -A) +# and queue (SBATCH -q) as appropriate. +# +# Invoke the script as follows: sbatch $script +# +# Log output is placed in regression.log. A summary is +# placed in summary.log +# +# The test fails when its output does not match the baseline file +# as determined by the 'cmp' command. The baseline file is +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#SBATCH -J snow +#SBATCH -A fv3-cpu +#SBATCH --open-mode=truncate +#SBATCH -o regression.log +#SBATCH -e regression.log +#SBATCH --ntasks=1 +#SBATCH -q debug +#SBATCH -t 00:03:00 + +set -x + +module load intel + +export DATA="/scratch2/NCEPDEV/stmp1/$LOGNAME/reg_tests.snow2mdl" + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +rm -fr $DATA + +export HOMEreg=/scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/snow2mdl +export HOMEgfs=$PWD/../.. +export WGRIB=/scratch2/NCEPDEV/nwprod/NCEPLIBS/utils/grib_util.v1.1.1/exec/wgrib +export WGRIB2=/scratch2/NCEPDEV/nwprod/NCEPLIBS/utils/grib_util.v1.1.1/exec/wgrib2 + +./snow2mdl.sh + +exit 0 diff --git a/reg_tests/snow2mdl/driver.jet.sh b/reg_tests/snow2mdl/driver.jet.sh new file mode 100755 index 000000000..69cf86d0e --- /dev/null +++ b/reg_tests/snow2mdl/driver.jet.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run snow2mdl regression test on Jet. +# +# Set $DATA to your working directory. Set the project code (SBATCH -A) +# and queue (SBATCH -q) as appropriate. +# +# Invoke the script as follows: sbatch $script +# +# Log output is placed in regression.log. A summary is +# placed in summary.log +# +# The test fails when its output does not match the baseline file +# as determined by the 'cmp' command. The baseline file is +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#SBATCH --nodes=1 +#SBATCH --partition=sjet +#SBATCH --time 0:01 +#SBATCH --account=emcda +#SBATCH --job-name=snow2mdl +#SBATCH -o regression.log +#SBATCH -e regression.log + +set -x + +module unload intel +module load intel/18.0.5.274 +module list + +export DATA="/mnt/lfs3/projects/emcda/$LOGNAME/stmp/reg_tests.snow2mdl" + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +export HOMEreg=/lfs3/HFIP/emcda/George.Gayno/reg_tests/snow2mdl +export HOMEgfs=$PWD/../.. +export WGRIB=/apps/wgrib/1.8.1.0b/bin/wgrib +export WGRIB2=/apps/wgrib2/0.1.9.6a/bin/wgrib2 + +rm -fr $DATA + +./snow2mdl.sh + +exit 0 diff --git a/reg_tests/snow2mdl/snow2mdl.sh b/reg_tests/snow2mdl/snow2mdl.sh new file mode 100755 index 000000000..4acec05b8 --- /dev/null +++ b/reg_tests/snow2mdl/snow2mdl.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +#-------------------------------------------------------------------------- +# Create a T1534 snow file. This script is run from its machine-specific +# driver. +#-------------------------------------------------------------------------- + +set -x + +export IMS_FILE=$HOMEreg/input_data/imssnow96.grb +export AFWA_NH_FILE=$HOMEreg/input_data/NPR.SNWN.SP.S1200.MESH16 +export AFWA_SH_FILE=$HOMEreg/input_data/NPR.SNWS.SP.S1200.MESH16 + +export MODEL_LATITUDE_FILE=$HOMEgfs/fix/fix_am/global_latitudes.t1534.3072.1536.grb +export MODEL_LONGITUDE_FILE=$HOMEgfs/fix/fix_am/global_longitudes.t1534.3072.1536.grb +export MODEL_SLMASK_FILE=$HOMEgfs/fix/fix_am/global_slmask.t1534.3072.1536.grb +export GFS_LONSPERLAT_FILE=$HOMEgfs/fix/fix_am/global_lonsperlat.t1534.3072.1536.txt + +export OMP_NUM_THREADS=1 +export OUTPUT_GRIB2=.false. + +${HOMEgfs}/ush/emcsfc_snow.sh + +iret=$? +if [ $iret -ne 0 ]; then + set +x + echo "<<< SNOW2MDL TEST FAILED. <<<" + echo "<<< SNOW2MDL TEST FAILED. <<<" > ./summary.log + exit $iret +fi + +test_failed=0 + +cmp ${DATA}/snogrb_model $HOMEreg/baseline_data/snogrb_model +iret=$? +if [ $iret -ne 0 ]; then + test_failed=1 +fi + +set +x +if [ $test_failed -ne 0 ]; then + echo + echo "*********************************" + echo "<<< SNOW2MDL TEST FAILED. >>>" + echo "*********************************" + echo "<<< SNOW2MDL TEST FAILED. >>>" > ./summary.log +else + echo + echo "*********************************" + echo "<<< SNOW2MDL TEST PASSED. >>>" + echo "*********************************" + echo "<<< SNOW2MDL TEST PASSED. >>>" > ./summary.log +fi + +exit From 3ad7d832c2adc1bbd9e7527184b08e0980ca1365 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Mon, 18 May 2020 15:14:54 -0400 Subject: [PATCH 021/192] Update repository to use CMake Build all UFS_UTILS programs using CMake. Update all driver scripts to load the same module file as the build script. This ensures the build and the run scripts use the same compiler version and libraries. Remove all files associated with the old build system. --- .gitmodules | 4 + CMakeLists.txt | 117 ++++++++++++ build_all.sh | 32 ++++ cmake | 1 + driver_scripts/driver_grid.cray.sh | 4 +- driver_scripts/driver_grid.dell.sh | 9 +- driver_scripts/driver_grid.hera.sh | 8 +- driver_scripts/driver_grid.jet.sh | 9 +- {sorc => fix}/link_fixdirs.sh | 1 - .../{fv3gfs/global_chgres.hera => build.hera} | 21 +- modulefiles/build.jet | 30 +++ modulefiles/build.orion | 31 +++ modulefiles/build.wcoss_cray | 39 ++++ ...gres.wcoss_dell_p3 => build.wcoss_dell_p3} | 24 ++- modulefiles/chgres_cube.hera | 26 --- modulefiles/chgres_cube.jet | 27 --- modulefiles/chgres_cube.linux.gnu | 24 --- modulefiles/chgres_cube.linux.intel | 24 --- modulefiles/chgres_cube.odin | 27 --- modulefiles/chgres_cube.wcoss_cray | 31 --- modulefiles/chgres_cube.wcoss_dell_p3 | 24 --- modulefiles/fv3gfs/fre-nctools.gaea | 10 - modulefiles/fv3gfs/fre-nctools.hera | 9 - modulefiles/fv3gfs/fre-nctools.jet | 8 - modulefiles/fv3gfs/fre-nctools.wcoss | 6 - modulefiles/fv3gfs/fre-nctools.wcoss_cray | 9 - modulefiles/fv3gfs/fre-nctools.wcoss_dell_p3 | 9 - modulefiles/fv3gfs/global_chgres.jet | 26 --- modulefiles/fv3gfs/global_chgres.wcoss | 22 --- modulefiles/fv3gfs/global_chgres.wcoss_cray | 27 --- .../fv3gfs/global_chgres.wcoss_cray_userlib | 29 --- modulefiles/fv3gfs/global_cycle.hera | 17 -- modulefiles/fv3gfs/global_cycle.jet | 19 -- modulefiles/fv3gfs/global_cycle.wcoss | 16 -- modulefiles/fv3gfs/global_cycle.wcoss_cray | 21 -- .../fv3gfs/global_cycle.wcoss_cray_userlib | 24 --- modulefiles/fv3gfs/global_cycle.wcoss_dell_p3 | 17 -- modulefiles/fv3gfs/nst_tf_chg.hera | 21 -- modulefiles/fv3gfs/nst_tf_chg.jet | 20 -- modulefiles/fv3gfs/nst_tf_chg.wcoss | 17 -- modulefiles/fv3gfs/nst_tf_chg.wcoss_cray | 22 --- modulefiles/fv3gfs/nst_tf_chg.wcoss_dell_p3 | 20 -- modulefiles/fv3gfs/orog.hera | 15 -- modulefiles/fv3gfs/orog.jet | 18 -- modulefiles/fv3gfs/orog.wcoss | 16 -- modulefiles/fv3gfs/orog.wcoss_cray | 18 -- modulefiles/fv3gfs/orog.wcoss_cray_userlib | 20 -- modulefiles/fv3gfs/orog.wcoss_dell_p3 | 14 -- modulefiles/module_nemsutil.hera | 15 -- modulefiles/module_nemsutil.jet | 14 -- modulefiles/module_nemsutil.wcoss | 13 -- modulefiles/module_nemsutil.wcoss_cray | 17 -- .../module_nemsutil.wcoss_cray_userlib | 19 -- modulefiles/module_nemsutil.wcoss_dell_p3 | 12 -- .../modulefile.global_emcsfc_ice_blend.hera | 17 -- .../modulefile.global_emcsfc_ice_blend.jet | 16 -- .../modulefile.global_emcsfc_ice_blend.wcoss | 14 -- ...ulefile.global_emcsfc_ice_blend.wcoss_cray | 17 -- ...global_emcsfc_ice_blend.wcoss_cray_userlib | 20 -- ...file.global_emcsfc_ice_blend.wcoss_dell_p3 | 17 -- .../modulefile.global_emcsfc_snow2mdl.hera | 23 --- .../modulefile.global_emcsfc_snow2mdl.jet | 22 --- .../modulefile.global_emcsfc_snow2mdl.wcoss | 18 -- ...dulefile.global_emcsfc_snow2mdl.wcoss_cray | 21 -- ....global_emcsfc_snow2mdl.wcoss_cray_userlib | 24 --- ...efile.global_emcsfc_snow2mdl.wcoss_dell_p3 | 20 -- modulefiles/modulefile.sfc_climo_gen.hera | 13 -- modulefiles/modulefile.sfc_climo_gen.jet | 16 -- .../modulefile.sfc_climo_gen.wcoss_cray | 16 -- ...odulefile.sfc_climo_gen.wcoss_cray_userlib | 18 -- .../modulefile.sfc_climo_gen.wcoss_dell_p3 | 11 -- reg_tests/chgres_cube/driver.cray.sh | 10 +- reg_tests/chgres_cube/driver.dell.sh | 12 +- reg_tests/chgres_cube/driver.hera.sh | 8 +- reg_tests/chgres_cube/driver.jet.sh | 12 +- reg_tests/global_cycle/driver.cray.sh | 3 +- reg_tests/global_cycle/driver.dell.sh | 11 +- reg_tests/global_cycle/driver.hera.sh | 11 +- reg_tests/global_cycle/driver.jet.sh | 12 +- reg_tests/grid_gen/driver.cray.sh | 4 +- reg_tests/grid_gen/driver.dell.sh | 12 +- reg_tests/grid_gen/driver.hera.sh | 9 +- reg_tests/grid_gen/driver.jet.sh | 12 +- reg_tests/ice_blend/driver.cray.sh | 3 +- reg_tests/ice_blend/driver.dell.sh | 3 + reg_tests/ice_blend/driver.hera.sh | 3 +- reg_tests/ice_blend/driver.jet.sh | 3 +- reg_tests/snow2mdl/driver.cray.sh | 3 +- reg_tests/snow2mdl/driver.dell.sh | 3 + reg_tests/snow2mdl/driver.hera.sh | 3 +- reg_tests/snow2mdl/driver.jet.sh | 5 +- sorc/CMakeLists.txt | 18 ++ sorc/build_all_ufs_utils.sh | 110 ----------- sorc/build_chgres.sh | 59 ------ sorc/build_chgres_cube.sh | 41 ---- sorc/build_cycle.sh | 27 --- sorc/build_emcsfc.sh | 33 ---- sorc/build_fre-nctools.sh | 118 ------------ sorc/build_nems_util.sh | 30 --- sorc/build_nst_tf_chg.sh | 25 --- sorc/build_orog.sh | 66 ------- sorc/build_sfc_climo_gen.sh | 34 ---- sorc/chgres_cube.fd/CMakeLists.txt | 38 ++++ sorc/chgres_cube.fd/makefile | 59 ------ .../run/config.C1152.l91.atm.theia.nml | 26 --- .../run/config.C1152.l91.dell.nml | 25 --- .../chgres_cube.fd/run/config.C1152.theia.nml | 17 -- sorc/chgres_cube.fd/run/config.C384.cray.nml | 17 -- sorc/chgres_cube.fd/run/config.C384.dell.nml | 24 --- .../run/config.C384.gaussian.dell.nml | 24 --- sorc/chgres_cube.fd/run/config.C384.theia.nml | 17 -- sorc/chgres_cube.fd/run/config.C48.cray.nml | 21 -- sorc/chgres_cube.fd/run/config.C48.dell.nml | 21 -- .../run/config.C48.gaussian.theia.nml | 22 --- .../run/config.C48.gfs.gaussian.theia.nml | 23 --- .../run/config.C48.gfs.spectral.dell.nml | 23 --- .../run/config.C48.gfs.spectral.theia.nml | 23 --- sorc/chgres_cube.fd/run/config.C48.theia.nml | 23 --- .../run/config.C768.atm.theia.nml | 26 --- .../run/config.C768.l91.atm.theia.nml | 26 --- .../run/config.C768.l91.dell.nml | 25 --- .../run/config.C768.nest.atm.theia.nml | 25 --- .../run/config.C768.nest.cray.nml | 18 -- .../run/config.C768.nest.theia.nml | 18 -- .../run/config.C768.stretch.cray.nml | 17 -- .../run/config.C768.stretch.theia.nml | 17 -- sorc/chgres_cube.fd/run/run.cray.sh | 33 ---- sorc/chgres_cube.fd/run/run.dell.sh | 48 ----- sorc/chgres_cube.fd/run/run.theia.ksh | 59 ------ sorc/chgres_cube.fd/surface.F90 | 4 +- sorc/emcsfc_ice_blend.fd/CMakeLists.txt | 15 ++ sorc/emcsfc_ice_blend.fd/make.sh | 14 -- sorc/emcsfc_ice_blend.fd/makefile | 29 --- sorc/emcsfc_snow2mdl.fd/CMakeLists.txt | 32 ++++ sorc/emcsfc_snow2mdl.fd/make.sh | 14 -- sorc/emcsfc_snow2mdl.fd/makefile | 44 ----- sorc/fre-nctools.fd/CMakeLists.txt | 6 + sorc/fre-nctools.fd/shared_lib/CMakeLists.txt | 18 ++ .../{shared/mosaic => shared_lib}/COPYING | 0 .../{tools/shared => shared_lib}/affinity.c | 0 .../{shared/mosaic => shared_lib}/constant.h | 0 .../mosaic => shared_lib}/create_xgrid.c | 0 .../mosaic => shared_lib}/create_xgrid.h | 0 .../mosaic => shared_lib}/gradient.F90 | 0 .../mosaic => shared_lib}/gradient_c2l.c | 0 .../mosaic => shared_lib}/gradient_c2l.h | 0 .../{shared/mosaic => shared_lib}/grid.F90 | 0 .../{shared/mosaic => shared_lib}/grid.html | 0 .../{shared/mosaic => shared_lib}/interp.c | 0 .../{shared/mosaic => shared_lib}/interp.h | 0 .../{shared/mosaic => shared_lib}/mosaic.F90 | 0 .../mosaic => shared_lib}/mosaic_util.c | 0 .../mosaic => shared_lib}/mosaic_util.h | 0 .../{tools/shared => shared_lib}/mpp.c | 0 .../{tools/shared => shared_lib}/mpp.h | 0 .../{tools/shared => shared_lib}/mpp_domain.c | 0 .../{tools/shared => shared_lib}/mpp_domain.h | 0 .../{tools/shared => shared_lib}/mpp_io.c | 0 .../{tools/shared => shared_lib}/mpp_io.h | 0 .../mosaic => shared_lib}/read_mosaic.c | 0 .../mosaic => shared_lib}/read_mosaic.h | 0 .../{tools/shared => shared_lib}/tool_util.c | 0 .../{tools/shared => shared_lib}/tool_util.h | 0 .../tools/filter_topo/CMakeLists.txt | 16 ++ .../tools/filter_topo/env.cshrc | 10 - .../tools/filter_topo/make.csh_hera | 6 - .../tools/filter_topo/make.csh_jet | 6 - .../tools/filter_topo/make.csh_wcoss | 6 - .../tools/filter_topo/make.csh_wcoss_cray | 6 - .../tools/filter_topo/make.csh_wcoss_dell_p3 | 6 - .../tools/fregrid/CMakeLists.txt | 14 ++ sorc/fre-nctools.fd/tools/fregrid/env.cray | 4 - sorc/fre-nctools.fd/tools/fregrid/env.gaea | 4 - sorc/fre-nctools.fd/tools/fregrid/env.gfdl-ws | 6 - sorc/fre-nctools.fd/tools/fregrid/env.hera | 4 - sorc/fre-nctools.fd/tools/fregrid/env.jet | 4 - sorc/fre-nctools.fd/tools/fregrid/env.pan | 6 - sorc/fre-nctools.fd/tools/fregrid/env.wcoss | 3 - .../tools/fregrid/env.wcoss_dell_p3 | 4 - sorc/fre-nctools.fd/tools/fregrid/env.zeus | 6 - .../tools/fregrid/fre-nctools.mk_cray | 90 --------- .../tools/fregrid/fre-nctools.mk_hera | 90 --------- .../tools/fregrid/fre-nctools.mk_jet | 90 --------- .../tools/fregrid/fre-nctools.mk_wcoss | 90 --------- .../fregrid/fre-nctools.mk_wcoss_dell_p3 | 90 --------- .../tools/make_hgrid/CMakeLists.txt | 15 ++ sorc/fre-nctools.fd/tools/make_hgrid/env.cray | 4 - .../fre-nctools.fd/tools/make_hgrid/env.cshrc | 7 - sorc/fre-nctools.fd/tools/make_hgrid/env.gaea | 4 - .../tools/make_hgrid/env.gfdl-ws | 6 - sorc/fre-nctools.fd/tools/make_hgrid/env.hera | 4 - sorc/fre-nctools.fd/tools/make_hgrid/env.jet | 7 - sorc/fre-nctools.fd/tools/make_hgrid/env.pan | 6 - .../fre-nctools.fd/tools/make_hgrid/env.wcoss | 3 - .../tools/make_hgrid/env.wcoss_dell_p3 | 4 - sorc/fre-nctools.fd/tools/make_hgrid/env.zeus | 6 - .../tools/make_hgrid/fre-nctools.mk_cray | 98 ---------- .../tools/make_hgrid/fre-nctools.mk_hera | 98 ---------- .../tools/make_hgrid/fre-nctools.mk_jet | 98 ---------- .../tools/make_hgrid/fre-nctools.mk_wcoss | 98 ---------- .../make_hgrid/fre-nctools.mk_wcoss_dell_p3 | 98 ---------- .../tools/make_solo_mosaic/CMakeLists.txt | 12 ++ .../tools/make_solo_mosaic/env.cray | 4 - .../tools/make_solo_mosaic/env.gaea | 4 - .../tools/make_solo_mosaic/env.gfdl-ws | 6 - .../tools/make_solo_mosaic/env.hera | 4 - .../tools/make_solo_mosaic/env.jet | 7 - .../tools/make_solo_mosaic/env.pan | 6 - .../tools/make_solo_mosaic/env.wcoss | 3 - .../tools/make_solo_mosaic/env.wcoss_dell_p3 | 4 - .../tools/make_solo_mosaic/env.zeus | 6 - .../make_solo_mosaic/fre-nctools.mk_cray | 76 -------- .../make_solo_mosaic/fre-nctools.mk_hera | 76 -------- .../tools/make_solo_mosaic/fre-nctools.mk_jet | 76 -------- .../make_solo_mosaic/fre-nctools.mk_wcoss | 76 -------- .../fre-nctools.mk_wcoss_dell_p3 | 76 -------- sorc/fre-nctools.fd/tools/shared/COPYING | 159 ---------------- .../tools/shave.fd/CMakeLists.txt | 10 + .../fre-nctools.fd/tools/shave.fd/build_shave | 36 ---- sorc/global_chgres.fd/CMakeLists.txt | 39 ++++ sorc/global_chgres.fd/Makefile | 62 ------ sorc/global_chgres.fd/chgres_utils.f90 | 70 +++---- sorc/global_chgres.fd/nrlmsise00_sub.f90 | 6 +- sorc/global_chgres.fd/read_write.f90 | 6 +- sorc/global_cycle.fd/CMakeLists.txt | 26 +++ sorc/global_cycle.fd/Makefile | 28 --- sorc/global_cycle.fd/makefile.sh | 21 -- sorc/machine-setup.sh | 5 +- sorc/mkgfsnemsioctl.fd/CMakeLists.txt | 12 ++ sorc/mkgfsnemsioctl.fd/makefile | 10 - .../{mkgfsnemsioctl.f => mkgfsnemsioctl.f90} | 0 sorc/nemsio_chgdate.fd/CMakeLists.txt | 17 ++ sorc/nemsio_chgdate.fd/makefile | 10 - sorc/nemsio_chgdate.fd/nemsio_chgdate.f90 | 10 +- sorc/nemsio_get.fd/CMakeLists.txt | 18 ++ sorc/nemsio_get.fd/makefile | 10 - .../{nemsio_get.f => nemsio_get.f90} | 0 sorc/nemsio_read.fd/CMakeLists.txt | 12 ++ sorc/nemsio_read.fd/makefile | 13 -- .../{nemsio_read.f => nemsio_read.f90} | 0 sorc/nst_tf_chg.fd/CMakeLists.txt | 24 +++ sorc/nst_tf_chg.fd/Makefile | 30 --- sorc/nst_tf_chg.fd/read_tfs_nc_2d.f90 | 5 +- sorc/orog.fd/CMakeLists.txt | 24 +++ sorc/orog.fd/Makefile | 29 --- sorc/orog.fd/mtnlm7_oclsm.f | 21 +- sorc/partial_ufs_build.sh | 179 ------------------ sorc/sfc_climo_gen.fd/CMakeLists.txt | 25 +++ sorc/sfc_climo_gen.fd/makefile | 46 ----- sorc/ufs_build.cfg | 15 -- ush/chgres_cube.sh | 2 +- ush/fv3gfs_driver_grid.sh | 12 +- ush/fv3gfs_make_orog.sh | 2 +- util/gdas_init/driver.cray.sh | 12 +- util/gdas_init/driver.dell.sh | 12 +- util/gdas_init/driver.hera.sh | 12 +- util/gdas_init/run_pre-v14.chgres.sh | 2 +- util/gdas_init/run_v14.chgres.sh | 2 +- util/gdas_init/run_v15.chgres.sh | 2 +- 259 files changed, 808 insertions(+), 4751 deletions(-) create mode 100644 .gitmodules create mode 100644 CMakeLists.txt create mode 100755 build_all.sh create mode 160000 cmake rename {sorc => fix}/link_fixdirs.sh (97%) rename modulefiles/{fv3gfs/global_chgres.hera => build.hera} (64%) create mode 100644 modulefiles/build.jet create mode 100644 modulefiles/build.orion create mode 100644 modulefiles/build.wcoss_cray rename modulefiles/{fv3gfs/global_chgres.wcoss_dell_p3 => build.wcoss_dell_p3} (53%) delete mode 100644 modulefiles/chgres_cube.hera delete mode 100644 modulefiles/chgres_cube.jet delete mode 100644 modulefiles/chgres_cube.linux.gnu delete mode 100644 modulefiles/chgres_cube.linux.intel delete mode 100644 modulefiles/chgres_cube.odin delete mode 100644 modulefiles/chgres_cube.wcoss_cray delete mode 100644 modulefiles/chgres_cube.wcoss_dell_p3 delete mode 100644 modulefiles/fv3gfs/fre-nctools.gaea delete mode 100644 modulefiles/fv3gfs/fre-nctools.hera delete mode 100644 modulefiles/fv3gfs/fre-nctools.jet delete mode 100644 modulefiles/fv3gfs/fre-nctools.wcoss delete mode 100644 modulefiles/fv3gfs/fre-nctools.wcoss_cray delete mode 100644 modulefiles/fv3gfs/fre-nctools.wcoss_dell_p3 delete mode 100644 modulefiles/fv3gfs/global_chgres.jet delete mode 100644 modulefiles/fv3gfs/global_chgres.wcoss delete mode 100644 modulefiles/fv3gfs/global_chgres.wcoss_cray delete mode 100644 modulefiles/fv3gfs/global_chgres.wcoss_cray_userlib delete mode 100644 modulefiles/fv3gfs/global_cycle.hera delete mode 100644 modulefiles/fv3gfs/global_cycle.jet delete mode 100644 modulefiles/fv3gfs/global_cycle.wcoss delete mode 100644 modulefiles/fv3gfs/global_cycle.wcoss_cray delete mode 100644 modulefiles/fv3gfs/global_cycle.wcoss_cray_userlib delete mode 100644 modulefiles/fv3gfs/global_cycle.wcoss_dell_p3 delete mode 100644 modulefiles/fv3gfs/nst_tf_chg.hera delete mode 100644 modulefiles/fv3gfs/nst_tf_chg.jet delete mode 100644 modulefiles/fv3gfs/nst_tf_chg.wcoss delete mode 100644 modulefiles/fv3gfs/nst_tf_chg.wcoss_cray delete mode 100644 modulefiles/fv3gfs/nst_tf_chg.wcoss_dell_p3 delete mode 100644 modulefiles/fv3gfs/orog.hera delete mode 100644 modulefiles/fv3gfs/orog.jet delete mode 100644 modulefiles/fv3gfs/orog.wcoss delete mode 100644 modulefiles/fv3gfs/orog.wcoss_cray delete mode 100644 modulefiles/fv3gfs/orog.wcoss_cray_userlib delete mode 100644 modulefiles/fv3gfs/orog.wcoss_dell_p3 delete mode 100644 modulefiles/module_nemsutil.hera delete mode 100644 modulefiles/module_nemsutil.jet delete mode 100644 modulefiles/module_nemsutil.wcoss delete mode 100644 modulefiles/module_nemsutil.wcoss_cray delete mode 100644 modulefiles/module_nemsutil.wcoss_cray_userlib delete mode 100644 modulefiles/module_nemsutil.wcoss_dell_p3 delete mode 100644 modulefiles/modulefile.global_emcsfc_ice_blend.hera delete mode 100644 modulefiles/modulefile.global_emcsfc_ice_blend.jet delete mode 100644 modulefiles/modulefile.global_emcsfc_ice_blend.wcoss delete mode 100644 modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_cray delete mode 100644 modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_cray_userlib delete mode 100644 modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_dell_p3 delete mode 100644 modulefiles/modulefile.global_emcsfc_snow2mdl.hera delete mode 100644 modulefiles/modulefile.global_emcsfc_snow2mdl.jet delete mode 100644 modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss delete mode 100644 modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_cray delete mode 100644 modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_cray_userlib delete mode 100644 modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_dell_p3 delete mode 100644 modulefiles/modulefile.sfc_climo_gen.hera delete mode 100644 modulefiles/modulefile.sfc_climo_gen.jet delete mode 100644 modulefiles/modulefile.sfc_climo_gen.wcoss_cray delete mode 100644 modulefiles/modulefile.sfc_climo_gen.wcoss_cray_userlib delete mode 100644 modulefiles/modulefile.sfc_climo_gen.wcoss_dell_p3 create mode 100644 sorc/CMakeLists.txt delete mode 100755 sorc/build_all_ufs_utils.sh delete mode 100755 sorc/build_chgres.sh delete mode 100755 sorc/build_chgres_cube.sh delete mode 100755 sorc/build_cycle.sh delete mode 100755 sorc/build_emcsfc.sh delete mode 100755 sorc/build_fre-nctools.sh delete mode 100755 sorc/build_nems_util.sh delete mode 100755 sorc/build_nst_tf_chg.sh delete mode 100755 sorc/build_orog.sh delete mode 100755 sorc/build_sfc_climo_gen.sh create mode 100644 sorc/chgres_cube.fd/CMakeLists.txt delete mode 100644 sorc/chgres_cube.fd/makefile delete mode 100644 sorc/chgres_cube.fd/run/config.C1152.l91.atm.theia.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C1152.l91.dell.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C1152.theia.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C384.cray.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C384.dell.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C384.gaussian.dell.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C384.theia.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C48.cray.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C48.dell.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C48.gaussian.theia.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C48.gfs.gaussian.theia.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C48.gfs.spectral.dell.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C48.gfs.spectral.theia.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C48.theia.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C768.atm.theia.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C768.l91.atm.theia.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C768.l91.dell.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C768.nest.atm.theia.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C768.nest.cray.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C768.nest.theia.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C768.stretch.cray.nml delete mode 100644 sorc/chgres_cube.fd/run/config.C768.stretch.theia.nml delete mode 100755 sorc/chgres_cube.fd/run/run.cray.sh delete mode 100755 sorc/chgres_cube.fd/run/run.dell.sh delete mode 100755 sorc/chgres_cube.fd/run/run.theia.ksh create mode 100644 sorc/emcsfc_ice_blend.fd/CMakeLists.txt delete mode 100755 sorc/emcsfc_ice_blend.fd/make.sh delete mode 100755 sorc/emcsfc_ice_blend.fd/makefile create mode 100644 sorc/emcsfc_snow2mdl.fd/CMakeLists.txt delete mode 100755 sorc/emcsfc_snow2mdl.fd/make.sh delete mode 100755 sorc/emcsfc_snow2mdl.fd/makefile create mode 100644 sorc/fre-nctools.fd/CMakeLists.txt create mode 100644 sorc/fre-nctools.fd/shared_lib/CMakeLists.txt rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/COPYING (100%) rename sorc/fre-nctools.fd/{tools/shared => shared_lib}/affinity.c (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/constant.h (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/create_xgrid.c (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/create_xgrid.h (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/gradient.F90 (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/gradient_c2l.c (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/gradient_c2l.h (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/grid.F90 (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/grid.html (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/interp.c (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/interp.h (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/mosaic.F90 (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/mosaic_util.c (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/mosaic_util.h (100%) rename sorc/fre-nctools.fd/{tools/shared => shared_lib}/mpp.c (100%) rename sorc/fre-nctools.fd/{tools/shared => shared_lib}/mpp.h (100%) rename sorc/fre-nctools.fd/{tools/shared => shared_lib}/mpp_domain.c (100%) rename sorc/fre-nctools.fd/{tools/shared => shared_lib}/mpp_domain.h (100%) rename sorc/fre-nctools.fd/{tools/shared => shared_lib}/mpp_io.c (100%) rename sorc/fre-nctools.fd/{tools/shared => shared_lib}/mpp_io.h (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/read_mosaic.c (100%) rename sorc/fre-nctools.fd/{shared/mosaic => shared_lib}/read_mosaic.h (100%) rename sorc/fre-nctools.fd/{tools/shared => shared_lib}/tool_util.c (100%) rename sorc/fre-nctools.fd/{tools/shared => shared_lib}/tool_util.h (100%) create mode 100644 sorc/fre-nctools.fd/tools/filter_topo/CMakeLists.txt delete mode 100644 sorc/fre-nctools.fd/tools/filter_topo/env.cshrc delete mode 100755 sorc/fre-nctools.fd/tools/filter_topo/make.csh_hera delete mode 100755 sorc/fre-nctools.fd/tools/filter_topo/make.csh_jet delete mode 100755 sorc/fre-nctools.fd/tools/filter_topo/make.csh_wcoss delete mode 100755 sorc/fre-nctools.fd/tools/filter_topo/make.csh_wcoss_cray delete mode 100755 sorc/fre-nctools.fd/tools/filter_topo/make.csh_wcoss_dell_p3 create mode 100644 sorc/fre-nctools.fd/tools/fregrid/CMakeLists.txt delete mode 100644 sorc/fre-nctools.fd/tools/fregrid/env.cray delete mode 100644 sorc/fre-nctools.fd/tools/fregrid/env.gaea delete mode 100644 sorc/fre-nctools.fd/tools/fregrid/env.gfdl-ws delete mode 100644 sorc/fre-nctools.fd/tools/fregrid/env.hera delete mode 100644 sorc/fre-nctools.fd/tools/fregrid/env.jet delete mode 100644 sorc/fre-nctools.fd/tools/fregrid/env.pan delete mode 100644 sorc/fre-nctools.fd/tools/fregrid/env.wcoss delete mode 100644 sorc/fre-nctools.fd/tools/fregrid/env.wcoss_dell_p3 delete mode 100644 sorc/fre-nctools.fd/tools/fregrid/env.zeus delete mode 100644 sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_cray delete mode 100644 sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_hera delete mode 100644 sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_jet delete mode 100644 sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_wcoss delete mode 100644 sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_wcoss_dell_p3 create mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/CMakeLists.txt delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/env.cray delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/env.cshrc delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/env.gaea delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/env.gfdl-ws delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/env.hera delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/env.jet delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/env.pan delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/env.wcoss delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/env.wcoss_dell_p3 delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/env.zeus delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_cray delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_hera delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_jet delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_wcoss delete mode 100644 sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_wcoss_dell_p3 create mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/CMakeLists.txt delete mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/env.cray delete mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/env.gaea delete mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/env.gfdl-ws delete mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/env.hera delete mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/env.jet delete mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/env.pan delete mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/env.wcoss delete mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/env.wcoss_dell_p3 delete mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/env.zeus delete mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_cray delete mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_hera delete mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_jet delete mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_wcoss delete mode 100644 sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_wcoss_dell_p3 delete mode 100644 sorc/fre-nctools.fd/tools/shared/COPYING create mode 100644 sorc/fre-nctools.fd/tools/shave.fd/CMakeLists.txt delete mode 100755 sorc/fre-nctools.fd/tools/shave.fd/build_shave create mode 100644 sorc/global_chgres.fd/CMakeLists.txt delete mode 100755 sorc/global_chgres.fd/Makefile create mode 100644 sorc/global_cycle.fd/CMakeLists.txt delete mode 100755 sorc/global_cycle.fd/Makefile delete mode 100755 sorc/global_cycle.fd/makefile.sh create mode 100644 sorc/mkgfsnemsioctl.fd/CMakeLists.txt delete mode 100755 sorc/mkgfsnemsioctl.fd/makefile rename sorc/mkgfsnemsioctl.fd/{mkgfsnemsioctl.f => mkgfsnemsioctl.f90} (100%) create mode 100644 sorc/nemsio_chgdate.fd/CMakeLists.txt delete mode 100755 sorc/nemsio_chgdate.fd/makefile create mode 100644 sorc/nemsio_get.fd/CMakeLists.txt delete mode 100755 sorc/nemsio_get.fd/makefile rename sorc/nemsio_get.fd/{nemsio_get.f => nemsio_get.f90} (100%) create mode 100644 sorc/nemsio_read.fd/CMakeLists.txt delete mode 100755 sorc/nemsio_read.fd/makefile rename sorc/nemsio_read.fd/{nemsio_read.f => nemsio_read.f90} (100%) create mode 100644 sorc/nst_tf_chg.fd/CMakeLists.txt delete mode 100755 sorc/nst_tf_chg.fd/Makefile create mode 100644 sorc/orog.fd/CMakeLists.txt delete mode 100755 sorc/orog.fd/Makefile delete mode 100755 sorc/partial_ufs_build.sh create mode 100644 sorc/sfc_climo_gen.fd/CMakeLists.txt delete mode 100755 sorc/sfc_climo_gen.fd/makefile delete mode 100644 sorc/ufs_build.cfg diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..5db8ad97a --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "cmake"] + path = cmake + url = https://github.com/NOAA-EMC/CMakeModules + branch = release/public-v1 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..7ae7980d4 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,117 @@ +cmake_minimum_required(VERSION 3.15) + +file(STRINGS "VERSION" pVersion) + +project( + ufs_util + VERSION ${pVersion} + LANGUAGES C Fortran) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") + +if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") + message(STATUS "Setting build type to 'Release' as none was specified.") + set(CMAKE_BUILD_TYPE + "Release" + CACHE STRING "Choose the type of build." FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" + "MinSizeRel" "RelWithDebInfo") +endif() + +if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU|Clang|AppleClang)$") + message(WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}") +endif() + +if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Intel|GNU)$") + message(WARNING "Compiler not officially supported: ${CMAKE_C_COMPILER_ID}") +endif() + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(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") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "-g -fbacktrace") + set(CMAKE_Fortran_FLAGS_RELEASE "-O3") + set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -ggdb -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check") +endif() + +if(CMAKE_C_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_C_FLAGS "-g -traceback") + set(CMAKE_C_FLAGS_RELEASE "-O2") + set(CMAKE_C_FLAGS_DEBUG "-O0") +elseif(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_C_FLAGS " ") + set(CMAKE_C_FLAGS_RELEASE " ") + set(CMAKE_C_FLAGS_DEBUG " ") +endif() + +find_package(PNG REQUIRED) +find_package(ZLIB REQUIRED) +find_package(Jasper REQUIRED) +find_package(NetCDF REQUIRED C Fortran) +find_package(MPI REQUIRED ) +find_package(ESMF MODULE REQUIRED) +find_package(WGRIB2 REQUIRED) + +option(OPENMP "use OpenMP threading" ON) +if(OPENMP) + find_package(OpenMP REQUIRED COMPONENTS Fortran) +endif() + +set(CMAKE_FIND_PACKAGE_PREFER_CONFIG true) + +if(NOT TARGET gfsio_4) + find_package(gfsio REQUIRED) +endif() + +if(NOT TARGET sfcio_4) + find_package(sfcio REQUIRED) +endif() + +if(NOT TARGET w3nco_d) + find_package(w3nco REQUIRED) +endif() + +if(NOT TARGET landsfcutil_d) + find_package(landsfcutil REQUIRED) +endif() + +if(NOT TARGET bacio_4) + find_package(bacio REQUIRED) +endif() + +if(NOT TARGET nemsio) + find_package(nemsio REQUIRED) +endif() + +if(NOT TARGET nemsiogfs) + find_package(nemsiogfs REQUIRED) +endif() + +if(NOT TARGET sigio_4) + find_package(sigio REQUIRED) +endif() + +if(NOT TARGET sp_d) + find_package(sp REQUIRED) +endif() + +if(NOT TARGET ip_d) + find_package(ip REQUIRED) +endif() + +if(NOT TARGET w3emc_d) + find_package(w3emc REQUIRED) +endif() + +if(NOT TARGET g2_d) + find_package(g2 REQUIRED) +endif() + +# EMC requires executables in ./exec +set(exec_dir bin) +if(EMC_EXEC_DIR) + set(exec_dir exec) +endif() + +add_subdirectory(sorc) diff --git a/build_all.sh b/build_all.sh new file mode 100755 index 000000000..854538b76 --- /dev/null +++ b/build_all.sh @@ -0,0 +1,32 @@ +#! /usr/bin/env bash +set -eux + +target=${target:-"NULL"} + +if [[ $target == "linux.gnu" || $target == "linux.intel" ]]; then + unset -f module +else + source ./sorc/machine-setup.sh > /dev/null 2>&1 +fi + +export MOD_PATH +source ./modulefiles/build.$target > /dev/null 2>&1 + +# +# --- Build all programs. +# + +rm -fr ./build +mkdir ./build +cd ./build + +if [[ $target == "wcoss_cray" ]]; then + cmake .. -DCMAKE_INSTALL_PREFIX=../ -DEMC_EXEC_DIR=ON +else + cmake .. -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_C_COMPILER=icc -DCMAKE_INSTALL_PREFIX=../ -DEMC_EXEC_DIR=ON +fi + +make -j 8 VERBOSE=1 +make install + +exit diff --git a/cmake b/cmake new file mode 160000 index 000000000..f38685844 --- /dev/null +++ b/cmake @@ -0,0 +1 @@ +Subproject commit f38685844f8a92defd7c7fb811befe71a2c954f5 diff --git a/driver_scripts/driver_grid.cray.sh b/driver_scripts/driver_grid.cray.sh index 6e8708a21..f0defe5b3 100755 --- a/driver_scripts/driver_grid.cray.sh +++ b/driver_scripts/driver_grid.cray.sh @@ -49,8 +49,8 @@ # #----------------------------------------------------------------------- -. $MODULESHOME/init/sh -module load PrgEnv-intel cfp-intel-sandybridge/1.1.0 +source ../sorc/machine-setup.sh > /dev/null 2>&1 +source ../modulefiles/build.$target module list #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.dell.sh b/driver_scripts/driver_grid.dell.sh index f193c4027..67ebbefa0 100755 --- a/driver_scripts/driver_grid.dell.sh +++ b/driver_scripts/driver_grid.dell.sh @@ -51,13 +51,8 @@ # #----------------------------------------------------------------------- -module purge -module load EnvVars/1.0.2 -module load lsf/10.1 -module load ips/18.0.1.163 -module load impi/18.0.1 -module load NetCDF/4.5.0 -module load HDF5-serial/1.10.1 +source ../sorc/machine-setup.sh > /dev/null 2>&1 +source ../modulefiles/build.$target module list #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.hera.sh b/driver_scripts/driver_grid.hera.sh index ad93e30e7..0bf50e2c2 100755 --- a/driver_scripts/driver_grid.hera.sh +++ b/driver_scripts/driver_grid.hera.sh @@ -51,12 +51,8 @@ set -x -. /apps/lmod/lmod/init/sh -module purge -module load intel/18.0.5.274 -module load impi/2018.0.4 -module load hdf5/1.10.5 -module load netcdf/4.7.0 +source ../sorc/machine-setup.sh > /dev/null 2>&1 +source ../modulefiles/build.$target module list #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.jet.sh b/driver_scripts/driver_grid.jet.sh index 7035b33f7..efc322354 100755 --- a/driver_scripts/driver_grid.jet.sh +++ b/driver_scripts/driver_grid.jet.sh @@ -52,13 +52,8 @@ set -x -. /apps/lmod/lmod/init/sh -module purge -module load intel/18.0.5.274 -module load impi/2018.4.274 -module load szip -module load hdf5 -module load netcdf/4.2.1.1 +source ../sorc/machine-setup.sh > /dev/null 2>&1 +source ../modulefiles/build.$target module list #----------------------------------------------------------------------- diff --git a/sorc/link_fixdirs.sh b/fix/link_fixdirs.sh similarity index 97% rename from sorc/link_fixdirs.sh rename to fix/link_fixdirs.sh index d5fbc1cde..fec3a44af 100755 --- a/sorc/link_fixdirs.sh +++ b/fix/link_fixdirs.sh @@ -44,7 +44,6 @@ elif [ $machine = "hera" ]; then elif [ $machine = "jet" ]; then FIX_DIR="/lfs3/projects/hfv3gfs/glopara/git/fv3gfs/fix" fi -cd ${pwd}/../fix ||exit 8 for dir in fix_am fix_fv3 fix_orog fix_fv3_gmted2010 fix_sfc_climo; do [[ -d $dir ]] && rm -rf $dir $LINK $FIX_DIR/$dir . diff --git a/modulefiles/fv3gfs/global_chgres.hera b/modulefiles/build.hera similarity index 64% rename from modulefiles/fv3gfs/global_chgres.hera rename to modulefiles/build.hera index 564a51b5d..98f2e11a4 100644 --- a/modulefiles/fv3gfs/global_chgres.hera +++ b/modulefiles/build.hera @@ -1,24 +1,27 @@ #%Module##################################################### -## global_chgres component - hera +## Build and run module for Hera ############################################################# -# Loading Intel Compiler Suite +module load hpss +module load cmake/3.16.1 module load intel/18.0.5.274 module load impi/2018.0.4 -# Loding nceplibs modules -module use -a $MOD_PATH -module load sigio/2.1.0 +module use -a /scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles module load w3nco/2.0.6 module load w3emc/2.3.0 -module load sp/2.0.2 -module load bacio/2.0.2 module load nemsio/2.2.3 -module load nemsiogfs/2.2.0 +module load bacio/2.0.2 +module load sp/2.0.2 module load ip/3.0.1 module load sfcio/1.1.0 +module load sigio/2.1.0 module load gfsio/1.1.0 +module load nemsiogfs/2.2.0 module load landsfcutil/2.1.0 +module load g2/2.5.0 + module load netcdf_parallel/4.7.4 +module load esmf/8.0.0_ParallelNetCDF -set FCMP ifort +export WGRIB2_ROOT="/scratch1/NCEPDEV/da/George.Gayno/noscrub/wgrib2" diff --git a/modulefiles/build.jet b/modulefiles/build.jet new file mode 100644 index 000000000..f477d6a62 --- /dev/null +++ b/modulefiles/build.jet @@ -0,0 +1,30 @@ +#%Module##################################################### +## Build and run module for Jet +############################################################# + +module use /lfs3/projects/hfv3gfs/nwprod/NCEPLIBS/modulefiles +module load cmake/3.16.1 +module load intel/18.0.5.274 +module load impi/2018.4.274 +module load szip/2.1 +module load hdf5/1.10.4 +module load netcdf/4.6.1 +export NETCDF="/apps/netcdf/4.6.1/intel/18.0.5.274" +module load w3nco/v2.0.6 +module load w3emc/v2.2.0 +module load sp/v2.0.2 +module load ip/v3.0.0 +module load bacio/v2.0.2 +module load sigio/v2.1.0 +module load sfcio/v1.0.0 +module load nemsio/v2.2.3 +module load nemsiogfs/v2.0.1 +module load gfsio/v1.1.0 +module load landsfcutil/v2.1.0 +module load g2/v3.1.0 + +# Use DTCs version of esmf v8. POC Dom H. +module use -a /lfs3/projects/hfv3gfs/GMTB/modulefiles/intel-18.0.5.274 +module load esmf/8.0.0 + +export WGRIB2_ROOT="/mnt/lfs3/projects/hwrfv3/Jili.Dong/wgrib2-2.0.8/grib2/lib" diff --git a/modulefiles/build.orion b/modulefiles/build.orion new file mode 100644 index 000000000..0adf7b990 --- /dev/null +++ b/modulefiles/build.orion @@ -0,0 +1,31 @@ +############################################################# +## Build module for Orion +############################################################# + +module load cmake/3.15.4 +module load intel/2020 +module load impi/2020 + +module use -a /apps/contrib/NCEPLIBS/orion/modulefiles +module load w3nco/2.1.0 +module load nemsio/2.3.0 +module load bacio/2.2.0 +module load sp/2.1.0 +module load sfcio/1.2.0 +module load sigio/2.2.0 +module load gfsio/1.2.0 +module load w3emc/2.5.0 +module load ip/3.1.0 +module load nemsiogfs/2.3.0 +module load landsfcutil/2.2.0 + +# George V's version. +module use -a /apps/contrib/NCEPLIBS/lib/modulefiles +module load g2-intel-sandybridge/2.5.0 + +export Jasper_ROOT="/apps/jasper-1.900.1" + +module load netcdf/4.7.2-parallel +module load esmf/8.0.0_ParallelNetCDF + +export WGRIB2_ROOT="/work/noaa/da/ggayno/save/wgrib2" diff --git a/modulefiles/build.wcoss_cray b/modulefiles/build.wcoss_cray new file mode 100644 index 000000000..026ef6e7a --- /dev/null +++ b/modulefiles/build.wcoss_cray @@ -0,0 +1,39 @@ +#%Module##################################################### +## Build and run module for WCOSS-Cray +############################################################# + +module load hpss/4.1.0.3 +module load xt-lsfhpc/9.1.3 +module load cfp-intel-sandybridge/1.1.0 +module load cmake/3.16.2 +module load PrgEnv-intel/5.2.56 +module rm intel +module load intel/16.3.210 +module load cray-mpich/7.2.0 +module load craype-haswell +module load alps/5.2.4-2.0502.9822.32.1.ari +module load cray-netcdf/4.3.3.1 +module load cray-hdf5/1.8.14 +module load w3nco-intel/2.0.6 +module load nemsio-intel/2.2.3 +module load bacio-intel/2.0.2 +module load sp-intel/2.0.2 +module load ip-intel/3.0.0 +module load sigio-intel/2.1.0 +module load sfcio-intel/1.0.0 +module load landsfcutil-intel/2.1.0 +module load gfsio-intel/1.1.0 +module load w3emc-intel/2.2.0 +module load nemsiogfs-intel/2.0.1 +module load g2-intel/2.5.0 +export ZLIB_ROOT=/usrx/local/prod/zlib/1.2.7/intel/haswell +export PNG_ROOT=/usrx/local/prod//png/1.2.49/intel/haswell +export Jasper_ROOT=/usrx/local/prod/jasper/1.900.1/intel/haswell + +module use /gpfs/hps3/emc/nems/noscrub/emc.nemspara/soft/modulefiles +module load esmf/8.0.0 +export NETCDF=/opt/cray/netcdf/4.3.3.1/INTEL/14.0 +module rm gcc +module load gcc/6.3.0 + +export WGRIB2_ROOT=/gpfs/hps3/emc/global/noscrub/George.Gayno/wgrib2 diff --git a/modulefiles/fv3gfs/global_chgres.wcoss_dell_p3 b/modulefiles/build.wcoss_dell_p3 similarity index 53% rename from modulefiles/fv3gfs/global_chgres.wcoss_dell_p3 rename to modulefiles/build.wcoss_dell_p3 index 56de3b799..3276ccb4a 100644 --- a/modulefiles/fv3gfs/global_chgres.wcoss_dell_p3 +++ b/modulefiles/build.wcoss_dell_p3 @@ -1,25 +1,31 @@ #%Module##################################################### -## global_chgres component - wcoss_dell_p3 +## Build and run module for WCOSS-Dell P3 ############################################################# + +module load lsf/10.1 +module load HPSS/5.0.2.5 +module load cmake/3.16.2 module load ips/18.0.1.163 module load impi/18.0.1 - module load w3nco/2.0.6 module load w3emc/2.3.0 module load sp/2.0.2 module load nemsio/2.2.3 -module load nemsiogfs/2.0.1 +module load bacio/2.0.2 module load ip/3.0.1 module load sfcio/1.0.0 +module load sigio/2.1.0 module load gfsio/1.1.0 module load landsfcutil/2.1.0 -module load bacio/2.0.2 -module load sigio/2.1.0 +module load nemsiogfs/2.0.1 +module load g2/3.1.0 +module load jasper/1.900.29 +export Jasper_ROOT="/usrx/local/prod/packages/gnu/4.8.5/jasper/1.900.29" module use /usrx/local/nceplibs/dev/NCEPLIBS/modulefiles module load netcdf_parallel/4.7.4 -# -export FCMP=ifort -export LDFLAGSM="-qopenmp -auto" -export OMPFLAGM="-qopenmp -auto" +module use /gpfs/dell2/emc/modeling/noscrub/emc.nemspara/soft/modulefiles +module load esmf/8.0.0_ParallelNetCDF + +export WGRIB2_ROOT=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/wgrib2 diff --git a/modulefiles/chgres_cube.hera b/modulefiles/chgres_cube.hera deleted file mode 100644 index 5bc36f078..000000000 --- a/modulefiles/chgres_cube.hera +++ /dev/null @@ -1,26 +0,0 @@ -#%Module##################################################### -## Build module for Hera -############################################################# - -module load intel/18.0.5.274 -module load impi/2018.0.4 - -module use -a $MOD_PATH -module load w3nco/2.0.6 -module load nemsio/2.2.3 -module load bacio/2.0.2 -module load sp/2.0.2 -module load sfcio/1.1.0 -module load sigio/2.1.0 - -export NCEPLIBS=/scratch1/NCEPDEV/global/gwv/l819/lib -module use -a $NCEPLIBS/modulefiles -module load esmflocal/8_0_48b.netcdf47 - -export WGRIB2API_INC="/apps/wgrib2/2.0.8/intel/18.0.3.222/lib" -export WGRIB2_LIB="/apps/wgrib2/2.0.8/intel/18.0.3.222/lib/libwgrib2.a" - -export FCOMP=mpiifort -export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" -# for debugging -#export FFLAGS="-O0 -g -traceback -r8 -i4 -qopenmp -convert big_endian -check bounds -warn unused -assume byterecl" diff --git a/modulefiles/chgres_cube.jet b/modulefiles/chgres_cube.jet deleted file mode 100644 index 6a1f9340e..000000000 --- a/modulefiles/chgres_cube.jet +++ /dev/null @@ -1,27 +0,0 @@ -#%Module##################################################### -## chgres build module for Jet -############################################################# - -module load intel/18.0.5.274 -module load impi/2018.4.274 -module load szip/2.1 -module load hdf5/1.8.9 -module load netcdf/4.2.1.1 - -module load w3nco/v2.0.6 -module load sp/v2.0.2 -module load bacio/v2.0.2 -module load sigio/v2.1.0 -module load sfcio/v1.0.0 -module load nemsio/v2.2.3 - -module use /mnt/lfs3/projects/hfv3gfs/gwv/ljtjet/lib/modulefiles -module load esmflocal/ESMF_8_0_0_beta_snapshot_21 - -export FCOMP=mpiifort -export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" -#debug -#export FFLAGS="-O0 -g -traceback -r8 -i4 -qopenmp -convert big_endian -check bounds -warn unused -assume byterecl" - -export WGRIB2API_INC="/mnt/lfs3/projects/hwrfv3/Jili.Dong/wgrib2-2.0.8/grib2/lib" -export WGRIB2_LIB="/mnt/lfs3/projects/hwrfv3/Jili.Dong/wgrib2-2.0.8/grib2/lib/libwgrib2.a" diff --git a/modulefiles/chgres_cube.linux.gnu b/modulefiles/chgres_cube.linux.gnu deleted file mode 100644 index ba76044c2..000000000 --- a/modulefiles/chgres_cube.linux.gnu +++ /dev/null @@ -1,24 +0,0 @@ -############################################################# -## chgres_cube component - linux.gnu -############################################################# - -export IP_INCd=${NCEPLIBS}/ip/include_d -export NEMSIO_INC=${NCEPLIBS}/nemsio/include -export SFCIO_INC4=${NCEPLIBS}/sfcio/include_4 -export SIGIO_INC4=${NCEPLIBS}/sigio/include_4 - -export BACIO_LIB4=${NCEPLIBS}/bacio/lib/libbacio_v2.1.0_4.a -export IP_LIBd=${NCEPLIBS}/ip/lib/libip_v3.0.0_d.a -export NEMSIO_LIB=${NCEPLIBS}/nemsio/lib/libnemsio_v2.2.3.a -export SFCIO_LIB4=${NCEPLIBS}/sfcio/lib/libsfcio_v1.1.0_4.a -export SIGIO_LIB4=${NCEPLIBS}/sigio/lib/libsigio_v2.1.0_4.a -export SP_LIBd=${NCEPLIBS}/sp/lib/libsp_v2.0.2_d.a -export W3NCO_LIBd=${NCEPLIBS}/w3nco/lib/libw3nco_v2.0.6_d.a - -export WGRIB2API_INC=${WGRIB2_DIR}/include -export WGRIB2_LIB=${WGRIB2_DIR}/lib/libwgrib2.a - -export FCOMP=mpif90 -export FFLAGS="-O3 -g -fbacktrace -fdefault-real-8 -ffree-line-length-none -fopenmp -fconvert=big-endian" -# for debugging -#export FFLAGS="-O0 -g -fbacktrace -fdefault-real-8 -ffree-line-length-none -fopenmp -fconvert=big-endian" diff --git a/modulefiles/chgres_cube.linux.intel b/modulefiles/chgres_cube.linux.intel deleted file mode 100644 index 9af64a3b9..000000000 --- a/modulefiles/chgres_cube.linux.intel +++ /dev/null @@ -1,24 +0,0 @@ -############################################################# -## chgres_cube component - linux.intel -############################################################# - -export IP_INCd=${NCEPLIBS}/ip/include_d -export NEMSIO_INC=${NCEPLIBS}/nemsio/include -export SFCIO_INC4=${NCEPLIBS}/sfcio/include_4 -export SIGIO_INC4=${NCEPLIBS}/sigio/include_4 - -export BACIO_LIB4=${NCEPLIBS}/bacio/lib/libbacio_v2.1.0_4.a -export IP_LIBd=${NCEPLIBS}/ip/lib/libip_v3.0.0_d.a -export NEMSIO_LIB=${NCEPLIBS}/nemsio/lib/libnemsio_v2.2.3.a -export SFCIO_LIB4=${NCEPLIBS}/sfcio/lib/libsfcio_v1.1.0_4.a -export SIGIO_LIB4=${NCEPLIBS}/sigio/lib/libsigio_v2.1.0_4.a -export SP_LIBd=${NCEPLIBS}/sp/lib/libsp_v2.0.2_d.a -export W3NCO_LIBd=${NCEPLIBS}/w3nco/lib/libw3nco_v2.0.6_d.a - -export WGRIB2API_INC=${WGRIB2_DIR}/include -export WGRIB2_LIB=${WGRIB2_DIR}/lib/libwgrib2.a - -export FCOMP=mpif90 -export FFLAGS="-O3 -fp-model source -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" -# for debugging -#export FFLAGS="-O0 -g -traceback -r8 -i4 -qopenmp -convert big_endian -check bounds -warn unused -assume byterecl" diff --git a/modulefiles/chgres_cube.odin b/modulefiles/chgres_cube.odin deleted file mode 100644 index ecbc18977..000000000 --- a/modulefiles/chgres_cube.odin +++ /dev/null @@ -1,27 +0,0 @@ -#%Module##################################################### -## chgres build module for Odin -############################################################# - -module use /oldscratch/ywang/external/modulefiles -module load esmf/8.0.0bs30 - -module load cray-netcdf-hdf5parallel -module load cray-parallel-netcdf -module load cray-hdf5-parallel -module load w3nco/v2.0.6 -module load nemsio/v2.2.2 -module load bacio/v2.0.2 -module load sp/v2.0.2 -module load sfcio/v1.0.0 -module load sigio/v2.0.1 - - -export FCOMP=ftn -export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" -export WGRIB2API_LIB="/home/larissa.reames/tmp/wgrib2-2/grib2/lib/libwgrib2_api.a" -export WGRIB2API_INC="/home/larissa.reames/tmp/wgrib2-2/grib2/lib" -export WGRIB2_LIB="/home/larissa.reames/tmp/wgrib2-2/grib2/lib/libwgrib2.a" - - -# for debugging -#export FFLAGS="-O0 -g -traceback -r8 -i4 -qopenmp -convert big_endian -check bounds -warn unused -assume byterecl" diff --git a/modulefiles/chgres_cube.wcoss_cray b/modulefiles/chgres_cube.wcoss_cray deleted file mode 100644 index d80eaaa35..000000000 --- a/modulefiles/chgres_cube.wcoss_cray +++ /dev/null @@ -1,31 +0,0 @@ -#%Module##################################################### -## chgres build module for WCOSS-Cray -############################################################# - -module load PrgEnv-intel/5.2.56 -module rm intel -module load intel/16.3.210 -module load cray-mpich/7.2.0 -module load craype-haswell -module load cray-netcdf/4.3.3.1 -module load cray-hdf5/1.8.14 -module load w3nco-intel/2.0.6 -module load nemsio-intel/2.2.3 -module load bacio-intel/2.0.2 -module load sp-intel/2.0.2 -module load sigio-intel/2.1.0 -module load sfcio-intel/1.0.0 - -module use /gpfs/hps3/emc/nems/noscrub/emc.nemspara/soft/modulefiles -module load esmf/8.0.0 -module rm gcc -module load gcc/4.9.2 - - -export WGRIB2API_INC=/gpfs/hps3/emc/global/noscrub/George.Gayno/wgrib2/include -export WGRIB2_LIB=/gpfs/hps3/emc/global/noscrub/George.Gayno/wgrib2/lib/libwgrib2.a - -export FCOMP=ftn -export FFLAGS="-O3 -fp-model precise -g -r8 -i4 -qopenmp -convert big_endian -assume byterecl" -# for debugging -#export FFLAGS="-O0 -g -r8 -i4 -qopenmp -convert big_endian -check bounds -assume byterecl -warn unused" diff --git a/modulefiles/chgres_cube.wcoss_dell_p3 b/modulefiles/chgres_cube.wcoss_dell_p3 deleted file mode 100644 index 02c8e36e6..000000000 --- a/modulefiles/chgres_cube.wcoss_dell_p3 +++ /dev/null @@ -1,24 +0,0 @@ -#%Module##################################################### -## chgres build module for WCOSS-Dell P3 -############################################################# - -module load ips/18.0.1.163 -module load impi/18.0.1 -module load NetCDF/4.5.0 -module load w3nco/2.0.6 -module load sp/2.0.2 -module load nemsio/2.2.3 -module load bacio/2.0.2 -module load sfcio/1.0.0 -module load sigio/2.1.0 - -module use /gpfs/dell2/emc/modeling/noscrub/emc.nemspara/soft/modulefiles -module load esmf/8.0.0 - -export WGRIB2API_INC=/u/Wesley.Ebisuzaki/home/grib2.v2.0.8.intel/lib -export WGRIB2_LIB=/u/Wesley.Ebisuzaki/home/grib2.v2.0.8.intel/lib/libwgrib2.a - -export FCOMP=mpif90 -export FFLAGS="-O3 -fp-model precise -g -traceback -r8 -i4 -qopenmp -convert big_endian -assume byterecl" -# for debugging -#export FFLAGS="-O0 -g -traceback -r8 -i4 -qopenmp -convert big_endian -check bounds -warn unused -assume byterecl" diff --git a/modulefiles/fv3gfs/fre-nctools.gaea b/modulefiles/fv3gfs/fre-nctools.gaea deleted file mode 100644 index edce66357..000000000 --- a/modulefiles/fv3gfs/fre-nctools.gaea +++ /dev/null @@ -1,10 +0,0 @@ -#%Module##################################################### -## Module file for fre-nctools -############################################################# - module rm PrgEnv-pgi PrgEnv-pathscale PrgEnv-intel PrgEnv-cray PrgEnv-gnu - module load PrgEnv-intel - module swap intel intel/15.0.2.164 - module load cray-hdf5 - module load cray-netcdf - #setenv LIBRARY_PATH ${LIBRARY_PATH}:${NETCDF_DIR}/lib:${HDF5}/lib - diff --git a/modulefiles/fv3gfs/fre-nctools.hera b/modulefiles/fv3gfs/fre-nctools.hera deleted file mode 100644 index e035db231..000000000 --- a/modulefiles/fv3gfs/fre-nctools.hera +++ /dev/null @@ -1,9 +0,0 @@ -#%Module##################################################### -## Module file for fre-nctools -############################################################# - -module load intel/18.0.5.274 -module load impi/2018.0.4 - -module load netcdf/4.7.0 -module load hdf5/1.10.5 diff --git a/modulefiles/fv3gfs/fre-nctools.jet b/modulefiles/fv3gfs/fre-nctools.jet deleted file mode 100644 index 9ba89bf9f..000000000 --- a/modulefiles/fv3gfs/fre-nctools.jet +++ /dev/null @@ -1,8 +0,0 @@ -#%Module##################################################### -## Module file for fre-nctools -############################################################# -module load intel/18.0.5.274 -module load impi/2018.4.274 -module load szip/2.1 -module load hdf5/1.8.9 -module load netcdf/4.2.1.1 diff --git a/modulefiles/fv3gfs/fre-nctools.wcoss b/modulefiles/fv3gfs/fre-nctools.wcoss deleted file mode 100644 index ce886dcab..000000000 --- a/modulefiles/fv3gfs/fre-nctools.wcoss +++ /dev/null @@ -1,6 +0,0 @@ -#%Module##################################################### -## Module file for fre-nctools -############################################################# - -module load ics/16.0.3 -module load NetCDF/4.2/serial diff --git a/modulefiles/fv3gfs/fre-nctools.wcoss_cray b/modulefiles/fv3gfs/fre-nctools.wcoss_cray deleted file mode 100644 index c143b3a35..000000000 --- a/modulefiles/fv3gfs/fre-nctools.wcoss_cray +++ /dev/null @@ -1,9 +0,0 @@ -#%Module##################################################### -## Module file for fre-nctools -############################################################# -module load PrgEnv-intel -module rm intel -module load intel/16.3.210 -module load craype-haswell -module load cray-netcdf -module load cray-hdf5 diff --git a/modulefiles/fv3gfs/fre-nctools.wcoss_dell_p3 b/modulefiles/fv3gfs/fre-nctools.wcoss_dell_p3 deleted file mode 100644 index 75a933a35..000000000 --- a/modulefiles/fv3gfs/fre-nctools.wcoss_dell_p3 +++ /dev/null @@ -1,9 +0,0 @@ -#%Module##################################################### -## Module file for fre-nctools, wcoss_dell_p3 -############################################################# -# -module load ips/18.0.1.163 -module load impi/18.0.1 - -module load NetCDF/4.5.0 -module load HDF5-serial/1.10.1 diff --git a/modulefiles/fv3gfs/global_chgres.jet b/modulefiles/fv3gfs/global_chgres.jet deleted file mode 100644 index 088023563..000000000 --- a/modulefiles/fv3gfs/global_chgres.jet +++ /dev/null @@ -1,26 +0,0 @@ -#%Module##################################################### -## global_chgres component - jet -############################################################# - -module purge -module load intel/18.0.5.274 -module load szip/2.1 -module load hdf5/1.8.9 -module load netcdf/4.2.1.1 - -module load ip/v3.0.0 -module load sp/v2.0.2 -module load w3emc/v2.2.0 -module load w3nco/v2.0.6 -module load bacio/v2.0.2 -module load sigio/v2.1.0 -module load nemsio/v2.2.3 -module load nemsiogfs/v2.0.1 -module load sfcio/v1.0.0 -module load gfsio/v1.1.0 -module load landsfcutil/v2.1.0 - -export NETCDF_INCLUDE="-I${NETCDF}/include" -export NETCDF_LDFLAGS_F="-L${NETCDF}/lib -lnetcdf -lnetcdff -L${HDF5}/lib -lhdf5 -lhdf5_fortran" - -set FCMP ifort diff --git a/modulefiles/fv3gfs/global_chgres.wcoss b/modulefiles/fv3gfs/global_chgres.wcoss deleted file mode 100644 index 1d30465a5..000000000 --- a/modulefiles/fv3gfs/global_chgres.wcoss +++ /dev/null @@ -1,22 +0,0 @@ -#%Module##################################################### -## global_chgres component - wcoss -############################################################# - -# Loading Intel Compiler Suite -module load ics/15.0.6 - -# Loading nceplibs modules -module load sigio/v2.1.0 -module load w3nco/v2.0.6 -module load w3emc/v2.2.0 -module load sp/v2.0.2 -module load bacio/v2.0.2 -module load nemsio/v2.2.1 -module load nemsiogfs/v2.0.1 -module load ip/v3.0.0 -module load sfcio/v1.0.0 -module load gfsio/v1.1.0 -module load landsfcutil/v2.1.0 -module load NetCDF/4.2/serial - -export FCMP=ifort diff --git a/modulefiles/fv3gfs/global_chgres.wcoss_cray b/modulefiles/fv3gfs/global_chgres.wcoss_cray deleted file mode 100644 index e24138b2e..000000000 --- a/modulefiles/fv3gfs/global_chgres.wcoss_cray +++ /dev/null @@ -1,27 +0,0 @@ -#%Module##################################################### -## global_chgres component - wcoss -############################################################# -module load ncep/1.0 -module load PrgEnv-intel/5.2.56 -module rm intel -module load intel/16.3.210 -module load cray-mpich/7.2.0 -module load craype-haswell -module load cray-netcdf - -# Load NCEPLIBS modules -module load sigio-intel/2.1.0 -module load w3nco-intel/2.0.6 -module load w3emc-intel/2.2.0 -module load sp-intel/2.0.2 -module load nemsio-intel/2.2.2 -module load nemsiogfs-intel/2.0.1 -module load ip-intel/3.0.0 -module load sfcio-intel/1.0.0 -module load gfsio-intel/1.1.0 -module load landsfcutil-intel/2.1.0 -module load bacio-intel/2.0.1 - -export FCMP=ftn -export NETCDF_INCLUDE="" -export NETCDF_LDFLAGS_F="" diff --git a/modulefiles/fv3gfs/global_chgres.wcoss_cray_userlib b/modulefiles/fv3gfs/global_chgres.wcoss_cray_userlib deleted file mode 100644 index 79f19b35f..000000000 --- a/modulefiles/fv3gfs/global_chgres.wcoss_cray_userlib +++ /dev/null @@ -1,29 +0,0 @@ -#%Module##################################################### -## global_chgres component - wcoss -############################################################# -module load ncep/1.0 -module load PrgEnv-intel/5.2.56 -module rm intel -module load intel/16.3.210 -module load cray-mpich/7.2.0 -module load craype-haswell -module load cray-netcdf - -module unuse /gpfs/hps/nco/ops/nwprod/lib/modulefiles -module use -a $MOD_PATH -module load nemsiogfs/v2.0.1 -module load sigio/v2.0.1 -module load w3nco/v2.0.6 -module load w3emc/v2.2.0 -module load sp/v2.0.2 -module load bacio/v2.0.2 -module load nemsio/v2.2.3 - -module load ip/v3.0.0 -module load sfcio/v1.0.0 -module load gfsio/v1.1.0 -module load landsfcutil/v2.1.0 - -export FCMP=ftn -export NETCDF_INCLUDE="" -export NETCDF_LDFLAGS_F="" diff --git a/modulefiles/fv3gfs/global_cycle.hera b/modulefiles/fv3gfs/global_cycle.hera deleted file mode 100644 index db85174d5..000000000 --- a/modulefiles/fv3gfs/global_cycle.hera +++ /dev/null @@ -1,17 +0,0 @@ -#%Module##################################################### -## global_cycle component - hera -############################################################# - -# Loading Intel Compiler Suite -module load intel/18.0.5.274 -module load impi/2018.0.4 - -# Loding nceplibs modules -module use -a $MOD_PATH -module load w3nco/2.0.6 -module load sp/2.0.2 -module load bacio/2.0.2 -module load ip/3.0.1 -module load netcdf_parallel/4.7.4 - -export FCMP=mpiifort diff --git a/modulefiles/fv3gfs/global_cycle.jet b/modulefiles/fv3gfs/global_cycle.jet deleted file mode 100644 index fc12b53f8..000000000 --- a/modulefiles/fv3gfs/global_cycle.jet +++ /dev/null @@ -1,19 +0,0 @@ -#%Module##################################################### -## global_cycle component - jet -############################################################# - -# Loading Intel Compiler Suite -module load intel/18.0.5.274 -module load impi/2018.4.274 - -module load w3nco/v2.0.6 -module load sp/v2.0.2 -module load bacio/v2.0.2 -module load ip/v3.0.0 -module load szip -module load hdf5/1.8.9 -module load netcdf/4.2.1.1 -export NETCDF_INCLUDE="-I${NETCDF}/include" -export NETCDF_LDFLAGS_F="-L${NETCDF}/lib -lnetcdf -lnetcdff -L${HDF5}/lib -lhdf5 -lhdf5_fortran" - -export FCMP=mpiifort diff --git a/modulefiles/fv3gfs/global_cycle.wcoss b/modulefiles/fv3gfs/global_cycle.wcoss deleted file mode 100644 index fbab1cc94..000000000 --- a/modulefiles/fv3gfs/global_cycle.wcoss +++ /dev/null @@ -1,16 +0,0 @@ -#%Module##################################################### -## global_cycle component - wcoss -############################################################# - -# Loading Intel Compiler Suite -module load ics/16.0.3 -module load ibmpe/1.3.0.12 - -# Loading nceplibs modules -module load w3nco/v2.0.6 -module load sp/v2.0.2 -module load bacio/v2.0.2 -module load ip/v3.0.0 -module load NetCDF/4.2/serial - -export FCMP=mpfort diff --git a/modulefiles/fv3gfs/global_cycle.wcoss_cray b/modulefiles/fv3gfs/global_cycle.wcoss_cray deleted file mode 100644 index e1a4ed9d1..000000000 --- a/modulefiles/fv3gfs/global_cycle.wcoss_cray +++ /dev/null @@ -1,21 +0,0 @@ -#%Module##################################################### -## global_cycle component - wcoss_cray -############################################################# -# Load ncep environment -module load ncep/1.0 - -# Load Intel environment -module load PrgEnv-intel/5.2.56 -module rm intel -module load intel/16.3.210 -module load cray-mpich/7.2.0 -module load craype-haswell -module load cray-netcdf - -# Load NCEPLIBS modules -module load w3nco-intel/2.0.6 -module load sp-intel/2.0.2 -module load ip-intel/3.0.0 -module load bacio-intel/2.0.1 - -export FCMP=ftn diff --git a/modulefiles/fv3gfs/global_cycle.wcoss_cray_userlib b/modulefiles/fv3gfs/global_cycle.wcoss_cray_userlib deleted file mode 100644 index de700b6de..000000000 --- a/modulefiles/fv3gfs/global_cycle.wcoss_cray_userlib +++ /dev/null @@ -1,24 +0,0 @@ -#%Module##################################################### -## global_cycle component - wcoss_cray -############################################################# -module purge -# Load ncep environment -module load ncep/1.0 - -# Load Intel environment -module load PrgEnv-intel/5.2.56 -module rm intel -module load intel/16.3.210 -module load cray-mpich/7.2.0 -module load craype-haswell -module load cray-netcdf - -# Load NCEPLIBS modules -module unuse /gpfs/hps/nco/ops/nwprod/lib/modulefiles -module use -a $MOD_PATH -module load w3nco-intel/2.0.6 -module load sp-intel/2.0.2 -module load ip-intel/3.0.0 -module load bacio-intel/2.0.1 - -export FCMP=ftn diff --git a/modulefiles/fv3gfs/global_cycle.wcoss_dell_p3 b/modulefiles/fv3gfs/global_cycle.wcoss_dell_p3 deleted file mode 100644 index eb9681dcc..000000000 --- a/modulefiles/fv3gfs/global_cycle.wcoss_dell_p3 +++ /dev/null @@ -1,17 +0,0 @@ -#%Module##################################################### -## global_cycle component - wcoss_dell_p3 -############################################################# - -module load ips/18.0.1.163 -module load impi/18.0.1 - -module load w3nco/2.0.6 -module load sp/2.0.2 -module load ip/3.0.1 -module load bacio/2.0.2 - -module use /usrx/local/nceplibs/dev/NCEPLIBS/modulefiles -module load netcdf_parallel/4.7.4 - -export FCMP=mpif90 - diff --git a/modulefiles/fv3gfs/nst_tf_chg.hera b/modulefiles/fv3gfs/nst_tf_chg.hera deleted file mode 100644 index 2bbd3a802..000000000 --- a/modulefiles/fv3gfs/nst_tf_chg.hera +++ /dev/null @@ -1,21 +0,0 @@ -#%Module##################################################### -## Build module for Hera -############################################################# - -# Loading Intel Compiler Suite -module load intel/18.0.5.274 - -# Loding nceplibs modules -module use -a $MOD_PATH -module load w3nco/2.0.6 -module load bacio/2.0.2 -module load nemsio/2.2.3 -module load netcdf/4.6.1 -module load hdf5/1.10.4 -export NETCDF_INCLUDE="-I${NETCDF}/include" -export NETCDF_LDFLAGS_F="-L${NETCDF}/lib -lnetcdf -lnetcdff -L${HDF5}/lib -lhdf5 -lhdf5_fortran" - -export FCOMP=ifort -export FFLAGS="-O3 -fp-model precise -g -r8 -i4" -# for debugging -#export FFLAGS="-g -r8 -i4 -warn unused -check bounds" diff --git a/modulefiles/fv3gfs/nst_tf_chg.jet b/modulefiles/fv3gfs/nst_tf_chg.jet deleted file mode 100644 index 67bd8a087..000000000 --- a/modulefiles/fv3gfs/nst_tf_chg.jet +++ /dev/null @@ -1,20 +0,0 @@ -#%Module##################################################### -## gaussian_sfcanl build module for Jet -############################################################# - -# Loading Intel Compiler Suite -module load intel/18.0.5.274 - -module load w3nco/v2.0.6 -module load bacio/v2.0.2 -module load nemsio/v2.2.3 -module load szip -module load hdf5/1.8.9 -module load netcdf/4.2.1.1 -export NETCDF_INCLUDE="-I${NETCDF}/include" -export NETCDF_LDFLAGS_F="-L${NETCDF}/lib -lnetcdf -lnetcdff -L${HDF5}/lib -lhdf5 -lhdf5_fortran" - -export FCOMP=ifort -export FFLAGS="-O3 -fp-model precise -g -r8 -i4" -# for debugging -#export FFLAGS="-g -r8 -i4 -warn unused -check bounds" diff --git a/modulefiles/fv3gfs/nst_tf_chg.wcoss b/modulefiles/fv3gfs/nst_tf_chg.wcoss deleted file mode 100644 index 706524816..000000000 --- a/modulefiles/fv3gfs/nst_tf_chg.wcoss +++ /dev/null @@ -1,17 +0,0 @@ -#%Module##################################################### -## gaussian_sfcanl build module - wcoss -############################################################# - -# Loading Intel Compiler Suite -module load ics/16.0.3 - -# Loading nceplibs modules -module load w3nco/v2.0.6 -module load bacio/v2.0.2 -module load nemsio/v2.2.3 -module load NetCDF/4.2/serial - -export FCOMP=ifort -export FFLAGS="-O3 -fp-model precise -g -r8 -i4" -# for debugging -#export FFLAGS="-g -r8 -i4 -warn unused -check bounds" diff --git a/modulefiles/fv3gfs/nst_tf_chg.wcoss_cray b/modulefiles/fv3gfs/nst_tf_chg.wcoss_cray deleted file mode 100644 index f0a7b6ffc..000000000 --- a/modulefiles/fv3gfs/nst_tf_chg.wcoss_cray +++ /dev/null @@ -1,22 +0,0 @@ -#%Module##################################################### -## gaussian_sfcanl component of fv3gfs - cray -############################################################# - -set ver v15.0.0 - -# Load Intel environment -module load PrgEnv-intel/5.2.56 -module rm intel -module rm NetCDF-intel-sandybridge/4.2 -module load intel/16.3.210 -module load cray-netcdf -module load craype-haswell - -module load nemsio-intel/2.2.3 -module load w3nco-intel/2.0.6 -module load bacio-intel/2.0.2 - -export FCOMP=ftn -export FFLAGS="-O3 -fp-model precise -g -r8 -i4" -# for debugging -#export FFLAGS="-g -r8 -i4 -warn unused -check bounds" diff --git a/modulefiles/fv3gfs/nst_tf_chg.wcoss_dell_p3 b/modulefiles/fv3gfs/nst_tf_chg.wcoss_dell_p3 deleted file mode 100644 index 1342c5bd6..000000000 --- a/modulefiles/fv3gfs/nst_tf_chg.wcoss_dell_p3 +++ /dev/null @@ -1,20 +0,0 @@ -#%Module##################################################### -## gaussian_sfcanl component of fv3gfs - wcoss_dell_p3 -############################################################# - -set ver v15.0.0 - -# Load Intel environment -module load ips/18.0.1.163 -module load impi/18.0.1 - -module load NetCDF/4.5.0 -module load HDF5-serial/1.10.1 -module load nemsio/2.2.3 -module load w3nco/2.0.6 -module load bacio/2.0.2 - -export FCOMP=ifort -export FFLAGS="-O3 -fp-model precise -g -r8 -i4" -# for debugging -#export FFLAGS="-g -r8 -i4 -warn unused -check bounds" diff --git a/modulefiles/fv3gfs/orog.hera b/modulefiles/fv3gfs/orog.hera deleted file mode 100644 index 0780cece2..000000000 --- a/modulefiles/fv3gfs/orog.hera +++ /dev/null @@ -1,15 +0,0 @@ -#%Module##################################################### -## Module file for orog -############################################################# -# Loading Intel Compiler Suite -module load intel/18.0.5.274 - -module load netcdf/4.7.0 - -# Loding nceplibs modules -module use -a $MOD_PATH -module load ip/3.0.1 -module load sp/2.0.2 -module load w3emc/2.3.0 -module load w3nco/2.0.6 -module load bacio/2.0.2 diff --git a/modulefiles/fv3gfs/orog.jet b/modulefiles/fv3gfs/orog.jet deleted file mode 100644 index 893457136..000000000 --- a/modulefiles/fv3gfs/orog.jet +++ /dev/null @@ -1,18 +0,0 @@ -#%Module##################################################### -## Module file for orog -############################################################# -# Loading Intel Compiler Suite -# -module purge - -module load intel/18.0.5.274 -module load szip/2.1 -module load hdf5/1.8.9 -module load netcdf/4.2.1.1 - -# Loding nceplibs modules -module load ip/v2.0.0 -module load sp/v2.0.2 -module load w3emc/v2.3.0 -module load w3nco/v2.0.6 -module load bacio/v2.0.2 diff --git a/modulefiles/fv3gfs/orog.wcoss b/modulefiles/fv3gfs/orog.wcoss deleted file mode 100644 index 9aa30c5b2..000000000 --- a/modulefiles/fv3gfs/orog.wcoss +++ /dev/null @@ -1,16 +0,0 @@ -#%Module##################################################### -## Module file for orog -############################################################# - -# Loading Intel Compiler Suite -module load ics/16.0.3 - -# Loding nceplibs modules -module load w3nco/v2.0.6 -module load w3emc/v2.2.0 -module load sp/v2.0.2 -module load ip/v2.0.0 -module load bacio/v2.0.2 -module load NetCDF - -export FCMP=ifort diff --git a/modulefiles/fv3gfs/orog.wcoss_cray b/modulefiles/fv3gfs/orog.wcoss_cray deleted file mode 100644 index 51cb66a18..000000000 --- a/modulefiles/fv3gfs/orog.wcoss_cray +++ /dev/null @@ -1,18 +0,0 @@ -#%Module##################################################### -## Module file for orog -############################################################# -module load ncep/1.0 -module load PrgEnv-intel/5.2.56 -module rm intel -module load intel/16.3.210 -module load cray-mpich/7.2.0 -module load craype-haswell -module load cray-netcdf - -module load w3emc-intel/2.2.0 -module load ip-intel/2.0.0 -module load sp-intel/2.0.2 -module load w3nco-intel/2.0.6 -module load bacio-intel/2.0.1 - -export FCMP=ftn diff --git a/modulefiles/fv3gfs/orog.wcoss_cray_userlib b/modulefiles/fv3gfs/orog.wcoss_cray_userlib deleted file mode 100644 index 4698b9cb3..000000000 --- a/modulefiles/fv3gfs/orog.wcoss_cray_userlib +++ /dev/null @@ -1,20 +0,0 @@ -#%Module##################################################### -## Module file for orog -############################################################# -module load ncep/1.0 -module load PrgEnv-intel/5.2.56 -module rm intel -module load intel/16.3.210 -module load cray-mpich/7.2.0 -module load craype-haswell -module load cray-netcdf - -module unuse /gpfs/hps/nco/ops/nwprod/lib/modulefiles -module use -a $MOD_PATH -module load ip/v2.0.0 -module load sp/v2.0.2 -module load w3emc/v2.2.0 -module load w3nco/v2.0.6 -module load bacio/v2.0.2 - -export FCMP=ftn diff --git a/modulefiles/fv3gfs/orog.wcoss_dell_p3 b/modulefiles/fv3gfs/orog.wcoss_dell_p3 deleted file mode 100644 index adde9c2aa..000000000 --- a/modulefiles/fv3gfs/orog.wcoss_dell_p3 +++ /dev/null @@ -1,14 +0,0 @@ -#%Module##################################################### -## Module file for orog, wcoss_dell_p3 -############################################################# -module load ips/18.0.1.163 -module load impi/18.0.1 - -module load NetCDF/4.5.0 -module load w3emc/2.3.0 -module load w3nco/2.0.6 -module load sp/2.0.2 -module load ip/3.0.1 -module load bacio/2.0.2 - -export FCMP=ifort diff --git a/modulefiles/module_nemsutil.hera b/modulefiles/module_nemsutil.hera deleted file mode 100644 index 4d1bfd5c4..000000000 --- a/modulefiles/module_nemsutil.hera +++ /dev/null @@ -1,15 +0,0 @@ -#%Module##################################################### -## Module file for nemsutil -############################################################# - -# Loading Intel Compiler Suite -module load intel/18.0.5.274 -module load impi/2018.0.4 - -# Loding nceplibs modules -module use -a $MOD_PATH -module load w3nco/2.0.6 -module load bacio/2.0.2 -module load nemsio/2.2.3 - -export FCMP=ifort diff --git a/modulefiles/module_nemsutil.jet b/modulefiles/module_nemsutil.jet deleted file mode 100644 index c1ff57408..000000000 --- a/modulefiles/module_nemsutil.jet +++ /dev/null @@ -1,14 +0,0 @@ -#%Module##################################################### -## Module file for nemsutil -############################################################# - -# Loading Intel Compiler Suite -module load intel/18.0.5.274 -module load impi/5.0.3.048 - -# Loding nceplibs modules -module load w3nco/v2.0.6 -module load bacio/v2.0.2 -module load nemsio/v2.2.3 - -export FCMP=ifort diff --git a/modulefiles/module_nemsutil.wcoss b/modulefiles/module_nemsutil.wcoss deleted file mode 100644 index f421c1a88..000000000 --- a/modulefiles/module_nemsutil.wcoss +++ /dev/null @@ -1,13 +0,0 @@ -#%Module##################################################### -## Module file for nemsutil -############################################################# - -# Loading Intel Compiler Suite -module load ics/14.0.1 - -# Loding nceplibs modules -module load w3nco/v2.0.6 -module load bacio/v2.0.1 -module load nemsio/v2.2.1 - -export FCMP=ifort diff --git a/modulefiles/module_nemsutil.wcoss_cray b/modulefiles/module_nemsutil.wcoss_cray deleted file mode 100644 index 371c8e024..000000000 --- a/modulefiles/module_nemsutil.wcoss_cray +++ /dev/null @@ -1,17 +0,0 @@ -#%Module##################################################### -## Module file for nemsutil -############################################################# - -module purge -module load modules -module load PrgEnv-intel -module load cray-mpich -module load craype-sandybridge - -module load w3nco-intel/2.0.6 -module load bacio-intel/2.0.1 - -export NEMSIO_INC=/usrx/local/nceplibs/nemsio/nemsio_v2.2.3/incmod -export NEMSIO_LIB=/usrx/local/nceplibs/nemsio/nemsio_v2.2.3/libnemsio_v2.2.3.a - -export FCMP=ftn diff --git a/modulefiles/module_nemsutil.wcoss_cray_userlib b/modulefiles/module_nemsutil.wcoss_cray_userlib deleted file mode 100644 index 53fad475a..000000000 --- a/modulefiles/module_nemsutil.wcoss_cray_userlib +++ /dev/null @@ -1,19 +0,0 @@ -#%Module##################################################### -## Module file for nemsutil -############################################################# - -# Load Intel environment -module purge -module load modules -module load PrgEnv-intel -module load cray-mpich -module load craype-sandybridge - -# Load NCEPLIBS modules -module unuse /gpfs/hps/nco/ops/nwprod/lib/modulefiles -module use $MOD_PATH -module load w3nco/v2.0.6 -module load bacio/v2.0.2 -module load nemsio/v2.2.3 - -export FCMP=ftn diff --git a/modulefiles/module_nemsutil.wcoss_dell_p3 b/modulefiles/module_nemsutil.wcoss_dell_p3 deleted file mode 100644 index e93d58165..000000000 --- a/modulefiles/module_nemsutil.wcoss_dell_p3 +++ /dev/null @@ -1,12 +0,0 @@ -#%Module##################################################### -## Module file for nemsutil -############################################################# - -module load ips/18.0.1.163 -module load impi/18.0.1 - -module load bacio/2.0.2 -module load w3nco/2.0.6 -module load nemsio/2.2.3 - -export FCMP=ifort diff --git a/modulefiles/modulefile.global_emcsfc_ice_blend.hera b/modulefiles/modulefile.global_emcsfc_ice_blend.hera deleted file mode 100644 index 2305392cf..000000000 --- a/modulefiles/modulefile.global_emcsfc_ice_blend.hera +++ /dev/null @@ -1,17 +0,0 @@ -#%Module##################################################### -## emcsfc_ice_blend build module for Hera -############################################################# - -module load intel/18.0.5.274 -export FCOMP=ifort -export FFLAGS="-O0 -i4" - -# load ncep library modules - -module use -a $MOD_PATH -module load w3nco/2.0.6 -module load bacio/2.0.2 -module load jasper/1.900.1 -module load z/1.2.11 -module load png/1.2.44 -module load g2/2.5.0 diff --git a/modulefiles/modulefile.global_emcsfc_ice_blend.jet b/modulefiles/modulefile.global_emcsfc_ice_blend.jet deleted file mode 100644 index 2e094dc03..000000000 --- a/modulefiles/modulefile.global_emcsfc_ice_blend.jet +++ /dev/null @@ -1,16 +0,0 @@ -#%Module##################################################### -## emcsfc_ice_blend build module for Jet -############################################################# - -module load intel/18.0.5.274 -export FCOMP=ifort -export FFLAGS="-O0 -i4" - -# load ncep library modules - -module load w3nco/v2.0.6 -module load bacio/v2.0.2 -module load jasper/v1.900.1 -module load z/v1.2.6 -module load png/v1.2.44 -module load g2/v3.1.0 diff --git a/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss b/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss deleted file mode 100644 index c4ccccfb8..000000000 --- a/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss +++ /dev/null @@ -1,14 +0,0 @@ -#%Module##################################################### -## Module file for emcsfc_ice_blend -############################################################# - -module load ics/12.1 -export FCOMP=ifort -export FFLAGS="-O0 -i4" - -module load w3nco/v2.0.6 -module load bacio/v2.0.2 -module load jasper/v1.900.1 -module load z/v1.2.6 -module load png/v1.2.44 -module load g2/v2.5.0 diff --git a/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_cray b/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_cray deleted file mode 100644 index 76f18d287..000000000 --- a/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_cray +++ /dev/null @@ -1,17 +0,0 @@ -#%Module##################################################### -## Module file for emcsfc_ice_blend -############################################################# - -# intel compiler - -module load PrgEnv-intel -module load craype-haswell -export FCOMP=ftn -export FFLAGS="-O0 -i4 -craype-verbose" - -module load w3nco-intel/2.0.6 -module load bacio-intel/2.0.1 -export JASPER_LIB=/usrx/local/prod/jasper/1.900.1/intel/haswell/lib/libjasper.a -module load zlib-intel-haswell/1.2.7 -module load png-intel-haswell/1.2.49 -module load g2-intel/2.5.0 diff --git a/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_cray_userlib b/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_cray_userlib deleted file mode 100644 index ca64e02e8..000000000 --- a/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_cray_userlib +++ /dev/null @@ -1,20 +0,0 @@ -#%Module##################################################### -## Module file for emcsfc_ice_blend -############################################################# - -# intel compiler - -module load PrgEnv-intel -module load craype-haswell -export FCOMP=ftn -export FFLAGS="-O0 -i4 -craype-verbose" - -module unuse /gpfs/hps/nco/ops/nwprod/lib/modulefiles -module use -a $MOD_PATH - -module load w3nco-intel/2.0.6 -module load bacio-intel/2.0.1 -export JASPER_LIB=/usrx/local/prod/jasper/1.900.1/intel/haswell/lib/libjasper.a -module load zlib-intel-haswell/1.2.7 -module load png-intel-haswell/1.2.49 -module load g2-intel/2.5.0 diff --git a/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_dell_p3 b/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_dell_p3 deleted file mode 100644 index 369695ec0..000000000 --- a/modulefiles/modulefile.global_emcsfc_ice_blend.wcoss_dell_p3 +++ /dev/null @@ -1,17 +0,0 @@ -#%Module##################################################### -## Module file for emcsfc_ice_blend -############################################################# - -# intel compiler - -module load ips/18.0.1.163 - -export FCOMP=ifort -export FFLAGS="-O0 -i4" - -module load w3nco/2.0.6 -module load bacio/2.0.2 -module load jasper/1.900.1 -module load libpng/1.2.59 -module load zlib/1.2.11 -module load g2/3.1.0 diff --git a/modulefiles/modulefile.global_emcsfc_snow2mdl.hera b/modulefiles/modulefile.global_emcsfc_snow2mdl.hera deleted file mode 100644 index 193f6247d..000000000 --- a/modulefiles/modulefile.global_emcsfc_snow2mdl.hera +++ /dev/null @@ -1,23 +0,0 @@ -#%Module##################################################### -## emcsfc_snow2mdl build module for Hera -############################################################# - -# load intel compiler - -module load intel/18.0.5.274 - -# load ncep library modules - -module use -a $MOD_PATH -module load ip/3.0.1 -module load sp/2.0.2 -module load w3nco/2.0.6 -module load bacio/2.0.2 -module load landsfcutil/2.1.0 -module load jasper/1.900.1 -module load z/1.2.11 -module load png/1.2.44 -module load g2/2.5.0 - -export FCOMP=ifort -export FFLAGS="-O0 -r8 -i4 -FR -I${IP_INCd} -qopenmp -convert big_endian -assume byterecl" diff --git a/modulefiles/modulefile.global_emcsfc_snow2mdl.jet b/modulefiles/modulefile.global_emcsfc_snow2mdl.jet deleted file mode 100644 index 0b88ae7c0..000000000 --- a/modulefiles/modulefile.global_emcsfc_snow2mdl.jet +++ /dev/null @@ -1,22 +0,0 @@ -#%Module##################################################### -## emcsfc_snow2mdl build module for Jet -############################################################# - -# load intel compiler - -module load intel/18.0.5.274 - -# load ncep library modules - -module load ip/v3.0.0 -module load sp/v2.0.2 -module load w3nco/v2.0.6 -module load bacio/v2.0.2 -module load jasper/v1.900.1 -module load z/v1.2.6 -module load png/v1.2.44 -module load g2/v3.1.0 -module load landsfcutil/v2.1.0 - -export FCOMP=ifort -export FFLAGS="-O0 -r8 -i4 -FR -I${IP_INCd} -qopenmp -convert big_endian -assume byterecl" diff --git a/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss b/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss deleted file mode 100644 index 8a6a88347..000000000 --- a/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss +++ /dev/null @@ -1,18 +0,0 @@ -#%Module##################################################### -## Module file for emcsfc_snow2mdl -############################################################# - -module load ics/12.1 - -module load ip/v3.0.0 -module load sp/v2.0.2 -module load w3nco/v2.0.6 -module load bacio/v2.0.2 -module load jasper/v1.900.1 -module load z/v1.2.6 -module load png/v1.2.44 -module load g2/v2.5.0 -module load landsfcutil/v2.1.0 - -export FCOMP=ifort -export FFLAGS="-O0 -r8 -i4 -FR -I${IP_INCd} -openmp -convert big_endian -assume byterecl" diff --git a/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_cray b/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_cray deleted file mode 100644 index de17f8570..000000000 --- a/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_cray +++ /dev/null @@ -1,21 +0,0 @@ -#%Module##################################################### -## Module file for emcsfc_snow2mdl -############################################################# - -# intel compiler - -module load PrgEnv-intel -module load craype-haswell - -module load ip-intel/3.0.0 -module load sp-intel/2.0.2 -module load w3nco-intel/2.0.6 -module load bacio-intel/2.0.1 -export JASPER_LIB=/usrx/local/prod/jasper/1.900.1/intel/haswell/lib/libjasper.a -module load zlib-intel-haswell/1.2.7 -module load png-intel-haswell/1.2.49 -module load g2-intel/2.5.0 -module load landsfcutil-intel/2.1.0 - -export FCOMP=ftn -export FFLAGS="-O0 -r8 -i4 -FR -I${IP_INCd} -openmp -convert big_endian -assume byterecl -craype-verbose" diff --git a/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_cray_userlib b/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_cray_userlib deleted file mode 100644 index 192136afe..000000000 --- a/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_cray_userlib +++ /dev/null @@ -1,24 +0,0 @@ -#%Module##################################################### -## Module file for emcsfc_snow2mdl -############################################################# - -# intel compiler - -module load PrgEnv-intel -module load craype-haswell - -module unuse /gpfs/hps/nco/ops/nwprod/lib/modulefiles -module use -a $MOD_PATH - -module load ip-intel/3.0.0 -module load sp-intel/2.0.2 -module load w3nco-intel/2.0.6 -module load bacio-intel/2.0.1 -export JASPER_LIB=/usrx/local/prod/jasper/1.900.1/intel/haswell/lib/libjasper.a -module load zlib-intel-haswell/1.2.7 -module load png-intel-haswell/1.2.49 -module load g2-intel/2.5.0 -module load landsfcutil-intel/2.1.0 - -export FCOMP=ftn -export FFLAGS="-O0 -r8 -i4 -FR -I${IP_INCd} -openmp -convert big_endian -assume byterecl -craype-verbose" diff --git a/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_dell_p3 b/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_dell_p3 deleted file mode 100644 index 207c6f846..000000000 --- a/modulefiles/modulefile.global_emcsfc_snow2mdl.wcoss_dell_p3 +++ /dev/null @@ -1,20 +0,0 @@ -#%Module##################################################### -## Module file for emcsfc_snow2mdl -############################################################# - -# intel compiler - -module load ips/18.0.1.163 - -module load w3nco/2.0.6 -module load bacio/2.0.2 -module load ip/3.0.1 -module load sp/2.0.2 -module load jasper/1.900.1 -module load libpng/1.2.59 -module load zlib/1.2.11 -module load g2/3.1.0 -module load landsfcutil/2.1.0 - -export FCOMP=ifort -export FFLAGS="-O0 -r8 -i4 -FR -I${IP_INCd} -qopenmp -convert big_endian -assume byterecl " diff --git a/modulefiles/modulefile.sfc_climo_gen.hera b/modulefiles/modulefile.sfc_climo_gen.hera deleted file mode 100644 index 93aff0a2e..000000000 --- a/modulefiles/modulefile.sfc_climo_gen.hera +++ /dev/null @@ -1,13 +0,0 @@ -#%Module##################################################### -## Module file for sfc_climo_gen (Hera) -############################################################# - -module load intel/18.0.5.274 -module load impi/2018.0.4 - -export NCEPLIBS=/scratch1/NCEPDEV/global/gwv/l819/lib -module use -a $NCEPLIBS/modulefiles -module load esmflocal/8_0_48b.netcdf47 - -export FCOMP=mpiifort -export FFLAGS="-O3 -fp-model=precise -g -traceback -r8 -i4 -convert big_endian" diff --git a/modulefiles/modulefile.sfc_climo_gen.jet b/modulefiles/modulefile.sfc_climo_gen.jet deleted file mode 100644 index 4969d85c6..000000000 --- a/modulefiles/modulefile.sfc_climo_gen.jet +++ /dev/null @@ -1,16 +0,0 @@ -#%Module##################################################### -## Module file for sfc_climo_gen -############################################################# - -module use /mnt/lfs3/projects/hfv3gfs/gwv/ljtjet/lib/modulefiles - -module load intel/18.0.5.274 -module load impi/2018.4.274 -module load szip -module load hdf5 -module load netcdf/4.2.1.1 - -module load esmflocal/ESMF_8_0_0_beta_snapshot_21 - -export FCOMP=mpiifort -export FFLAGS="-O3 -fp-model=precise -g -traceback -r8 -i4 -convert big_endian" diff --git a/modulefiles/modulefile.sfc_climo_gen.wcoss_cray b/modulefiles/modulefile.sfc_climo_gen.wcoss_cray deleted file mode 100644 index 9fdbae9e0..000000000 --- a/modulefiles/modulefile.sfc_climo_gen.wcoss_cray +++ /dev/null @@ -1,16 +0,0 @@ -#%Module##################################################### -## Module file sfc_climo_gen -############################################################# - -module load PrgEnv-intel/5.2.56 -module rm intel -module load intel/16.3.210 -module load cray-mpich/7.2.0 -module load craype-haswell -module load cray-netcdf - -module use /gpfs/hps3/emc/nems/noscrub/emc.nemspara/soft/modulefiles -module load esmf/7.1.0r - -export FCOMP=ftn -export FFLAGS="-O3 -fp-model=precise -g -r8 -i4 -convert big_endian -craype-verbose" diff --git a/modulefiles/modulefile.sfc_climo_gen.wcoss_cray_userlib b/modulefiles/modulefile.sfc_climo_gen.wcoss_cray_userlib deleted file mode 100644 index d5e46a879..000000000 --- a/modulefiles/modulefile.sfc_climo_gen.wcoss_cray_userlib +++ /dev/null @@ -1,18 +0,0 @@ -#%Module##################################################### -## Module file for sfc_climo_gen -############################################################# - -module load PrgEnv-intel/5.2.56 -module rm intel -module load intel/16.3.210 -module load cray-mpich/7.2.0 -module load craype-haswell -module load cray-netcdf - -module unuse /gpfs/hps/nco/ops/nwprod/lib/modulefiles -module use -a $MOD_PATH - -module load esmf/7.1.0r - -export FCOMP=ftn -export FFLAGS="-O3 -fp-model=precise -g -r8 -i4 -convert big_endian -craype-verbose" diff --git a/modulefiles/modulefile.sfc_climo_gen.wcoss_dell_p3 b/modulefiles/modulefile.sfc_climo_gen.wcoss_dell_p3 deleted file mode 100644 index c48531622..000000000 --- a/modulefiles/modulefile.sfc_climo_gen.wcoss_dell_p3 +++ /dev/null @@ -1,11 +0,0 @@ -#%Module##################################################### -## Module file for sfc_climo_gen -############################################################# - -module load ips/18.0.1.163 -module load impi/18.0.1 -module load NetCDF/4.5.0 -module load ESMF/7_1_0r - -export FCOMP=mpif90 -export FFLAGS="-O3 -fp-model=precise -g -traceback -r8 -i4 -convert big_endian" diff --git a/reg_tests/chgres_cube/driver.cray.sh b/reg_tests/chgres_cube/driver.cray.sh index 3381b98e4..cae83b182 100755 --- a/reg_tests/chgres_cube/driver.cray.sh +++ b/reg_tests/chgres_cube/driver.cray.sh @@ -22,14 +22,8 @@ set -x -module purge -module load PrgEnv-intel/5.2.56 -module rm intel -module load intel/16.3.210 -module load cray-mpich/7.2.0 -module load craype-haswell -module load cray-netcdf/4.3.3.1 -module load xt-lsfhpc/9.1.3 +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target module list export OUTDIR=/gpfs/hps3/stmp/$LOGNAME/chgres_reg_tests diff --git a/reg_tests/chgres_cube/driver.dell.sh b/reg_tests/chgres_cube/driver.dell.sh index 7c774fcff..4cbd48361 100755 --- a/reg_tests/chgres_cube/driver.dell.sh +++ b/reg_tests/chgres_cube/driver.dell.sh @@ -22,14 +22,8 @@ set -x -module purge -module load EnvVars/1.0.2 -module load ips/18.0.1.163 -module load impi/18.0.1 -module load lsf/10.1 -module use /usrx/local/dev/modulefiles -module load NetCDF/4.5.0 -module list +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target export OUTDIR=/gpfs/dell1/stmp/$LOGNAME/chgres_reg_tests QUEUE="debug" @@ -51,7 +45,7 @@ SUM_FILE=summary.log rm -f $LOG_FILE $SUM_FILE -export NCCMP=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/util/nccmp/nccmp-1.8.5.0/src/nccmp +export NCCMP=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/util/nccmp/nccmp-nc4.7.4/src/nccmp export OMP_STACKSIZE=1024M diff --git a/reg_tests/chgres_cube/driver.hera.sh b/reg_tests/chgres_cube/driver.hera.sh index 79e3a172c..fa09e7999 100755 --- a/reg_tests/chgres_cube/driver.hera.sh +++ b/reg_tests/chgres_cube/driver.hera.sh @@ -24,12 +24,8 @@ set -x -source /apps/lmod/lmod/init/sh -module purge -module load intel/18.0.5.274 -module load impi/2018.0.4 -module load netcdf/4.7.0 -module list +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target export OUTDIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/chgres_reg_tests PROJECT_CODE="fv3-cpu" diff --git a/reg_tests/chgres_cube/driver.jet.sh b/reg_tests/chgres_cube/driver.jet.sh index f6b565224..fa3c48a1f 100755 --- a/reg_tests/chgres_cube/driver.jet.sh +++ b/reg_tests/chgres_cube/driver.jet.sh @@ -24,14 +24,8 @@ set -x -source /apps/lmod/lmod/init/sh -module purge -module load intel/18.0.5.274 -module load impi/2018.4.274 -module load szip -module load hdf5 -module load netcdf/4.2.1.1 -module list +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target export OUTDIR=/mnt/lfs3/projects/emcda/$LOGNAME/stmp/chgres_reg_tests PROJECT_CODE="hfv3gfs" @@ -47,7 +41,7 @@ export HOMEufs=$PWD/../.. export HOMEreg=/mnt/lfs3/projects/emcda/George.Gayno/reg_tests/chgres_cube -export NCCMP=/apps/nccmp/1.8.2.1/intel/18.0.3.222/bin/nccmp +export NCCMP=/apps/nccmp/1.8.5/intel/18.0.5.274/bin/nccmp LOG_FILE=regression.log SUM_FILE=summary.log diff --git a/reg_tests/global_cycle/driver.cray.sh b/reg_tests/global_cycle/driver.cray.sh index 438d9670a..ffd5048dd 100755 --- a/reg_tests/global_cycle/driver.cray.sh +++ b/reg_tests/global_cycle/driver.cray.sh @@ -27,7 +27,8 @@ #BSUB -W 00:05 #BSUB -extsched 'CRAYLINUX[]' -module load PrgEnv-intel cfp-intel-sandybridge/1.1.0 +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target module list export DATA=/gpfs/hps3/stmp/$LOGNAME/reg_tests.cycle diff --git a/reg_tests/global_cycle/driver.dell.sh b/reg_tests/global_cycle/driver.dell.sh index 5264d0012..383124240 100755 --- a/reg_tests/global_cycle/driver.dell.sh +++ b/reg_tests/global_cycle/driver.dell.sh @@ -32,15 +32,8 @@ set -x -module purge -module load EnvVars/1.0.2 -module load ips/18.0.1.163 -module load lsf/10.1 -module load impi/18.0.1 -module use /usrx/local/nceplibs/dev/NCEPLIBS/modulefiles -module load netcdf_parallel/4.7.4 - -set -x +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target export DATA=/gpfs/dell1/stmp/$LOGNAME/reg_tests.cycle diff --git a/reg_tests/global_cycle/driver.hera.sh b/reg_tests/global_cycle/driver.hera.sh index 4a7196e6b..ecc05cd9b 100755 --- a/reg_tests/global_cycle/driver.hera.sh +++ b/reg_tests/global_cycle/driver.hera.sh @@ -29,15 +29,8 @@ set -x -. /apps/lmod/lmod/init/sh -module purge -module load intel/18.0.5.274 -module load impi/2018.0.4 -module load szip/2.1 -module load hdf5/1.10.5 -module use /scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles -module load netcdf_parallel/4.7.4 -module list +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target export DATA=/scratch2/NCEPDEV/stmp1/$LOGNAME/reg_tests.cycle diff --git a/reg_tests/global_cycle/driver.jet.sh b/reg_tests/global_cycle/driver.jet.sh index 7f2f85863..e306a6497 100755 --- a/reg_tests/global_cycle/driver.jet.sh +++ b/reg_tests/global_cycle/driver.jet.sh @@ -30,14 +30,8 @@ set -x -. /apps/lmod/lmod/init/sh -module purge -module load intel/18.0.5.274 -module load impi/2018.4.274 -module load szip -module load hdf5 -module load netcdf/4.2.1.1 -module list +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target export DATA=/lfs3/HFIP/emcda/$LOGNAME/stmp/reg_tests.cycle @@ -55,7 +49,7 @@ export NWPROD=$PWD/../.. export COMOUT=$DATA -export NCCMP=/apps/nccmp/1.8.2.1/intel/18.0.3.222/bin/nccmp +export NCCMP=/apps/nccmp/1.8.5/intel/18.0.5.274/bin/nccmp reg_dir=$PWD diff --git a/reg_tests/grid_gen/driver.cray.sh b/reg_tests/grid_gen/driver.cray.sh index 47c331297..40267adbd 100755 --- a/reg_tests/grid_gen/driver.cray.sh +++ b/reg_tests/grid_gen/driver.cray.sh @@ -19,8 +19,8 @@ # #----------------------------------------------------------------------------- -. $MODULESHOME/init/sh -module load PrgEnv-intel cfp-intel-sandybridge/1.1.0 +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target module list set -x diff --git a/reg_tests/grid_gen/driver.dell.sh b/reg_tests/grid_gen/driver.dell.sh index 14f87fa2d..7ceac48e7 100755 --- a/reg_tests/grid_gen/driver.dell.sh +++ b/reg_tests/grid_gen/driver.dell.sh @@ -19,14 +19,8 @@ # #----------------------------------------------------------------------------- -module purge -module load EnvVars/1.0.2 -module load lsf/10.1 -module load ips/18.0.1.163 -module load impi/18.0.1 -module load NetCDF/4.5.0 -module load HDF5-serial/1.10.1 -module list +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target set -x @@ -45,7 +39,7 @@ export APRUN=time export APRUN_SFC="mpirun -l" export OMP_STACKSIZE=2048m export machine=WCOSS_DELL_P3 -export NCCMP=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/util/nccmp/nccmp-1.8.5.0/src/nccmp +export NCCMP=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/util/nccmp/nccmp-nc4.7.4/src/nccmp export HOMEreg=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/ufs_utils.git/reg_tests/grid_gen/baseline_data export OMP_NUM_THREADS=24 diff --git a/reg_tests/grid_gen/driver.hera.sh b/reg_tests/grid_gen/driver.hera.sh index 72791e01b..3483bfb52 100755 --- a/reg_tests/grid_gen/driver.hera.sh +++ b/reg_tests/grid_gen/driver.hera.sh @@ -21,13 +21,8 @@ # #----------------------------------------------------------------------------- -. /apps/lmod/lmod/init/sh -module purge -module load intel/18.0.5.274 -module load impi/2018.0.4 -module load hdf5/1.10.5 -module load netcdf/4.7.0 -module list +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target set -x diff --git a/reg_tests/grid_gen/driver.jet.sh b/reg_tests/grid_gen/driver.jet.sh index b78ca688e..364fbec73 100755 --- a/reg_tests/grid_gen/driver.jet.sh +++ b/reg_tests/grid_gen/driver.jet.sh @@ -21,14 +21,8 @@ # #----------------------------------------------------------------------------- -. /apps/lmod/lmod/init/sh -module purge -module load intel/18.0.5.274 -module load impi/2018.4.274 -module load szip -module load hdf5 -module load netcdf/4.2.1.1 -module list +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target set -x @@ -47,7 +41,7 @@ export APRUN=time export APRUN_SFC=srun export OMP_STACKSIZE=2048m export machine=JET -export NCCMP=/apps/nccmp/1.8.2.1/intel/18.0.3.222/bin/nccmp +export NCCMP=/apps/nccmp/1.8.5/intel/18.0.5.274/bin/nccmp export HOMEreg=/mnt/lfs3/projects/emcda/George.Gayno/reg_tests/grid_gen/baseline_data ulimit -a diff --git a/reg_tests/ice_blend/driver.cray.sh b/reg_tests/ice_blend/driver.cray.sh index ab0b4825a..f2904b0df 100755 --- a/reg_tests/ice_blend/driver.cray.sh +++ b/reg_tests/ice_blend/driver.cray.sh @@ -28,7 +28,8 @@ set -x -module load PrgEnv-intel +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target module list export DATA=/gpfs/hps3/stmp/$LOGNAME/reg_tests.ice_blend diff --git a/reg_tests/ice_blend/driver.dell.sh b/reg_tests/ice_blend/driver.dell.sh index e200aff09..9ca96d131 100755 --- a/reg_tests/ice_blend/driver.dell.sh +++ b/reg_tests/ice_blend/driver.dell.sh @@ -26,6 +26,9 @@ #BSUB -R "affinity[core(1)]" #BSUB -P GFS-DEV +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target + set -x export DATA=/gpfs/dell1/stmp/$LOGNAME/reg_tests.ice_blend diff --git a/reg_tests/ice_blend/driver.hera.sh b/reg_tests/ice_blend/driver.hera.sh index 9dd1ab3c7..4866e7974 100755 --- a/reg_tests/ice_blend/driver.hera.sh +++ b/reg_tests/ice_blend/driver.hera.sh @@ -29,7 +29,8 @@ set -x -module load intel +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target export DATA="/scratch2/NCEPDEV/stmp1/$LOGNAME/reg_test.ice_blend" diff --git a/reg_tests/ice_blend/driver.jet.sh b/reg_tests/ice_blend/driver.jet.sh index cf61e18f1..455d0f179 100755 --- a/reg_tests/ice_blend/driver.jet.sh +++ b/reg_tests/ice_blend/driver.jet.sh @@ -28,7 +28,8 @@ set -x -module load intel +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target export DATA="/mnt/lfs3/projects/emcda/$LOGNAME/stmp/reg_test.ice_blend" diff --git a/reg_tests/snow2mdl/driver.cray.sh b/reg_tests/snow2mdl/driver.cray.sh index 7069afc57..f39c5b3ce 100755 --- a/reg_tests/snow2mdl/driver.cray.sh +++ b/reg_tests/snow2mdl/driver.cray.sh @@ -28,7 +28,8 @@ set -x -module load PrgEnv-intel +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target module list export DATA=/gpfs/hps3/stmp/$LOGNAME/reg_tests.snow2mdl diff --git a/reg_tests/snow2mdl/driver.dell.sh b/reg_tests/snow2mdl/driver.dell.sh index 4b5f520ec..610f726d8 100755 --- a/reg_tests/snow2mdl/driver.dell.sh +++ b/reg_tests/snow2mdl/driver.dell.sh @@ -26,6 +26,9 @@ #BSUB -R "affinity[core(1)]" #BSUB -P GFS-DEV +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target + set -x export DATA=/gpfs/dell1/stmp/$LOGNAME/reg_tests.snow2mdl diff --git a/reg_tests/snow2mdl/driver.hera.sh b/reg_tests/snow2mdl/driver.hera.sh index 49b049990..cd0457104 100755 --- a/reg_tests/snow2mdl/driver.hera.sh +++ b/reg_tests/snow2mdl/driver.hera.sh @@ -29,7 +29,8 @@ set -x -module load intel +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target export DATA="/scratch2/NCEPDEV/stmp1/$LOGNAME/reg_tests.snow2mdl" diff --git a/reg_tests/snow2mdl/driver.jet.sh b/reg_tests/snow2mdl/driver.jet.sh index 69cf86d0e..e5bd8a2c8 100755 --- a/reg_tests/snow2mdl/driver.jet.sh +++ b/reg_tests/snow2mdl/driver.jet.sh @@ -28,9 +28,8 @@ set -x -module unload intel -module load intel/18.0.5.274 -module list +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target export DATA="/mnt/lfs3/projects/emcda/$LOGNAME/stmp/reg_tests.snow2mdl" diff --git a/sorc/CMakeLists.txt b/sorc/CMakeLists.txt new file mode 100644 index 000000000..b5c8884ef --- /dev/null +++ b/sorc/CMakeLists.txt @@ -0,0 +1,18 @@ +add_subdirectory(emcsfc_ice_blend.fd) +add_subdirectory(emcsfc_snow2mdl.fd) +if (OpenMP_FOUND) + add_subdirectory(global_chgres.fd) + add_subdirectory(global_cycle.fd) +else() + message(STATUS "OpenMP is required for global_chgres.fd and was NOT found, skipping ...") + message(STATUS "OpenMP is required for global_cycle.fd and was NOT found, skipping ...") +endif() +add_subdirectory(nst_tf_chg.fd) +add_subdirectory(nemsio_read.fd) +add_subdirectory(nemsio_get.fd) +add_subdirectory(nemsio_chgdate.fd) +add_subdirectory(mkgfsnemsioctl.fd) +add_subdirectory(fre-nctools.fd) +add_subdirectory(chgres_cube.fd) +add_subdirectory(orog.fd) +add_subdirectory(sfc_climo_gen.fd) diff --git a/sorc/build_all_ufs_utils.sh b/sorc/build_all_ufs_utils.sh deleted file mode 100755 index 3d190f90a..000000000 --- a/sorc/build_all_ufs_utils.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/sh -set -eu -#------------------------------------ -# USER DEFINED STUFF: -# -# USE_PREINST_LIBS: set to "true" to use preinstalled libraries. -# Anything other than "true" will use libraries locally. -#------------------------------------ - -export USE_PREINST_LIBS="true" - -#------------------------------------ -# END USER DEFINED STUFF -#------------------------------------ - -build_dir=`pwd` -logs_dir=$build_dir/logs -if [ ! -d $logs_dir ]; then - echo "Creating logs folder" - mkdir $logs_dir -fi - -# Check final exec folder exists -if [ ! -d "../exec" ]; then - echo "Creating ../exec folder" - mkdir ../exec -fi - -#------------------------------------ -# INCLUDE PARTIAL BUILD -#------------------------------------ - -. ./partial_ufs_build.sh - -#------------------------------------ -# build NEMS util -#------------------------------------ -$Build_nems_util && { -echo " .... Building NEMS util .... " -./build_nems_util.sh > $logs_dir/build_NEMS.log 2>&1 -} - -#------------------------------------ -# build chgres -#------------------------------------ -$Build_chgres && { -echo " .... Building chgres .... " -./build_chgres.sh > $logs_dir/build_chgres.log 2>&1 -} - -#------------------------------------ -# build chgres_cube -#------------------------------------ -$Build_chgres_cube && { -echo " .... Building chgres_cube .... " -./build_chgres_cube.sh > $logs_dir/build_chgres_cube.log 2>&1 -} - -#------------------------------------ -# build nst_tf_chg -#------------------------------------ -$Build_nst_tf_chg && { -echo " .... Building nst_tf_chg .... " -./build_nst_tf_chg.sh > $logs_dir/build_nst_tf_chg.log 2>&1 -} - -#------------------------------------ -# build orog -#------------------------------------ -$Build_orog && { -echo " .... Building orog .... " -./build_orog.sh > $logs_dir/build_orog.log 2>&1 -} - -#------------------------------------ -# build cycle -#------------------------------------ -$Build_cycle && { -echo " .... Building cycle .... " -./build_cycle.sh > $logs_dir/build_cycle.log 2>&1 -} - -#------------------------------------ -# build emcsfc -#------------------------------------ -$Build_emcsfc && { -echo " .... Building emcsfc .... " -./build_emcsfc.sh > $logs_dir/build_emcsfc.log 2>&1 -} - -#------------------------------------ -# build fre-nctools -#------------------------------------ -$Build_nctools && { -echo " .... Building fre-nctools .... " -./build_fre-nctools.sh > $logs_dir/build_fre-nctools.log 2>&1 -} - -#------------------------------------ -# build sfc_climo_gen -#------------------------------------ - -$Build_sfc_climo_gen && { -echo " .... Building sfc_climo_gen .... " -./build_sfc_climo_gen.sh > $logs_dir/build_sfc_climo_gen.log 2>&1 -} - -echo;echo " .... Build system finished .... " - -exit 0 diff --git a/sorc/build_chgres.sh b/sorc/build_chgres.sh deleted file mode 100755 index 7dcb4291f..000000000 --- a/sorc/build_chgres.sh +++ /dev/null @@ -1,59 +0,0 @@ -#! /usr/bin/env bash -set -eux - -source ./machine-setup.sh > /dev/null 2>&1 -cwd=`pwd` - -USE_PREINST_LIBS=${USE_PREINST_LIBS:-"true"} -if [ $USE_PREINST_LIBS = true ]; then - export MOD_PATH - source ../modulefiles/fv3gfs/global_chgres.$target > /dev/null 2>&1 -else - export MOD_PATH=${cwd}/lib/modulefiles - if [ $target = wcoss_cray ]; then - source ../modulefiles/fv3gfs/global_chgres.${target}_userlib > /dev/null 2>&1 - else - source ../modulefiles/fv3gfs/global_chgres.$target > /dev/null 2>&1 - fi -fi - -# Check final exec folder exists -if [ ! -d "../exec" ]; then - mkdir ../exec -fi - -# -# --- Chgres part -# -cd global_chgres.fd - -export FCMP=${FCMP:-ifort} -export FCMP95=$FCMP - -export FFLAGSM="-i4 -O3 -r8 -convert big_endian -fp-model precise" -export RECURS= -export LDFLAGSM=${LDFLAGSM:-"-qopenmp -auto"} -export OMPFLAGM=${OMPFLAGM:-"-qopenmp -auto"} - -export INCS="-I${SIGIO_INC4} -I${SFCIO_INC4} -I${LANDSFCUTIL_INCd} \ - -I${NEMSIO_INC} -I${NEMSIOGFS_INC} -I${GFSIO_INC4} -I${IP_INCd} ${NETCDF_INCLUDE}" - -export LIBSM="${GFSIO_LIB4} \ - ${NEMSIOGFS_LIB} \ - ${NEMSIO_LIB} \ - ${SIGIO_LIB4} \ - ${SFCIO_LIB4} \ - ${LANDSFCUTIL_LIBd} \ - ${IP_LIBd} \ - ${SP_LIBd} \ - ${W3EMC_LIBd} \ - ${W3NCO_LIBd} \ - ${BACIO_LIB4} \ - ${NETCDF_LDFLAGS_F}" - -make -f Makefile clobber -make -f Makefile -make -f Makefile install -make -f Makefile clobber - -exit diff --git a/sorc/build_chgres_cube.sh b/sorc/build_chgres_cube.sh deleted file mode 100755 index c13704e1c..000000000 --- a/sorc/build_chgres_cube.sh +++ /dev/null @@ -1,41 +0,0 @@ -#! /usr/bin/env bash -set -eux - -target=${target:-"NULL"} - -if [[ $target == "linux.gnu" || $target == "linux.intel" ]]; then - unset -f module -else - source ./machine-setup.sh > /dev/null 2>&1 -fi - -cwd=`pwd` - -USE_PREINST_LIBS=${USE_PREINST_LIBS:-"true"} -if [ $USE_PREINST_LIBS = true ]; then - export MOD_PATH - source ../modulefiles/chgres_cube.$target > /dev/null 2>&1 -else - export MOD_PATH=${cwd}/lib/modulefiles - if [ $target = wcoss_cray ]; then - source ../modulefiles/chgres_cube.${target}_userlib > /dev/null 2>&1 - else - source ../modulefiles/chgres_cube.$target > /dev/null 2>&1 - fi -fi - -# Check final exec folder exists -if [ ! -d "../exec" ]; then - mkdir ../exec -fi - -# -# --- Chgres part -# -cd chgres_cube.fd - -make clean -make -make install - -exit diff --git a/sorc/build_cycle.sh b/sorc/build_cycle.sh deleted file mode 100755 index 75e80cc29..000000000 --- a/sorc/build_cycle.sh +++ /dev/null @@ -1,27 +0,0 @@ -#! /usr/bin/env bash -set -eux - -source ./machine-setup.sh > /dev/null 2>&1 -cwd=`pwd` - -USE_PREINST_LIBS=${USE_PREINST_LIBS:-"true"} -if [ $USE_PREINST_LIBS = true ]; then - export MOD_PATH - source ../modulefiles/fv3gfs/global_cycle.$target > /dev/null 2>&1 -else - export MOD_PATH=${cwd}/lib/modulefiles - if [ $target = wcoss_cray ]; then - source ../modulefiles/fv3gfs/global_cycle.${target}_userlib > /dev/null 2>&1 - else - source ../modulefiles/fv3gfs/global_cycle.$target > /dev/null 2>&1 - fi -fi -module list - -# Check final exec folder exists -if [ ! -d "../exec" ]; then - mkdir ../exec -fi - -cd ${cwd}/global_cycle.fd -./makefile.sh diff --git a/sorc/build_emcsfc.sh b/sorc/build_emcsfc.sh deleted file mode 100755 index 233c40b26..000000000 --- a/sorc/build_emcsfc.sh +++ /dev/null @@ -1,33 +0,0 @@ -#! /usr/bin/env bash -set -eux - -source ./machine-setup.sh > /dev/null 2>&1 -cwd=`pwd` - -# Check final exec folder exists -if [ ! -d "../exec" ]; then - mkdir ../exec -fi - -for prog in emcsfc_ice_blend emcsfc_snow2mdl -do - module purge - USE_PREINST_LIBS=${USE_PREINST_LIBS:-"true"} - if [ $USE_PREINST_LIBS = true ]; then - export MOD_PATH - source ../modulefiles/modulefile.global_${prog}.${target} > /dev/null 2>&1 - else - export MOD_PATH=${cwd}/lib/modulefiles - if [ $target = wcoss_cray ]; then - source ../modulefiles/modulefile.global_${prog}.${target}_userlib > /dev/null 2>&1 - else - source ../modulefiles/modulefile.global_${prog}.${target} > /dev/null 2>&1 - fi - fi - module list - cd ${cwd}/${prog}.fd - ./make.sh - cd $cwd -done - -echo; echo DONE BUILDING EMCSFC PROGRAMS diff --git a/sorc/build_fre-nctools.sh b/sorc/build_fre-nctools.sh deleted file mode 100755 index 718adad42..000000000 --- a/sorc/build_fre-nctools.sh +++ /dev/null @@ -1,118 +0,0 @@ -#!/bin/sh -set -eux - -source ./machine-setup.sh > /dev/null 2>&1 -system_site=$target -if [ $system_site = "wcoss_cray" ]; then - system_site=cray -fi - -cwd=`pwd` - -# Check final exec folder exists -if [ ! -d "../exec" ]; then - mkdir ../exec -fi - -cd fre-nctools.fd/ - -home_dir=`pwd`/../.. -srcDir=`pwd` - -#Build in a temporary directory. -tmpDir=`pwd`/build -mkdir -p $tmpDir -cd $tmpDir - -set +x -echo "////////////////////////////////////////////////////////////////////////////////" -echo "//////////////////////////////////////////////////////// Environment Settings //" -echo "////////////////////////////////////////////////////////////////////////////////" -set -x - -#Original setup is for cray so for now require input only on a different platform. - -set +x -module list -module use ../../../modulefiles/fv3gfs > /dev/null 2>&1 -module load fre-nctools.${target} > /dev/null 2>&1 -module list -set -x - -MPICH_UNEX_BUFFER_SIZE=256m -MPICH_MAX_SHORT_MSG_SIZE=64000 -MPICH_PTL_UNEX_EVENTS=160k -KMP_STACKSIZE=2g -F_UFMTENDIAN=big - -if [ $system_site = "cray" ]; then - HDF5=${HDF5_DIR} - NETCDF=${NETCDF_DIR} -fi - -alias make="make HDF5_HOME=${HDF5} NETCDF_HOME=${NETCDF} NC_BLKSZ=64K SITE=${system_site} -f fre-nctools.mk" - -set +x -echo "////////////////////////////////////////////////////////////////////////////////" -echo "//////////////////////////////////////////////////////////// Directory Layout //" -echo "////////////////////////////////////////////////////////////////////////////////" -set -x - -mkdir -p share/src -cp -r $srcDir/shared share/src/. -cp -r $srcDir/tools share/src/. - -echo "Done..." - -for freNCToolsDir in tools/make_hgrid tools/make_solo_mosaic tools/fregrid -do - set +x - echo "////////////////////////////////////////////////////////////////////////////////" - echo "////////////////////////////////////////////////////////////////// $freNCToolsDir:t" - echo "////////////////////////////////////////////////////////////////////////////////" - set -x - - cd share/src/$freNCToolsDir - cp fre-nctools.mk_${system_site} fre-nctools.mk - targets=` grep "TARGETS :=" fre-nctools.mk | cut -f2 -d'=' ` - echo "Making $targets" - - make clean - make - - for Target in $targets - do - if [ -f $Target ]; then - mv $Target $home_dir/exec - else - echo "Error during '$Target' build" - exit 1 - fi - done - make clean - cd $tmpDir -done - -set +x -echo "////////////////////////////////////////////////////////////////////////////////" -echo "///////////////////////////////////////////////////////////////// filter_topo //" -echo "////////////////////////////////////////////////////////////////////////////////" -set -x - -cd ../tools/filter_topo -./make.csh_${target} -mv filter_topo $home_dir/exec/. - -echo "\n////////// CLEANING UP TEMPORARY BUILD AREA //////////\n" -rm -fr $tmpDir - -set +x -echo "///////////////////////////////////////////////////////////////////////////" -echo "///////////////////////////////////////////////////////////////// shave //" -echo "///////////////////////////////////////////////////////////////////////////" -set -x - -cd $srcDir/tools/shave.fd -./build_shave $system_site - -exit diff --git a/sorc/build_nems_util.sh b/sorc/build_nems_util.sh deleted file mode 100755 index 3f2f1498c..000000000 --- a/sorc/build_nems_util.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -set -eux - -source ./machine-setup.sh > /dev/null 2>&1 -cwd=`pwd` - -USE_PREINST_LIBS=${USE_PREINST_LIBS:-"true"} -if [ $USE_PREINST_LIBS = true ]; then - export MOD_PATH - source ../modulefiles/module_nemsutil.$target > /dev/null 2>&1 -else - export MOD_PATH=${cwd}/lib/modulefiles - if [ $target = wcoss_cray ]; then - source ../modulefiles/module_nemsutil.${target}_userlib > /dev/null 2>&1 - else - source ../modulefiles/module_nemsutil.$target > /dev/null 2>&1 - fi -fi - -# Check final exec folder exists -if [ ! -d "../exec" ]; then - mkdir ../exec -fi - -for prog in nemsio_get.fd nemsio_read.fd nemsio_chgdate.fd mkgfsnemsioctl.fd ;do - cd ${cwd}/${prog} - make -f makefile -done - -exit diff --git a/sorc/build_nst_tf_chg.sh b/sorc/build_nst_tf_chg.sh deleted file mode 100755 index 5ba9ec958..000000000 --- a/sorc/build_nst_tf_chg.sh +++ /dev/null @@ -1,25 +0,0 @@ -#! /usr/bin/env bash -set -eux - -source ./machine-setup.sh > /dev/null 2>&1 -cwd=`pwd` - -module purge -USE_PREINST_LIBS=${USE_PREINST_LIBS:-"true"} -if [ $USE_PREINST_LIBS = true ]; then - export MOD_PATH - source ../modulefiles/fv3gfs/nst_tf_chg.$target > /dev/null 2>&1 -else - export MOD_PATH=${cwd}/lib/modulefiles - if [ $target = wcoss_cray ]; then - source ../modulefiles/fv3gfs/nst_tf_chg.${target}_userlib > /dev/null 2>&1 - else - source ../modulefiles/fv3gfs/nst_tf_chg.$target > /dev/null 2>&1 - fi -fi -module list - -cd ${cwd}/nst_tf_chg.fd -make clean -make build -make install diff --git a/sorc/build_orog.sh b/sorc/build_orog.sh deleted file mode 100755 index c1cc33a81..000000000 --- a/sorc/build_orog.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -##################################################################################### -# orog using module compile standard -# 10/10/2016 Fanglin.Yang@noaa.gov: Create module load version -##################################################################################### -set -eux - -source ./machine-setup.sh > /dev/null 2>&1 -cwd=`pwd` - -USE_PREINST_LIBS=${USE_PREINST_LIBS:-"true"} -if [ $USE_PREINST_LIBS = true ]; then - export MOD_PATH - source ../modulefiles/fv3gfs/orog.$target > /dev/null 2>&1 -else - export MOD_PATH=${cwd}/lib/modulefiles - if [ $target = wcoss_cray ]; then - source ../modulefiles/fv3gfs/orog.${target}_userlib > /dev/null 2>&1 - else - source ../modulefiles/fv3gfs/orog.$target > /dev/null 2>&1 - fi -fi - -# Check final exec folder exists -if [ ! -d "../exec" ]; then - mkdir ../exec -fi - -cd ./orog.fd - -if [ $target = wcoss_cray ]; then - export LIBSM="${BACIO_LIB4} ${IP_LIBd} ${W3NCO_LIBd} ${SP_LIBd}" - export FFLAGSM="-O3 -g -traceback -r8 -convert big_endian -fp-model precise -assume byterecl" -elif [ $target = wcoss_dell_p3 ]; then - INCS="${NETCDF_INCLUDE}" - export LIBSM="${BACIO_LIB4} ${W3NCO_LIBd} ${IP_LIBd} ${SP_LIBd} ${NETCDF_LDFLAGS}" - export FFLAGSM="-O3 -g -traceback -r8 -convert big_endian -fp-model precise -assume byterecl ${INCS}" -elif [ $target = wcoss ]; then - INCS="${NETCDF_INCLUDE}" - export LIBSM="${BACIO_LIB4} ${W3NCO_LIBd} ${IP_LIBd} ${SP_LIBd} ${NETCDF_LDFLAGS}" - export FFLAGSM="-O3 -g -traceback -r8 -convert big_endian -fp-model precise -assume byterecl ${INCS}" -elif [ $target = jet ]; then - INCS="-I${NETCDF}/include" - export LIBSM="${BACIO_LIB4} ${W3NCO_LIBd} ${IP_LIBd} ${SP_LIBd} -L${NETCDF}/lib -lnetcdff -lnetcdf" - export FFLAGSM="-O3 -g -traceback -r8 -convert big_endian -fp-model precise -assume byterecl ${INCS}" -elif [ $target = hera ]; then - INCS="-I${NETCDF}/include" - export LIBSM="${BACIO_LIB4} ${W3NCO_LIBd} ${IP_LIBd} ${SP_LIBd} -L${NETCDF}/lib -lnetcdff -lnetcdf" - export FFLAGSM="-O3 -g -traceback -r8 -convert big_endian -fp-model precise -assume byterecl ${INCS}" -else - echo machine $target not found - exit 1 -fi - -export FCMP=${FCMP:-ifort} -export FCMP95=$FCMP - -export LDFLAGSM="-qopenmp -auto" -export OMPFLAGM="-qopenmp -auto" - -make -f Makefile clobber -make -f Makefile -make -f Makefile install -make -f Makefile clobber - -exit diff --git a/sorc/build_sfc_climo_gen.sh b/sorc/build_sfc_climo_gen.sh deleted file mode 100755 index cf253d358..000000000 --- a/sorc/build_sfc_climo_gen.sh +++ /dev/null @@ -1,34 +0,0 @@ -#! /usr/bin/env bash -set -eux - -source ./machine-setup.sh > /dev/null 2>&1 -cwd=`pwd` - -# Check final exec folder exists -if [ ! -d "../exec" ]; then - mkdir ../exec -fi - -module purge -USE_PREINST_LIBS=${USE_PREINST_LIBS:-"true"} -if [ $USE_PREINST_LIBS = true ]; then - export MOD_PATH - source ../modulefiles/modulefile.sfc_climo_gen.${target} > /dev/null 2>&1 -else - export MOD_PATH=${cwd}/lib/modulefiles - if [ $target = wcoss_cray ]; then - source ../modulefiles/modulefile.sfc_climo_gen.${target}_userlib > /dev/null 2>&1 - else - source ../modulefiles/modulefile.sfc_climo_gen.${target} > /dev/null 2>&1 - fi -fi - -module list - -cd ./sfc_climo_gen.fd - -make clean -make -make install - -echo; echo DONE BUILDING sfc_climo_gen diff --git a/sorc/chgres_cube.fd/CMakeLists.txt b/sorc/chgres_cube.fd/CMakeLists.txt new file mode 100644 index 000000000..d1eb87408 --- /dev/null +++ b/sorc/chgres_cube.fd/CMakeLists.txt @@ -0,0 +1,38 @@ +set(fortran_src + atmosphere.F90 + chgres.F90 + grib2_util.F90 + input_data.F90 + model_grid.F90 + program_setup.f90 + search_util.f90 + static_data.F90 + surface.F90 + utils.f90 + write_data.F90) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian -assume byterecl") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-0 -fdefault-real-8 -fconvert=big-endian") +endif() + +set(exe_name chgres_cube) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + nemsio + sfcio_4 + sigio_4 + bacio_4 + sp_d + w3nco_d + esmf + wgrib2 + MPI::MPI_Fortran + NetCDF::NetCDF_Fortran) +if(OpenMP_Fortran_FOUND) + target_link_libraries(${exe_name} OpenMP::OpenMP_Fortran) +endif() + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/chgres_cube.fd/makefile b/sorc/chgres_cube.fd/makefile deleted file mode 100644 index a247c85b7..000000000 --- a/sorc/chgres_cube.fd/makefile +++ /dev/null @@ -1,59 +0,0 @@ -SHELL= /bin/sh - -include $(ESMFMKFILE) - -CMD= chgres_cube.exe - -OBJS = chgres.o \ - atmosphere.o \ - input_data.o \ - surface.o \ - model_grid.o \ - program_setup.o \ - write_data.o \ - search_util.o \ - static_data.o \ - utils.o \ - grib2_util.o - -$(CMD): $(OBJS) - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -o $(CMD) $(OBJS) $(SP_LIBd) $(NEMSIO_LIB) $(BACIO_LIB4) $(W3NCO_LIBd) $(SFCIO_LIB4) $(SIGIO_LIB4) $(ESMF_F90LINKPATHS) $(ESMF_F90ESMFLINKRPATHS) $(ESMF_F90ESMFLINKLIBS) $(WGRIB2_LIB) - -model_grid.o: program_setup.o model_grid.F90 - $(FCOMP) $(FFLAGS) -I$(NEMSIO_INC) -I$(SFCIO_INC4) -I$(SIGIO_INC4) -I$(WGRIB2API_INC) $(ESMF_F90COMPILEPATHS) -c model_grid.F90 - -utils.o: utils.f90 - $(FCOMP) $(FFLAGS) -c $(ESMF_F90COMPILEPATHS) utils.f90 - -grib2_util.o: model_grid.o program_setup.o grib2_util.F90 - $(FCOMP) $(FFLAGS) -c $(ESMF_F90COMPILEPATHS) grib2_util.F90 - -program_setup.o: program_setup.f90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c program_setup.f90 - -atmosphere.o: program_setup.o model_grid.o input_data.o atmosphere.F90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c atmosphere.F90 - -chgres.o: atmosphere.o model_grid.o program_setup.o surface.o chgres.F90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c chgres.F90 - -write_data.o: atmosphere.o model_grid.o program_setup.o surface.o static_data.o write_data.F90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c write_data.F90 - -input_data.o: program_setup.o model_grid.o grib2_util.o input_data.F90 - $(FCOMP) $(FFLAGS) -I$(NEMSIO_INC) -I$(SIGIO_INC4) -I$(SFCIO_INC4) -I$(WGRIB2API_INC) $(ESMF_F90COMPILEPATHS) -c input_data.F90 - -surface.o: search_util.o model_grid.o input_data.o program_setup.o static_data.o surface.F90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c surface.F90 - -search_util.o: search_util.f90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c search_util.f90 - -static_data.o: model_grid.o program_setup.o static_data.F90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c static_data.F90 - -clean: - rm -f *.o *.mod ${CMD} ../../exec/${CMD} - -install: - mv $(CMD) ../../exec diff --git a/sorc/chgres_cube.fd/run/config.C1152.l91.atm.theia.nml b/sorc/chgres_cube.fd/run/config.C1152.l91.atm.theia.nml deleted file mode 100644 index f4c3f646c..000000000 --- a/sorc/chgres_cube.fd/run/config.C1152.l91.atm.theia.nml +++ /dev/null @@ -1,26 +0,0 @@ - -# Convert atmosphere from C768 L64 to C1152 L91. -# Uses lots of memory. Use six nodes, six tasks per node. -# When using -O3, takes 8 1/2 minutes - -&config - mosaic_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C1152/C1152_mosaic.nc" - fix_dir_target_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/gridgen_sfc/C1152" - orog_dir_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C1152" - orog_files_target_grid="C1152_oro_data.tile1.nc","C1152_oro_data.tile2.nc","C1152_oro_data.tile3.nc","C1152_oro_data.tile4.nc","C1152_oro_data.tile5.nc","C1152_oro_data.tile6.nc" - vcoord_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l91.txt" - mosaic_file_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768/C768_mosaic.nc" - orog_dir_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768" - orog_files_input_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - data_dir_input_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/ICs/C768_2018082906" - atm_core_files_input_grid="fv_core.res.tile1.nc","fv_core.res.tile2.nc","fv_core.res.tile3.nc","fv_core.res.tile4.nc","fv_core.res.tile5.nc","fv_core.res.tile6.nc","fv_core.res.nc" - atm_tracer_files_input_grid="fv_tracer.res.tile1.nc","fv_tracer.res.tile2.nc","fv_tracer.res.tile3.nc","fv_tracer.res.tile4.nc","fv_tracer.res.tile5.nc","fv_tracer.res.tile6.nc" - cycle_mon=08 - cycle_day=29 - cycle_hour=6 - convert_atm=.true. - convert_sfc=.false. - convert_nst=.false. - tracers="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" - tracers_input="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" -/ diff --git a/sorc/chgres_cube.fd/run/config.C1152.l91.dell.nml b/sorc/chgres_cube.fd/run/config.C1152.l91.dell.nml deleted file mode 100644 index 79a113084..000000000 --- a/sorc/chgres_cube.fd/run/config.C1152.l91.dell.nml +++ /dev/null @@ -1,25 +0,0 @@ - -# C768 L64 to C1152 L91 -# Spread across six nodes. - -&config - fix_dir_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/gridgen_sfc/C1152" - mosaic_file_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C1152/C1152_mosaic.nc" - orog_dir_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C1152" - orog_files_target_grid="C1152_oro_data.tile1.nc","C1152_oro_data.tile2.nc","C1152_oro_data.tile3.nc","C1152_oro_data.tile4.nc","C1152_oro_data.tile5.nc","C1152_oro_data.tile6.nc" - mosaic_file_input_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768/C768_mosaic.nc" - orog_dir_input_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768" - orog_files_input_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - data_dir_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/ICs/C768_2018082906" - atm_core_files_input_grid="fv_core.res.tile1.nc","fv_core.res.tile2.nc","fv_core.res.tile3.nc","fv_core.res.tile4.nc","fv_core.res.tile5.nc","fv_core.res.tile6.nc","fv_core.res.nc" - atm_tracer_files_input_grid="fv_tracer.res.tile1.nc","fv_tracer.res.tile2.nc","fv_tracer.res.tile3.nc","fv_tracer.res.tile4.nc","fv_tracer.res.tile5.nc","fv_tracer.res.tile6.nc" - vcoord_file_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l91.txt" - cycle_mon=8 - cycle_day=29 - cycle_hour=6 - convert_atm=.true. - convert_sfc=.false. - convert_nst=.false. - tracers="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" - tracers_input="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" -/ diff --git a/sorc/chgres_cube.fd/run/config.C1152.theia.nml b/sorc/chgres_cube.fd/run/config.C1152.theia.nml deleted file mode 100644 index 89234d7d4..000000000 --- a/sorc/chgres_cube.fd/run/config.C1152.theia.nml +++ /dev/null @@ -1,17 +0,0 @@ -&config - fix_dir_target_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/gridgen_sfc/C1152" - mosaic_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C1152/C1152_mosaic.nc" - orog_dir_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C1152" - orog_files_target_grid="C1152_oro_data.tile1.nc","C1152_oro_data.tile2.nc","C1152_oro_data.tile3.nc","C1152_oro_data.tile4.nc","C1152_oro_data.tile5.nc","C1152_oro_data.tile6.nc" - mosaic_file_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768/C768_mosaic.nc" - orog_dir_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768" - orog_files_input_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - data_dir_input_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/ICs/C768_2017082600" - sfc_files_input_grid="sfc_data.tile1.nc","sfc_data.tile2.nc","sfc_data.tile3.nc","sfc_data.tile4.nc","sfc_data.tile5.nc","sfc_data.tile6.nc" - cycle_mon=8 - cycle_day=26 - cycle_hour=0 - convert_atm=.false. - convert_sfc=.true. - convert_nst=.true. -/ diff --git a/sorc/chgres_cube.fd/run/config.C384.cray.nml b/sorc/chgres_cube.fd/run/config.C384.cray.nml deleted file mode 100644 index 20f9f4f34..000000000 --- a/sorc/chgres_cube.fd/run/config.C384.cray.nml +++ /dev/null @@ -1,17 +0,0 @@ -&config - fix_dir_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/gridgen_sfc/C384" - mosaic_file_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C384/C384_mosaic.nc" - orog_dir_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C384" - orog_files_target_grid="C384_oro_data.tile1.nc","C384_oro_data.tile2.nc","C384_oro_data.tile3.nc","C384_oro_data.tile4.nc","C384_oro_data.tile5.nc","C384_oro_data.tile6.nc" - mosaic_file_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768/C768_mosaic.nc" - orog_dir_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768" - orog_files_input_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - data_dir_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/ICs/C768_2017082600" - sfc_files_input_grid="sfc_data.tile1.nc","sfc_data.tile2.nc","sfc_data.tile3.nc","sfc_data.tile4.nc","sfc_data.tile5.nc","sfc_data.tile6.nc" - cycle_mon=8 - cycle_day=26 - cycle_hour=0 - convert_atm=.false. - convert_sfc=.true. - convert_nst=.true. -/ diff --git a/sorc/chgres_cube.fd/run/config.C384.dell.nml b/sorc/chgres_cube.fd/run/config.C384.dell.nml deleted file mode 100644 index fb2ff02a5..000000000 --- a/sorc/chgres_cube.fd/run/config.C384.dell.nml +++ /dev/null @@ -1,24 +0,0 @@ - -# Fits on one node - -&config - fix_dir_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/gridgen_sfc/C384" - mosaic_file_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C384/C384_mosaic.nc" - orog_dir_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C384" - orog_files_target_grid="C384_oro_data.tile1.nc","C384_oro_data.tile2.nc","C384_oro_data.tile3.nc","C384_oro_data.tile4.nc","C384_oro_data.tile5.nc","C384_oro_data.tile6.nc" - mosaic_file_input_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768/C768_mosaic.nc" - orog_dir_input_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768" - orog_files_input_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - data_dir_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/ICs/C768_2018082906" - atm_core_files_input_grid="fv_core.res.tile1.nc","fv_core.res.tile2.nc","fv_core.res.tile3.nc","fv_core.res.tile4.nc","fv_core.res.tile5.nc","fv_core.res.tile6.nc","fv_core.res.nc" - atm_tracer_files_input_grid="fv_tracer.res.tile1.nc","fv_tracer.res.tile2.nc","fv_tracer.res.tile3.nc","fv_tracer.res.tile4.nc","fv_tracer.res.tile5.nc","fv_tracer.res.tile6.nc" - vcoord_file_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l64.txt" - cycle_mon=8 - cycle_day=29 - cycle_hour=6 - convert_atm=.true. - convert_sfc=.false. - convert_nst=.false. - tracers="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" - tracers_input="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" -/ diff --git a/sorc/chgres_cube.fd/run/config.C384.gaussian.dell.nml b/sorc/chgres_cube.fd/run/config.C384.gaussian.dell.nml deleted file mode 100644 index 73b9655b2..000000000 --- a/sorc/chgres_cube.fd/run/config.C384.gaussian.dell.nml +++ /dev/null @@ -1,24 +0,0 @@ - -# Fits on one node - -&config - fix_dir_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/gridgen_sfc/C384" - mosaic_file_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C384/C384_mosaic.nc" - orog_dir_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C384" - orog_files_target_grid="C384_oro_data.tile1.nc","C384_oro_data.tile2.nc","C384_oro_data.tile3.nc","C384_oro_data.tile4.nc","C384_oro_data.tile5.nc","C384_oro_data.tile6.nc" - mosaic_file_input_grid="NULL" - orog_dir_input_grid="NULL" - orog_files_input_grid="NULL" - data_dir_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/ICs/C384_2018092800_gaussian" - atm_files_input_grid="gdas.t00z.atmf000.nemsio" - vcoord_file_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l64.txt" - cycle_mon=9 - cycle_day=28 - cycle_hour=0 - convert_atm=.true. - convert_sfc=.false. - convert_nst=.false. - input_type="gaussian" - tracers="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" - tracers_input="spfh","clwmr","o3mr","icmr","rwmr","snmr","grle" -/ diff --git a/sorc/chgres_cube.fd/run/config.C384.theia.nml b/sorc/chgres_cube.fd/run/config.C384.theia.nml deleted file mode 100644 index 672b8a5a0..000000000 --- a/sorc/chgres_cube.fd/run/config.C384.theia.nml +++ /dev/null @@ -1,17 +0,0 @@ -&config - fix_dir_target_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/gridgen_sfc/C384" - mosaic_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C384/C384_mosaic.nc" - orog_dir_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C384" - orog_files_target_grid="C384_oro_data.tile1.nc","C384_oro_data.tile2.nc","C384_oro_data.tile3.nc","C384_oro_data.tile4.nc","C384_oro_data.tile5.nc","C384_oro_data.tile6.nc" - mosaic_file_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768/C768_mosaic.nc" - orog_dir_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768" - orog_files_input_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - data_dir_input_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/ICs/C768_2017082600" - sfc_files_input_grid="sfc_data.tile1.nc","sfc_data.tile2.nc","sfc_data.tile3.nc","sfc_data.tile4.nc","sfc_data.tile5.nc","sfc_data.tile6.nc" - cycle_mon=8 - cycle_day=26 - cycle_hour=0 - convert_atm=.false. - convert_sfc=.true. - convert_nst=.true. -/ diff --git a/sorc/chgres_cube.fd/run/config.C48.cray.nml b/sorc/chgres_cube.fd/run/config.C48.cray.nml deleted file mode 100644 index fc8f69da9..000000000 --- a/sorc/chgres_cube.fd/run/config.C48.cray.nml +++ /dev/null @@ -1,21 +0,0 @@ -&config - fix_dir_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/gridgen_sfc/C48" - mosaic_file_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C48/C48_mosaic.nc" - orog_dir_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C48" - orog_files_target_grid="C48_oro_data.tile1.nc","C48_oro_data.tile2.nc","C48_oro_data.tile3.nc","C48_oro_data.tile4.nc","C48_oro_data.tile5.nc","C48_oro_data.tile6.nc" - mosaic_file_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C96/C96_mosaic.nc" - orog_dir_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C96" - orog_files_input_grid="C96_oro_data.tile1.nc","C96_oro_data.tile2.nc","C96_oro_data.tile3.nc","C96_oro_data.tile4.nc","C96_oro_data.tile5.nc","C96_oro_data.tile6.nc" - data_dir_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/ICs/C96_2018022000" - atm_files_input_grid="dynf000.tile1.nc","dynf000.tile2.nc","dynf000.tile3.nc","dynf000.tile4.nc","dynf000.tile5.nc","dynf000.tile6.nc" - vcoord_file_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l64.txt" - cycle_mon=2 - cycle_day=22 - cycle_hour=0 - convert_atm=.true. - convert_sfc=.false. - convert_nst=.false. - input_type="history" - tracers="sphum","liq_wat","o3mr" - tracers_input="spfh","clwmr","o3mr" -/ diff --git a/sorc/chgres_cube.fd/run/config.C48.dell.nml b/sorc/chgres_cube.fd/run/config.C48.dell.nml deleted file mode 100644 index 5a980fd63..000000000 --- a/sorc/chgres_cube.fd/run/config.C48.dell.nml +++ /dev/null @@ -1,21 +0,0 @@ -&config - fix_dir_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/gridgen_sfc/C48" - mosaic_file_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C48/C48_mosaic.nc" - orog_dir_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C48" - orog_files_target_grid="C48_oro_data.tile1.nc","C48_oro_data.tile2.nc","C48_oro_data.tile3.nc","C48_oro_data.tile4.nc","C48_oro_data.tile5.nc","C48_oro_data.tile6.nc" - mosaic_file_input_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C96/C96_mosaic.nc" - orog_dir_input_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C96" - orog_files_input_grid="C96_oro_data.tile1.nc","C96_oro_data.tile2.nc","C96_oro_data.tile3.nc","C96_oro_data.tile4.nc","C96_oro_data.tile5.nc","C96_oro_data.tile6.nc" - data_dir_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/ICs/C96_2018022000" - atm_files_input_grid="dynf000.tile1.nc","dynf000.tile2.nc","dynf000.tile3.nc","dynf000.tile4.nc","dynf000.tile5.nc","dynf000.tile6.nc" - vcoord_file_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l64.txt" - cycle_mon=2 - cycle_day=22 - cycle_hour=0 - convert_atm=.true. - convert_sfc=.false. - convert_nst=.false. - input_type="history" - tracers="sphum","liq_wat","o3mr" - tracers_input="spfh","clwmr","o3mr" -/ diff --git a/sorc/chgres_cube.fd/run/config.C48.gaussian.theia.nml b/sorc/chgres_cube.fd/run/config.C48.gaussian.theia.nml deleted file mode 100644 index d9707f7da..000000000 --- a/sorc/chgres_cube.fd/run/config.C48.gaussian.theia.nml +++ /dev/null @@ -1,22 +0,0 @@ -&config - mosaic_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C48/C48_mosaic.nc" - fix_dir_target_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/gridgen_sfc/C48" - orog_dir_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C48" - orog_files_target_grid="C48_oro_data.tile1.nc","C48_oro_data.tile2.nc","C48_oro_data.tile3.nc","C48_oro_data.tile4.nc","C48_oro_data.tile5.nc","C48_oro_data.tile6.nc" - vcoord_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l64.txt" - mosaic_file_input_grid="NULL" - orog_dir_input_grid="NULL" - orog_files_input_grid="NULL" - data_dir_input_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/ICs/C768_2018091400_gaussian" - atm_files_input_grid="gdas.t00z.atmf000.nemsio" - sfc_files_input_grid="gdas.t00z.sfcf000.nemsio" - cycle_mon=9 - cycle_day=14 - cycle_hour=0 - convert_atm=.false. - convert_sfc=.true. - convert_nst=.false. - input_type="gaussian" - tracers="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" - tracers_input="spfh","clwmr","o3mr","icmr","rwmr","snmr","grle" -/ diff --git a/sorc/chgres_cube.fd/run/config.C48.gfs.gaussian.theia.nml b/sorc/chgres_cube.fd/run/config.C48.gfs.gaussian.theia.nml deleted file mode 100644 index 781668335..000000000 --- a/sorc/chgres_cube.fd/run/config.C48.gfs.gaussian.theia.nml +++ /dev/null @@ -1,23 +0,0 @@ -&config - mosaic_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C48/C48_mosaic.nc" - fix_dir_target_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/gridgen_sfc/C48" - orog_dir_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C48" - orog_files_target_grid="C48_oro_data.tile1.nc","C48_oro_data.tile2.nc","C48_oro_data.tile3.nc","C48_oro_data.tile4.nc","C48_oro_data.tile5.nc","C48_oro_data.tile6.nc" - vcoord_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l64.txt" - mosaic_file_input_grid="NULL" - orog_dir_input_grid="NULL" - orog_files_input_grid="NULL" - data_dir_input_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_tutorial/nemsio" - atm_files_input_grid="gfnanl.gdas.2017071700" - nst_files_input_grid="nsnanl.gdas.2017071700" - sfc_files_input_grid="sfnanl.gdas.2017071700" - cycle_mon=7 - cycle_day=17 - cycle_hour=0 - convert_atm=.true. - convert_sfc=.true. - convert_nst=.true. - input_type="gfs_gaussian" - tracers="sphum","liq_wat","o3mr" - tracers_input="spfh","clwmr","o3mr" -/ diff --git a/sorc/chgres_cube.fd/run/config.C48.gfs.spectral.dell.nml b/sorc/chgres_cube.fd/run/config.C48.gfs.spectral.dell.nml deleted file mode 100644 index eee9d16b6..000000000 --- a/sorc/chgres_cube.fd/run/config.C48.gfs.spectral.dell.nml +++ /dev/null @@ -1,23 +0,0 @@ -&config - mosaic_file_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C48/C48_mosaic.nc" - fix_dir_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/gridgen_sfc/C48" - orog_dir_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C48" - orog_files_target_grid="C48_oro_data.tile1.nc","C48_oro_data.tile2.nc","C48_oro_data.tile3.nc","C48_oro_data.tile4.nc","C48_oro_data.tile5.nc","C48_oro_data.tile6.nc" - vcoord_file_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l65.txt" - mosaic_file_input_grid="NULL" - orog_dir_input_grid="NULL" - orog_files_input_grid="NULL" - data_dir_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/chgres_tutorial/old.fmt" - atm_files_input_grid="gdas.t00z.sanl" - nst_files_input_grid="NULL" - sfc_files_input_grid="gdas.t00z.sfcanl" - cycle_mon=7 - cycle_day=17 - cycle_hour=0 - convert_atm=.true. - convert_sfc=.true. - convert_nst=.false. - input_type="gfs_spectral" - tracers_input="spfh","o3mr","clwmr" - tracers="sphum","o3mr","liq_wat" -/ diff --git a/sorc/chgres_cube.fd/run/config.C48.gfs.spectral.theia.nml b/sorc/chgres_cube.fd/run/config.C48.gfs.spectral.theia.nml deleted file mode 100644 index ccd66ce81..000000000 --- a/sorc/chgres_cube.fd/run/config.C48.gfs.spectral.theia.nml +++ /dev/null @@ -1,23 +0,0 @@ -&config - mosaic_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C48/C48_mosaic.nc" - fix_dir_target_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/gridgen_sfc/C48" - orog_dir_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C48" - orog_files_target_grid="C48_oro_data.tile1.nc","C48_oro_data.tile2.nc","C48_oro_data.tile3.nc","C48_oro_data.tile4.nc","C48_oro_data.tile5.nc","C48_oro_data.tile6.nc" - vcoord_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l65.txt" - mosaic_file_input_grid="NULL" - orog_dir_input_grid="NULL" - orog_files_input_grid="NULL" - data_dir_input_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_tutorial/old.fmt" - atm_files_input_grid="gdas.t00z.sanl" - nst_files_input_grid="NULL" - sfc_files_input_grid="gdas.t00z.sfcanl" - cycle_mon=7 - cycle_day=17 - cycle_hour=0 - convert_atm=.true. - convert_sfc=.true. - convert_nst=.false. - input_type="gfs_spectral" - tracers_input="spfh","o3mr","clwmr" - tracers="sphum","o3mr","liq_wat" -/ diff --git a/sorc/chgres_cube.fd/run/config.C48.theia.nml b/sorc/chgres_cube.fd/run/config.C48.theia.nml deleted file mode 100644 index 59c67a479..000000000 --- a/sorc/chgres_cube.fd/run/config.C48.theia.nml +++ /dev/null @@ -1,23 +0,0 @@ -&config - mosaic_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C48/C48_mosaic.nc" - fix_dir_target_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/gridgen_sfc/C48" - orog_dir_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C48" - orog_files_target_grid="C48_oro_data.tile1.nc","C48_oro_data.tile2.nc","C48_oro_data.tile3.nc","C48_oro_data.tile4.nc","C48_oro_data.tile5.nc","C48_oro_data.tile6.nc" - vcoord_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l64.txt" - mosaic_file_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C96/C96_mosaic.nc" - orog_dir_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C96" - orog_files_input_grid="C96_oro_data.tile1.nc","C96_oro_data.tile2.nc","C96_oro_data.tile3.nc","C96_oro_data.tile4.nc","C96_oro_data.tile5.nc","C96_oro_data.tile6.nc" - data_dir_input_grid="/scratch4/NCEPDEV/stmp3/George.Gayno/FV3_RT/rt_10604/fv3_control/" - atm_files_input_grid="dynf000.tile1.nc","dynf000.tile2.nc","dynf000.tile3.nc","dynf000.tile4.nc","dynf000.tile5.nc","dynf000.tile6.nc" - sfc_files_input_grid="phyf000.tile1.nc","phyf000.tile2.nc","phyf000.tile3.nc","phyf000.tile4.nc","phyf000.tile5.nc","phyf000.tile6.nc" - input_type="history" - cycle_mon=2 - cycle_day=22 - cycle_hour=0 - convert_atm=.true. - convert_sfc=.true. - convert_nst=.false. - atm_weight_file="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/weights/C96_to_C48.bilinear.nc" - tracers="sphum","liq_wat","o3mr" - tracers_input="spfh","clwmr","o3mr" -/ diff --git a/sorc/chgres_cube.fd/run/config.C768.atm.theia.nml b/sorc/chgres_cube.fd/run/config.C768.atm.theia.nml deleted file mode 100644 index da2bff20f..000000000 --- a/sorc/chgres_cube.fd/run/config.C768.atm.theia.nml +++ /dev/null @@ -1,26 +0,0 @@ - -# Convert from C384 L64 to C768 L64. -# Use two nodes, six tasks per node. - -&config - mosaic_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768/C768_mosaic.nc" - fix_dir_target_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/gridgen_sfc/C768" - orog_dir_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768" - orog_files_target_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - vcoord_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l64.txt" - mosaic_file_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C384/C384_mosaic.nc" - orog_dir_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C384" - orog_files_input_grid="C384_oro_data.tile1.nc","C384_oro_data.tile2.nc","C384_oro_data.tile3.nc","C384_oro_data.tile4.nc","C384_oro_data.tile5.nc","C384_oro_data.tile6.nc" - data_dir_input_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/ICs/C384_2003110700" - atm_core_files_input_grid="fv_core.res.tile1.nc","fv_core.res.tile2.nc","fv_core.res.tile3.nc","fv_core.res.tile4.nc","fv_core.res.tile5.nc","fv_core.res.tile6.nc","fv_core.res.nc" - atm_tracer_files_input_grid="fv_tracer.res.tile1.nc","fv_tracer.res.tile2.nc","fv_tracer.res.tile3.nc","fv_tracer.res.tile4.nc","fv_tracer.res.tile5.nc","fv_tracer.res.tile6.nc" - cycle_mon=11 - cycle_day=7 - cycle_hour=0 - convert_atm=.true. - convert_sfc=.false. - convert_nst=.false. - atm_weight_file="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/weights/C384_to_C768.bilinear.nc" - tracers="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" - tracers_input="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" -/ diff --git a/sorc/chgres_cube.fd/run/config.C768.l91.atm.theia.nml b/sorc/chgres_cube.fd/run/config.C768.l91.atm.theia.nml deleted file mode 100644 index 172637be4..000000000 --- a/sorc/chgres_cube.fd/run/config.C768.l91.atm.theia.nml +++ /dev/null @@ -1,26 +0,0 @@ - -# Convert atmosphere from C768 L64 to C768 L91. -# Use three nodes, six tasks per node. -# When using -O3, takes about 7 minutes. - -&config - mosaic_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768/C768_mosaic.nc" - fix_dir_target_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/gridgen_sfc/C768" - orog_dir_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768" - orog_files_target_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - vcoord_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l91.txt" - mosaic_file_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768/C768_mosaic.nc" - orog_dir_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768" - orog_files_input_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - data_dir_input_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/ICs/C768_2018082906" - atm_core_files_input_grid="fv_core.res.tile1.nc","fv_core.res.tile2.nc","fv_core.res.tile3.nc","fv_core.res.tile4.nc","fv_core.res.tile5.nc","fv_core.res.tile6.nc","fv_core.res.nc" - atm_tracer_files_input_grid="fv_tracer.res.tile1.nc","fv_tracer.res.tile2.nc","fv_tracer.res.tile3.nc","fv_tracer.res.tile4.nc","fv_tracer.res.tile5.nc","fv_tracer.res.tile6.nc" - cycle_mon=08 - cycle_day=29 - cycle_hour=6 - convert_atm=.true. - convert_sfc=.false. - convert_nst=.false. - tracers="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" - tracers_input="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" -/ diff --git a/sorc/chgres_cube.fd/run/config.C768.l91.dell.nml b/sorc/chgres_cube.fd/run/config.C768.l91.dell.nml deleted file mode 100644 index 8ae9e738d..000000000 --- a/sorc/chgres_cube.fd/run/config.C768.l91.dell.nml +++ /dev/null @@ -1,25 +0,0 @@ - -# C768 L64 to C768 L91. -# Spread across three nodes. - -&config - fix_dir_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/gridgen_sfc/C768" - mosaic_file_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768/C768_mosaic.nc" - orog_dir_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768" - orog_files_target_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - mosaic_file_input_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768/C768_mosaic.nc" - orog_dir_input_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768" - orog_files_input_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - data_dir_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/ICs/C768_2018082906" - atm_core_files_input_grid="fv_core.res.tile1.nc","fv_core.res.tile2.nc","fv_core.res.tile3.nc","fv_core.res.tile4.nc","fv_core.res.tile5.nc","fv_core.res.tile6.nc","fv_core.res.nc" - atm_tracer_files_input_grid="fv_tracer.res.tile1.nc","fv_tracer.res.tile2.nc","fv_tracer.res.tile3.nc","fv_tracer.res.tile4.nc","fv_tracer.res.tile5.nc","fv_tracer.res.tile6.nc" - vcoord_file_target_grid="/gpfs/dell2/emc/modeling/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l91.txt" - cycle_mon=8 - cycle_day=29 - cycle_hour=6 - convert_atm=.true. - convert_sfc=.false. - convert_nst=.false. - tracers="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" - tracers_input="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" -/ diff --git a/sorc/chgres_cube.fd/run/config.C768.nest.atm.theia.nml b/sorc/chgres_cube.fd/run/config.C768.nest.atm.theia.nml deleted file mode 100644 index 08fe98025..000000000 --- a/sorc/chgres_cube.fd/run/config.C768.nest.atm.theia.nml +++ /dev/null @@ -1,25 +0,0 @@ -# Takes lots of memory. Use two nodes - six tasks per node. - -&config - fix_dir_target_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/gridgen_sfc/C768" - mosaic_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/esmf_grid/albedo_test_ll_to_fv3_nest/fix/C768_mosaic.nest.nc" - orog_dir_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/esmf_grid/albedo_test_ll_to_fv3_nest/fix" - orog_files_target_grid="C768_oro_data.tile7.nc" - vcoord_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_am/global_hyblev.l64.txt" - mosaic_file_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C384/C384_mosaic.nc" - orog_dir_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C384" - orog_files_input_grid="C384_oro_data.tile1.nc","C384_oro_data.tile2.nc","C384_oro_data.tile3.nc","C384_oro_data.tile4.nc","C384_oro_data.tile5.nc","C384_oro_data.tile6.nc" - data_dir_input_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/ICs/C384_2003110700" - atm_core_files_input_grid="fv_core.res.tile1.nc","fv_core.res.tile2.nc","fv_core.res.tile3.nc","fv_core.res.tile4.nc","fv_core.res.tile5.nc","fv_core.res.tile6.nc","fv_core.res.nc" - atm_tracer_files_input_grid="fv_tracer.res.tile1.nc","fv_tracer.res.tile2.nc","fv_tracer.res.tile3.nc","fv_tracer.res.tile4.nc","fv_tracer.res.tile5.nc","fv_tracer.res.tile6.nc" - cycle_mon=11 - cycle_day=7 - cycle_hour=0 - convert_atm=.true. - convert_sfc=.false. - convert_nst=.false. - regional=1 - halo_bndy=4 - tracers="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" - tracers_input="sphum","liq_wat","o3mr","ice_wat","rainwat","snowwat","graupel" -/ diff --git a/sorc/chgres_cube.fd/run/config.C768.nest.cray.nml b/sorc/chgres_cube.fd/run/config.C768.nest.cray.nml deleted file mode 100644 index 54196d832..000000000 --- a/sorc/chgres_cube.fd/run/config.C768.nest.cray.nml +++ /dev/null @@ -1,18 +0,0 @@ -&config - fix_dir_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/gridgen_sfc/C768.nest" - mosaic_file_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/esmf_grid/albedo_test_ll_to_fv3_nest/fix/C768_mosaic.nest.nc" - orog_dir_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/esmf_grid/albedo_test_ll_to_fv3_nest/fix" - orog_files_target_grid="C768_oro_data.tile7.nc" - mosaic_file_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768/C768_mosaic.nc" - orog_dir_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768" - orog_files_input_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - data_dir_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/ICs/C768_2017082600" - sfc_files_input_grid="sfc_data.tile1.nc","sfc_data.tile2.nc","sfc_data.tile3.nc","sfc_data.tile4.nc","sfc_data.tile5.nc","sfc_data.tile6.nc" - cycle_mon=8 - cycle_day=26 - cycle_hour=0 - convert_atm=.false. - convert_sfc=.true. - convert_nst=.true. - regional=0 -/ diff --git a/sorc/chgres_cube.fd/run/config.C768.nest.theia.nml b/sorc/chgres_cube.fd/run/config.C768.nest.theia.nml deleted file mode 100644 index 931c88d60..000000000 --- a/sorc/chgres_cube.fd/run/config.C768.nest.theia.nml +++ /dev/null @@ -1,18 +0,0 @@ -&config - fix_dir_target_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/gridgen_sfc/C768" - mosaic_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/esmf_grid/albedo_test_ll_to_fv3_nest/fix/C768_mosaic.nest.nc" - orog_dir_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/esmf_grid/albedo_test_ll_to_fv3_nest/fix" - orog_files_target_grid="C768_oro_data.tile7.nc" - mosaic_file_input_grid="/scratch4/NCEPDEV/global/save/glopara/svn/fv3gfs/fix_fv3/C768/C768_mosaic.nc" - orog_dir_input_grid="/scratch4/NCEPDEV/global/save/glopara/svn/fv3gfs/fix_fv3/C768" - orog_files_input_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - data_dir_input_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/ICs/C768_2017082600" - sfc_files_input_grid="sfc_data.tile1.nc","sfc_data.tile2.nc","sfc_data.tile3.nc","sfc_data.tile4.nc","sfc_data.tile5.nc","sfc_data.tile6.nc" - cycle_mon=8 - cycle_day=26 - cycle_hour=0 - convert_atm=.false. - convert_sfc=.true. - convert_nst=.true. - regional=0 -/ diff --git a/sorc/chgres_cube.fd/run/config.C768.stretch.cray.nml b/sorc/chgres_cube.fd/run/config.C768.stretch.cray.nml deleted file mode 100644 index 46db7c63d..000000000 --- a/sorc/chgres_cube.fd/run/config.C768.stretch.cray.nml +++ /dev/null @@ -1,17 +0,0 @@ -&config - fix_dir_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/gridgen_sfc/C768.nest" - mosaic_file_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/esmf_grid/albedo_test_ll_to_fv3_nest/fix/C768_mosaic.6tiles.nc" - orog_dir_target_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/esmf_grid/albedo_test_ll_to_fv3_nest/fix" - orog_files_target_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - mosaic_file_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768/C768_mosaic.nc" - orog_dir_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768" - orog_files_input_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - data_dir_input_grid="/gpfs/hps3/emc/global/noscrub/George.Gayno/fv3gfs.git/chgres_cube/fix/ICs/C768_2017082600" - sfc_files_input_grid="sfc_data.tile1.nc","sfc_data.tile2.nc","sfc_data.tile3.nc","sfc_data.tile4.nc","sfc_data.tile5.nc","sfc_data.tile6.nc" - cycle_mon=8 - cycle_day=26 - cycle_hour=0 - convert_atm=.false. - convert_sfc=.true. - convert_nst=.true. -/ diff --git a/sorc/chgres_cube.fd/run/config.C768.stretch.theia.nml b/sorc/chgres_cube.fd/run/config.C768.stretch.theia.nml deleted file mode 100644 index a00a7d467..000000000 --- a/sorc/chgres_cube.fd/run/config.C768.stretch.theia.nml +++ /dev/null @@ -1,17 +0,0 @@ -&config - fix_dir_target_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/gridgen_sfc/C768" - mosaic_file_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/esmf_grid/albedo_test_ll_to_fv3_nest/fix/C768_mosaic.6tiles.nc" - orog_dir_target_grid="/scratch4/NCEPDEV/da/save/George.Gayno/esmf_grid/albedo_test_ll_to_fv3_nest/fix" - orog_files_target_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - mosaic_file_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768/C768_mosaic.nc" - orog_dir_input_grid="/scratch4/NCEPDEV/da/save/George.Gayno/fv3gfs.git/global-workflow/fix/fix_fv3/C768" - orog_files_input_grid="C768_oro_data.tile1.nc","C768_oro_data.tile2.nc","C768_oro_data.tile3.nc","C768_oro_data.tile4.nc","C768_oro_data.tile5.nc","C768_oro_data.tile6.nc" - data_dir_input_grid="/scratch4/NCEPDEV/da/noscrub/George.Gayno/chgres_cube/fix/ICs/C768_2017082600" - sfc_files_input_grid="sfc_data.tile1.nc","sfc_data.tile2.nc","sfc_data.tile3.nc","sfc_data.tile4.nc","sfc_data.tile5.nc","sfc_data.tile6.nc" - cycle_mon=8 - cycle_day=26 - cycle_hour=0 - convert_atm=.false. - convert_sfc=.true. - convert_nst=.true. -/ diff --git a/sorc/chgres_cube.fd/run/run.cray.sh b/sorc/chgres_cube.fd/run/run.cray.sh deleted file mode 100755 index 4d3fd796c..000000000 --- a/sorc/chgres_cube.fd/run/run.cray.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh - -#BSUB -oo log -#BSUB -eo log -#BSUB -q debug -#BSUB -J chgres_fv3 -#BSUB -P FV3GFS-T2O -#BSUB -W 0:10 -#BSUB -M 1000 -#BSUB -extsched 'CRAYLINUX[]' - -set -x - -export NODES=1 -# threads useful when using gfs sigio files as input -export OMP_NUM_THREADS=1 -#export OMP_NUM_THREADS=4 -export OMP_STACKSIZE=1024M - -WORK_DIR=/gpfs/hps3/stmp/$LOGNAME/chgres_fv3 -rm -fr $WORK_DIR -mkdir -p $WORK_DIR -cd $WORK_DIR - -cp $LS_SUBCWD/config.C48.cray.nml ./fort.41 - -EXEC_DIR=$LS_SUBCWD/../../../exec - -export KMP_AFFINITY=disabled -aprun -j 1 -n 6 -N 6 -d${OMP_NUM_THREADS} -cc depth $EXEC_DIR/chgres_cube.exe -#aprun -j 1 -n 18 -N 18 -d${OMP_NUM_THREADS} -cc depth $EXEC_DIR/chgres_cube.exe - -exit diff --git a/sorc/chgres_cube.fd/run/run.dell.sh b/sorc/chgres_cube.fd/run/run.dell.sh deleted file mode 100755 index dfbd6a295..000000000 --- a/sorc/chgres_cube.fd/run/run.dell.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -#BSUB -oo log -#BSUB -eo log -#BSUB -q debug -#BSUB -P FV3GFS-T2O -#BSUB -J chgres.fv3 -#BSUB -W 0:15 -#BSUB -x # run not shared -#BSUB -n 6 # total tasks -#BSUB -R span[ptile=6] # tasks per node -#BSUB -R affinity[core(1):distribute=balance] - -set -x - -module purge -module load EnvVars/1.0.2 -module load ips/18.0.1.163 -module load impi/18.0.1 -module load lsf/10.1 -module use /usrx/local/dev/modulefiles -module load NetCDF/4.5.0 - -# On Dell, always set environment variables AFTER any module loads. -# Threads are only useful when using gfs sigio files. Set OMP_NUM_THREADS -# equal to "affinity[core(n)". - -export OMP_STACKSIZE=1024M -export OMP_NUM_THREADS=1 - -EXECDIR=${LS_SUBCWD}/../../../exec -RUNDIR=$LS_SUBCWD - -WORKDIR=/gpfs/dell1/stmp/$LOGNAME/chgres.fv3 -rm -fr $WORKDIR -mkdir -p $WORKDIR -cd $WORKDIR - -#cp $RUNDIR/config.C1152.l91.dell.nml ./fort.41 -#cp $RUNDIR/config.C768.l91.dell.nml ./fort.41 -#cp $RUNDIR/config.C384.dell.nml ./fort.41 -cp $RUNDIR/config.C384.gaussian.dell.nml ./fort.41 -#cp $RUNDIR/config.C48.dell.nml ./fort.41 -#cp $RUNDIR/config.C48.gfs.spectral.dell.nml ./fort.41 - -mpirun $EXECDIR/chgres_cube.exe - -exit diff --git a/sorc/chgres_cube.fd/run/run.theia.ksh b/sorc/chgres_cube.fd/run/run.theia.ksh deleted file mode 100755 index 1cb9fd996..000000000 --- a/sorc/chgres_cube.fd/run/run.theia.ksh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/ksh - -#----------------------------------------------------------- -# Run test case on Theia. MUST BE RUN WITH A -# MULTIPLE OF SIX MPI TASKS. Could not get it to -# work otherwise. -# -# Invoke as: sbatch $script -#----------------------------------------------------------- - -#SBATCH --ntasks=12 --nodes=2 -#####SBATCH --ntasks=6 --nodes=1 -#SBATCH -t 0:15:00 -#SBATCH -A fv3-cpu -#SBATCH -q debug -#SBATCH -J fv3 -#SBATCH -o ./log -#SBATCH -e ./log - -set -x - -source /apps/lmod/lmod/init/ksh -module purge -module load intel/18.1.163 -module load impi/5.1.1.109 -module load netcdf/4.3.0 - -# Threads useful when ingesting spectral gfs sigio files. -# Otherwise set to 1. -export OMP_NUM_THREADS=1 -export OMP_STACKSIZE=1024M - -WORKDIR=/scratch3/NCEPDEV/stmp1/$LOGNAME/chgres_fv3 -rm -fr $WORKDIR -mkdir -p $WORKDIR -cd $WORKDIR - -#ln -fs ${SLURM_SUBMIT_DIR}/test.nml ./fort.41 -#ln -fs ${SLURM_SUBMIT_DIR}/config.C48.theia.nml ./fort.41 -#ln -fs ${SLURM_SUBMIT_DIR}/config.C48.gaussian.theia.nml ./fort.41 -#ln -fs ${SLURM_SUBMIT_DIR}/config.C48.gfs.gaussian.theia.nml ./fort.41 -#ln -fs ${SLURM_SUBMIT_DIR}/config.C48.gfs.spectral.theia.nml ./fort.41 -#ln -fs ${SLURM_SUBMIT_DIR}/config.C384.theia.nml ./fort.41 -ln -fs ${SLURM_SUBMIT_DIR}/config.C768.nest.atm.theia.nml ./fort.41 -#ln -fs ${SLURM_SUBMIT_DIR}/config.C768.nest.theia.nml ./fort.41 -#ln -fs ${SLURM_SUBMIT_DIR}/config.C768.atm.theia.nml ./fort.41 -#ln -fs ${SLURM_SUBMIT_DIR}/config.C768.l91.atm.theia.nml ./fort.41 -#ln -fs ${SLURM_SUBMIT_DIR}/config.C1152.l91.atm.theia.nml ./fort.41 -#ln -fs ${SLURM_SUBMIT_DIR}/config.C96.nest.theia.nml ./fort.41 -#ln -fs ${SLURM_SUBMIT_DIR}/config.C768.stretch.theia.nml ./fort.41 -#ln -fs ${SLURM_SUBMIT_DIR}/config.C1152.theia.nml ./fort.41 - -date - -srun ${SLURM_SUBMIT_DIR}/../../../exec/chgres_cube.exe - -date - -exit 0 diff --git a/sorc/chgres_cube.fd/surface.F90 b/sorc/chgres_cube.fd/surface.F90 index 436fc30e8..6baa2f9bf 100644 --- a/sorc/chgres_cube.fd/surface.F90 +++ b/sorc/chgres_cube.fd/surface.F90 @@ -2345,8 +2345,8 @@ FUNCTION FRH2O (TKELV,SMC,SH2O,SMCMAX,BEXP,PSIS) DO WHILE ( (NLOG .LT. 10) .AND. (KCOUNT .EQ. 0) ) NLOG = NLOG+1 - DF = ALOG(( PSIS*GRAV/HLICE ) * ( ( 1.+CK*SWL )**2. ) * & - ( SMCMAX/(SMC-SWL) )**BX) - ALOG(-(TKELV-frz_h2o)/TKELV) + DF = LOG(( PSIS*GRAV/HLICE ) * ( ( 1.+CK*SWL )**2. ) * & + ( SMCMAX/(SMC-SWL) )**BX) - LOG(-(TKELV-frz_h2o)/TKELV) DENOM = 2. * CK / ( 1.+CK*SWL ) + BX / ( SMC - SWL ) SWLK = SWL - DF/DENOM diff --git a/sorc/emcsfc_ice_blend.fd/CMakeLists.txt b/sorc/emcsfc_ice_blend.fd/CMakeLists.txt new file mode 100644 index 000000000..ecfe7af75 --- /dev/null +++ b/sorc/emcsfc_ice_blend.fd/CMakeLists.txt @@ -0,0 +1,15 @@ +set(fortran_src + emcsfc_ice_blend.f90) + +set(exe_name emcsfc_ice_blend) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + bacio_4 + g2_4 + w3nco_4 + ${JASPER_LIBRARIES} + PNG::PNG + ZLIB::ZLIB) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/emcsfc_ice_blend.fd/make.sh b/sorc/emcsfc_ice_blend.fd/make.sh deleted file mode 100755 index 406b02298..000000000 --- a/sorc/emcsfc_ice_blend.fd/make.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -make clean -make -rc=$? - -if ((rc != 0));then - echo "ERROR BUILDING EMCSFC_ICE_BLEND" - exit $rc -else - make install -fi - -exit diff --git a/sorc/emcsfc_ice_blend.fd/makefile b/sorc/emcsfc_ice_blend.fd/makefile deleted file mode 100755 index 3fbc6343e..000000000 --- a/sorc/emcsfc_ice_blend.fd/makefile +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -#------------------------------------------------------------------------ -# Makefile for the emcsfc_ice_blend program. -# -# Before invoking, read the README.build for details. -#------------------------------------------------------------------------ - -EXE=emcsfc_ice_blend - -OBJS= emcsfc_ice_blend.o - -LIBS= $(BACIO_LIB4) $(G2_LIB4) $(W3NCO_LIB4) $(JASPER_LIB) $(PNG_LIB) $(Z_LIB) - -$(EXE): $(OBJS) - $(FCOMP) $(FFLAGS) -o $(EXE) $(OBJS) $(LIBS) - -emcsfc_ice_blend.o: emcsfc_ice_blend.f90 - $(FCOMP) $(FFLAGS) -I$(G2_INC4) -c emcsfc_ice_blend.f90 - -all: check_prereqs $(EXE) -clean: - rm -f *.o $(EXE) ../../exec/$(EXE) -install: - /usr/bin/install -c -d ../../exec - /usr/bin/install -c $(EXE) ../../exec -check_prereqs: - /nwprod/spa_util/check_libs.bash $(LIBS) - /nwprod/spa_util/check_incs.bash $(G2_INC4)/grib_mod.mod diff --git a/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt b/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt new file mode 100644 index 000000000..8a4561a1a --- /dev/null +++ b/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt @@ -0,0 +1,32 @@ +set(fortran_src + driver.f + grib_utils.f + model_grid.f + program_setup.f + snow2mdl.f + snowdat.f) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -FR -convert big_endian -assume byterecl") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-form -fdefault-real-8 -fconvert=big-endian") +endif() + +set(exe_name emcsfc_snow2mdl) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + g2_d + ip_d + sp_d + landsfcutil_d + bacio_4 + w3nco_d + ${JASPER_LIBRARIES} + PNG::PNG + ZLIB::ZLIB) +if(OpenMP_Fortran_FOUND) + target_link_libraries(${exe_name} OpenMP::OpenMP_Fortran) +endif() + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/emcsfc_snow2mdl.fd/make.sh b/sorc/emcsfc_snow2mdl.fd/make.sh deleted file mode 100755 index 1bcd8e445..000000000 --- a/sorc/emcsfc_snow2mdl.fd/make.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -make clean -make -rc=$? - -if ((rc != 0));then - echo "ERROR BUILDING EMCSFC_SNOW2MDL" - exit $rc -else - make install -fi - -exit diff --git a/sorc/emcsfc_snow2mdl.fd/makefile b/sorc/emcsfc_snow2mdl.fd/makefile deleted file mode 100755 index ef4b705f7..000000000 --- a/sorc/emcsfc_snow2mdl.fd/makefile +++ /dev/null @@ -1,44 +0,0 @@ -SHELL= /bin/sh - -#------------------------------------------------------------------------ -# Makefile for emcsfc_snow2mdl program. -# -# Before invoking, read the README.build file for details. -#------------------------------------------------------------------------ - -CMD= emcsfc_snow2mdl - -OBJS = driver.o \ - program_setup.o \ - snowdat.o \ - model_grid.o \ - grib_utils.o \ - snow2mdl.o - -LIBS= $(G2_LIBd) $(IP_LIBd) $(SP_LIBd) $(LANDSFCUTIL_LIBd) $(BACIO_LIB4) \ - $(W3NCO_LIBd) $(JASPER_LIB) $(PNG_LIB) $(Z_LIB) - -$(CMD): $(OBJS) - $(FCOMP) $(FFLAGS) -o $(CMD) $(OBJS) $(LIBS) - -driver.o: snowdat.o model_grid.o snow2mdl.o program_setup.o driver.f - $(FCOMP) $(FFLAGS) -c driver.f -program_setup.o: program_setup.f - $(FCOMP) $(FFLAGS) -c program_setup.f -snowdat.o: program_setup.o model_grid.o snowdat.f - $(FCOMP) $(FFLAGS) -I$(G2_INCd) -c snowdat.f -model_grid.o: program_setup.o model_grid.f - $(FCOMP) $(FFLAGS) -I$(G2_INCd) -c model_grid.f -snow2mdl.o: snowdat.o program_setup.o model_grid.o snow2mdl.f - $(FCOMP) $(FFLAGS) -I$(LANDSFCUTIL_INCd) -I$(G2_INCd) -c snow2mdl.f -grib_utils.o: grib_utils.f - $(FCOMP) $(FFLAGS) -I$(G2_INCd) -c grib_utils.f -all: check_prereqs $(CMD) -clean: - rm -f *.o *.mod $(CMD) ../../exec/$(CMD) -install: - /usr/bin/install -c -d ../../exec - /usr/bin/install -c $(CMD) ../../exec -check_prereqs: - /nwprod/spa_util/check_libs.bash $(LIBS) - /nwprod/spa_util/check_incs.bash $(G2_INCd)/grib_mod.mod $(LANDSFCUTIL_INCd)/consts.mod diff --git a/sorc/fre-nctools.fd/CMakeLists.txt b/sorc/fre-nctools.fd/CMakeLists.txt new file mode 100644 index 000000000..cec8e70db --- /dev/null +++ b/sorc/fre-nctools.fd/CMakeLists.txt @@ -0,0 +1,6 @@ +add_subdirectory(shared_lib) +add_subdirectory(tools/fregrid) +add_subdirectory(tools/make_solo_mosaic) +add_subdirectory(tools/make_hgrid) +add_subdirectory(tools/filter_topo) +add_subdirectory(tools/shave.fd) diff --git a/sorc/fre-nctools.fd/shared_lib/CMakeLists.txt b/sorc/fre-nctools.fd/shared_lib/CMakeLists.txt new file mode 100644 index 000000000..6d19e3036 --- /dev/null +++ b/sorc/fre-nctools.fd/shared_lib/CMakeLists.txt @@ -0,0 +1,18 @@ +set(c_src + create_xgrid.c + gradient_c2l.c + interp.c + mosaic_util.c + mpp.c + mpp_domain.c + mpp_io.c + mpp_domain.c + read_mosaic.c + tool_util.c) + +add_library(shared_lib STATIC ${c_src}) +target_compile_definitions(shared_lib PRIVATE use_netCDF) + +target_include_directories(shared_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +target_link_libraries(shared_lib NetCDF::NetCDF_C) diff --git a/sorc/fre-nctools.fd/shared/mosaic/COPYING b/sorc/fre-nctools.fd/shared_lib/COPYING similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/COPYING rename to sorc/fre-nctools.fd/shared_lib/COPYING diff --git a/sorc/fre-nctools.fd/tools/shared/affinity.c b/sorc/fre-nctools.fd/shared_lib/affinity.c similarity index 100% rename from sorc/fre-nctools.fd/tools/shared/affinity.c rename to sorc/fre-nctools.fd/shared_lib/affinity.c diff --git a/sorc/fre-nctools.fd/shared/mosaic/constant.h b/sorc/fre-nctools.fd/shared_lib/constant.h similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/constant.h rename to sorc/fre-nctools.fd/shared_lib/constant.h diff --git a/sorc/fre-nctools.fd/shared/mosaic/create_xgrid.c b/sorc/fre-nctools.fd/shared_lib/create_xgrid.c similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/create_xgrid.c rename to sorc/fre-nctools.fd/shared_lib/create_xgrid.c diff --git a/sorc/fre-nctools.fd/shared/mosaic/create_xgrid.h b/sorc/fre-nctools.fd/shared_lib/create_xgrid.h similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/create_xgrid.h rename to sorc/fre-nctools.fd/shared_lib/create_xgrid.h diff --git a/sorc/fre-nctools.fd/shared/mosaic/gradient.F90 b/sorc/fre-nctools.fd/shared_lib/gradient.F90 similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/gradient.F90 rename to sorc/fre-nctools.fd/shared_lib/gradient.F90 diff --git a/sorc/fre-nctools.fd/shared/mosaic/gradient_c2l.c b/sorc/fre-nctools.fd/shared_lib/gradient_c2l.c similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/gradient_c2l.c rename to sorc/fre-nctools.fd/shared_lib/gradient_c2l.c diff --git a/sorc/fre-nctools.fd/shared/mosaic/gradient_c2l.h b/sorc/fre-nctools.fd/shared_lib/gradient_c2l.h similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/gradient_c2l.h rename to sorc/fre-nctools.fd/shared_lib/gradient_c2l.h diff --git a/sorc/fre-nctools.fd/shared/mosaic/grid.F90 b/sorc/fre-nctools.fd/shared_lib/grid.F90 similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/grid.F90 rename to sorc/fre-nctools.fd/shared_lib/grid.F90 diff --git a/sorc/fre-nctools.fd/shared/mosaic/grid.html b/sorc/fre-nctools.fd/shared_lib/grid.html similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/grid.html rename to sorc/fre-nctools.fd/shared_lib/grid.html diff --git a/sorc/fre-nctools.fd/shared/mosaic/interp.c b/sorc/fre-nctools.fd/shared_lib/interp.c similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/interp.c rename to sorc/fre-nctools.fd/shared_lib/interp.c diff --git a/sorc/fre-nctools.fd/shared/mosaic/interp.h b/sorc/fre-nctools.fd/shared_lib/interp.h similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/interp.h rename to sorc/fre-nctools.fd/shared_lib/interp.h diff --git a/sorc/fre-nctools.fd/shared/mosaic/mosaic.F90 b/sorc/fre-nctools.fd/shared_lib/mosaic.F90 similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/mosaic.F90 rename to sorc/fre-nctools.fd/shared_lib/mosaic.F90 diff --git a/sorc/fre-nctools.fd/shared/mosaic/mosaic_util.c b/sorc/fre-nctools.fd/shared_lib/mosaic_util.c similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/mosaic_util.c rename to sorc/fre-nctools.fd/shared_lib/mosaic_util.c diff --git a/sorc/fre-nctools.fd/shared/mosaic/mosaic_util.h b/sorc/fre-nctools.fd/shared_lib/mosaic_util.h similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/mosaic_util.h rename to sorc/fre-nctools.fd/shared_lib/mosaic_util.h diff --git a/sorc/fre-nctools.fd/tools/shared/mpp.c b/sorc/fre-nctools.fd/shared_lib/mpp.c similarity index 100% rename from sorc/fre-nctools.fd/tools/shared/mpp.c rename to sorc/fre-nctools.fd/shared_lib/mpp.c diff --git a/sorc/fre-nctools.fd/tools/shared/mpp.h b/sorc/fre-nctools.fd/shared_lib/mpp.h similarity index 100% rename from sorc/fre-nctools.fd/tools/shared/mpp.h rename to sorc/fre-nctools.fd/shared_lib/mpp.h diff --git a/sorc/fre-nctools.fd/tools/shared/mpp_domain.c b/sorc/fre-nctools.fd/shared_lib/mpp_domain.c similarity index 100% rename from sorc/fre-nctools.fd/tools/shared/mpp_domain.c rename to sorc/fre-nctools.fd/shared_lib/mpp_domain.c diff --git a/sorc/fre-nctools.fd/tools/shared/mpp_domain.h b/sorc/fre-nctools.fd/shared_lib/mpp_domain.h similarity index 100% rename from sorc/fre-nctools.fd/tools/shared/mpp_domain.h rename to sorc/fre-nctools.fd/shared_lib/mpp_domain.h diff --git a/sorc/fre-nctools.fd/tools/shared/mpp_io.c b/sorc/fre-nctools.fd/shared_lib/mpp_io.c similarity index 100% rename from sorc/fre-nctools.fd/tools/shared/mpp_io.c rename to sorc/fre-nctools.fd/shared_lib/mpp_io.c diff --git a/sorc/fre-nctools.fd/tools/shared/mpp_io.h b/sorc/fre-nctools.fd/shared_lib/mpp_io.h similarity index 100% rename from sorc/fre-nctools.fd/tools/shared/mpp_io.h rename to sorc/fre-nctools.fd/shared_lib/mpp_io.h diff --git a/sorc/fre-nctools.fd/shared/mosaic/read_mosaic.c b/sorc/fre-nctools.fd/shared_lib/read_mosaic.c similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/read_mosaic.c rename to sorc/fre-nctools.fd/shared_lib/read_mosaic.c diff --git a/sorc/fre-nctools.fd/shared/mosaic/read_mosaic.h b/sorc/fre-nctools.fd/shared_lib/read_mosaic.h similarity index 100% rename from sorc/fre-nctools.fd/shared/mosaic/read_mosaic.h rename to sorc/fre-nctools.fd/shared_lib/read_mosaic.h diff --git a/sorc/fre-nctools.fd/tools/shared/tool_util.c b/sorc/fre-nctools.fd/shared_lib/tool_util.c similarity index 100% rename from sorc/fre-nctools.fd/tools/shared/tool_util.c rename to sorc/fre-nctools.fd/shared_lib/tool_util.c diff --git a/sorc/fre-nctools.fd/tools/shared/tool_util.h b/sorc/fre-nctools.fd/shared_lib/tool_util.h similarity index 100% rename from sorc/fre-nctools.fd/tools/shared/tool_util.h rename to sorc/fre-nctools.fd/shared_lib/tool_util.h diff --git a/sorc/fre-nctools.fd/tools/filter_topo/CMakeLists.txt b/sorc/fre-nctools.fd/tools/filter_topo/CMakeLists.txt new file mode 100644 index 000000000..bd56685b1 --- /dev/null +++ b/sorc/fre-nctools.fd/tools/filter_topo/CMakeLists.txt @@ -0,0 +1,16 @@ +set(fortran_src + filter_topo.F90) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -assume byterecl -real_size 64 -fno-alias -stack_temps -safe_cray_ptr -ftz") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-0 -fdefault-real-8") +endif() + +set(exe_name filter_topo) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + NetCDF::NetCDF_Fortran) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/fre-nctools.fd/tools/filter_topo/env.cshrc b/sorc/fre-nctools.fd/tools/filter_topo/env.cshrc deleted file mode 100644 index 5aa3c81fd..000000000 --- a/sorc/fre-nctools.fd/tools/filter_topo/env.cshrc +++ /dev/null @@ -1,10 +0,0 @@ -# Platform-Specific Environment Setting File -# ------------------------------------------------------------------------------ -# The script created at 2015-06-09T14:32:10 via: -# /ncrc/home2/fms/local/opt/fre-commands/bronx-9/bin/fremake --link --ncores=8 --platform=ncrc2.intel --target=prod-openmp --walltime=120 --xmlfile=/lustre/f1/unswept/Zhi.Liang/mdt_xml_dev/CM4_am4p5.xml.theia cm4_libs_compile -# ------------------------------------------------------------------------------ - - module load fre/bronx-10 - module load intel_compilers/15.0.1 mpich2/1.2.1p1 - - diff --git a/sorc/fre-nctools.fd/tools/filter_topo/make.csh_hera b/sorc/fre-nctools.fd/tools/filter_topo/make.csh_hera deleted file mode 100755 index fb43802b0..000000000 --- a/sorc/fre-nctools.fd/tools/filter_topo/make.csh_hera +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/csh -f - -source $MODULESHOME/init/csh -source ${PWD}/../../../../modulefiles/fv3gfs/fre-nctools.hera - -ifort -o filter_topo -I${NETCDF}/include -fltconsistency -fno-alias -stack_temps -safe_cray_ptr -ftz -assume byterecl -g -O2 -i4 -real_size 64 -traceback filter_topo.F90 -L${NETCDF}/lib -L${HDF5}/lib -lnetcdf -lnetcdff -lhdf5_hl -lhdf5 diff --git a/sorc/fre-nctools.fd/tools/filter_topo/make.csh_jet b/sorc/fre-nctools.fd/tools/filter_topo/make.csh_jet deleted file mode 100755 index a46af8836..000000000 --- a/sorc/fre-nctools.fd/tools/filter_topo/make.csh_jet +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/csh -f - -source $MODULESHOME/init/csh -source ${PWD}/../../../../modulefiles/fv3gfs/fre-nctools.jet - -ifort -o filter_topo -I${NETCDF}/include -fltconsistency -fno-alias -stack_temps -safe_cray_ptr -ftz -assume byterecl -g -O2 -i4 -real_size 64 -traceback filter_topo.F90 -L${NETCDF}/lib -L${HDF5}/lib -lnetcdf -lnetcdff -lhdf5_hl -lhdf5 diff --git a/sorc/fre-nctools.fd/tools/filter_topo/make.csh_wcoss b/sorc/fre-nctools.fd/tools/filter_topo/make.csh_wcoss deleted file mode 100755 index bd3804d0c..000000000 --- a/sorc/fre-nctools.fd/tools/filter_topo/make.csh_wcoss +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/csh -f - -source $MODULESHOME/init/csh -source ${PWD}/../../../../modulefiles/fv3gfs/fre-nctools.wcoss - -ifort -o filter_topo -I${NETCDF}/include -fltconsistency -fno-alias -stack_temps -safe_cray_ptr -ftz -assume byterecl -g -O2 -i4 -real_size 64 -traceback filter_topo.F90 -L${NETCDF}/lib -L${HDF5}/lib -lnetcdf -lnetcdff -lhdf5_hl -lhdf5 diff --git a/sorc/fre-nctools.fd/tools/filter_topo/make.csh_wcoss_cray b/sorc/fre-nctools.fd/tools/filter_topo/make.csh_wcoss_cray deleted file mode 100755 index 757e5e0a8..000000000 --- a/sorc/fre-nctools.fd/tools/filter_topo/make.csh_wcoss_cray +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/csh -f - -source /opt/modules/default/init/csh -source ${PWD}/../../../../modulefiles/fv3gfs/fre-nctools.wcoss_cray - -ftn -o filter_topo -fltconsistency -fno-alias -stack_temps -safe_cray_ptr -ftz -assume byterecl -g -O2 -i4 -real_size 64 -traceback filter_topo.F90 diff --git a/sorc/fre-nctools.fd/tools/filter_topo/make.csh_wcoss_dell_p3 b/sorc/fre-nctools.fd/tools/filter_topo/make.csh_wcoss_dell_p3 deleted file mode 100755 index 0f33714d3..000000000 --- a/sorc/fre-nctools.fd/tools/filter_topo/make.csh_wcoss_dell_p3 +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/csh -f - -source $MODULESHOME/init/csh -source ${PWD}/../../../../modulefiles/fv3gfs/fre-nctools.wcoss_dell_p3 - -ifort -o filter_topo -I${NETCDF}/include -fltconsistency -fno-alias -stack_temps -safe_cray_ptr -ftz -assume byterecl -g -O2 -i4 -real_size 64 -traceback filter_topo.F90 -L${NETCDF}/lib -L${HDF5}/lib -lnetcdf -lnetcdff -lhdf5_hl -lhdf5 diff --git a/sorc/fre-nctools.fd/tools/fregrid/CMakeLists.txt b/sorc/fre-nctools.fd/tools/fregrid/CMakeLists.txt new file mode 100644 index 000000000..f376313c6 --- /dev/null +++ b/sorc/fre-nctools.fd/tools/fregrid/CMakeLists.txt @@ -0,0 +1,14 @@ +set(c_src + bilinear_interp.c + conserve_interp.c + fregrid.c + fregrid_util.c) + +add_executable(fregrid ${c_src}) + +target_link_libraries(fregrid + m + shared_lib + NetCDF::NetCDF_C) + +install(TARGETS fregrid RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/fre-nctools.fd/tools/fregrid/env.cray b/sorc/fre-nctools.fd/tools/fregrid/env.cray deleted file mode 100644 index 42e7137c5..000000000 --- a/sorc/fre-nctools.fd/tools/fregrid/env.cray +++ /dev/null @@ -1,4 +0,0 @@ -# ORNL uses the cc wrapper -MPICC := cc -CC := cc -STATIC := -static diff --git a/sorc/fre-nctools.fd/tools/fregrid/env.gaea b/sorc/fre-nctools.fd/tools/fregrid/env.gaea deleted file mode 100644 index 42e7137c5..000000000 --- a/sorc/fre-nctools.fd/tools/fregrid/env.gaea +++ /dev/null @@ -1,4 +0,0 @@ -# ORNL uses the cc wrapper -MPICC := cc -CC := cc -STATIC := -static diff --git a/sorc/fre-nctools.fd/tools/fregrid/env.gfdl-ws b/sorc/fre-nctools.fd/tools/fregrid/env.gfdl-ws deleted file mode 100644 index 3d742259a..000000000 --- a/sorc/fre-nctools.fd/tools/fregrid/env.gfdl-ws +++ /dev/null @@ -1,6 +0,0 @@ -LIBS2 := -CLIBS2 := - -# GFDL uses the mpicc wrapper and Intel icc -MPICC := mpicc -CC := icc diff --git a/sorc/fre-nctools.fd/tools/fregrid/env.hera b/sorc/fre-nctools.fd/tools/fregrid/env.hera deleted file mode 100644 index a4ca56ba4..000000000 --- a/sorc/fre-nctools.fd/tools/fregrid/env.hera +++ /dev/null @@ -1,4 +0,0 @@ -# hera -MPICC := mpiicc -CC := icc -STATIC := diff --git a/sorc/fre-nctools.fd/tools/fregrid/env.jet b/sorc/fre-nctools.fd/tools/fregrid/env.jet deleted file mode 100644 index d7940540e..000000000 --- a/sorc/fre-nctools.fd/tools/fregrid/env.jet +++ /dev/null @@ -1,4 +0,0 @@ -# jet -MPICC := mpiicc -CC := icc -STATIC := diff --git a/sorc/fre-nctools.fd/tools/fregrid/env.pan b/sorc/fre-nctools.fd/tools/fregrid/env.pan deleted file mode 100644 index 3d742259a..000000000 --- a/sorc/fre-nctools.fd/tools/fregrid/env.pan +++ /dev/null @@ -1,6 +0,0 @@ -LIBS2 := -CLIBS2 := - -# GFDL uses the mpicc wrapper and Intel icc -MPICC := mpicc -CC := icc diff --git a/sorc/fre-nctools.fd/tools/fregrid/env.wcoss b/sorc/fre-nctools.fd/tools/fregrid/env.wcoss deleted file mode 100644 index e6f023dfb..000000000 --- a/sorc/fre-nctools.fd/tools/fregrid/env.wcoss +++ /dev/null @@ -1,3 +0,0 @@ -# ORNL uses the cc wrapper -MPICC := mpiicc -CC := icc diff --git a/sorc/fre-nctools.fd/tools/fregrid/env.wcoss_dell_p3 b/sorc/fre-nctools.fd/tools/fregrid/env.wcoss_dell_p3 deleted file mode 100644 index 07f52aac8..000000000 --- a/sorc/fre-nctools.fd/tools/fregrid/env.wcoss_dell_p3 +++ /dev/null @@ -1,4 +0,0 @@ -# Dell -MPICC := mpiicc -CC := icc -STATIC := diff --git a/sorc/fre-nctools.fd/tools/fregrid/env.zeus b/sorc/fre-nctools.fd/tools/fregrid/env.zeus deleted file mode 100644 index 3d742259a..000000000 --- a/sorc/fre-nctools.fd/tools/fregrid/env.zeus +++ /dev/null @@ -1,6 +0,0 @@ -LIBS2 := -CLIBS2 := - -# GFDL uses the mpicc wrapper and Intel icc -MPICC := mpicc -CC := icc diff --git a/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_cray b/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_cray deleted file mode 100644 index 237a6393e..000000000 --- a/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_cray +++ /dev/null @@ -1,90 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:32:02 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2010 -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -# MPICC and CC are defined in env.$(SITE) -include ./env.$(SITE) - -#MPICC := mpicc -#CC := icc -CFLAGS := -O3 -g -traceback -CFLAGS_O2:= -O2 -g -traceback -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -limf $(CLIBS2) $(STATIC) - -TARGETS := fregrid fregrid_parallel - -SOURCES := fregrid.c bilinear_interp.c conserve_interp.c fregrid_util.c -SOURCES += create_xgrid.c gradient_c2l.c interp.c read_mosaic.c -SOURCES += mpp_domain.c mpp_io.c tool_util.c affinity.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/gradient_c2l.h ../../shared/mosaic/interp.h \ - ../../shared/mosaic/mosaic_util.h ../../shared/mosaic/read_mosaic.h - -all: $(TARGETS) - -fregrid: $(OBJECTS) mosaic_util.o mpp.o - $(CC) -o $@ $^ $(CLIBS) - -fregrid_parallel: $(OBJECTS) mosaic_util_parallel.o mpp_parallel.o - $(MPICC) -o $@ $^ $(CLIBS) - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util_parallel.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -gradient_c2l.o: ../../shared/mosaic/gradient_c2l.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -affinity.o: ../shared/affinity.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_parallel.o: ../shared/mpp.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -conserve_interp.o: conserve_interp.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -bilinear_interp.o: bilinear_interp.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_hera b/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_hera deleted file mode 100644 index 2361c05f2..000000000 --- a/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_hera +++ /dev/null @@ -1,90 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:32:02 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2010 -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -# MPICC and CC are defined in env.$(SITE) -include ./env.$(SITE) - -#MPICC := mpicc -#CC := icc -CFLAGS := -O3 -g -CFLAGS_O2:= -O2 -g -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -limf $(CLIBS2) $(STATIC) - -TARGETS := fregrid fregrid_parallel - -SOURCES := fregrid.c bilinear_interp.c conserve_interp.c fregrid_util.c -SOURCES += create_xgrid.c gradient_c2l.c interp.c read_mosaic.c -SOURCES += mpp_domain.c mpp_io.c tool_util.c affinity.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/gradient_c2l.h ../../shared/mosaic/interp.h \ - ../../shared/mosaic/mosaic_util.h ../../shared/mosaic/read_mosaic.h - -all: $(TARGETS) - -fregrid: $(OBJECTS) mosaic_util.o mpp.o - $(CC) -o $@ $^ $(CLIBS) - -fregrid_parallel: $(OBJECTS) mosaic_util_parallel.o mpp_parallel.o - $(MPICC) -o $@ $^ $(CLIBS) - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util_parallel.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -gradient_c2l.o: ../../shared/mosaic/gradient_c2l.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -affinity.o: ../shared/affinity.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_parallel.o: ../shared/mpp.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -conserve_interp.o: conserve_interp.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -bilinear_interp.o: bilinear_interp.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_jet b/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_jet deleted file mode 100644 index 2361c05f2..000000000 --- a/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_jet +++ /dev/null @@ -1,90 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:32:02 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2010 -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -# MPICC and CC are defined in env.$(SITE) -include ./env.$(SITE) - -#MPICC := mpicc -#CC := icc -CFLAGS := -O3 -g -CFLAGS_O2:= -O2 -g -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -limf $(CLIBS2) $(STATIC) - -TARGETS := fregrid fregrid_parallel - -SOURCES := fregrid.c bilinear_interp.c conserve_interp.c fregrid_util.c -SOURCES += create_xgrid.c gradient_c2l.c interp.c read_mosaic.c -SOURCES += mpp_domain.c mpp_io.c tool_util.c affinity.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/gradient_c2l.h ../../shared/mosaic/interp.h \ - ../../shared/mosaic/mosaic_util.h ../../shared/mosaic/read_mosaic.h - -all: $(TARGETS) - -fregrid: $(OBJECTS) mosaic_util.o mpp.o - $(CC) -o $@ $^ $(CLIBS) - -fregrid_parallel: $(OBJECTS) mosaic_util_parallel.o mpp_parallel.o - $(MPICC) -o $@ $^ $(CLIBS) - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util_parallel.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -gradient_c2l.o: ../../shared/mosaic/gradient_c2l.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -affinity.o: ../shared/affinity.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_parallel.o: ../shared/mpp.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -conserve_interp.o: conserve_interp.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -bilinear_interp.o: bilinear_interp.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_wcoss b/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_wcoss deleted file mode 100644 index 237a6393e..000000000 --- a/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_wcoss +++ /dev/null @@ -1,90 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:32:02 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2010 -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -# MPICC and CC are defined in env.$(SITE) -include ./env.$(SITE) - -#MPICC := mpicc -#CC := icc -CFLAGS := -O3 -g -traceback -CFLAGS_O2:= -O2 -g -traceback -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -limf $(CLIBS2) $(STATIC) - -TARGETS := fregrid fregrid_parallel - -SOURCES := fregrid.c bilinear_interp.c conserve_interp.c fregrid_util.c -SOURCES += create_xgrid.c gradient_c2l.c interp.c read_mosaic.c -SOURCES += mpp_domain.c mpp_io.c tool_util.c affinity.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/gradient_c2l.h ../../shared/mosaic/interp.h \ - ../../shared/mosaic/mosaic_util.h ../../shared/mosaic/read_mosaic.h - -all: $(TARGETS) - -fregrid: $(OBJECTS) mosaic_util.o mpp.o - $(CC) -o $@ $^ $(CLIBS) - -fregrid_parallel: $(OBJECTS) mosaic_util_parallel.o mpp_parallel.o - $(MPICC) -o $@ $^ $(CLIBS) - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util_parallel.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -gradient_c2l.o: ../../shared/mosaic/gradient_c2l.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -affinity.o: ../shared/affinity.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_parallel.o: ../shared/mpp.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -conserve_interp.o: conserve_interp.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -bilinear_interp.o: bilinear_interp.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_wcoss_dell_p3 b/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_wcoss_dell_p3 deleted file mode 100644 index 237a6393e..000000000 --- a/sorc/fre-nctools.fd/tools/fregrid/fre-nctools.mk_wcoss_dell_p3 +++ /dev/null @@ -1,90 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:32:02 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2010 -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -# MPICC and CC are defined in env.$(SITE) -include ./env.$(SITE) - -#MPICC := mpicc -#CC := icc -CFLAGS := -O3 -g -traceback -CFLAGS_O2:= -O2 -g -traceback -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -limf $(CLIBS2) $(STATIC) - -TARGETS := fregrid fregrid_parallel - -SOURCES := fregrid.c bilinear_interp.c conserve_interp.c fregrid_util.c -SOURCES += create_xgrid.c gradient_c2l.c interp.c read_mosaic.c -SOURCES += mpp_domain.c mpp_io.c tool_util.c affinity.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/gradient_c2l.h ../../shared/mosaic/interp.h \ - ../../shared/mosaic/mosaic_util.h ../../shared/mosaic/read_mosaic.h - -all: $(TARGETS) - -fregrid: $(OBJECTS) mosaic_util.o mpp.o - $(CC) -o $@ $^ $(CLIBS) - -fregrid_parallel: $(OBJECTS) mosaic_util_parallel.o mpp_parallel.o - $(MPICC) -o $@ $^ $(CLIBS) - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util_parallel.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -gradient_c2l.o: ../../shared/mosaic/gradient_c2l.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -affinity.o: ../shared/affinity.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_parallel.o: ../shared/mpp.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -conserve_interp.o: conserve_interp.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -bilinear_interp.o: bilinear_interp.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/CMakeLists.txt b/sorc/fre-nctools.fd/tools/make_hgrid/CMakeLists.txt new file mode 100644 index 000000000..c59be2dee --- /dev/null +++ b/sorc/fre-nctools.fd/tools/make_hgrid/CMakeLists.txt @@ -0,0 +1,15 @@ +set(c_src + create_conformal_cubic_grid.c + create_gnomonic_cubic_grid.c + create_grid_from_file.c + create_lonlat_grid.c + make_hgrid.c) + +add_executable(make_hgrid ${c_src}) + +target_link_libraries(make_hgrid + m + shared_lib + NetCDF::NetCDF_C) + +install(TARGETS make_hgrid RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/env.cray b/sorc/fre-nctools.fd/tools/make_hgrid/env.cray deleted file mode 100644 index 42e7137c5..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/env.cray +++ /dev/null @@ -1,4 +0,0 @@ -# ORNL uses the cc wrapper -MPICC := cc -CC := cc -STATIC := -static diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/env.cshrc b/sorc/fre-nctools.fd/tools/make_hgrid/env.cshrc deleted file mode 100644 index 4dcbd0dd7..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/env.cshrc +++ /dev/null @@ -1,7 +0,0 @@ -module load fre/bronx-10 -module load intel_compilers/11.1.073 mpich2/1.2.1p1 -setenv SITE pan - -alias make make HDF5_HOME=/usr/local/hdf5-1.8.8_optimized NETCDF_HOME=/usr/local/netcdf-4.2_optimized -f fre-nctools.mk - - diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/env.gaea b/sorc/fre-nctools.fd/tools/make_hgrid/env.gaea deleted file mode 100644 index 42e7137c5..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/env.gaea +++ /dev/null @@ -1,4 +0,0 @@ -# ORNL uses the cc wrapper -MPICC := cc -CC := cc -STATIC := -static diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/env.gfdl-ws b/sorc/fre-nctools.fd/tools/make_hgrid/env.gfdl-ws deleted file mode 100644 index 3d742259a..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/env.gfdl-ws +++ /dev/null @@ -1,6 +0,0 @@ -LIBS2 := -CLIBS2 := - -# GFDL uses the mpicc wrapper and Intel icc -MPICC := mpicc -CC := icc diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/env.hera b/sorc/fre-nctools.fd/tools/make_hgrid/env.hera deleted file mode 100644 index a4ca56ba4..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/env.hera +++ /dev/null @@ -1,4 +0,0 @@ -# hera -MPICC := mpiicc -CC := icc -STATIC := diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/env.jet b/sorc/fre-nctools.fd/tools/make_hgrid/env.jet deleted file mode 100644 index 28bf431ee..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/env.jet +++ /dev/null @@ -1,7 +0,0 @@ -CLIBS_SITE := -CFLAGS_SITE := - -# GFDL uses the mpicc wrapper and Intel icc -MPICC := mpicc -CC := icc -NETCDF_HOME = $(NETCDF_DIR) diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/env.pan b/sorc/fre-nctools.fd/tools/make_hgrid/env.pan deleted file mode 100644 index 3d742259a..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/env.pan +++ /dev/null @@ -1,6 +0,0 @@ -LIBS2 := -CLIBS2 := - -# GFDL uses the mpicc wrapper and Intel icc -MPICC := mpicc -CC := icc diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/env.wcoss b/sorc/fre-nctools.fd/tools/make_hgrid/env.wcoss deleted file mode 100644 index e6f023dfb..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/env.wcoss +++ /dev/null @@ -1,3 +0,0 @@ -# ORNL uses the cc wrapper -MPICC := mpiicc -CC := icc diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/env.wcoss_dell_p3 b/sorc/fre-nctools.fd/tools/make_hgrid/env.wcoss_dell_p3 deleted file mode 100644 index 6c090e2e2..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/env.wcoss_dell_p3 +++ /dev/null @@ -1,4 +0,0 @@ -# theia -MPICC := mpiicc -CC := icc -STATIC := diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/env.zeus b/sorc/fre-nctools.fd/tools/make_hgrid/env.zeus deleted file mode 100644 index 3d742259a..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/env.zeus +++ /dev/null @@ -1,6 +0,0 @@ -LIBS2 := -CLIBS2 := - -# GFDL uses the mpicc wrapper and Intel icc -MPICC := mpicc -CC := icc diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_cray b/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_cray deleted file mode 100644 index 3274f74bf..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_cray +++ /dev/null @@ -1,98 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:33:28 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2011 -# This program is distributed under the terms of the GNU General Public -# License. See the file COPYING contained in this directory -# -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -include env.$(SITE) - -#MPICC := mpicc -#CC := icc -CFLAGS := -O3 -traceback -CFLAGS_O2:= -O2 -traceback -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -limf $(CLIBS2) $(STATIC) - -TARGETS := make_hgrid make_hgrid_parallel - -SOURCES := make_hgrid.c create_conformal_cubic_grid.c create_gnomonic_cubic_grid.c create_grid_from_file.c create_lonlat_grid.c -SOURCES += mpp_domain.c mpp_io.c tool_util.c -SOURCES += read_mosaic.c create_xgrid.c interp.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/interp.h ../../shared/mosaic/mosaic_util.h \ - ../../shared/mosaic/read_mosaic.h ./create_hgrid.h - -all: $(TARGETS) - -make_hgrid: $(OBJECTS) mosaic_util.o mpp.o - $(CC) -o $@ $^ $(CLIBS) - -make_hgrid_parallel: $(OBJECTS) mosaic_util_parallel.o mpp_parallel.o - $(MPICC) -o $@ $^ $(CLIBS) - -make_hgrid.o: make_hgrid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_gnomonic_cubic_grid.o: create_gnomonic_cubic_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_conformal_cubic_grid.o: create_conformal_cubic_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_lonlat_grid.o: create_lonlat_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_grid_from_file.o: create_grid_from_file.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util_parallel.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -read_mosaic_parallel.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(MPICC) -Duse_libMPI -Duse_netCDF $(CFLAGS) $(INCLUDES) -o $@ -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_parallel.o: ../shared/mpp.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_hera b/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_hera deleted file mode 100644 index 2624c2e6e..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_hera +++ /dev/null @@ -1,98 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:33:28 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2011 -# This program is distributed under the terms of the GNU General Public -# License. See the file COPYING contained in this directory -# -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -include env.$(SITE) - -#MPICC := mpicc -#CC := icc -CFLAGS := -O3 -CFLAGS_O2:= -O2 -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -limf $(CLIBS2) $(STATIC) - -TARGETS := make_hgrid make_hgrid_parallel - -SOURCES := make_hgrid.c create_conformal_cubic_grid.c create_gnomonic_cubic_grid.c create_grid_from_file.c create_lonlat_grid.c -SOURCES += mpp_domain.c mpp_io.c tool_util.c -SOURCES += read_mosaic.c create_xgrid.c interp.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/interp.h ../../shared/mosaic/mosaic_util.h \ - ../../shared/mosaic/read_mosaic.h ./create_hgrid.h - -all: $(TARGETS) - -make_hgrid: $(OBJECTS) mosaic_util.o mpp.o - $(CC) -o $@ $^ $(CLIBS) - -make_hgrid_parallel: $(OBJECTS) mosaic_util_parallel.o mpp_parallel.o - $(MPICC) -o $@ $^ $(CLIBS) - -make_hgrid.o: make_hgrid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_gnomonic_cubic_grid.o: create_gnomonic_cubic_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_conformal_cubic_grid.o: create_conformal_cubic_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_lonlat_grid.o: create_lonlat_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_grid_from_file.o: create_grid_from_file.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util_parallel.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -read_mosaic_parallel.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(MPICC) -Duse_libMPI -Duse_netCDF $(CFLAGS) $(INCLUDES) -o $@ -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_parallel.o: ../shared/mpp.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_jet b/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_jet deleted file mode 100644 index 2624c2e6e..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_jet +++ /dev/null @@ -1,98 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:33:28 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2011 -# This program is distributed under the terms of the GNU General Public -# License. See the file COPYING contained in this directory -# -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -include env.$(SITE) - -#MPICC := mpicc -#CC := icc -CFLAGS := -O3 -CFLAGS_O2:= -O2 -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -limf $(CLIBS2) $(STATIC) - -TARGETS := make_hgrid make_hgrid_parallel - -SOURCES := make_hgrid.c create_conformal_cubic_grid.c create_gnomonic_cubic_grid.c create_grid_from_file.c create_lonlat_grid.c -SOURCES += mpp_domain.c mpp_io.c tool_util.c -SOURCES += read_mosaic.c create_xgrid.c interp.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/interp.h ../../shared/mosaic/mosaic_util.h \ - ../../shared/mosaic/read_mosaic.h ./create_hgrid.h - -all: $(TARGETS) - -make_hgrid: $(OBJECTS) mosaic_util.o mpp.o - $(CC) -o $@ $^ $(CLIBS) - -make_hgrid_parallel: $(OBJECTS) mosaic_util_parallel.o mpp_parallel.o - $(MPICC) -o $@ $^ $(CLIBS) - -make_hgrid.o: make_hgrid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_gnomonic_cubic_grid.o: create_gnomonic_cubic_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_conformal_cubic_grid.o: create_conformal_cubic_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_lonlat_grid.o: create_lonlat_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_grid_from_file.o: create_grid_from_file.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util_parallel.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -read_mosaic_parallel.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(MPICC) -Duse_libMPI -Duse_netCDF $(CFLAGS) $(INCLUDES) -o $@ -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_parallel.o: ../shared/mpp.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_wcoss b/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_wcoss deleted file mode 100644 index 3274f74bf..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_wcoss +++ /dev/null @@ -1,98 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:33:28 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2011 -# This program is distributed under the terms of the GNU General Public -# License. See the file COPYING contained in this directory -# -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -include env.$(SITE) - -#MPICC := mpicc -#CC := icc -CFLAGS := -O3 -traceback -CFLAGS_O2:= -O2 -traceback -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -limf $(CLIBS2) $(STATIC) - -TARGETS := make_hgrid make_hgrid_parallel - -SOURCES := make_hgrid.c create_conformal_cubic_grid.c create_gnomonic_cubic_grid.c create_grid_from_file.c create_lonlat_grid.c -SOURCES += mpp_domain.c mpp_io.c tool_util.c -SOURCES += read_mosaic.c create_xgrid.c interp.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/interp.h ../../shared/mosaic/mosaic_util.h \ - ../../shared/mosaic/read_mosaic.h ./create_hgrid.h - -all: $(TARGETS) - -make_hgrid: $(OBJECTS) mosaic_util.o mpp.o - $(CC) -o $@ $^ $(CLIBS) - -make_hgrid_parallel: $(OBJECTS) mosaic_util_parallel.o mpp_parallel.o - $(MPICC) -o $@ $^ $(CLIBS) - -make_hgrid.o: make_hgrid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_gnomonic_cubic_grid.o: create_gnomonic_cubic_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_conformal_cubic_grid.o: create_conformal_cubic_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_lonlat_grid.o: create_lonlat_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_grid_from_file.o: create_grid_from_file.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util_parallel.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -read_mosaic_parallel.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(MPICC) -Duse_libMPI -Duse_netCDF $(CFLAGS) $(INCLUDES) -o $@ -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_parallel.o: ../shared/mpp.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_wcoss_dell_p3 b/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_wcoss_dell_p3 deleted file mode 100644 index 3274f74bf..000000000 --- a/sorc/fre-nctools.fd/tools/make_hgrid/fre-nctools.mk_wcoss_dell_p3 +++ /dev/null @@ -1,98 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:33:28 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2011 -# This program is distributed under the terms of the GNU General Public -# License. See the file COPYING contained in this directory -# -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -include env.$(SITE) - -#MPICC := mpicc -#CC := icc -CFLAGS := -O3 -traceback -CFLAGS_O2:= -O2 -traceback -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -limf $(CLIBS2) $(STATIC) - -TARGETS := make_hgrid make_hgrid_parallel - -SOURCES := make_hgrid.c create_conformal_cubic_grid.c create_gnomonic_cubic_grid.c create_grid_from_file.c create_lonlat_grid.c -SOURCES += mpp_domain.c mpp_io.c tool_util.c -SOURCES += read_mosaic.c create_xgrid.c interp.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/interp.h ../../shared/mosaic/mosaic_util.h \ - ../../shared/mosaic/read_mosaic.h ./create_hgrid.h - -all: $(TARGETS) - -make_hgrid: $(OBJECTS) mosaic_util.o mpp.o - $(CC) -o $@ $^ $(CLIBS) - -make_hgrid_parallel: $(OBJECTS) mosaic_util_parallel.o mpp_parallel.o - $(MPICC) -o $@ $^ $(CLIBS) - -make_hgrid.o: make_hgrid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_gnomonic_cubic_grid.o: create_gnomonic_cubic_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_conformal_cubic_grid.o: create_conformal_cubic_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_lonlat_grid.o: create_lonlat_grid.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -create_grid_from_file.o: create_grid_from_file.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util_parallel.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -read_mosaic_parallel.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(MPICC) -Duse_libMPI -Duse_netCDF $(CFLAGS) $(INCLUDES) -o $@ -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_parallel.o: ../shared/mpp.c $(HEADERS) - $(MPICC) -Duse_libMPI $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/CMakeLists.txt b/sorc/fre-nctools.fd/tools/make_solo_mosaic/CMakeLists.txt new file mode 100644 index 000000000..87ef6bed2 --- /dev/null +++ b/sorc/fre-nctools.fd/tools/make_solo_mosaic/CMakeLists.txt @@ -0,0 +1,12 @@ +set(c_src + make_solo_mosaic.c + get_contact.c) + +add_executable(make_solo_mosaic ${c_src}) + +target_link_libraries(make_solo_mosaic + m + shared_lib + NetCDF::NetCDF_C) + +install(TARGETS make_solo_mosaic RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.cray b/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.cray deleted file mode 100644 index 42e7137c5..000000000 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.cray +++ /dev/null @@ -1,4 +0,0 @@ -# ORNL uses the cc wrapper -MPICC := cc -CC := cc -STATIC := -static diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.gaea b/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.gaea deleted file mode 100644 index 42e7137c5..000000000 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.gaea +++ /dev/null @@ -1,4 +0,0 @@ -# ORNL uses the cc wrapper -MPICC := cc -CC := cc -STATIC := -static diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.gfdl-ws b/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.gfdl-ws deleted file mode 100644 index 3d742259a..000000000 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.gfdl-ws +++ /dev/null @@ -1,6 +0,0 @@ -LIBS2 := -CLIBS2 := - -# GFDL uses the mpicc wrapper and Intel icc -MPICC := mpicc -CC := icc diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.hera b/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.hera deleted file mode 100644 index a4ca56ba4..000000000 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.hera +++ /dev/null @@ -1,4 +0,0 @@ -# hera -MPICC := mpiicc -CC := icc -STATIC := diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.jet b/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.jet deleted file mode 100644 index 28bf431ee..000000000 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.jet +++ /dev/null @@ -1,7 +0,0 @@ -CLIBS_SITE := -CFLAGS_SITE := - -# GFDL uses the mpicc wrapper and Intel icc -MPICC := mpicc -CC := icc -NETCDF_HOME = $(NETCDF_DIR) diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.pan b/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.pan deleted file mode 100644 index 3d742259a..000000000 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.pan +++ /dev/null @@ -1,6 +0,0 @@ -LIBS2 := -CLIBS2 := - -# GFDL uses the mpicc wrapper and Intel icc -MPICC := mpicc -CC := icc diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.wcoss b/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.wcoss deleted file mode 100644 index e6f023dfb..000000000 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.wcoss +++ /dev/null @@ -1,3 +0,0 @@ -# ORNL uses the cc wrapper -MPICC := mpiicc -CC := icc diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.wcoss_dell_p3 b/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.wcoss_dell_p3 deleted file mode 100644 index 07f52aac8..000000000 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.wcoss_dell_p3 +++ /dev/null @@ -1,4 +0,0 @@ -# Dell -MPICC := mpiicc -CC := icc -STATIC := diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.zeus b/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.zeus deleted file mode 100644 index 3d742259a..000000000 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/env.zeus +++ /dev/null @@ -1,6 +0,0 @@ -LIBS2 := -CLIBS2 := - -# GFDL uses the mpicc wrapper and Intel icc -MPICC := mpicc -CC := icc diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_cray b/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_cray deleted file mode 100644 index a67bbe8d4..000000000 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_cray +++ /dev/null @@ -1,76 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:33:52 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2011 -# This program is distributed under the terms of the GNU General Public -# License. See the file COPYING contained in this directory -# -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -include env.$(SITE) - -#CC := icc -CFLAGS := -O3 -traceback -CFLAGS_O2:= -O2 -traceback -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -limf $(CLIBS2) $(STATIC) - -TARGETS := make_solo_mosaic - -SOURCES := make_solo_mosaic.c get_contact.c -SOURCES += mpp.c mpp_domain.c mpp_io.c tool_util.c -SOURCES += create_xgrid.c interp.c mosaic_util.c read_mosaic.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/interp.h ../../shared/mosaic/mosaic_util.h \ - ./get_contact.h ../../shared/mosaic/read_mosaic.h - -all: $(TARGETS) - -make_solo_mosaic: $(OBJECTS) - $(CC) -o $@ $^ $(CLIBS) - -make_solo_mosaic.o: make_solo_mosaic.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -get_contact.o: get_contact.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_hera b/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_hera deleted file mode 100644 index 7a2130a22..000000000 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_hera +++ /dev/null @@ -1,76 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:33:52 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2011 -# This program is distributed under the terms of the GNU General Public -# License. See the file COPYING contained in this directory -# -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -include env.$(SITE) - -#CC := icc -CFLAGS := -O3 -CFLAGS_O2:= -O2 -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -limf $(CLIBS2) $(STATIC) - -TARGETS := make_solo_mosaic - -SOURCES := make_solo_mosaic.c get_contact.c -SOURCES += mpp.c mpp_domain.c mpp_io.c tool_util.c -SOURCES += create_xgrid.c interp.c mosaic_util.c read_mosaic.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/interp.h ../../shared/mosaic/mosaic_util.h \ - ./get_contact.h ../../shared/mosaic/read_mosaic.h - -all: $(TARGETS) - -make_solo_mosaic: $(OBJECTS) - $(CC) -o $@ $^ $(CLIBS) - -make_solo_mosaic.o: make_solo_mosaic.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -get_contact.o: get_contact.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_jet b/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_jet deleted file mode 100644 index 7a2130a22..000000000 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_jet +++ /dev/null @@ -1,76 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:33:52 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2011 -# This program is distributed under the terms of the GNU General Public -# License. See the file COPYING contained in this directory -# -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -include env.$(SITE) - -#CC := icc -CFLAGS := -O3 -CFLAGS_O2:= -O2 -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -limf $(CLIBS2) $(STATIC) - -TARGETS := make_solo_mosaic - -SOURCES := make_solo_mosaic.c get_contact.c -SOURCES += mpp.c mpp_domain.c mpp_io.c tool_util.c -SOURCES += create_xgrid.c interp.c mosaic_util.c read_mosaic.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/interp.h ../../shared/mosaic/mosaic_util.h \ - ./get_contact.h ../../shared/mosaic/read_mosaic.h - -all: $(TARGETS) - -make_solo_mosaic: $(OBJECTS) - $(CC) -o $@ $^ $(CLIBS) - -make_solo_mosaic.o: make_solo_mosaic.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -get_contact.o: get_contact.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_wcoss b/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_wcoss deleted file mode 100644 index a67bbe8d4..000000000 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_wcoss +++ /dev/null @@ -1,76 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:33:52 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2011 -# This program is distributed under the terms of the GNU General Public -# License. See the file COPYING contained in this directory -# -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -include env.$(SITE) - -#CC := icc -CFLAGS := -O3 -traceback -CFLAGS_O2:= -O2 -traceback -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -limf $(CLIBS2) $(STATIC) - -TARGETS := make_solo_mosaic - -SOURCES := make_solo_mosaic.c get_contact.c -SOURCES += mpp.c mpp_domain.c mpp_io.c tool_util.c -SOURCES += create_xgrid.c interp.c mosaic_util.c read_mosaic.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/interp.h ../../shared/mosaic/mosaic_util.h \ - ./get_contact.h ../../shared/mosaic/read_mosaic.h - -all: $(TARGETS) - -make_solo_mosaic: $(OBJECTS) - $(CC) -o $@ $^ $(CLIBS) - -make_solo_mosaic.o: make_solo_mosaic.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -get_contact.o: get_contact.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_wcoss_dell_p3 b/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_wcoss_dell_p3 deleted file mode 100644 index a67bbe8d4..000000000 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/fre-nctools.mk_wcoss_dell_p3 +++ /dev/null @@ -1,76 +0,0 @@ -# -# $Id: fre-nctools.mk,v 20.0 2013/12/14 00:33:52 fms Exp $ -# ------------------------------------------------------------------------------ -# FMS/FRE Project: Makefile to Build Regridding Executables -# ------------------------------------------------------------------------------ -# afy Ver 1.00 Initial version (Makefile, ver 17.0.4.2) June 10 -# afy Ver 1.01 Add rules to build MPI-based executable June 10 -# afy Ver 1.02 Simplified according to fre-nctools standards June 10 -# ------------------------------------------------------------------------------ -# Copyright (C) NOAA Geophysical Fluid Dynamics Laboratory, 2009-2011 -# This program is distributed under the terms of the GNU General Public -# License. See the file COPYING contained in this directory -# -# Designed and written by V. Balaji, Amy Langenhorst and Aleksey Yakovlev -# -include env.$(SITE) - -#CC := icc -CFLAGS := -O3 -traceback -CFLAGS_O2:= -O2 -traceback -INCLUDES := -I${NETCDF_HOME}/include -I./ -I../shared -I../../shared/mosaic -CLIBS := -L${NETCDF_HOME}/lib -L${HDF5_HOME}/lib -lnetcdf -lhdf5_hl -lhdf5 -lz -limf $(CLIBS2) $(STATIC) - -TARGETS := make_solo_mosaic - -SOURCES := make_solo_mosaic.c get_contact.c -SOURCES += mpp.c mpp_domain.c mpp_io.c tool_util.c -SOURCES += create_xgrid.c interp.c mosaic_util.c read_mosaic.c - -OBJECTS := $(SOURCES:c=o) - -HEADERS = fre-nctools.mk ../shared/mpp.h ../shared/mpp_domain.h ../shared/mpp_io.h ../shared/tool_util.h \ - ../../shared/mosaic/constant.h ../../shared/mosaic/create_xgrid.h \ - ../../shared/mosaic/interp.h ../../shared/mosaic/mosaic_util.h \ - ./get_contact.h ../../shared/mosaic/read_mosaic.h - -all: $(TARGETS) - -make_solo_mosaic: $(OBJECTS) - $(CC) -o $@ $^ $(CLIBS) - -make_solo_mosaic.o: make_solo_mosaic.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -get_contact.o: get_contact.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -mosaic_util.o: ../../shared/mosaic/mosaic_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -read_mosaic.o: ../../shared/mosaic/read_mosaic.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -interp.o: ../../shared/mosaic/interp.c $(HEADERS) - $(CC) -Duse_netCDF $(CFLAGS) $(INCLUDES) -c $< - -mpp_io.o: ../shared/mpp_io.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp_domain.o: ../shared/mpp_domain.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -mpp.o: ../shared/mpp.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -tool_util.o: ../shared/tool_util.c $(HEADERS) - $(CC) $(CFLAGS) $(INCLUDES) -o $@ -c $< - -create_xgrid.o: ../../shared/mosaic/create_xgrid.c $(HEADERS) - $(CC) $(CFLAGS_O2) $(INCLUDES) -c $< - -%.o: %.c - $(CC) $(CFLAGS) $(INCLUDES) -c $< - -clean: - -rm -f *.o $(TARGETS) diff --git a/sorc/fre-nctools.fd/tools/shared/COPYING b/sorc/fre-nctools.fd/tools/shared/COPYING deleted file mode 100644 index 93a221957..000000000 --- a/sorc/fre-nctools.fd/tools/shared/COPYING +++ /dev/null @@ -1,159 +0,0 @@ -TERMS AND CONDITIONS -0. Definitions. - -“This License” refers to version 3 of the GNU General Public License. - -“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. - -“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. - -To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. - -A “covered work” means either the unmodified Program or a work based on the Program. - -To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. - -To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. - -An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. -1. Source Code. - -The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. - -A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. - -The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. - -The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. - -The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. -2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. - -You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. -3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. -4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. -5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified it, and giving a relevant date. - b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. - c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. - d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. - -A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. -6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: - - a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. - b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. - c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. - d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. - e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. - -A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. - -A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. - -“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). - -The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. -7. Additional Terms. - -“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. - -Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or - b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or - c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or - d) Limiting the use for publicity purposes of names of licensors or authors of the material; or - e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or - f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. - -All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. -8. Termination. - -You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. -9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. -10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. - -An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. -11. Patents. - -A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. - -A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. - -In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. - -A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. -12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. -13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. -14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. - -Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. -15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. -16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. diff --git a/sorc/fre-nctools.fd/tools/shave.fd/CMakeLists.txt b/sorc/fre-nctools.fd/tools/shave.fd/CMakeLists.txt new file mode 100644 index 000000000..6f75df2df --- /dev/null +++ b/sorc/fre-nctools.fd/tools/shave.fd/CMakeLists.txt @@ -0,0 +1,10 @@ +set(fortran_src + shave_nc.F90) + +set(exe_name shave) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + NetCDF::NetCDF_Fortran) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/fre-nctools.fd/tools/shave.fd/build_shave b/sorc/fre-nctools.fd/tools/shave.fd/build_shave deleted file mode 100755 index 18cdf07aa..000000000 --- a/sorc/fre-nctools.fd/tools/shave.fd/build_shave +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -set -x - -case $1 in - "cray" ) - FCMP=ftn - FFLAGS="-O3 -fp-model precise" ;; - "wcoss" ) - FCMP=ifort - FFLAGS="-O3 -fp-model precise ${NETCDF_FFLAGS} ${NETCDF_LDFLAGS_F}" ;; - "wcoss_dell_p3" ) - FCMP=ifort - FFLAGS="-O3 -fp-model precise ${NETCDF_FFLAGS} ${NETCDF_LDFLAGS_F}" ;; - "jet" ) - FCMP=ifort - FFLAGS="-O3 -fp-model precise -I$NETCDF/include -L$NETCDF/lib -lnetcdff -lnetcdf" ;; - "hera" ) - FCMP=ifort - FFLAGS="-O3 -fp-model precise -I$NETCDF/include -L$NETCDF/lib -lnetcdff -lnetcdf" ;; - *) - echo "SHAVE UTILITY BUILD NOT TESTED ON MACHINE $1" - exit 1 ;; -esac - -EXEC=../../../../exec/shave.x -rm -f $EXEC -$FCMP $FFLAGS -o $EXEC shave_nc.F90 -rc=$? - -if ((rc != 0)); then - echo "ERROR BUILDING SHAVE UTILITY" - exit $rc -else - exit 0 -fi diff --git a/sorc/global_chgres.fd/CMakeLists.txt b/sorc/global_chgres.fd/CMakeLists.txt new file mode 100644 index 000000000..a3298825e --- /dev/null +++ b/sorc/global_chgres.fd/CMakeLists.txt @@ -0,0 +1,39 @@ +set(fortran_src + chgres.f90 + chgres_utils.f90 + funcphys.f90 + machine_8.f90 + nrlmsise00_sub.f90 + nsst_chgres.f90 + nstio_module.f90 + num_parthds.f90 + physcons.f90 + read_write.f90 + sfcsub.F + surface_chgres.f90) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fconvert=big-endian") +endif() + +set(exe_name global_chgres) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + gfsio_4 + nemsiogfs + nemsio + sigio_4 + sfcio_4 + landsfcutil_d + ip_d + sp_d + w3emc_d + w3nco_d + bacio_4 + NetCDF::NetCDF_Fortran + OpenMP::OpenMP_Fortran) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/global_chgres.fd/Makefile b/sorc/global_chgres.fd/Makefile deleted file mode 100755 index 3d0024489..000000000 --- a/sorc/global_chgres.fd/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -SHELL =/bin/ksh -INCMOD =$(INCS) -LIBS =$(LIBSM) - -SRCM =chgres.f -SRCS = - -OBJS =num_parthds.o \ - nstio_module.o \ - nsst_chgres.o \ - funcphys.o \ - physcons.o \ - machine_8.o \ - surface_chgres.o \ - sfcsub.o \ - chgres_utils.o \ - nrlmsise00_sub.o \ - read_write.o \ - chgres.o - -FC =$(FCMP) -FC90 =$(FCMP95) -LDR =$(FCMP) - -FFLAGS =$(FFLAGSM) -OMPFLAG=$(OMPFLAGM) -LDFLAGS =$(LDFLAGSM) - -CMD =global_chgres -$(CMD): $(OBJS) - $(LDR) $(LDFLAGS) $(OBJS) $(LIBS) -o $(CMD) - -read_write.o: nstio_module.o surface_chgres.o read_write.f90 - $(FC90) $(FFLAGS) $(INCMOD) $(OMPFLAG) -c read_write.f90 -num_parthds.o: num_parthds.f90 - $(FC90) $(FFLAGS) $(OMPFLAG) -c num_parthds.f90 -nstio_module.o : nstio_module.f90 - $(FC90) $(FFLAGS) $(RECURS) -c nstio_module.f90 -nsst_chgres.o : nsst_chgres.f90 - $(FC90) $(FFLAGS) $(RECURS) -c nsst_chgres.f90 -chgres_utils.o: physcons.o funcphys.o chgres_utils.f90 - $(FC90) $(FFLAGS) $(RECURS) $(INCMOD) -c chgres_utils.f90 -nrlmsise00_sub.o: nrlmsise00_sub.f90 - $(FC90) $(FFLAGS) $(RECURS) -c nrlmsise00_sub.f90 -funcphys.o: funcphys.f90 physcons.o machine_8.o - $(FC90) $(FFLAGS) $(RECURS) -c funcphys.f90 -physcons.o: physcons.f90 machine_8.o - $(FC90) $(FFLAGS) $(RECURS) -c physcons.f90 -machine_8.o: machine_8.f90 - $(FC90) $(FFLAGS) $(RECURS) -c machine_8.f90 -sfcsub.o: machine_8.o sfcsub.F - $(FC) $(FFLAGS) $(OMPFLAG) $(INCMOD) -c sfcsub.F -surface_chgres.o: sfcsub.o machine_8.o surface_chgres.f90 - $(FC90) $(FFLAGS) $(INCMOD) $(RECURS) -c surface_chgres.f90 -chgres.o: surface_chgres.o funcphys.o chgres.f90 - $(FC90) $(FFLAGS) $(OMPFLAG) $(INCMOD) -c chgres.f90 -clean: - -rm -f $(OBJS) *.mod -install: - -cp $(CMD) ../../exec/. -clobber: clean - -rm -f $(CMD) diff --git a/sorc/global_chgres.fd/chgres_utils.f90 b/sorc/global_chgres.fd/chgres_utils.f90 index 5ef03d782..0f156dad3 100755 --- a/sorc/global_chgres.fd/chgres_utils.f90 +++ b/sorc/global_chgres.fd/chgres_utils.f90 @@ -536,8 +536,8 @@ SUBROUTINE VINTG(IM,IX,KM1,KM2,NT,P1,U1,V1,T1,Q1,W1,P2, & ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! COMPUTE LOG PRESSURE INTERPOLATING COORDINATE ! AND COPY INPUT WIND, TEMPERATURE, HUMIDITY AND OTHER TRACERS -!$OMP PARALLEL DO DEFAULT(SHARED) -!$OMP+ PRIVATE(K,I) +!$OMP PARALLEL DO DEFAULT(SHARED), & +!$OMP& PRIVATE(K,I) DO K=1,KM1 DO I=1,IM Z1(I,K) = -LOG(P1(I,K)) @@ -556,8 +556,8 @@ SUBROUTINE VINTG(IM,IX,KM1,KM2,NT,P1,U1,V1,T1,Q1,W1,P2, & ENDDO ENDDO ENDDO -!$OMP PARALLEL DO DEFAULT(SHARED) -!$OMP+ PRIVATE(K,I) +!$OMP PARALLEL DO DEFAULT(SHARED), & +!$OMP& PRIVATE(K,I) DO K=1,KM2 DO I=1,IM Z2(I,K) = -LOG(P2(I,K)) @@ -678,9 +678,9 @@ SUBROUTINE TERP3(IM,IXZ1,IXQ1,IXZ2,IXQ2,NM,NXQ1,NXQ2, & ! BUT WITHIN THE TWO EDGE INTERVALS INTERPOLATE LINEARLY. ! KEEP THE OUTPUT FIELDS CONSTANT OUTSIDE THE INPUT DOMAIN. -!$OMP PARALLEL DO DEFAULT(PRIVATE) SHARED(IM,IXZ1,IXQ1,IXZ2) -!$OMP+ SHARED(IXQ2,NM,NXQ1,NXQ2,KM1,KXZ1,KXQ1,Z1,Q1,KM2,KXZ2) -!$OMP+ SHARED(KXQ2,Z2,Q2,J2,K1S) +!$OMP PARALLEL DO DEFAULT(PRIVATE) SHARED(IM,IXZ1,IXQ1,IXZ2) , & +!$OMP& SHARED(IXQ2,NM,NXQ1,NXQ2,KM1,KXZ1,KXQ1,Z1,Q1,KM2,KXZ2) , & +!$OMP& SHARED(KXQ2,Z2,Q2,J2,K1S) DO K2=1,KM2 DO I=1,IM @@ -1085,8 +1085,8 @@ SUBROUTINE SPECSETS(H,D,IDRT) deallocate (vcoord) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if(h%idvt==100.and.h%ntrac==20) then -!$OMP PARALLEL DO DEFAULT(SHARED) -!$OMP+ PRIVATE(i,j,clat,rlon,k) +!$OMP PARALLEL DO DEFAULT(SHARED) , & +!$OMP& PRIVATE(i,j,clat,rlon,k) do j=1,h%latb clat=sqrt(1-slat(j)**2) do i=1,h%lonb @@ -1247,8 +1247,8 @@ SUBROUTINE NEWPR1(IM,IX,KM,KMP,IDVC,IDVM,IDSL,NVCOORD,VCOORD, & if (thermodyn_id <= 1) then !!$OMP PARALLEL DO DEFAULT(PRIVATE) SHARED(KM,kmp,IM) !!$OMP+ SHARED(qn,qp,TOV,PI,AK,BK,PS,CK) -!$omp parallel do shared(km,kmp,im,qp,tp,tov,pi,ak,bk,ck) -!$omp1 private(i,k,tem,qnk,trk) +!$omp parallel do shared(km,kmp,im,qp,tp,tov,pi,ak,bk,ck) , & +!$omp& private(i,k,tem,qnk,trk) DO K=2,KM tem = float(k-1) / float(kmp-1) DO I=1,IM @@ -1283,12 +1283,12 @@ SUBROUTINE NEWPR1(IM,IX,KM,KMP,IDVC,IDVM,IDSL,NVCOORD,VCOORD, & endif DPMINALL=1000.0 -!$omp parallel do -!$omp1 shared(im,km,kmp,ntracm,thermodyn_id,pp,tp,qp,cpi,cp0i) -!$omp1 shared(ak,bk,ck,pi) -!$omp1 private(i,k,nit,converg,dpmin,tvu,tvd,trk) -!$omp1 private(pio,po,to,qo,pn,tn,qn,akbkps) -!$omp1 private(xcp,xcp2,sumq,sumq2,temu,temd) +!$omp parallel do & +!$omp& shared(im,km,kmp,ntracm,thermodyn_id,pp,tp,qp,cpi,cp0i) , & +!$omp& shared(ak,bk,ck,pi) ,& +!$omp& private(i,k,nit,converg,dpmin,tvu,tvd,trk) ,& +!$omp& private(pio,po,to,qo,pn,tn,qn,akbkps) ,& +!$omp& private(xcp,xcp2,sumq,sumq2,temu,temd) ! DO I=1,IM DO K=1,KMP @@ -1439,8 +1439,8 @@ SUBROUTINE CHECKDP(IM,IX,KM,AK,BK,CK,PS,TP,QP) ENDDO PI(1:IM,1)=PS(1:IM) PI(1:IM,KM+1)=0.0 -!$OMP PARALLEL DO DEFAULT(SHARED) -!$OMP+ PRIVATE(K,I,TVU,TVD,TRK) +!$OMP PARALLEL DO DEFAULT(SHARED) , & +!$OMP& PRIVATE(K,I,TVU,TVD,TRK) DO K=2,KM DO I=1,IM TVU=FTV(TP(I,K ),QP(I,K )) @@ -1518,16 +1518,16 @@ SUBROUTINE VINTTQ(KM1,KM2,P1,T1,Q1,P2,T2,Q2) ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! COMPUTE LOG PRESSURE INTERPOLATING COORDINATE ! AND COPY INPUT WIND, TEMPERATURE, HUMIDITY AND OTHER TRACERS -!$OMP PARALLEL DO DEFAULT(SHARED) -!$OMP+ PRIVATE(K) +!$OMP PARALLEL DO DEFAULT(SHARED) , & +!$OMP& PRIVATE(K) DO K=1,KM1 Z1(1,K)=-LOG(P1(K)) C1(1,K,1)=T1(K) C1(1,K,2)=Q1(K) ENDDO !$OMP END PARALLEL DO -!$OMP PARALLEL DO DEFAULT(SHARED) -!$OMP+ PRIVATE(K) +!$OMP PARALLEL DO DEFAULT(SHARED), & +!$OMP& PRIVATE(K) DO K=1,KM2 Z2(1,K)=-LOG(P2(K)) ENDDO @@ -1741,8 +1741,8 @@ SUBROUTINE VINTTR(IM,IX,KM1,KM2,NT,P1,T1,Q1,P2,T2,Q2) ! COMPUTE LOG PRESSURE INTERPOLATING COORDINATE ! AND COPY INPUT WIND, TEMPERATURE, HUMIDITY AND OTHER TRACERS -!$OMP PARALLEL DO DEFAULT(SHARED) -!$OMP+ PRIVATE(K,I) +!$OMP PARALLEL DO DEFAULT(SHARED) , & +!$OMP& PRIVATE(K,I) DO K=1,KM1 DO I=1,IM Z1(I,K)=-LOG(P1(I,K)) @@ -1758,8 +1758,8 @@ SUBROUTINE VINTTR(IM,IX,KM1,KM2,NT,P1,T1,Q1,P2,T2,Q2) ENDDO ENDDO ENDDO -!$OMP PARALLEL DO DEFAULT(SHARED) -!$OMP+ PRIVATE(K,I) +!$OMP PARALLEL DO DEFAULT(SHARED) , & +!$OMP& PRIVATE(K,I) DO K=1,KM2 DO I=1,IM Z2(I,K)=-LOG(P2(I,K)) @@ -1829,16 +1829,16 @@ subroutine getomega(jcap,nc,km,idvc,idvm,idrt,idsl,nvcoord, & CASE(0,1) continue CASE(2) -!$OMP PARALLEL DO DEFAULT(SHARED) -!$OMP+ PRIVATE(i) +!$OMP PARALLEL DO DEFAULT(SHARED) , & +!$OMP& PRIVATE(i) do i=1,ijn psx(i)=psx(i)/(psi(i)*1.0E-3) psy(i)=psy(i)/(psi(i)*1.0E-3) enddo !$OMP END PARALLEL DO CASE DEFAULT -!$OMP PARALLEL DO DEFAULT(SHARED) -!$OMP+ PRIVATE(i) +!$OMP PARALLEL DO DEFAULT(SHARED) , & +!$OMP& PRIVATE(i) do i=1,ijn psx(i)=psx(i)/psi(i) psy(i)=psy(i)/psi(i) @@ -1846,8 +1846,8 @@ subroutine getomega(jcap,nc,km,idvc,idvm,idrt,idsl,nvcoord, & !$OMP END PARALLEL DO END SELECT -!$OMP PARALLEL DO DEFAULT(SHARED) -!$OMP+ PRIVATE(K) +!$OMP PARALLEL DO DEFAULT(SHARED) , & +!$OMP& PRIVATE(K) do K=1,km call sptran(0,jcap,idrt,lonb,latb,1,1,1,lonb2,lonb2,nc,ijn, & j1,j2,jc,sd(1,k),di(in,k),di(is,k),1) @@ -1858,8 +1858,8 @@ subroutine getomega(jcap,nc,km,idvc,idvm,idrt,idsl,nvcoord, & ps=psi,t=ti,pm=pm,pd=pd,dpmdps=dpmdps,dpddps=dpddps) !----3.omeda from modstuff -!$OMP PARALLEL DO DEFAULT(SHARED) -!$OMP+ PRIVATE(i) +!$OMP PARALLEL DO DEFAULT(SHARED) , & +!$OMP& PRIVATE(i) do i=1,ijl pi(i,1)=psi(i) dpidps(i,1)=1. diff --git a/sorc/global_chgres.fd/nrlmsise00_sub.f90 b/sorc/global_chgres.fd/nrlmsise00_sub.f90 index 2738065c2..ee23a98c9 100755 --- a/sorc/global_chgres.fd/nrlmsise00_sub.f90 +++ b/sorc/global_chgres.fd/nrlmsise00_sub.f90 @@ -1662,12 +1662,12 @@ BLOCK DATA GTD7BK PZ1(50),PZ2(50),PAA1(50),PAA2(50) COMMON/LOWER7/PTM(10),PDM(10,8) COMMON/MAVG7/PAVGM(10) - COMMON/DATIM7/ISDATE(3),ISTIME(2),NAME(2) +! COMMON/DATIM7/ISDATE(3),ISTIME(2),NAME(2) COMMON/METSEL/IMR common/pres/pr65(2,65),pr151(2,151) DATA IMR/0/ - DATA ISDATE/'01-F','EB-0','2 '/,ISTIME/'15:4','9:27'/ - DATA NAME/'MSIS','E-00'/ +! DATA ISDATE/'01-F','EB-0','2 '/,ISTIME/'15:4','9:27'/ +! DATA NAME/'MSIS','E-00'/ ! TEMPERATURE DATA PT1/ & 9.86573E-01, 1.62228E-02, 1.55270E-02,-1.04323E-01,-3.75801E-03,& diff --git a/sorc/global_chgres.fd/read_write.f90 b/sorc/global_chgres.fd/read_write.f90 index 04dd17798..6cbb0b587 100644 --- a/sorc/global_chgres.fd/read_write.f90 +++ b/sorc/global_chgres.fd/read_write.f90 @@ -285,9 +285,9 @@ subroutine write_fv3_sfc_data_netcdf(lonb, latb, lsoil, sfcoutput, f10m, & endif if (tile < 10) then - write(outfile, '(A, I1, A)'), 'out.sfc.tile', tile, '.nc' + write(outfile, '(A, I1, A)') 'out.sfc.tile', tile, '.nc' else - write(outfile, '(A, I2, A)'), 'out.sfc.tile', tile, '.nc' + write(outfile, '(A, I2, A)') 'out.sfc.tile', tile, '.nc' endif !--- open the file @@ -1014,7 +1014,7 @@ SUBROUTINE WRITE_FV3_ATMS_BNDY_NETCDF(ZS,PS,T,W,U,V,Q,VCOORD,LONB,LATB,& ! Create output file header. !---------------------------------------------------------------------------------- - WRITE(OUTFILE, '(A, I1, A)'), 'gfs_bndy.tile', 7, '.nc' + WRITE(OUTFILE, '(A, I1, A)') 'gfs_bndy.tile', 7, '.nc' ERROR = NF90_CREATE(OUTFILE, IOR(NF90_NETCDF4,NF90_CLASSIC_MODEL), & NCID2, INITIALSIZE=INITAL, CHUNKSIZE=FSIZE) CALL NETCDF_ERROR(ERROR, 'CREATING FILE: '//TRIM(OUTFILE) ) diff --git a/sorc/global_cycle.fd/CMakeLists.txt b/sorc/global_cycle.fd/CMakeLists.txt new file mode 100644 index 000000000..94d44e144 --- /dev/null +++ b/sorc/global_cycle.fd/CMakeLists.txt @@ -0,0 +1,26 @@ +set(fortran_src + cycle.f90 + machine.f90 + num_parthds.f90 + sfcsub.F + read_write_data.f90) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fconvert=big-endian") +endif() + +set(exe_name global_cycle) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + w3nco_d + bacio_4 + ip_d + sp_d + MPI::MPI_Fortran + NetCDF::NetCDF_Fortran + OpenMP::OpenMP_Fortran) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/global_cycle.fd/Makefile b/sorc/global_cycle.fd/Makefile deleted file mode 100755 index 028d2744f..000000000 --- a/sorc/global_cycle.fd/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -SHELL= /bin/ksh -FC =$(FCMP) -LIBS =$(LIBSM) -OBJS =num_parthds.o machine.o cycle.o sfcsub.o read_write_data.o - -CMD =global_cycle -$(CMD): $(OBJS) - ${FC} ${DEBUG} $(FFLAGS) $(LDFLG) $(OBJS) $(LIBS) -o $(CMD) - -num_parthds.o: num_parthds.f90 - $(FC) $(FFLAGS) $(OMPFLAG) -c num_parthds.f90 - -machine.o: machine.f90 - ${FC} $(FFLAGS) -c machine.f90 - -read_write_data.o: read_write_data.f90 - ${FC} $(FFLAGS) -c read_write_data.f90 - -sfcsub.o: machine.o sfcsub.F - $(FC) $(FFLAGS) $(OMPFLAG) -c sfcsub.F - -cycle.o: read_write_data.o cycle.f90 - $(FC) $(FFLAGS) -c cycle.f90 - -install: - -cp -p $(CMD) ../../exec/. -clean: - -rm -f $(OBJS) *.mod $(CMD) diff --git a/sorc/global_cycle.fd/makefile.sh b/sorc/global_cycle.fd/makefile.sh deleted file mode 100755 index 3ba5efb20..000000000 --- a/sorc/global_cycle.fd/makefile.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/ksh -set -x - -#----------------------------------------------------- -#-use standard module. -#----------------------------------------------------- - -export FCMP=${FCMP:-ifort} - -##export DEBUG='-ftrapuv -check all -check nooutput_conversion -fp-stack-check -fstack-protector -traceback -g' -export INCS="-I$IP_INCd ${NETCDF_INCLUDE}" -export FFLAGS="$INCS -O3 -fp-model precise -r8 -convert big_endian -traceback -g" -export OMPFLAG=-qopenmp -export LDFLG=-qopenmp - -export LIBSM="${W3NCO_LIBd} ${BACIO_LIB4} ${IP_LIBd} ${SP_LIBd} ${NETCDF_LDFLAGS_F}" - -make -f Makefile clean -make -f Makefile -make -f Makefile install -make -f Makefile clean diff --git a/sorc/machine-setup.sh b/sorc/machine-setup.sh index 48b2ee1bf..8389f2b0e 100644 --- a/sorc/machine-setup.sh +++ b/sorc/machine-setup.sh @@ -27,7 +27,6 @@ if [[ -d /lfs3 ]] ; then fi target=jet module purge - module use /lfs3/projects/hfv3gfs/nwprod/NCEPLIBS/modulefiles elif [[ -d /scratch1 ]] ; then # We are on NOAA Hera if ( ! eval module help > /dev/null 2>&1 ) ; then @@ -36,7 +35,6 @@ elif [[ -d /scratch1 ]] ; then fi target=hera module purge - MOD_PATH=/scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles elif [[ -d /gpfs/hps && -e /etc/SuSE-release ]] ; then # We are on NOAA Luna or Surge if ( ! eval module help > /dev/null 2>&1 ) ; then @@ -109,6 +107,9 @@ elif [[ -d /lustre && -d /ncrc ]] ; then fi target=gaea module purge +elif [[ "$(hostname)" =~ "Orion" ]]; then + target="orion" + module purge elif [[ "$(hostname)" =~ "odin" ]]; then target="odin" else diff --git a/sorc/mkgfsnemsioctl.fd/CMakeLists.txt b/sorc/mkgfsnemsioctl.fd/CMakeLists.txt new file mode 100644 index 000000000..7002cf37f --- /dev/null +++ b/sorc/mkgfsnemsioctl.fd/CMakeLists.txt @@ -0,0 +1,12 @@ +set(fortran_src + mkgfsnemsioctl.f90) + +set(exe_name mkgfsnemsioctl) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + nemsio + bacio_4 + w3nco_d) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/mkgfsnemsioctl.fd/makefile b/sorc/mkgfsnemsioctl.fd/makefile deleted file mode 100755 index 351cda92d..000000000 --- a/sorc/mkgfsnemsioctl.fd/makefile +++ /dev/null @@ -1,10 +0,0 @@ -SHELL =/bin/ksh -EXEC =../../exec/mkgfsnemsioctl -FOPTS = -O -FR -I$(NEMSIO_INC) -LOPTS = $(OPTS) -LIBS = $(NEMSIO_LIB) $(BACIO_LIB4) $(W3NCO_LIBd) -OBJS = mkgfsnemsioctl.o -SRCS = mkgfsnemsioctl.f -# ************************************************************************* -all: $(SRCS) - $(FCMP) $(FOPTS) $(LOPTS) ${SRCS} -o $(EXEC) $(LIBS) diff --git a/sorc/mkgfsnemsioctl.fd/mkgfsnemsioctl.f b/sorc/mkgfsnemsioctl.fd/mkgfsnemsioctl.f90 similarity index 100% rename from sorc/mkgfsnemsioctl.fd/mkgfsnemsioctl.f rename to sorc/mkgfsnemsioctl.fd/mkgfsnemsioctl.f90 diff --git a/sorc/nemsio_chgdate.fd/CMakeLists.txt b/sorc/nemsio_chgdate.fd/CMakeLists.txt new file mode 100644 index 000000000..bb04b6c8d --- /dev/null +++ b/sorc/nemsio_chgdate.fd/CMakeLists.txt @@ -0,0 +1,17 @@ +set(fortran_src + nemsio_chgdate.f90) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -convert big_endian") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fconvert=big-endian") +endif() + +set(exe_name nemsio_chgdate) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + nemsio + bacio_4) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/nemsio_chgdate.fd/makefile b/sorc/nemsio_chgdate.fd/makefile deleted file mode 100755 index 91a80b7e9..000000000 --- a/sorc/nemsio_chgdate.fd/makefile +++ /dev/null @@ -1,10 +0,0 @@ -EXEC =../../exec/nemsio_chgdate -FOPTS =-O -FR -I$(NEMSIO_INC) -convert big_endian -LOPTS = $(OPTS) -LIBS =$(NEMSIO_LIB) $(BACIO_LIB4) -OBJS = nemsio_chgdate.o -SRCS = nemsio_chgdate.f90 -# ************************************************************************* -all: ${OBJS} -$(OBJS): $(SRCS) - $(FCMP) $(FOPTS) $(LOPTS) $(SRCS) -o $(EXEC) $(LIBS) diff --git a/sorc/nemsio_chgdate.fd/nemsio_chgdate.f90 b/sorc/nemsio_chgdate.fd/nemsio_chgdate.f90 index 23eaa7283..a75ad367b 100644 --- a/sorc/nemsio_chgdate.fd/nemsio_chgdate.f90 +++ b/sorc/nemsio_chgdate.fd/nemsio_chgdate.f90 @@ -60,11 +60,11 @@ program nemsio_chgdate write(6,'(A,I4)') 'OLD nfhour = ', nfhour ! Replace old date with new dates -read(idatestr(1:4), '(I)') idate(1) -read(idatestr(5:6), '(I)') idate(2) -read(idatestr(7:8), '(I)') idate(3) -read(idatestr(9:10), '(I)')idate(4) -read(nfhourstr, '(I)') nfhour +read(idatestr(1:4), '(I4)') idate(1) +read(idatestr(5:6), '(I2)') idate(2) +read(idatestr(7:8), '(I2)') idate(3) +read(idatestr(9:10), '(I2)')idate(4) +read(nfhourstr, '(I10)') nfhour write(6,'(A,7(1X,I6))') 'NEW idate = ', idate write(6,'(A,I4)') 'NEW nfhour = ', nfhour diff --git a/sorc/nemsio_get.fd/CMakeLists.txt b/sorc/nemsio_get.fd/CMakeLists.txt new file mode 100644 index 000000000..435602ef8 --- /dev/null +++ b/sorc/nemsio_get.fd/CMakeLists.txt @@ -0,0 +1,18 @@ +set(fortran_src + nemsio_get.f90) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -convert big_endian") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fconvert=big-endian") +endif() + +set(exe_name nemsio_get) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + nemsio + bacio_4 + w3nco_d) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/nemsio_get.fd/makefile b/sorc/nemsio_get.fd/makefile deleted file mode 100755 index 4040c63fa..000000000 --- a/sorc/nemsio_get.fd/makefile +++ /dev/null @@ -1,10 +0,0 @@ -EXEC =../../exec/nemsio_get -FOPTS =-O -FR -I$(NEMSIO_INC) -convert big_endian -LOPTS = $(OPTS) -LIBS =$(NEMSIO_LIB) $(BACIO_LIB4) $(W3NCO_LIBd) -OBJS = nemsio_get.o -SRCS = nemsio_get.f -# ************************************************************************* -all: ${OBJS} -$(OBJS): $(SRCS) - $(FCMP) $(FOPTS) $(LOPTS) $(SRCS) -o $(EXEC) $(LIBS) diff --git a/sorc/nemsio_get.fd/nemsio_get.f b/sorc/nemsio_get.fd/nemsio_get.f90 similarity index 100% rename from sorc/nemsio_get.fd/nemsio_get.f rename to sorc/nemsio_get.fd/nemsio_get.f90 diff --git a/sorc/nemsio_read.fd/CMakeLists.txt b/sorc/nemsio_read.fd/CMakeLists.txt new file mode 100644 index 000000000..9e192044d --- /dev/null +++ b/sorc/nemsio_read.fd/CMakeLists.txt @@ -0,0 +1,12 @@ +set(fortran_src + nemsio_read.f90) + +set(exe_name nemsio_read) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + nemsio + bacio_4 + w3nco_d) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/nemsio_read.fd/makefile b/sorc/nemsio_read.fd/makefile deleted file mode 100755 index 34beec544..000000000 --- a/sorc/nemsio_read.fd/makefile +++ /dev/null @@ -1,13 +0,0 @@ -SHELL =/bin/sh -EXEC =../../exec/nemsio_read -FOPTS = -O -FR -I$(NEMSIO_INC) -LOPTS = $(OPTS) -LIBS = $(NEMSIO_LIB) $(BACIO_LIB4) $(W3NCO_LIBd) -OBJS = nemsio_read.o -SRCS = nemsio_read.f -# ************************************************************************* -all: $(OBJS) - -$(OBJS): $(SRCS) - $(FCMP) $(FOPTS) $(LOPTS) $(SRCS) -o $(EXEC) $(LIBS) - diff --git a/sorc/nemsio_read.fd/nemsio_read.f b/sorc/nemsio_read.fd/nemsio_read.f90 similarity index 100% rename from sorc/nemsio_read.fd/nemsio_read.f rename to sorc/nemsio_read.fd/nemsio_read.f90 diff --git a/sorc/nst_tf_chg.fd/CMakeLists.txt b/sorc/nst_tf_chg.fd/CMakeLists.txt new file mode 100644 index 000000000..43cd32228 --- /dev/null +++ b/sorc/nst_tf_chg.fd/CMakeLists.txt @@ -0,0 +1,24 @@ +set(fortran_src + nc_check.f90 + nst_tf_chg.f90 + read_tfs_nc.f90 + read_tfs_nc_2d.f90 + setup.f90 + smth9_msk.f90) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8") +endif() + +set(exe_name nst_tf_chg) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + nemsio + w3nco_d + bacio_4 + NetCDF::NetCDF_Fortran) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/nst_tf_chg.fd/Makefile b/sorc/nst_tf_chg.fd/Makefile deleted file mode 100755 index 048e37103..000000000 --- a/sorc/nst_tf_chg.fd/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -SHELL= /bin/sh - -CMD= nst_tf_chg.x - -OBJS = setup.o nst_tf_chg.o read_tfs_nc.o smth9_msk.o nc_check.o - -build: $(CMD) - -$(CMD): $(OBJS) - $(FCOMP) $(FFLAGS) -I$(NEMSIO_INC) $(NETCDF_INCLUDE) -o $(CMD) $(OBJS) $(NETCDF_LDFLAGS_F) $(NEMSIO_LIB) $(BACIO_LIB4) $(W3NCO_LIBd) - -setup.o: setup.f90 - $(FCOMP) $(FFLAGS) -c setup.f90 -nst_tf_chg.o: nst_tf_chg.f90 - $(FCOMP) $(FFLAGS) -I$(NEMSIO_INC) $(NETCDF_INCLUDE) -c nst_tf_chg.f90 -nc_check.o: nc_check.f90 - $(FCOMP) $(FFLAGS) $(NETCDF_INCLUDE) -c nc_check.f90 -read_tfs_nc.o: read_tfs_nc.f90 - $(FCOMP) $(FFLAGS) $(NETCDF_INCLUDE) -c read_tfs_nc.f90 -smth9_msk.o: smth9_msk.f90 - $(FCOMP) $(FFLAGS) -c smth9_msk.f90 - -install: - cp ${CMD} ../../exec - -clean: - rm -f *.o *.mod ${CMD} ../../exec/${CMD} - -test: - @echo NO TESTS YET diff --git a/sorc/nst_tf_chg.fd/read_tfs_nc_2d.f90 b/sorc/nst_tf_chg.fd/read_tfs_nc_2d.f90 index 310db46cb..85ea78955 100644 --- a/sorc/nst_tf_chg.fd/read_tfs_nc_2d.f90 +++ b/sorc/nst_tf_chg.fd/read_tfs_nc_2d.f90 @@ -1,4 +1,4 @@ -subroutine read_tfs_nc(filename,tf,mask,nlon,nlat) +subroutine read_tfs_nc_2d(filename,tf,mask,nlon,nlat) ! ! abstract : read Tf at GFS Gaussin grids in netCDF ! @@ -88,5 +88,4 @@ subroutine read_tfs_nc(filename,tf,mask,nlon,nlat) ! If we got this far, everything worked as expected. Yipee! print *,"*** SUCCESS reading file ", filename, "!" -end subroutine read_tfs_nc - +end subroutine read_tfs_nc_2d diff --git a/sorc/orog.fd/CMakeLists.txt b/sorc/orog.fd/CMakeLists.txt new file mode 100644 index 000000000..28a57938a --- /dev/null +++ b/sorc/orog.fd/CMakeLists.txt @@ -0,0 +1,24 @@ +set(fortran_src + mtnlm7_oclsm.f + netcdf_io.F90) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian -assume byterecl") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fconvert=big-endian -fno-range-check") +endif() + +set(exe_name orog) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + bacio_4 + w3nco_d + ip_d + sp_d + NetCDF::NetCDF_Fortran) +if(OpenMP_Fortran_FOUND) + target_link_libraries(${exe_name} OpenMP::OpenMP_Fortran) +endif() + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/orog.fd/Makefile b/sorc/orog.fd/Makefile deleted file mode 100755 index ab31834de..000000000 --- a/sorc/orog.fd/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -SHELL =/bin/ksh -LIBS =$(LIBSM) - -SRCM =mtnlm7_oclsm.f -SRCS = - -OBJS =mtnlm7_oclsm.o netcdf_io.o -FC =$(FCMP) -FC90 =$(FCMP95) -LDR =$(FCMP) - -FFLAGS =$(FFLAGSM) -OMPFLAG=$(OMPFLAGM) -LDFLAGS =$(LDFLAGSM) - -CMD =orog.x -$(CMD): $(OBJS) - $(LDR) $(LDFLAGS) $(OBJS) $(LIBS) -o $(CMD) - -netcdf_io.o: netcdf_io.F90 - $(FC) $(FFLAGS) $(OMPFLAG) -c netcdf_io.F90 -mtnlm7_oclsm.o: mtnlm7_oclsm.f - $(FC) $(FFLAGS) $(OMPFLAG) -c mtnlm7_oclsm.f -clean: - -rm -f $(OBJS) *.mod -install: - -cp $(CMD) ../../exec/. -clobber: clean - -rm -f $(CMD) diff --git a/sorc/orog.fd/mtnlm7_oclsm.f b/sorc/orog.fd/mtnlm7_oclsm.f index a910616e6..46cd166ec 100755 --- a/sorc/orog.fd/mtnlm7_oclsm.f +++ b/sorc/orog.fd/mtnlm7_oclsm.f @@ -1935,7 +1935,7 @@ SUBROUTINE MAKEPC(ZAVG,ZSLM,THETA,GAMMA,SIGMA, C DO J=1,JMN GLAT(J) = -90. + (J-1) * DELXN + DELXN * 0.5 - DELTAX(J) = DELTAY * COSD(GLAT(J)) + DELTAX(J) = DELTAY * COS(GLAT(J)*PI/180.0) ENDDO C C---- FIND THE AVERAGE OF THE MODES IN A GRID BOX @@ -2137,7 +2137,7 @@ SUBROUTINE MAKEPC(ZAVG,ZSLM,THETA,GAMMA,SIGMA, HLPRIM(I,J) = SQRT(HL(I,J)*HL(I,J) + HXY(I,J)*HXY(I,J)) IF( HL(I,J).NE. 0. .AND. SLM(I,J) .NE. 0. ) THEN C - THETA(I,J) = 0.5 * ATAN2D(HXY(I,J),HL(I,J)) + THETA(I,J) = 0.5 * ATAN2(HXY(I,J),HL(I,J)) * 180.0 / PI C === for testing print out in degrees C THETA(I,J) = 0.5 * ATAN2(HXY(I,J),HL(I,J)) ENDIF @@ -2199,7 +2199,7 @@ SUBROUTINE MAKEPC2(ZAVG,ZSLM,THETA,GAMMA,SIGMA, C DO J=1,JMN GLAT(J) = -90. + (J-1) * DELXN + DELXN * 0.5 - DELTAX(J) = DELTAY * COSD(GLAT(J)) + DELTAX(J) = DELTAY * COS(GLAT(J)*D2R) ENDDO C C---- FIND THE AVERAGE OF THE MODES IN A GRID BOX @@ -2369,7 +2369,7 @@ SUBROUTINE MAKEPC2(ZAVG,ZSLM,THETA,GAMMA,SIGMA, HLPRIM(I,J) = SQRT(HL(I,J)*HL(I,J) + HXY(I,J)*HXY(I,J)) IF( HL(I,J).NE. 0. .AND. SLM(I,J) .NE. 0. ) THEN C - THETA(I,J) = 0.5 * ATAN2D(HXY(I,J),HL(I,J)) + THETA(I,J) = 0.5 * ATAN2(HXY(I,J),HL(I,J)) / D2R C === for testing print out in degrees C THETA(I,J) = 0.5 * ATAN2(HXY(I,J),HL(I,J)) ENDIF @@ -3917,7 +3917,8 @@ subroutine read_g(glob,ITOPO) parameter (ix=40*120,jx=50*120) parameter (ia=60*120,ja=30*120) cc - integer*2 idat(ix,jx),itopo + integer*2 idat(ix,jx) + integer itopo cc ccmr integer*2 m9999 ccmr data m9999 / -9999 / @@ -3930,8 +3931,8 @@ subroutine read_g(glob,ITOPO) real(kind=8) dloin,dlain,rlon,rlat cc open(235, file="./fort.235", access='direct', recl=43200*21600*2) - read(235,rec=1)glob - rewind(235) + read(235,rec=1)glob + close(235) cc cc print*,' ' @@ -4417,7 +4418,7 @@ subroutine nanc(a,l,c) real(kind=8)a(l),rtc,t1,t2 character*24 cn character*(*) c - t1=rtc() +c t1=rtc() cgwv print *, ' nanc call ',c do k=1,l word=a(k) @@ -4434,12 +4435,12 @@ subroutine nanc(a,l,c) 101 format(e20.10) end do - t2=rtc() +c t2=rtc() cgwv print 102,l,t2-t1,c 102 format(' time to check ',i9,' words is ',f10.4,' ',a24) return end - real function timef + real function timef() character(8) :: date character(10) :: time character(5) :: zone diff --git a/sorc/partial_ufs_build.sh b/sorc/partial_ufs_build.sh deleted file mode 100755 index 74c4f3252..000000000 --- a/sorc/partial_ufs_build.sh +++ /dev/null @@ -1,179 +0,0 @@ -# -# define the array of the name of build program -# - declare -a Build_prg=("Build_nems_util" \ - "Build_chgres" "Build_cycle" \ - "Build_nst_tf_chg" \ - "Build_orog" \ - "Build_nctools" "Build_chgres_cube" \ - "Build_sfc_climo_gen" "Build_emcsfc") - -# -# function parse_cfg: read config file and retrieve the values -# - parse_cfg() { - declare -i n - declare -i num_args - declare -i total_args - declare -a all_prg - total_args=$# - num_args=$1 - (( num_args == 0 )) && return 0 - config=$2 - [[ ${config,,} == "--verbose" ]] && config=$3 - all_prg=() - for (( n = num_args + 2; n <= total_args; n++ )); do - all_prg+=( ${!n} ) - done - - if [[ ${config^^} == ALL ]]; then -# -# set all values to true -# - for var in "${Build_prg[@]}"; do - eval "$var=true" - done - elif [[ $config == config=* ]]; then -# -# process config file -# - cfg_file=${config#config=} - $verbose && echo "INFO: settings in config file: $cfg_file" - while read cline; do -# remove leading white space - clean_line="${cline#"${cline%%[![:space:]]*}"}" - ( [[ -z "$clean_line" ]] || [[ "${clean_line:0:1}" == "#" ]] ) || { - $verbose && echo $clean_line - first9=${clean_line:0:9} - [[ ${first9,,} == "building " ]] && { - short_prg=$(sed -e 's/.*(\(.*\)).*/\1/' <<< "$clean_line") -# remove trailing white space - clean_line="${cline%"${cline##*[![:space:]]}"}" - build_action=true - last5=${clean_line: -5} - [[ ${last5,,} == ". yes" ]] && build_action=true - last4=${clean_line: -4} - [[ ${last4,,} == ". no" ]] && build_action=false - found=false - for prg in ${all_prg[@]}; do - [[ $prg == "Build_"$short_prg ]] && { - found=true - eval "$prg=$build_action" - break - } - done - $found || { - echo "*** Unrecognized line in config file \"$cfg_file\":" 2>&1 - echo "$cline" 2>&1 - exit 3 - } - } - } - done < $cfg_file - elif [[ $config == select=* ]]; then -# -# set all values to (default) false -# - for var in "${Build_prg[@]}"; do - eval "$var=false" - done -# -# read command line partial build setting -# - del="" - sel_prg=${config#select=} - for separator in " " "," ";" ":" "/" "|"; do - [[ "${sel_prg/$separator}" == "$sel_prg" ]] || { - del=$separator - sel_prg=${sel_prg//$del/ } - } - done - [[ $del == "" ]] && { - short_prg=$sel_prg - found=false - for prg in ${all_prg[@]}; do - [[ $prg == "Build_"$short_prg ]] && { - found=true - eval "$prg=true" - break - } - done - $found || { - echo "*** Unrecognized program name \"$short_prg\" in command line" 2>&1 - exit 4 - } - } || { - for short_prg in $(echo ${sel_prg}); do - found=false - for prg in ${all_prg[@]}; do - [[ $prg == "Build_"$short_prg ]] && { - found=true - eval "$prg=true" - break - } - done - $found || { - echo "*** Unrecognized program name \"$short_prg\" in command line" 2>&1 - exit 5 - } - done - } - else - echo "*** Unrecognized command line option \"$config\"" 2>&1 - exit 6 - fi - } - -# -# read command line arguments; processing config file -# - verbose=false - num_arg=$# - (( num_arg > 1 )) && { - [[ ${1,,} == "--verbose" ]] && { - verbose=true - } || { - echo "Usage: $0 [ALL|config=config_file|[select=][prog1[,prog2[,...]]]" 2>&1 - exit 1 - } - } - (( num_arg == 1 )) && { - ( [[ $1 == "-h" ]] || [[ $1 == "--help" ]] ) && { - echo "Usage: $0 [ALL|config=config_file|[select=][prog1[,prog2[,...]]]" 2>&1 - exit 2 - } - ( [[ $1 == "-v" ]] || [[ ${1,,} == "--verbose" ]] ) && { - verbose=true - num_arg=0 - } || { - echo "Usage: $0 [ALL|config=config_file|[select=][prog1[,prog2[,...]]]" 2>&1 - exit 3 - } - } - - if (( num_arg == 0 )); then -# -# set default values for partial build -# - parse_cfg 1 "config=ufs_build.cfg" ${Build_prg[@]} - else - -# -# call arguments retriever/config parser -# - parse_cfg $num_arg "$@" ${Build_prg[@]} - fi - -# -# print values of build array -# - $verbose && { - echo "INFO: partial build settings:" - for var in "${Build_prg[@]}"; do - echo -n " $var: " - ${!var} && echo True || echo False - done - } - - echo "=== end of partial build setting ===" > /dev/null - diff --git a/sorc/sfc_climo_gen.fd/CMakeLists.txt b/sorc/sfc_climo_gen.fd/CMakeLists.txt new file mode 100644 index 000000000..b57f47fa9 --- /dev/null +++ b/sorc/sfc_climo_gen.fd/CMakeLists.txt @@ -0,0 +1,25 @@ +set(fortran_src + driver.F90 + interp.F90 + model_grid.F90 + output.f90 + program_setup.f90 + search.f90 + source_grid.F90 + utils.f90) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-0 -fdefault-real-8 -fconvert=big-endian") +endif() + +set(exe_name sfc_climo_gen) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + esmf + MPI::MPI_Fortran + NetCDF::NetCDF_Fortran) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/sfc_climo_gen.fd/makefile b/sorc/sfc_climo_gen.fd/makefile deleted file mode 100755 index 46d85319f..000000000 --- a/sorc/sfc_climo_gen.fd/makefile +++ /dev/null @@ -1,46 +0,0 @@ -SHELL= /bin/sh - -include $(ESMFMKFILE) - -CMD= sfc_climo_gen - -OBJS = driver.o \ - model_grid.o \ - output.o \ - program_setup.o \ - source_grid.o \ - utils.o \ - search.o \ - interp.o - -$(CMD): $(OBJS) - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -o $(CMD) $(OBJS) $(ESMF_F90LINKPATHS) $(ESMF_F90LINKRPATHS) $(ESMF_F90ESMFLINKLIBS) -g -traceback - -interp.o: source_grid.o model_grid.o utils.o interp.F90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c interp.F90 - -utils.o: utils.f90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c utils.f90 - -program_setup.o: program_setup.f90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c program_setup.f90 - -model_grid.o: utils.o program_setup.o model_grid.F90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c model_grid.F90 - -source_grid.o: utils.o source_grid.F90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c source_grid.F90 - -search.o: search.f90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c search.f90 - -output.o: program_setup.o model_grid.o source_grid.o utils.o output.f90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c output.f90 - -driver.o: model_grid.o source_grid.o program_setup.o utils.o driver.F90 - $(FCOMP) $(FFLAGS) $(ESMF_F90COMPILEPATHS) -c driver.F90 - -install: - mv $(CMD) ../../exec -clean: - rm -f *.o *.mod ${CMD} ../../exec/${CMD} diff --git a/sorc/ufs_build.cfg b/sorc/ufs_build.cfg deleted file mode 100644 index 253eaef2a..000000000 --- a/sorc/ufs_build.cfg +++ /dev/null @@ -1,15 +0,0 @@ -# -# ***** configuration of fv3gfs build ***** - - Building NEMS_util (nems_util) ........................ yes - Building chgres (chgres) .............................. yes - Building chgres_cube (chgres_cube) .................... yes - Building nst_tf_chg (nst_tf_chg) ...................... yes - Building orog (orog) .................................. yes - Building cycle (cycle) ................................ yes - Building emcsfc (emcsfc) .............................. yes - Building fre-nctools (nctools) ........................ yes - Building sfc_climo_gen (sfc_climo_gen) ................ yes - -# -- END -- - diff --git a/ush/chgres_cube.sh b/ush/chgres_cube.sh index b29f785c4..fd036e5c8 100755 --- a/ush/chgres_cube.sh +++ b/ush/chgres_cube.sh @@ -179,7 +179,7 @@ fi #---------------------------------------------------------------------------- APRUN=${APRUN:-time} -CHGRESEXEC=${CHGRESEXEC:-${EXECufs}/chgres_cube.exe} +CHGRESEXEC=${CHGRESEXEC:-${EXECufs}/chgres_cube} export OMP_NUM_THREADS=${OMP_NUM_THREADS_CH:-1} diff --git a/ush/fv3gfs_driver_grid.sh b/ush/fv3gfs_driver_grid.sh index 3fd806c67..4e7d909fb 100755 --- a/ush/fv3gfs_driver_grid.sh +++ b/ush/fv3gfs_driver_grid.sh @@ -360,8 +360,8 @@ elif [ $gtype = regional ]; then echo $npts_cgx $npts_cgy $halop1 \'$filter_dir/oro.C${res}.tile${tile}.nc\' \'$filter_dir/oro.C${res}.tile${tile}.shave.nc\' >input.shave.orog echo $npts_cgx $npts_cgy $halop1 \'$filter_dir/C${res}_grid.tile${tile}.nc\' \'$filter_dir/C${res}_grid.tile${tile}.shave.nc\' >input.shave.grid - $APRUN $exec_dir/shave.x input.shave.orog.halo$halo echo $npts_cgx $npts_cgy $halo \'$filter_dir/C${res}_grid.tile${tile}.nc\' \'$filter_dir/C${res}_grid.tile${tile}.shave.nc\' >input.shave.grid.halo$halo - $APRUN $exec_dir/shave.x input.shave.orog.halo0 echo $npts_cgx $npts_cgy 0 \'$filter_dir/C${res}_grid.tile${tile}.nc\' \'$filter_dir/C${res}_grid.tile${tile}.shave.nc\' >input.shave.grid.halo0 - $APRUN $exec_dir/shave.x /dev/null 2>&1 +source ../../modulefiles/build.$target module list PROJECT_CODE=GFS-DEV diff --git a/util/gdas_init/driver.dell.sh b/util/gdas_init/driver.dell.sh index 27af36e35..ec18e09a9 100755 --- a/util/gdas_init/driver.dell.sh +++ b/util/gdas_init/driver.dell.sh @@ -8,16 +8,8 @@ set -x -module purge -module load EnvVars/1.0.2 -module load ips/18.0.1.163 -module load impi/18.0.1 -module load lsf/10.1 -module load HPSS/5.0.2.5 -module use /usrx/local/dev/modulefiles -module load NetCDF/4.5.0 -module load prod_util/1.1.3 -module list +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target PROJECT_CODE=GFS-DEV diff --git a/util/gdas_init/driver.hera.sh b/util/gdas_init/driver.hera.sh index 711bab9a0..02a703e7d 100755 --- a/util/gdas_init/driver.hera.sh +++ b/util/gdas_init/driver.hera.sh @@ -8,16 +8,8 @@ set -x -source /apps/lmod/lmod/init/sh -module purge -module use -a /scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles -module load intel/18.0.5.274 -module load impi/2018.0.4 -module load netcdf/4.7.0 -module load hpss -module load prod_util -module load nco/4.7.0 -module list +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target PROJECT_CODE=fv3-cpu QUEUE=batch diff --git a/util/gdas_init/run_pre-v14.chgres.sh b/util/gdas_init/run_pre-v14.chgres.sh index 0598bd75b..92cfe80b3 100755 --- a/util/gdas_init/run_pre-v14.chgres.sh +++ b/util/gdas_init/run_pre-v14.chgres.sh @@ -70,7 +70,7 @@ cat << EOF > fort.41 / EOF -$APRUN $UFS_DIR/exec/chgres_cube.exe +$APRUN $UFS_DIR/exec/chgres_cube rc=$? if [ $rc != 0 ]; then diff --git a/util/gdas_init/run_v14.chgres.sh b/util/gdas_init/run_v14.chgres.sh index 301657385..c60c4b3d5 100755 --- a/util/gdas_init/run_v14.chgres.sh +++ b/util/gdas_init/run_v14.chgres.sh @@ -72,7 +72,7 @@ cat << EOF > fort.41 / EOF -$APRUN $UFS_DIR/exec/chgres_cube.exe +$APRUN $UFS_DIR/exec/chgres_cube rc=$? if [ $rc != 0 ]; then diff --git a/util/gdas_init/run_v15.chgres.sh b/util/gdas_init/run_v15.chgres.sh index 22cf94d93..c26d92e6c 100755 --- a/util/gdas_init/run_v15.chgres.sh +++ b/util/gdas_init/run_v15.chgres.sh @@ -70,7 +70,7 @@ cat << EOF > fort.41 / EOF -$APRUN $UFS_DIR/exec/chgres_cube.exe +$APRUN $UFS_DIR/exec/chgres_cube rc=$? if [ $rc != 0 ]; then From f71d94ea238741177d0439774531e504a79d1832 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Tue, 2 Jun 2020 16:42:53 -0400 Subject: [PATCH 022/192] Update for path changes on Jet On June 1, the directory 'project' was changed to 'HFIP'. And on June 30, the /lfs3 disk will be replaced by /lfs4. The repository was updated accordingly. For details, see issue #107. --- driver_scripts/driver_grid.jet.sh | 4 ++-- fix/link_fixdirs.sh | 2 +- modulefiles/build.jet | 6 +++--- modulefiles/module-setup.sh.inc | 2 +- modulefiles/module_base.jet | 4 ++-- reg_tests/chgres_cube/driver.jet.sh | 4 ++-- reg_tests/global_cycle/driver.jet.sh | 4 ++-- reg_tests/grid_gen/driver.jet.sh | 4 ++-- reg_tests/ice_blend/driver.jet.sh | 8 ++++---- reg_tests/snow2mdl/driver.jet.sh | 4 ++-- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/driver_scripts/driver_grid.jet.sh b/driver_scripts/driver_grid.jet.sh index efc322354..a71d5e155 100755 --- a/driver_scripts/driver_grid.jet.sh +++ b/driver_scripts/driver_grid.jet.sh @@ -87,8 +87,8 @@ fi #----------------------------------------------------------------------- export home_dir=$SLURM_SUBMIT_DIR/.. -export TMPDIR=/mnt/lfs3/projects/emcda/$LOGNAME/stmp/fv3_grid.$gtype -export out_dir=/mnt/lfs3/projects/emcda/$LOGNAME/stmp/C${res} +export TMPDIR=/lfs4/HFIP/emcda/$LOGNAME/stmp/fv3_grid.$gtype +export out_dir=/lfs4/HFIP/emcda/$LOGNAME/stmp/C${res} #----------------------------------------------------------------------- # Should not need to change anything below here. diff --git a/fix/link_fixdirs.sh b/fix/link_fixdirs.sh index fec3a44af..718692317 100755 --- a/fix/link_fixdirs.sh +++ b/fix/link_fixdirs.sh @@ -42,7 +42,7 @@ elif [ $machine = "dell" ]; then elif [ $machine = "hera" ]; then FIX_DIR="/scratch1/NCEPDEV/global/glopara/fix" elif [ $machine = "jet" ]; then - FIX_DIR="/lfs3/projects/hfv3gfs/glopara/git/fv3gfs/fix" + FIX_DIR="/lfs4/HFIP/hfv3gfs/glopara/git/fv3gfs/fix" fi for dir in fix_am fix_fv3 fix_orog fix_fv3_gmted2010 fix_sfc_climo; do [[ -d $dir ]] && rm -rf $dir diff --git a/modulefiles/build.jet b/modulefiles/build.jet index f477d6a62..5b552697c 100644 --- a/modulefiles/build.jet +++ b/modulefiles/build.jet @@ -2,7 +2,7 @@ ## Build and run module for Jet ############################################################# -module use /lfs3/projects/hfv3gfs/nwprod/NCEPLIBS/modulefiles +module use /lfs4/HFIP/hfv3gfs/nwprod/NCEPLIBS/modulefiles module load cmake/3.16.1 module load intel/18.0.5.274 module load impi/2018.4.274 @@ -24,7 +24,7 @@ module load landsfcutil/v2.1.0 module load g2/v3.1.0 # Use DTCs version of esmf v8. POC Dom H. -module use -a /lfs3/projects/hfv3gfs/GMTB/modulefiles/intel-18.0.5.274 +module use -a /lfs4/HFIP/hfv3gfs/software/modulefiles/intel-18.0.5.274/impi-2018.4.274 module load esmf/8.0.0 -export WGRIB2_ROOT="/mnt/lfs3/projects/hwrfv3/Jili.Dong/wgrib2-2.0.8/grib2/lib" +export WGRIB2_ROOT="/lfs4/HFIP/hwrfv3/Jili.Dong/wgrib2-2.0.8/grib2/lib" diff --git a/modulefiles/module-setup.sh.inc b/modulefiles/module-setup.sh.inc index d4faa4f64..48d2cd723 100644 --- a/modulefiles/module-setup.sh.inc +++ b/modulefiles/module-setup.sh.inc @@ -16,7 +16,7 @@ else __ms_shell=sh fi -if [[ -d /lfs3 ]] ; then +if [[ -d /lfs4 ]] ; then # We are on NOAA Jet if ( ! eval module help > /dev/null 2>&1 ) ; then source /apps/lmod/lmod/init/$__ms_shell diff --git a/modulefiles/module_base.jet b/modulefiles/module_base.jet index 00e997aee..1a2df69c2 100644 --- a/modulefiles/module_base.jet +++ b/modulefiles/module_base.jet @@ -9,7 +9,7 @@ proc ModulesHelp {} { module load intel/15.0.3.187 impi/2018.4.274 szip hdf5 netcdf4/4.2.1.1 -module use /lfs3/projects/hfv3gfs/nwprod/NCEPLIBS/modulefiles +module use /lfs4/HFIP/hfv3gfs/nwprod/NCEPLIBS/modulefiles module load bacio/v2.0.2 module load sp/v2.0.2 module load ip/v2.0.0 @@ -17,7 +17,7 @@ module load w3nco/v2.0.6 module load w3emc/v2.3.0 module load nemsio/v2.2.3 -module use /lfs3/projects/hwrf-vd/soft/modulefiles +module use /lfs4/HFIP/hwrf-vd/soft/modulefiles module load prod_util module load grib_util module load hpss diff --git a/reg_tests/chgres_cube/driver.jet.sh b/reg_tests/chgres_cube/driver.jet.sh index fa3c48a1f..b17353920 100755 --- a/reg_tests/chgres_cube/driver.jet.sh +++ b/reg_tests/chgres_cube/driver.jet.sh @@ -27,7 +27,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 source ../../modulefiles/build.$target -export OUTDIR=/mnt/lfs3/projects/emcda/$LOGNAME/stmp/chgres_reg_tests +export OUTDIR=/lfs4/HFIP/emcda/$LOGNAME/stmp/chgres_reg_tests PROJECT_CODE="hfv3gfs" QUEUE="debug" @@ -39,7 +39,7 @@ QUEUE="debug" export HOMEufs=$PWD/../.. -export HOMEreg=/mnt/lfs3/projects/emcda/George.Gayno/reg_tests/chgres_cube +export HOMEreg=/lfs4/HFIP/emcda/George.Gayno/reg_tests/chgres_cube export NCCMP=/apps/nccmp/1.8.5/intel/18.0.5.274/bin/nccmp diff --git a/reg_tests/global_cycle/driver.jet.sh b/reg_tests/global_cycle/driver.jet.sh index e306a6497..74183c565 100755 --- a/reg_tests/global_cycle/driver.jet.sh +++ b/reg_tests/global_cycle/driver.jet.sh @@ -33,13 +33,13 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 source ../../modulefiles/build.$target -export DATA=/lfs3/HFIP/emcda/$LOGNAME/stmp/reg_tests.cycle +export DATA=/lfs4/HFIP/emcda/$LOGNAME/stmp/reg_tests.cycle #----------------------------------------------------------------------------- # Should not have to change anything below. #----------------------------------------------------------------------------- -export HOMEreg=/lfs3/HFIP/emcda/George.Gayno/reg_tests/global_cycle +export HOMEreg=/lfs4/HFIP/emcda/George.Gayno/reg_tests/global_cycle export OMP_NUM_THREADS_CY=2 diff --git a/reg_tests/grid_gen/driver.jet.sh b/reg_tests/grid_gen/driver.jet.sh index 364fbec73..3ec9726a7 100755 --- a/reg_tests/grid_gen/driver.jet.sh +++ b/reg_tests/grid_gen/driver.jet.sh @@ -28,7 +28,7 @@ set -x QUEUE="windfall" PROJECT_CODE="emcda" -export WORK_DIR=/mnt/lfs3/projects/emcda/$LOGNAME/stmp/reg_tests.grid +export WORK_DIR=/lfs4/HFIP/emcda/$LOGNAME/stmp/reg_tests.grid #----------------------------------------------------------------------------- # Should not have to change anything below here. @@ -42,7 +42,7 @@ export APRUN_SFC=srun export OMP_STACKSIZE=2048m export machine=JET export NCCMP=/apps/nccmp/1.8.5/intel/18.0.5.274/bin/nccmp -export HOMEreg=/mnt/lfs3/projects/emcda/George.Gayno/reg_tests/grid_gen/baseline_data +export HOMEreg=/lfs4/HFIP/emcda/George.Gayno/reg_tests/grid_gen/baseline_data ulimit -a ulimit -s unlimited diff --git a/reg_tests/ice_blend/driver.jet.sh b/reg_tests/ice_blend/driver.jet.sh index 455d0f179..bc55aa272 100755 --- a/reg_tests/ice_blend/driver.jet.sh +++ b/reg_tests/ice_blend/driver.jet.sh @@ -31,7 +31,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 source ../../modulefiles/build.$target -export DATA="/mnt/lfs3/projects/emcda/$LOGNAME/stmp/reg_test.ice_blend" +export DATA="/lfs4/HFIP/emcda/$LOGNAME/stmp/reg_test.ice_blend" #----------------------------------------------------------------------------- # Should not have to change anything below. @@ -39,11 +39,11 @@ export DATA="/mnt/lfs3/projects/emcda/$LOGNAME/stmp/reg_test.ice_blend" export WGRIB=/apps/wgrib/1.8.1.0b/bin/wgrib export WGRIB2=/apps/wgrib2/0.1.9.6a/bin/wgrib2 -export COPYGB=/mnt/lfs3/projects/emcda/George.Gayno/ufs_utils.git/jet_port/grib_util/copygb -export COPYGB2=/mnt/lfs3/projects/emcda/George.Gayno/ufs_utils.git/jet_port/grib_util/copygb2 +export COPYGB=/lfs4/HFIP/emcda/George.Gayno/ufs_utils.git/jet_port/grib_util/copygb +export COPYGB2=/lfs4/HFIP/emcda/George.Gayno/ufs_utils.git/jet_port/grib_util/copygb2 export CNVGRIB=/apps/cnvgrib/1.4.0/bin/cnvgrib -export HOMEreg=/lfs3/HFIP/emcda/George.Gayno/reg_tests/ice_blend +export HOMEreg=/lfs4/HFIP/emcda/George.Gayno/reg_tests/ice_blend export HOMEgfs=$PWD/../.. rm -fr $DATA diff --git a/reg_tests/snow2mdl/driver.jet.sh b/reg_tests/snow2mdl/driver.jet.sh index e5bd8a2c8..c4679031e 100755 --- a/reg_tests/snow2mdl/driver.jet.sh +++ b/reg_tests/snow2mdl/driver.jet.sh @@ -31,13 +31,13 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 source ../../modulefiles/build.$target -export DATA="/mnt/lfs3/projects/emcda/$LOGNAME/stmp/reg_tests.snow2mdl" +export DATA="/lfs4/HFIP/emcda/$LOGNAME/stmp/reg_tests.snow2mdl" #----------------------------------------------------------------------------- # Should not have to change anything below. #----------------------------------------------------------------------------- -export HOMEreg=/lfs3/HFIP/emcda/George.Gayno/reg_tests/snow2mdl +export HOMEreg=/lfs4/HFIP/emcda/George.Gayno/reg_tests/snow2mdl export HOMEgfs=$PWD/../.. export WGRIB=/apps/wgrib/1.8.1.0b/bin/wgrib export WGRIB2=/apps/wgrib2/0.1.9.6a/bin/wgrib2 From 7448e0a53b954e84fac4e885acaddca2e69fff98 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Mon, 8 Jun 2020 09:51:57 -0400 Subject: [PATCH 023/192] Add geo-referencing to 'orography', 'sfc_climo' and 'chgres_cube' files Remove unused lat/lon records from the orography files. And add geo-referencing records and metadata to the 'orography', 'sfc_climo_gen' and 'chgres_cube' output files. For details see #11 and #22 --- sorc/chgres_cube.fd/write_data.F90 | 330 +++++++++++++++++++++++++-- sorc/orog.fd/netcdf_io.F90 | 62 +++-- sorc/sfc_climo_gen.fd/interp.F90 | 20 +- sorc/sfc_climo_gen.fd/model_grid.F90 | 93 ++++++-- sorc/sfc_climo_gen.fd/output.f90 | 60 ++++- 5 files changed, 510 insertions(+), 55 deletions(-) diff --git a/sorc/chgres_cube.fd/write_data.F90 b/sorc/chgres_cube.fd/write_data.F90 index a5bd97552..5d11f67eb 100644 --- a/sorc/chgres_cube.fd/write_data.F90 +++ b/sorc/chgres_cube.fd/write_data.F90 @@ -1110,7 +1110,11 @@ subroutine write_fv3_atm_data_netcdf(localpet) i_target, j_target, & ip1_target, jp1_target, & longitude_target_grid, & - latitude_target_grid + latitude_target_grid, & + longitude_s_target_grid, & + latitude_s_target_grid, & + longitude_w_target_grid, & + latitude_w_target_grid implicit none @@ -1126,6 +1130,8 @@ subroutine write_fv3_atm_data_netcdf(localpet) integer :: dim_lev, dim_levp1, dim_ntracer integer, allocatable :: id_tracers(:) integer :: id_lon, id_lat, id_ps + integer :: id_lat_s, id_lon_s + integer :: id_lat_w, id_lon_w integer :: id_w, id_zh, id_u_w integer :: id_v_w, id_u_s, id_v_s integer :: id_t, id_delp @@ -1209,36 +1215,99 @@ subroutine write_fv3_atm_data_netcdf(localpet) endif !--- define field - error = nf90_def_var(ncid, 'lon', NF90_FLOAT, (/dim_lon/), id_lon) - call netcdf_err(error, 'DEFINING LON FIELD' ) - error = nf90_put_att(ncid, id_lon, "cartesian_axis", "X") - call netcdf_err(error, 'WRITING LON FIELD' ) - error = nf90_def_var(ncid, 'lat', NF90_FLOAT, (/dim_lat/), id_lat) - call netcdf_err(error, 'DEFINING LAT FIELD' ) - error = nf90_put_att(ncid, id_lat, "cartesian_axis", "Y") - call netcdf_err(error, 'WRITING LAT FIELD' ) + error = nf90_def_var(ncid, 'geolon', NF90_FLOAT, (/dim_lon,dim_lat/), id_lon) + call netcdf_err(error, 'DEFINING GEOLON FIELD' ) + error = nf90_put_att(ncid, id_lon, "long_name", "Longitude") + call netcdf_err(error, 'DEFINING GEOLON NAME' ) + error = nf90_put_att(ncid, id_lon, "units", "degrees_east") + call netcdf_err(error, 'DEFINING GEOLON UNITS' ) + + error = nf90_def_var(ncid, 'geolat', NF90_FLOAT, (/dim_lon,dim_lat/), id_lat) + call netcdf_err(error, 'DEFINING GEOLAT FIELD' ) + error = nf90_put_att(ncid, id_lat, "long_name", "Latitude") + call netcdf_err(error, 'DEFINING GEOLAT NAME' ) + error = nf90_put_att(ncid, id_lat, "units", "degrees_north") + call netcdf_err(error, 'DEFINING GEOLAT UNITS' ) + + error = nf90_def_var(ncid, 'geolon_s', NF90_FLOAT, (/dim_lon,dim_latp/), id_lon_s) + call netcdf_err(error, 'DEFINING GEOLON_S FIELD' ) + error = nf90_put_att(ncid, id_lon_s, "long_name", "Longitude_s") + call netcdf_err(error, 'DEFINING GEOLON_S NAME' ) + error = nf90_put_att(ncid, id_lon_s, "units", "degrees_east") + call netcdf_err(error, 'DEFINING GEOLON_S UNITS' ) + + error = nf90_def_var(ncid, 'geolat_s', NF90_FLOAT, (/dim_lon,dim_latp/), id_lat_s) + call netcdf_err(error, 'DEFINING GEOLAT_S FIELD' ) + error = nf90_put_att(ncid, id_lat_s, "long_name", "Latitude_s") + call netcdf_err(error, 'DEFINING GEOLAT_S NAME' ) + error = nf90_put_att(ncid, id_lat_s, "units", "degrees_north") + call netcdf_err(error, 'DEFINING GEOLAT_S UNITS' ) + + error = nf90_def_var(ncid, 'geolon_w', NF90_FLOAT, (/dim_lonp,dim_lat/), id_lon_w) + call netcdf_err(error, 'DEFINING GEOLON_W FIELD' ) + error = nf90_put_att(ncid, id_lon_w, "long_name", "Longitude_w") + call netcdf_err(error, 'DEFINING GEOLON_W NAME' ) + error = nf90_put_att(ncid, id_lon_w, "units", "degrees_east") + call netcdf_err(error, 'DEFINING GEOLON_W UNITS' ) + + error = nf90_def_var(ncid, 'geolat_w', NF90_FLOAT, (/dim_lonp,dim_lat/), id_lat_w) + call netcdf_err(error, 'DEFINING GEOLAT_W FIELD' ) + error = nf90_put_att(ncid, id_lat_w, "long_name", "Latitude_w") + call netcdf_err(error, 'DEFINING GEOLAT_W NAME' ) + error = nf90_put_att(ncid, id_lat_w, "units", "degrees_north") + call netcdf_err(error, 'DEFINING GEOLAT_W UNITS' ) + error = nf90_def_var(ncid, 'ps', NF90_FLOAT, (/dim_lon,dim_lat/), id_ps) - call netcdf_err(error, 'WRITING PS' ) + call netcdf_err(error, 'DEFINING PS' ) + error = nf90_put_att(ncid, id_ps, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING PS COORD' ) + error = nf90_def_var(ncid, 'w', NF90_FLOAT, (/dim_lon,dim_lat,dim_lev/), id_w) - call netcdf_err(error, 'WRITING W' ) + call netcdf_err(error, 'DEFINING W' ) + error = nf90_put_att(ncid, id_w, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING W COORD' ) + error = nf90_def_var(ncid, 'zh', NF90_FLOAT, (/dim_lon,dim_lat,dim_levp1/), id_zh) - call netcdf_err(error, 'WRITING ZH' ) + call netcdf_err(error, 'DEFINING ZH' ) + error = nf90_put_att(ncid, id_zh, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING ZH COORD' ) + error = nf90_def_var(ncid, 't', NF90_FLOAT, (/dim_lon,dim_lat,dim_lev/), id_t) - call netcdf_err(error, 'WRITING T' ) + call netcdf_err(error, 'DEFINING T' ) + error = nf90_put_att(ncid, id_t, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING T COORD' ) + error = nf90_def_var(ncid, 'delp', NF90_FLOAT, (/dim_lon,dim_lat,dim_lev/), id_delp) - call netcdf_err(error, 'WRITING DELP' ) + call netcdf_err(error, 'DEFINING DELP' ) + error = nf90_put_att(ncid, id_delp, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING DELP COORD' ) + do n = 1, num_tracers error = nf90_def_var(ncid, tracers(n), NF90_FLOAT, (/dim_lon,dim_lat,dim_lev/), id_tracers(n)) - call netcdf_err(error, 'WRITING TRACERS' ) + call netcdf_err(error, 'DEFINING TRACERS' ) + error = nf90_put_att(ncid, id_tracers(n), "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING TRACERS COORD' ) enddo + error = nf90_def_var(ncid, 'u_w', NF90_FLOAT, (/dim_lonp,dim_lat,dim_lev/), id_u_w) - call netcdf_err(error, 'WRITING U_W' ) + call netcdf_err(error, 'DEFINING U_W' ) + error = nf90_put_att(ncid, id_u_w, "coordinates", "geolon_w geolat_w") + call netcdf_err(error, 'DEFINING U_W COORD' ) + error = nf90_def_var(ncid, 'v_w', NF90_FLOAT, (/dim_lonp,dim_lat,dim_lev/), id_v_w) - call netcdf_err(error, 'WRITING V_W' ) + call netcdf_err(error, 'DEFINING V_W' ) + error = nf90_put_att(ncid, id_v_w, "coordinates", "geolon_w geolat_w") + call netcdf_err(error, 'DEFINING V_W COORD' ) + error = nf90_def_var(ncid, 'u_s', NF90_FLOAT, (/dim_lon,dim_latp,dim_lev/), id_u_s) - call netcdf_err(error, 'WRITING U_S' ) + call netcdf_err(error, 'DEFINING U_S' ) + error = nf90_put_att(ncid, id_u_s, "coordinates", "geolon_s geolat_s") + call netcdf_err(error, 'DEFINING U_S COORD' ) + error = nf90_def_var(ncid, 'v_s', NF90_FLOAT, (/dim_lon,dim_latp,dim_lev/), id_v_s) - call netcdf_err(error, 'WRITING V_S' ) + call netcdf_err(error, 'DEFINING V_S' ) + error = nf90_put_att(ncid, id_v_s, "coordinates", "geolon_s geolat_s") + call netcdf_err(error, 'DEFINING V_S COORD' ) error = nf90_enddef(ncid, header_buffer_val,4,0,4) call netcdf_err(error, 'DEFINING HEADER' ) @@ -1256,7 +1325,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) if (localpet < num_tiles_target_grid) then dum2d(:,:) = data_one_tile(i_start:i_end, j_start:j_end) - error = nf90_put_var( ncid, id_lon, dum2d(:,1)) + error = nf90_put_var( ncid, id_lon, dum2d) call netcdf_err(error, 'WRITING LONGITUDE RECORD' ) endif @@ -1271,7 +1340,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) if (localpet < num_tiles_target_grid) then dum2d(:,:) = data_one_tile(i_start:i_end, j_start:j_end) - error = nf90_put_var( ncid, id_lat, dum2d(1,:)) + error = nf90_put_var( ncid, id_lat, dum2d) call netcdf_err(error, 'WRITING LATITUDE RECORD' ) endif @@ -1396,6 +1465,44 @@ subroutine write_fv3_atm_data_netcdf(localpet) deallocate(dum3d, data_one_tile_3d) +! lat/lon_s + + if (localpet < num_tiles_target_grid) then + allocate(dum2d(i_target_out,jp1_target_out)) + allocate(data_one_tile(i_target,jp1_target)) + else + allocate(dum2d(0,0)) + allocate(data_one_tile(0,0)) + endif + + do tile = 1, num_tiles_target_grid + print*,"- CALL FieldGather FOR TARGET GRID LON_S FOR TILE: ", tile + call ESMF_FieldGather(longitude_s_target_grid, data_one_tile, rootPet=tile-1, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + enddo + + if (localpet < num_tiles_target_grid) then + dum2d(:,:) = data_one_tile(i_start:i_end,j_start:jp1_end) + error = nf90_put_var( ncid, id_lon_s, dum2d) + call netcdf_err(error, 'WRITING LON_S RECORD' ) + endif + + do tile = 1, num_tiles_target_grid + print*,"- CALL FieldGather FOR TARGET GRID LAT_S FOR TILE: ", tile + call ESMF_FieldGather(latitude_s_target_grid, data_one_tile, rootPet=tile-1, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + enddo + + if (localpet < num_tiles_target_grid) then + dum2d(:,:) = data_one_tile(i_start:i_end,j_start:jp1_end) + error = nf90_put_var( ncid, id_lat_s, dum2d) + call netcdf_err(error, 'WRITING LAT_S RECORD' ) + endif + + deallocate(dum2d, data_one_tile) + ! uwinds s if (localpet < num_tiles_target_grid) then @@ -1438,6 +1545,44 @@ subroutine write_fv3_atm_data_netcdf(localpet) deallocate(dum3d, data_one_tile_3d) +! lat/lon_w + + if (localpet < num_tiles_target_grid) then + allocate(dum2d(ip1_target_out,j_target_out)) + allocate(data_one_tile(ip1_target,j_target)) + else + allocate(dum2d(0,0)) + allocate(data_one_tile(0,0)) + endif + + do tile = 1, num_tiles_target_grid + print*,"- CALL FieldGather FOR TARGET GRID LON_W FOR TILE: ", tile + call ESMF_FieldGather(longitude_w_target_grid, data_one_tile, rootPet=tile-1, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + enddo + + if (localpet < num_tiles_target_grid) then + dum2d(:,:) = data_one_tile(i_start:ip1_end,j_start:j_end) + error = nf90_put_var( ncid, id_lon_w, dum2d) + call netcdf_err(error, 'WRITING LON_W RECORD' ) + endif + + do tile = 1, num_tiles_target_grid + print*,"- CALL FieldGather FOR TARGET GRID LAT_W FOR TILE: ", tile + call ESMF_FieldGather(latitude_w_target_grid, data_one_tile, rootPet=tile-1, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + enddo + + if (localpet < num_tiles_target_grid) then + dum2d(:,:) = data_one_tile(i_start:ip1_end,j_start:j_end) + error = nf90_put_var( ncid, id_lat_w, dum2d) + call netcdf_err(error, 'WRITING LAT_W RECORD' ) + endif + + deallocate(dum2d, data_one_tile) + ! uwinds w if (localpet < num_tiles_target_grid) then @@ -1498,6 +1643,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) use model_grid, only : num_tiles_target_grid, & landmask_target_grid, & + latitude_target_grid, & + longitude_target_grid, & i_target, j_target, lsoil_target use program_setup, only : convert_nst, halo=>halo_bndy @@ -1565,6 +1712,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) integer :: error, i, ncid, tile integer :: id_x, id_y, id_lsoil integer :: id_slmsk, id_time + integer :: id_lat, id_lon integer :: id_tsea, id_sheleg, id_tg3 integer :: id_zorl, id_alvsf, id_alvwf integer :: id_alnsf, id_alnwf, id_vfrac @@ -1696,12 +1844,28 @@ subroutine write_fv3_sfc_data_netcdf(localpet) error = nf90_put_att(ncid, id_time, "cartesian_axis", "T") call netcdf_err(error, 'WRITING TIME FIELD' ) + error = nf90_def_var(ncid, 'geolon', NF90_DOUBLE, (/dim_x,dim_y/), id_lon) + call netcdf_err(error, 'DEFINING GEOLON' ) + error = nf90_put_att(ncid, id_lon, "long_name", "Longitude") + call netcdf_err(error, 'DEFINING GEOLON LONG NAME' ) + error = nf90_put_att(ncid, id_lon, "units", "degrees_east") + call netcdf_err(error, 'DEFINING GEOLON UNITS' ) + + error = nf90_def_var(ncid, 'geolat', NF90_DOUBLE, (/dim_x,dim_y/), id_lat) + call netcdf_err(error, 'DEFINING GEOLAT' ) + error = nf90_put_att(ncid, id_lat, "long_name", "Latitude") + call netcdf_err(error, 'DEFINING GEOLAT LONG NAME' ) + error = nf90_put_att(ncid, id_lat, "units", "degrees_north") + call netcdf_err(error, 'DEFINING GEOLAT UNITS' ) + error = nf90_def_var(ncid, 'slmsk', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_slmsk) call netcdf_err(error, 'DEFINING SLMSK' ) error = nf90_put_att(ncid, id_slmsk, "long_name", "slmsk") call netcdf_err(error, 'DEFINING SLMSK LONG NAME' ) error = nf90_put_att(ncid, id_slmsk, "units", "none") call netcdf_err(error, 'DEFINING SLMSK UNITS' ) + error = nf90_put_att(ncid, id_slmsk, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING SLMSK COORD' ) error = nf90_def_var(ncid, 'tsea', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_tsea) call netcdf_err(error, 'DEFINING TSEA' ) @@ -1709,6 +1873,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING TSEA LONG NAME' ) error = nf90_put_att(ncid, id_tsea, "units", "none") call netcdf_err(error, 'DEFINING TSEA UNITS' ) + error = nf90_put_att(ncid, id_tsea, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING TSEA COORD' ) error = nf90_def_var(ncid, 'sheleg', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_sheleg) call netcdf_err(error, 'DEFINING SHELEG' ) @@ -1716,6 +1882,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING SHELEG LONG NAME' ) error = nf90_put_att(ncid, id_sheleg, "units", "none") call netcdf_err(error, 'DEFINING SHELEG UNITS' ) + error = nf90_put_att(ncid, id_sheleg, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING SHELEG COORD' ) error = nf90_def_var(ncid, 'tg3', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_tg3) call netcdf_err(error, 'DEFINING TG3' ) @@ -1723,6 +1891,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING TG3 LONG NAME' ) error = nf90_put_att(ncid, id_tg3, "units", "none") call netcdf_err(error, 'DEFINING TG3 UNITS' ) + error = nf90_put_att(ncid, id_tg3, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING TG3 COORD' ) error = nf90_def_var(ncid, 'zorl', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_zorl) call netcdf_err(error, 'DEFINING ZORL' ) @@ -1730,6 +1900,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING ZORL LONG NAME' ) error = nf90_put_att(ncid, id_zorl, "units", "none") call netcdf_err(error, 'DEFINING ZORL UNITS' ) + error = nf90_put_att(ncid, id_zorl, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING ZORL COORD' ) error = nf90_def_var(ncid, 'alvsf', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_alvsf) call netcdf_err(error, 'DEFINING ALVSF' ) @@ -1737,6 +1909,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING ALVSF LONG NAME' ) error = nf90_put_att(ncid, id_alvsf, "units", "none") call netcdf_err(error, 'DEFINING ALVSF UNITS' ) + error = nf90_put_att(ncid, id_alvsf, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING ALVSF COORD' ) error = nf90_def_var(ncid, 'alvwf', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_alvwf) call netcdf_err(error, 'DEFINING ALVWF' ) @@ -1744,6 +1918,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING ALVWF LONG NAME' ) error = nf90_put_att(ncid, id_alvwf, "units", "none") call netcdf_err(error, 'DEFINING ALVWF UNITS' ) + error = nf90_put_att(ncid, id_alvwf, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING ALVWF COORD' ) error = nf90_def_var(ncid, 'alnsf', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_alnsf) call netcdf_err(error, 'DEFINING ALNSF' ) @@ -1751,6 +1927,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING ALNSF LONG NAME' ) error = nf90_put_att(ncid, id_alnsf, "units", "none") call netcdf_err(error, 'DEFINING ALNSF UNITS' ) + error = nf90_put_att(ncid, id_alnsf, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING ALNSF COORD' ) error = nf90_def_var(ncid, 'alnwf', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_alnwf) call netcdf_err(error, 'DEFINING ALNWF' ) @@ -1758,6 +1936,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING ALNWF LONG NAME' ) error = nf90_put_att(ncid, id_alnwf, "units", "none") call netcdf_err(error, 'DEFINING ALNWF UNITS' ) + error = nf90_put_att(ncid, id_alnwf, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING ALNWF COORD' ) error = nf90_def_var(ncid, 'facsf', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_facsf) call netcdf_err(error, 'DEFINING FACSF' ) @@ -1765,6 +1945,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING FACSF LONG NAME' ) error = nf90_put_att(ncid, id_facsf, "units", "none") call netcdf_err(error, 'DEFINING FACSF UNITS' ) + error = nf90_put_att(ncid, id_facsf, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING FACSF COORD' ) error = nf90_def_var(ncid, 'facwf', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_facwf) call netcdf_err(error, 'DEFINING FACWF' ) @@ -1772,6 +1954,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING FACWF LONG NAME' ) error = nf90_put_att(ncid, id_facwf, "units", "none") call netcdf_err(error, 'DEFINING FACWF UNITS' ) + error = nf90_put_att(ncid, id_facwf, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING FACWF COORD' ) error = nf90_def_var(ncid, 'vfrac', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_vfrac) call netcdf_err(error, 'DEFINING VFRAC' ) @@ -1779,6 +1963,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING VFRAC LONG NAME' ) error = nf90_put_att(ncid, id_vfrac, "units", "none") call netcdf_err(error, 'DEFINING VFRAC UNITS' ) + error = nf90_put_att(ncid, id_vfrac, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING VFRAC COORD' ) error = nf90_def_var(ncid, 'canopy', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_canopy) call netcdf_err(error, 'DEFINING CANOPY' ) @@ -1786,6 +1972,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING CANOPY LONG NAME' ) error = nf90_put_att(ncid, id_canopy, "units", "none") call netcdf_err(error, 'DEFINING CANOPY UNITS' ) + error = nf90_put_att(ncid, id_canopy, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING CANOPY COORD' ) error = nf90_def_var(ncid, 'f10m', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_f10m) call netcdf_err(error, 'DEFINING F10M' ) @@ -1793,6 +1981,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING F10M LONG NAME' ) error = nf90_put_att(ncid, id_f10m, "units", "none") call netcdf_err(error, 'DEFINING F10M UNITS' ) + error = nf90_put_att(ncid, id_f10m, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING F10M COORD' ) error = nf90_def_var(ncid, 't2m', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_t2m) call netcdf_err(error, 'DEFINING T2M' ) @@ -1800,6 +1990,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING T2M LONG NAME' ) error = nf90_put_att(ncid, id_t2m, "units", "none") call netcdf_err(error, 'DEFINING T2M UNITS' ) + error = nf90_put_att(ncid, id_t2m, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING T2M COORD' ) error = nf90_def_var(ncid, 'q2m', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_q2m) call netcdf_err(error, 'DEFINING Q2M' ) @@ -1807,6 +1999,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING Q2M LONG NAME' ) error = nf90_put_att(ncid, id_q2m, "units", "none") call netcdf_err(error, 'DEFINING Q2M UNITS' ) + error = nf90_put_att(ncid, id_q2m, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING Q2M COORD' ) error = nf90_def_var(ncid, 'vtype', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_vtype) call netcdf_err(error, 'DEFINING VTYPE' ) @@ -1814,6 +2008,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING VTYPE LONG NAME' ) error = nf90_put_att(ncid, id_vtype, "units", "none") call netcdf_err(error, 'DEFINING VTYPE UNITS' ) + error = nf90_put_att(ncid, id_vtype, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING VTYPE COORD' ) error = nf90_def_var(ncid, 'stype', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_stype) call netcdf_err(error, 'DEFINING STYPE' ) @@ -1821,6 +2017,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING STYPE LONG NAME' ) error = nf90_put_att(ncid, id_stype, "units", "none") call netcdf_err(error, 'DEFINING STYPE UNITS' ) + error = nf90_put_att(ncid, id_stype, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING STYPE COORD' ) error = nf90_def_var(ncid, 'uustar', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_uustar) call netcdf_err(error, 'DEFINING UUSTAR' ) @@ -1828,6 +2026,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING UUSTAR LONG NAME' ) error = nf90_put_att(ncid, id_uustar, "units", "none") call netcdf_err(error, 'DEFINING UUSTAR UNITS' ) + error = nf90_put_att(ncid, id_uustar, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING UUSTAR COORD' ) error = nf90_def_var(ncid, 'ffmm', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_ffmm) call netcdf_err(error, 'DEFINING FFMM' ) @@ -1835,6 +2035,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING FFMM LONG NAME' ) error = nf90_put_att(ncid, id_ffmm, "units", "none") call netcdf_err(error, 'DEFINING FFMM UNITS' ) + error = nf90_put_att(ncid, id_ffmm, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING FFMM COORD' ) error = nf90_def_var(ncid, 'ffhh', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_ffhh) call netcdf_err(error, 'DEFINING FFHH' ) @@ -1842,6 +2044,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING FFHH LONG NAME' ) error = nf90_put_att(ncid, id_ffhh, "units", "none") call netcdf_err(error, 'DEFINING FFHH UNITS' ) + error = nf90_put_att(ncid, id_ffhh, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING FFHH COORD' ) error = nf90_def_var(ncid, 'hice', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_hice) call netcdf_err(error, 'DEFINING HICE' ) @@ -1849,6 +2053,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING HICE LONG NAME' ) error = nf90_put_att(ncid, id_hice, "units", "none") call netcdf_err(error, 'DEFINING HICE UNITS' ) + error = nf90_put_att(ncid, id_hice, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING HICE COORD' ) error = nf90_def_var(ncid, 'fice', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_fice) call netcdf_err(error, 'DEFINING FICE' ) @@ -1856,6 +2062,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING FICE LONG NAME' ) error = nf90_put_att(ncid, id_fice, "units", "none") call netcdf_err(error, 'DEFINING FICE UNITS' ) + error = nf90_put_att(ncid, id_fice, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING FICE COORD' ) error = nf90_def_var(ncid, 'tisfc', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_tisfc) call netcdf_err(error, 'DEFINING TISFC' ) @@ -1863,6 +2071,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING TISFC LONG NAME' ) error = nf90_put_att(ncid, id_tisfc, "units", "none") call netcdf_err(error, 'DEFINING TISFC UNITS' ) + error = nf90_put_att(ncid, id_tisfc, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING TISFC COORD' ) error = nf90_def_var(ncid, 'tprcp', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_tprcp) call netcdf_err(error, 'DEFINING TPRCP' ) @@ -1870,6 +2080,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING TPRCP LONG NAME' ) error = nf90_put_att(ncid, id_tprcp, "units", "none") call netcdf_err(error, 'DEFINING TPRCP UNITS' ) + error = nf90_put_att(ncid, id_tprcp, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING TPRCP COORD' ) error = nf90_def_var(ncid, 'srflag', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_srflag) call netcdf_err(error, 'DEFINING SRFLAG' ) @@ -1877,6 +2089,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING SRFLAG LONG NAME' ) error = nf90_put_att(ncid, id_srflag, "units", "none") call netcdf_err(error, 'DEFINING SRFLAG UNITS' ) + error = nf90_put_att(ncid, id_srflag, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING SRFLAG COORD' ) error = nf90_def_var(ncid, 'snwdph', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_snwdph) call netcdf_err(error, 'DEFINING SNWDPH' ) @@ -1884,6 +2098,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING SNWDPH LONG NAME' ) error = nf90_put_att(ncid, id_snwdph, "units", "none") call netcdf_err(error, 'DEFINING SNWDPH UNITS' ) + error = nf90_put_att(ncid, id_snwdph, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING SNWDPH COORD' ) error = nf90_def_var(ncid, 'shdmin', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_shdmin) call netcdf_err(error, 'DEFINING SHDMIN' ) @@ -1891,6 +2107,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING SHDMIN LONG NAME' ) error = nf90_put_att(ncid, id_shdmin, "units", "none") call netcdf_err(error, 'DEFINING SHDMIN UNITS' ) + error = nf90_put_att(ncid, id_shdmin, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING SHDMIN COORD' ) error = nf90_def_var(ncid, 'shdmax', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_shdmax) call netcdf_err(error, 'DEFINING SHDMAX' ) @@ -1898,6 +2116,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING SHDMAX LONG NAME' ) error = nf90_put_att(ncid, id_shdmax, "units", "none") call netcdf_err(error, 'DEFINING SHDMAX UNITS' ) + error = nf90_put_att(ncid, id_shdmax, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING SHDMAX COORD' ) error = nf90_def_var(ncid, 'slope', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_slope) call netcdf_err(error, 'DEFINING SLOPE' ) @@ -1905,6 +2125,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING SLOPE LONG NAME' ) error = nf90_put_att(ncid, id_slope, "units", "none") call netcdf_err(error, 'DEFINING SLOPE UNITS' ) + error = nf90_put_att(ncid, id_slope, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING SLOPE COORD' ) error = nf90_def_var(ncid, 'snoalb', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_snoalb) call netcdf_err(error, 'DEFINING SNOALB' ) @@ -1912,6 +2134,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING SNOALB LONG NAME' ) error = nf90_put_att(ncid, id_snoalb, "units", "none") call netcdf_err(error, 'DEFINING SNOALB UNITS' ) + error = nf90_put_att(ncid, id_snoalb, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING SNOALB COORD' ) error = nf90_def_var(ncid, 'stc', NF90_DOUBLE, (/dim_x,dim_y,dim_lsoil,dim_time/), id_stc) call netcdf_err(error, 'DEFINING STC' ) @@ -1919,6 +2143,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING STC LONG NAME' ) error = nf90_put_att(ncid, id_stc, "units", "none") call netcdf_err(error, 'DEFINING STC UNITS' ) + error = nf90_put_att(ncid, id_stc, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING STC COORD' ) error = nf90_def_var(ncid, 'smc', NF90_DOUBLE, (/dim_x,dim_y,dim_lsoil,dim_time/), id_smc) call netcdf_err(error, 'DEFINING SMC' ) @@ -1926,6 +2152,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING SMC LONG NAME' ) error = nf90_put_att(ncid, id_smc, "units", "none") call netcdf_err(error, 'DEFINING SMC UNITS' ) + error = nf90_put_att(ncid, id_smc, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING SMC COORD' ) error = nf90_def_var(ncid, 'slc', NF90_DOUBLE, (/dim_x,dim_y,dim_lsoil,dim_time/), id_slc) call netcdf_err(error, 'DEFINING SLC' ) @@ -1933,6 +2161,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING SLC LONG NAME' ) error = nf90_put_att(ncid, id_slc, "units", "none") call netcdf_err(error, 'DEFINING SLC UNITS' ) + error = nf90_put_att(ncid, id_slc, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING SLC COORD' ) if (convert_nst) then @@ -1942,6 +2172,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING TREF LONG NAME' ) error = nf90_put_att(ncid, id_tref, "units", "none") call netcdf_err(error, 'DEFINING TREF UNITS' ) + error = nf90_put_att(ncid, id_tref, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING TREF COORD' ) error = nf90_def_var(ncid, 'z_c', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_z_c) call netcdf_err(error, 'DEFINING Z_C' ) @@ -1949,6 +2181,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING Z_C LONG NAME' ) error = nf90_put_att(ncid, id_z_c, "units", "none") call netcdf_err(error, 'DEFINING Z_C UNITS' ) + error = nf90_put_att(ncid, id_z_c, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING Z_C COORD' ) error = nf90_def_var(ncid, 'c_0', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_c_0) call netcdf_err(error, 'DEFINING C_0' ) @@ -1956,6 +2190,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING C_0 LONG NAME' ) error = nf90_put_att(ncid, id_c_0, "units", "none") call netcdf_err(error, 'DEFINING C_0 UNITS' ) + error = nf90_put_att(ncid, id_c_0, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING C_0 COORD' ) error = nf90_def_var(ncid, 'c_d', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_c_d) call netcdf_err(error, 'DEFINING C_D' ) @@ -1963,6 +2199,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING C_D LONG NAME' ) error = nf90_put_att(ncid, id_c_d, "units", "none") call netcdf_err(error, 'DEFINING C_D UNITS' ) + error = nf90_put_att(ncid, id_c_d, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING C_D COORD' ) error = nf90_def_var(ncid, 'w_0', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_w_0) call netcdf_err(error, 'DEFINING W_0' ) @@ -1970,6 +2208,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING W_0 LONG NAME' ) error = nf90_put_att(ncid, id_w_0, "units", "none") call netcdf_err(error, 'DEFINING W_0 UNITS' ) + error = nf90_put_att(ncid, id_w_0, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING W_0 COORD' ) error = nf90_def_var(ncid, 'w_d', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_w_d) call netcdf_err(error, 'DEFINING W_D' ) @@ -1977,6 +2217,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING W_D LONG NAME' ) error = nf90_put_att(ncid, id_w_d, "units", "none") call netcdf_err(error, 'DEFINING W_D UNITS' ) + error = nf90_put_att(ncid, id_w_d, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING W_D COORD' ) error = nf90_def_var(ncid, 'xt', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_xt) call netcdf_err(error, 'DEFINING XT' ) @@ -1984,6 +2226,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING XT LONG NAME' ) error = nf90_put_att(ncid, id_xt, "units", "none") call netcdf_err(error, 'DEFINING XT UNITS' ) + error = nf90_put_att(ncid, id_xt, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING XT COORD' ) error = nf90_def_var(ncid, 'xs', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_xs) call netcdf_err(error, 'DEFINING XS' ) @@ -1991,6 +2235,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING XS LONG NAME' ) error = nf90_put_att(ncid, id_xs, "units", "none") call netcdf_err(error, 'DEFINING XS UNITS' ) + error = nf90_put_att(ncid, id_xs, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING XS COORD' ) error = nf90_def_var(ncid, 'xu', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_xu) call netcdf_err(error, 'DEFINING XU' ) @@ -1998,6 +2244,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING XU LONG NAME' ) error = nf90_put_att(ncid, id_xu, "units", "none") call netcdf_err(error, 'DEFINING XU UNITS' ) + error = nf90_put_att(ncid, id_xu, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING XU COORD' ) error = nf90_def_var(ncid, 'xv', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_xv) call netcdf_err(error, 'DEFINING XV' ) @@ -2005,6 +2253,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING XV LONG NAME' ) error = nf90_put_att(ncid, id_xv, "units", "none") call netcdf_err(error, 'DEFINING XV UNITS' ) + error = nf90_put_att(ncid, id_xv, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING XV COORD' ) error = nf90_def_var(ncid, 'xz', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_xz) call netcdf_err(error, 'DEFINING XZ' ) @@ -2012,6 +2262,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING XZ LONG NAME' ) error = nf90_put_att(ncid, id_xz, "units", "none") call netcdf_err(error, 'DEFINING XZ UNITS' ) + error = nf90_put_att(ncid, id_xz, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING XZ COORD' ) error = nf90_def_var(ncid, 'zm', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_zm) call netcdf_err(error, 'DEFINING ZM' ) @@ -2019,6 +2271,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING ZM LONG NAME' ) error = nf90_put_att(ncid, id_zm, "units", "none") call netcdf_err(error, 'DEFINING ZM UNITS' ) + error = nf90_put_att(ncid, id_zm, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING ZM COORD' ) error = nf90_def_var(ncid, 'xtts', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_xtts) call netcdf_err(error, 'DEFINING XTTS' ) @@ -2026,6 +2280,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING XTTS LONG NAME' ) error = nf90_put_att(ncid, id_xtts, "units", "none") call netcdf_err(error, 'DEFINING XTTS UNITS' ) + error = nf90_put_att(ncid, id_xtts, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING XTTS COORD' ) error = nf90_def_var(ncid, 'xzts', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_xzts) call netcdf_err(error, 'DEFINING XZTS' ) @@ -2033,6 +2289,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING XZTS LONG NAME' ) error = nf90_put_att(ncid, id_xzts, "units", "none") call netcdf_err(error, 'DEFINING XZTS UNITS' ) + error = nf90_put_att(ncid, id_xzts, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING XZTS COORD' ) error = nf90_def_var(ncid, 'd_conv', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_d_conv) call netcdf_err(error, 'DEFINING D_CONV' ) @@ -2040,6 +2298,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING D_CONV LONG NAME' ) error = nf90_put_att(ncid, id_d_conv, "units", "none") call netcdf_err(error, 'DEFINING D_CONV UNITS' ) + error = nf90_put_att(ncid, id_d_conv, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING D_CONV COORD' ) error = nf90_def_var(ncid, 'ifd', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_ifd) call netcdf_err(error, 'DEFINING IFD' ) @@ -2047,6 +2307,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING IFD LONG NAME' ) error = nf90_put_att(ncid, id_ifd, "units", "none") call netcdf_err(error, 'DEFINING IFD UNITS' ) + error = nf90_put_att(ncid, id_ifd, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING IFD COORD' ) error = nf90_def_var(ncid, 'dt_cool', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_dt_cool) call netcdf_err(error, 'DEFINING DT_COOL' ) @@ -2054,6 +2316,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING DT_COOL LONG NAME' ) error = nf90_put_att(ncid, id_dt_cool, "units", "none") call netcdf_err(error, 'DEFINING DT_COOL UNITS' ) + error = nf90_put_att(ncid, id_dt_cool, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING DT_COOL COORD' ) error = nf90_def_var(ncid, 'qrain', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_qrain) call netcdf_err(error, 'DEFINING QRAIN' ) @@ -2061,6 +2325,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING QRAIN LONG NAME' ) error = nf90_put_att(ncid, id_qrain, "units", "none") call netcdf_err(error, 'DEFINING QRAIN UNITS' ) + error = nf90_put_att(ncid, id_qrain, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING QRAIN COORD' ) endif ! nsst records @@ -2081,6 +2347,28 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'WRITING TIME RECORD' ) endif + print*,"- CALL FieldGather FOR TARGET GRID LATITUDE FOR TILE: ", tile + call ESMF_FieldGather(latitude_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + + if (localpet == 0) then + dum2d(:,:) = data_one_tile(istart:iend, jstart:jend) + error = nf90_put_var( ncid, id_lat, dum2d) + call netcdf_err(error, 'WRITING LATITUDE RECORD' ) + endif + + print*,"- CALL FieldGather FOR TARGET GRID LONGITUDE FOR TILE: ", tile + call ESMF_FieldGather(longitude_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + + if (localpet == 0) then + dum2d(:,:) = data_one_tile(istart:iend, jstart:jend) + error = nf90_put_var( ncid, id_lon, dum2d) + call netcdf_err(error, 'WRITING LONGITUDE RECORD' ) + endif + print*,"- CALL FieldGather FOR TARGET GRID SNOW LIQ EQUIV FOR TILE: ", tile call ESMF_FieldGather(snow_liq_equiv_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & diff --git a/sorc/orog.fd/netcdf_io.F90 b/sorc/orog.fd/netcdf_io.F90 index b582559c1..558945f31 100755 --- a/sorc/orog.fd/netcdf_io.F90 +++ b/sorc/orog.fd/netcdf_io.F90 @@ -12,7 +12,7 @@ subroutine write_netcdf(im, jm, slm, land_frac, oro, orf, hprime, ntiles, tile, integer :: fsize=65536, inital = 0 integer :: dim1, dim2 integer :: dim_lon, dim_lat - integer :: id_lon,id_lat,id_geolon,id_geolat + integer :: id_geolon,id_geolat integer :: id_slmsk,id_orog_raw,id_orog_filt,id_land_frac integer :: id_stddev,id_convex integer :: id_oa1,id_oa2,id_oa3,id_oa4 @@ -40,74 +40,106 @@ subroutine write_netcdf(im, jm, slm, land_frac, oro, orf, hprime, ntiles, tile, call netcdf_err(error, 'define dimension lat for file='//trim(outfile) ) !--- define field - error = nf_def_var(ncid, 'lon', NF_FLOAT, 1, (/dim_lon/), id_lon) - call netcdf_err(error, 'define var lon for file='//trim(outfile) ) - error = nf_put_att_text(ncid, id_lon, "cartesian_axis", 1, "X") - call netcdf_err(error, 'put att cartesian_axis for lon for file='//trim(outfile) ) - error = nf_def_var(ncid, 'lat', NF_FLOAT, 1, (/dim_lat/), id_lat) - call netcdf_err(error, 'define var lat for file='//trim(outfile) ) - error = nf_put_att_text(ncid, id_lat, "cartesian_axis", 1, "Y") - call netcdf_err(error, 'put att cartesian_axis for lat for file='//trim(outfile) ) - +!---geolon error = nf_def_var(ncid, 'geolon', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_geolon) call netcdf_err(error, 'define var geolon for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_geolon, "long_name", 9, "Longitude") + call netcdf_err(error, 'define geolon name for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_geolon, "units", 12, "degrees_east") + call netcdf_err(error, 'define geolon units for file='//trim(outfile) ) +!---geolat error = nf_def_var(ncid, 'geolat', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_geolat) call netcdf_err(error, 'define var geolat for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_geolat, "long_name", 8, "Latitude") + call netcdf_err(error, 'define geolat name for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_geolat, "units", 13, "degrees_north") + call netcdf_err(error, 'define geolat units for file='//trim(outfile) ) !---slmsk error = nf_def_var(ncid, 'slmsk', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_slmsk) call netcdf_err(error, 'define var slmsk for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_slmsk, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define slmsk coordinates for file='//trim(outfile) ) !--- land_frac error = nf_def_var(ncid, 'land_frac', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_land_frac) call netcdf_err(error, 'define var land_frac for file='//trim(outfile) ) - + error = nf_put_att_text(ncid, id_land_frac, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define land_frac coordinates for file='//trim(outfile) ) !---orography - raw error = nf_def_var(ncid, 'orog_raw', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_orog_raw) call netcdf_err(error, 'define var orog_raw for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_orog_raw, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define orog_raw coordinates for file='//trim(outfile) ) !---orography - filtered error = nf_def_var(ncid, 'orog_filt', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_orog_filt) call netcdf_err(error, 'define var orog_filt for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_orog_filt, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define orog_filt coordinates for file='//trim(outfile) ) !---stddev error = nf_def_var(ncid, 'stddev', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_stddev) call netcdf_err(error, 'define var stddev for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_stddev, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define stddev coordinates for file='//trim(outfile) ) !---convexity error = nf_def_var(ncid, 'convexity', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_convex) call netcdf_err(error, 'define var convexity for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_convex, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define convexity coordinates for file='//trim(outfile) ) !---oa1 -> oa4 error = nf_def_var(ncid, 'oa1', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_oa1) call netcdf_err(error, 'define var oa1 for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_oa1, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define oa1 coordinates for file='//trim(outfile) ) error = nf_def_var(ncid, 'oa2', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_oa2) call netcdf_err(error, 'define var oa2 for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_oa2, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define oa2 coordinates for file='//trim(outfile) ) error = nf_def_var(ncid, 'oa3', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_oa3) call netcdf_err(error, 'define var oa3 for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_oa3, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define oa3 coordinates for file='//trim(outfile) ) error = nf_def_var(ncid, 'oa4', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_oa4) call netcdf_err(error, 'define var oa4 for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_oa4, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define oa4 coordinates for file='//trim(outfile) ) !---ol1 -> ol4 error = nf_def_var(ncid, 'ol1', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_ol1) call netcdf_err(error, 'define var ol1 for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_ol1, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define ol1 coordinates for file='//trim(outfile) ) error = nf_def_var(ncid, 'ol2', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_ol2) call netcdf_err(error, 'define var ol2 for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_ol2, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define ol2 coordinates for file='//trim(outfile) ) error = nf_def_var(ncid, 'ol3', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_ol3) call netcdf_err(error, 'define var ol3 for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_ol3, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define ol3 coordinates for file='//trim(outfile) ) error = nf_def_var(ncid, 'ol4', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_ol4) call netcdf_err(error, 'define var ol4 for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_ol4, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define ol4 coordinates for file='//trim(outfile) ) !---theta gamma sigma elvmax error = nf_def_var(ncid, 'theta', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_theta) call netcdf_err(error, 'define var theta for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_theta, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define theta coordinates for file='//trim(outfile) ) error = nf_def_var(ncid, 'gamma', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_gamma) call netcdf_err(error, 'define var gamma for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_gamma, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define gamma coordinates for file='//trim(outfile) ) error = nf_def_var(ncid, 'sigma', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_sigma) call netcdf_err(error, 'define var sigma for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_sigma, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define sigma coordinates for file='//trim(outfile) ) error = nf_def_var(ncid, 'elvmax', NF_FLOAT, 2, (/dim_lon,dim_lat/), id_elvmax) call netcdf_err(error, 'define var elvmax for file='//trim(outfile) ) + error = nf_put_att_text(ncid, id_elvmax, "coordinates", 13, "geolon geolat") + call netcdf_err(error, 'define elvmax coordinates for file='//trim(outfile) ) error = nf__enddef(ncid, header_buffer_val,4,0,4) call netcdf_err(error, 'end meta define for file='//trim(outfile) ) !--- write out data - error = nf_put_var_double( ncid, id_lon, lon(:)) - call netcdf_err(error, 'write var lon for file='//trim(outfile) ) - error = nf_put_var_double( ncid, id_lat, lat(:)) - call netcdf_err(error, 'write var lat for file='//trim(outfile) ) error = nf_put_var_double( ncid, id_geolon, geolon(:dim1,:dim2)) call netcdf_err(error, 'write var geolon for file='//trim(outfile) ) error = nf_put_var_double( ncid, id_geolat, geolat(:dim1,:dim2)) diff --git a/sorc/sfc_climo_gen.fd/interp.F90 b/sorc/sfc_climo_gen.fd/interp.F90 index 5ed80f14d..67a8cc079 100644 --- a/sorc/sfc_climo_gen.fd/interp.F90 +++ b/sorc/sfc_climo_gen.fd/interp.F90 @@ -46,6 +46,8 @@ subroutine interp(localpet, method, input_file) real(esmf_kind_r4), allocatable :: data_src_global(:,:) real(esmf_kind_r4), allocatable :: data_mdl_one_tile(:,:) real(esmf_kind_r4), allocatable :: vegt_mdl_one_tile(:,:) + real(esmf_kind_r4), allocatable :: lat_mdl_one_tile(:,:) + real(esmf_kind_r4), allocatable :: lon_mdl_one_tile(:,:) type(esmf_regridmethod_flag),intent(in) :: method type(esmf_field) :: data_field_src @@ -93,9 +95,13 @@ subroutine interp(localpet, method, input_file) if (localpet == 0) then allocate(data_mdl_one_tile(i_mdl,j_mdl)) allocate(mask_mdl_one_tile(i_mdl,j_mdl)) + allocate(lat_mdl_one_tile(i_mdl,j_mdl)) + allocate(lon_mdl_one_tile(i_mdl,j_mdl)) else allocate(data_mdl_one_tile(0,0)) allocate(mask_mdl_one_tile(0,0)) + allocate(lat_mdl_one_tile(0,0)) + allocate(lon_mdl_one_tile(0,0)) endif record = 0 @@ -199,6 +205,16 @@ subroutine interp(localpet, method, input_file) OUTPUT_LOOP : do tile = 1, num_tiles + print*,"- CALL FieldGather FOR MODEL LATITUDE." + call ESMF_FieldGather(latitude_field_mdl, lat_mdl_one_tile, rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather.", rc) + + print*,"- CALL FieldGather FOR MODEL LONGITUDE." + call ESMF_FieldGather(longitude_field_mdl, lon_mdl_one_tile, rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather.", rc) + print*,"- CALL FieldGather FOR MODEL GRID DATA." call ESMF_FieldGather(data_field_mdl, data_mdl_one_tile, rootPet=0, tile=tile, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -225,7 +241,7 @@ subroutine interp(localpet, method, input_file) call adjust_for_landice (data_mdl_one_tile, vegt_mdl_one_tile, i_mdl, j_mdl, field_names(n)) end select where(mask_mdl_one_tile == 0) data_mdl_one_tile = missing - call output (data_mdl_one_tile, i_mdl, j_mdl, tile, record, t, n) + call output (data_mdl_one_tile, lat_mdl_one_tile, lon_mdl_one_tile, i_mdl, j_mdl, tile, record, t, n) endif if (field_names(n) == 'vegetation_type') then @@ -245,7 +261,7 @@ subroutine interp(localpet, method, input_file) status=nf90_close(ncid) deallocate(data_mdl_one_tile, mask_mdl_one_tile) - deallocate(data_src_global) + deallocate(data_src_global, lat_mdl_one_tile, lon_mdl_one_tile) print*,"- CALL FieldRegridRelease." call ESMF_FieldRegridRelease(routehandle=regrid_data, rc=rc) diff --git a/sorc/sfc_climo_gen.fd/model_grid.F90 b/sorc/sfc_climo_gen.fd/model_grid.F90 index f281b64ea..b123b6bfa 100644 --- a/sorc/sfc_climo_gen.fd/model_grid.F90 +++ b/sorc/sfc_climo_gen.fd/model_grid.F90 @@ -26,6 +26,10 @@ module model_grid ! grid_mdl ESMF grid object for the model grid. ! grid_tiles Array of model grid tile names. ! i/j_mdl i/j dimensions of model tile. +! latitude_field_mdl ESMF field object that holds the +! model grid latitude +! longitude_field_mdl ESMF field object that holds the +! model grid longitude ! mdl_field_mdl ESMF field object that holds the ! model land mask. ! missing Value assigned to undefined points @@ -51,6 +55,7 @@ module model_grid type(esmf_grid), public :: grid_mdl type(esmf_field), public :: data_field_mdl, mask_field_mdl + type(esmf_field), public :: latitude_field_mdl, longitude_field_mdl type(esmf_field), public :: vegt_field_mdl public :: define_model_grid @@ -92,10 +97,13 @@ subroutine define_model_grid(localpet, npets) integer :: extra, rc, tile integer, allocatable :: decomptile(:,:) - integer, allocatable :: mask_mdl_one_tile(:,:) + integer(esmf_kind_i4), allocatable :: mask_mdl_one_tile(:,:) integer(esmf_kind_i4), pointer :: mask_field_mdl_ptr(:,:) integer(esmf_kind_i4), pointer :: mask_mdl_ptr(:,:) + real(esmf_kind_r4), allocatable :: latitude_one_tile(:,:) + real(esmf_kind_r4), allocatable :: longitude_one_tile(:,:) + !----------------------------------------------------------------------- ! Get the number of tiles from the mosaic file. !----------------------------------------------------------------------- @@ -193,6 +201,24 @@ subroutine define_model_grid(localpet, npets) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) + print*,"- CALL FieldCreate FOR MODEL GRID LATITUDE." + latitude_field_mdl = ESMF_FieldCreate(grid_mdl, & + typekind=ESMF_TYPEKIND_R4, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + name="latitude on model grid", & + rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- CALL FieldCreate FOR MODEL GRID LONGITUDE." + longitude_field_mdl = ESMF_FieldCreate(grid_mdl, & + typekind=ESMF_TYPEKIND_R4, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + name="longitude on model grid", & + rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + !----------------------------------------------------------------------- ! Set model land mask. !----------------------------------------------------------------------- @@ -216,22 +242,39 @@ subroutine define_model_grid(localpet, npets) if (localpet == 0) then allocate(mask_mdl_one_tile(i_mdl,j_mdl)) + allocate(latitude_one_tile(i_mdl,j_mdl)) + allocate(longitude_one_tile(i_mdl,j_mdl)) else allocate(mask_mdl_one_tile(0,0)) + allocate(latitude_one_tile(0,0)) + allocate(longitude_one_tile(0,0)) endif do tile = 1, num_tiles if (localpet == 0) then the_file = trim(orog_dir_mdl) // trim(orog_files_mdl(tile)) - call get_model_mask(trim(the_file), mask_mdl_one_tile, i_mdl, j_mdl) + call get_model_info(trim(the_file), mask_mdl_one_tile, & + latitude_one_tile, longitude_one_tile, i_mdl, j_mdl) endif + print*,"- CALL FieldScatter FOR MODEL GRID MASK. TILE IS: ", tile call ESMF_FieldScatter(mask_field_mdl, mask_mdl_one_tile, rootpet=0, tile=tile, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) + + print*,"- CALL FieldScatter FOR MODEL LATITUDE. TILE IS: ", tile + call ESMF_FieldScatter(latitude_field_mdl, latitude_one_tile, rootpet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + print*,"- CALL FieldScatter FOR MODEL LONGITUDE. TILE IS: ", tile + call ESMF_FieldScatter(longitude_field_mdl, longitude_one_tile, rootpet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + enddo - deallocate(mask_mdl_one_tile) + deallocate(mask_mdl_one_tile, latitude_one_tile, longitude_one_tile) print*,"- CALL GridAddItem FOR MODEL GRID." call ESMF_GridAddItem(grid_mdl, & @@ -254,17 +297,17 @@ subroutine define_model_grid(localpet, npets) end subroutine define_model_grid - subroutine get_model_mask(orog_file, mask, idim, jdim) + subroutine get_model_info(orog_file, mask, lat2d, lon2d, idim, jdim) !----------------------------------------------------------------------- ! subroutine documentation block ! -! Subroutine: get model mask +! Subroutine: get model information ! prgmmr: gayno org: w/np2 date: 2018 ! -! Abstract: Read model land/sea mask from the orography file. +! Abstract: Read model land/sea mask and lat/lon from the orography file. ! -! Usage: call get_model_mask(orog_file, mask, idim, jdim) +! Usage: call get_model_info(orog_file, mask, lat2d, lon2d, idim, jdim) ! ! input argument list: ! orog_file the orography file @@ -272,6 +315,8 @@ subroutine get_model_mask(orog_file, mask, idim, jdim) ! ! output argument list: ! mask land/sea mask +! lat2d latitude +! lon2d longitude ! !----------------------------------------------------------------------- @@ -286,16 +331,19 @@ subroutine get_model_mask(orog_file, mask, idim, jdim) integer, intent(in) :: idim, jdim integer(esmf_kind_i4), intent(out) :: mask(idim,jdim) + real(esmf_kind_r4), intent(out) :: lat2d(idim,jdim) + real(esmf_kind_r4), intent(out) :: lon2d(idim,jdim) + integer :: error, lat, lon integer :: ncid, id_dim, id_var real(kind=4), allocatable :: dummy(:,:) - print*,"- READ MODEL LAND MASK FILE" + print*,"- READ MODEL OROGRAPHY FILE" - print*,'- OPEN LAND MASK FILE: ', orog_file + print*,'- OPEN FILE: ', orog_file error=nf90_open(orog_file,nf90_nowrite,ncid) - call netcdf_err(error, "OPENING MODEL LAND MASK FILE") + call netcdf_err(error, "OPENING MODEL OROGRAPHY FILE") print*,"- READ I-DIMENSION" error=nf90_inq_dimid(ncid, 'lon', id_dim) @@ -322,14 +370,27 @@ subroutine get_model_mask(orog_file, mask, idim, jdim) call netcdf_err(error, "READING SLMSK ID") error=nf90_get_var(ncid, id_var, dummy) call netcdf_err(error, "READING SLMSK") + mask = nint(dummy) - error = nf90_close(ncid) + print*,"- READ LATITUDE" + error=nf90_inq_varid(ncid, 'geolat', id_var) + call netcdf_err(error, "READING GEOLAT ID") + error=nf90_get_var(ncid, id_var, dummy) + call netcdf_err(error, "READING GEOLAT") + lat2d=dummy - mask = nint(dummy) + print*,"- READ LONGITUDE" + error=nf90_inq_varid(ncid, 'geolon', id_var) + call netcdf_err(error, "READING GEOLON ID") + error=nf90_get_var(ncid, id_var, dummy) + call netcdf_err(error, "READING GEOLON") + lon2d=dummy + + error = nf90_close(ncid) deallocate (dummy) - end subroutine get_model_mask + end subroutine get_model_info subroutine model_grid_cleanup @@ -361,6 +422,12 @@ subroutine model_grid_cleanup print*,"- CALL FieldDestroy FOR MODEL GRID VEGETATION TYPE." call ESMF_FieldDestroy(vegt_field_mdl,rc=rc) + print*,"- CALL FieldDestroy FOR MODEL GRID LATITUDE." + call ESMF_FieldDestroy(latitude_field_mdl,rc=rc) + + print*,"- CALL FieldDestroy FOR MODEL GRID LONGITUDE." + call ESMF_FieldDestroy(longitude_field_mdl,rc=rc) + end subroutine model_grid_cleanup end module model_grid diff --git a/sorc/sfc_climo_gen.fd/output.f90 b/sorc/sfc_climo_gen.fd/output.f90 index 38554e419..b38aa8bea 100644 --- a/sorc/sfc_climo_gen.fd/output.f90 +++ b/sorc/sfc_climo_gen.fd/output.f90 @@ -1,4 +1,5 @@ - subroutine output(data_one_tile, i_mdl, j_mdl, tile, record, time, field_idx) + subroutine output(data_one_tile, lat_one_tile, lon_one_tile, i_mdl, j_mdl, & + tile, record, time, field_idx) !-------------------------------------------------------------------------- ! subroutine documentation block @@ -6,14 +7,17 @@ subroutine output(data_one_tile, i_mdl, j_mdl, tile, record, time, field_idx) ! Subroutine: output ! prgmmr: gayno org: w/np2 date: 2018 ! -! Abstract: Output model data for a single tile and a signle +! Abstract: Output model data for a single tile and a single ! record in netcdf format. ! -! Usage: call output(data_one_tile, i_mdl, j_mdl, tile, record, & +! Usage: call output(data_one_tile, lat_one_tile, lon_one_tile, & +! i_mdl, j_mdl, tile, record, & ! time, field_idx) ! ! input argument list: ! data_one_tile Data to be output (single tile). +! lat_one_tile Latitude of tile. +! lon_one_tile Longitude of tile. ! field_idx Index of field within field name ! array. ! i/j_mdl i/j dimensions of tile. @@ -38,6 +42,8 @@ subroutine output(data_one_tile, i_mdl, j_mdl, tile, record, time, field_idx) integer, intent(in) :: record, time, field_idx real(esmf_kind_r4), intent(in) :: data_one_tile(i_mdl,j_mdl) + real(esmf_kind_r4), intent(in) :: lat_one_tile(i_mdl,j_mdl) + real(esmf_kind_r4), intent(in) :: lon_one_tile(i_mdl,j_mdl) character(len=200) :: out_file character(len=200) :: out_file_with_halo @@ -46,7 +52,7 @@ subroutine output(data_one_tile, i_mdl, j_mdl, tile, record, time, field_idx) integer :: dim_x, dim_y, id_data integer :: dim_time, id_times integer :: header_buffer_val = 16384 - integer :: i_out, j_out + integer :: i_out, j_out, id_lat, id_lon integer :: i_start, i_end, j_start, j_end integer, save :: ncid(6), ncid_with_halo @@ -126,11 +132,26 @@ subroutine output(data_one_tile, i_mdl, j_mdl, tile, record, time, field_idx) call netcdf_err(error, 'DEFINING GLOBAL SOURCE ATTRIBUTE' ) endif + error = nf90_def_var(ncid(tile), 'geolat', NF90_FLOAT, (/dim_x,dim_y/), id_lat) + call netcdf_err(error, 'DEFINING GEOLAT FIELD' ) + error = nf90_put_att(ncid(tile), id_lat, "long_name", "Latitude") + call netcdf_err(error, 'DEFINING GEOLAT NAME ATTRIBUTE' ) + error = nf90_put_att(ncid(tile), id_lat, "units", "degrees_north") + call netcdf_err(error, 'DEFINING GEOLAT UNIT ATTRIBUTE' ) + error = nf90_def_var(ncid(tile), 'geolon', NF90_FLOAT, (/dim_x,dim_y/), id_lon) + call netcdf_err(error, 'DEFINING GEOLON FIELD' ) + error = nf90_put_att(ncid(tile), id_lon, "long_name", "Longitude") + call netcdf_err(error, 'DEFINING GEOLON NAME ATTRIBUTE' ) + error = nf90_put_att(ncid(tile), id_lon, "units", "degrees_east") + call netcdf_err(error, 'DEFINING GEOLON UNIT ATTRIBUTE' ) + do j = 1, num_fields error = nf90_def_var(ncid(tile), trim(field_names(j)), NF90_FLOAT, (/dim_x,dim_y,dim_time/), id_data) call netcdf_err(error, 'DEFINING FIELD' ) error = nf90_put_att(ncid(tile), id_data, "missing_value", missing) call netcdf_err(error, 'DEFINING FIELD ATTRIBUTE' ) + error = nf90_put_att(ncid(tile), id_data, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING COORD ATTRIBUTE' ) enddo error = nf90_enddef(ncid(tile), header_buffer_val,4,0,4) @@ -139,6 +160,14 @@ subroutine output(data_one_tile, i_mdl, j_mdl, tile, record, time, field_idx) error = nf90_put_var( ncid(tile), id_times, day_of_rec) call netcdf_err(error, 'WRITING TIME FIELD' ) + error = nf90_put_var( ncid(tile), id_lat, lat_one_tile(i_start:i_end,j_start:j_end), & + start=(/1,1/), count=(/i_out,j_out/)) + call netcdf_err(error, 'IN NF90_PUT_VAR FOR GEOLAT' ) + + error = nf90_put_var( ncid(tile), id_lon, lon_one_tile(i_start:i_end,j_start:j_end), & + start=(/1,1/), count=(/i_out,j_out/)) + call netcdf_err(error, 'IN NF90_PUT_VAR FOR GEOLON' ) + endif print*,'- WRITE DATA FOR RECORD: ',record @@ -182,11 +211,26 @@ subroutine output(data_one_tile, i_mdl, j_mdl, tile, record, time, field_idx) call netcdf_err(error, 'DEFINING GLOBAL SOURCE ATTRIBUTE' ) endif + error = nf90_def_var(ncid_with_halo, 'geolat', NF90_FLOAT, (/dim_x,dim_y/), id_lat) + call netcdf_err(error, 'DEFINING GEOLAT FIELD' ) + error = nf90_put_att(ncid_with_halo, id_lat, "long_name", "Latitude") + call netcdf_err(error, 'DEFINING GEOLAT NAME ATTRIBUTE' ) + error = nf90_put_att(ncid_with_halo, id_lat, "units", "degrees_north") + call netcdf_err(error, 'DEFINING GEOLAT UNIT ATTRIBUTE' ) + error = nf90_def_var(ncid_with_halo, 'geolon', NF90_FLOAT, (/dim_x,dim_y/), id_lon) + call netcdf_err(error, 'DEFINING GEOLON FIELD' ) + error = nf90_put_att(ncid_with_halo, id_lon, "long_name", "Longitude") + call netcdf_err(error, 'DEFINING GEOLON NAME ATTRIBUTE' ) + error = nf90_put_att(ncid_with_halo, id_lon, "units", "degrees_east") + call netcdf_err(error, 'DEFINING GEOLON UNIT ATTRIBUTE' ) + do j = 1, num_fields error = nf90_def_var(ncid_with_halo, field_names(j), NF90_FLOAT, (/dim_x,dim_y,dim_time/), id_data) call netcdf_err(error, 'DEFINING FIELD VARIABLE' ) error = nf90_put_att(ncid_with_halo, id_data, "missing_value", missing) call netcdf_err(error, 'DEFINING FIELD ATTRIBUTE' ) + error = nf90_put_att(ncid_with_halo, id_data, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING COORD ATTRIBUTE' ) enddo error = nf90_enddef(ncid_with_halo, header_buffer_val,4,0,4) @@ -195,6 +239,14 @@ subroutine output(data_one_tile, i_mdl, j_mdl, tile, record, time, field_idx) error = nf90_put_var(ncid_with_halo, id_times, day_of_rec) call netcdf_err(error, 'WRITING TIME VARIABLE' ) + error = nf90_put_var( ncid_with_halo, id_lat, lat_one_tile, & + start=(/1,1/), count=(/i_mdl,j_mdl/)) + call netcdf_err(error, 'IN NF90_PUT_VAR FOR GEOLAT' ) + + error = nf90_put_var( ncid_with_halo, id_lon, lon_one_tile, & + start=(/1,1/), count=(/i_mdl,j_mdl/)) + call netcdf_err(error, 'IN NF90_PUT_VAR FOR GEOLON' ) + endif print*,'- WRITE DATA FOR RECORD: ',record From 10426d4ac93a986e5273eb1e9e7e5f897a67acd5 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Tue, 16 Jun 2020 13:28:56 -0400 Subject: [PATCH 024/192] Define NDATE in GDAS initialization scripts Add module load of 'prod_util' to the Hera, Cray and Dell build/run modules. This will define the NDATE program for the GDAS initialization scripts. This fixes a bug that was added when the CMake version of UFS_UTILS was merged. For details see #115 --- modulefiles/build.hera | 1 + modulefiles/build.wcoss_cray | 1 + modulefiles/build.wcoss_dell_p3 | 3 +++ 3 files changed, 5 insertions(+) diff --git a/modulefiles/build.hera b/modulefiles/build.hera index 98f2e11a4..d7068c38d 100644 --- a/modulefiles/build.hera +++ b/modulefiles/build.hera @@ -8,6 +8,7 @@ module load intel/18.0.5.274 module load impi/2018.0.4 module use -a /scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles +module load prod_util/1.1.0 module load w3nco/2.0.6 module load w3emc/2.3.0 module load nemsio/2.2.3 diff --git a/modulefiles/build.wcoss_cray b/modulefiles/build.wcoss_cray index 026ef6e7a..14506ef13 100644 --- a/modulefiles/build.wcoss_cray +++ b/modulefiles/build.wcoss_cray @@ -2,6 +2,7 @@ ## Build and run module for WCOSS-Cray ############################################################# +module load prod_util/1.1.0 module load hpss/4.1.0.3 module load xt-lsfhpc/9.1.3 module load cfp-intel-sandybridge/1.1.0 diff --git a/modulefiles/build.wcoss_dell_p3 b/modulefiles/build.wcoss_dell_p3 index 3276ccb4a..338663c9b 100644 --- a/modulefiles/build.wcoss_dell_p3 +++ b/modulefiles/build.wcoss_dell_p3 @@ -29,3 +29,6 @@ module use /gpfs/dell2/emc/modeling/noscrub/emc.nemspara/soft/modulefiles module load esmf/8.0.0_ParallelNetCDF export WGRIB2_ROOT=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/wgrib2 + +module use /usrx/local/dev/modulefiles +module load prod_util/1.1.3 From 9a036a568cd67116d6691d09f019fc73b8a10737 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Mon, 20 Jul 2020 09:25:07 -0400 Subject: [PATCH 025/192] Add processing of climatological Thompson MP tracers to chgres_cube Update chgres_cube to optionally process climatological Thompson MP tracers. To process these tracers, the namelist variable "thomp_mp_climo_file" is set to the path/name of the climo file (netcdf). If variable is not set, the tracers will not be processed. For more details see #106. --- sorc/chgres_cube.fd/CMakeLists.txt | 1 + sorc/chgres_cube.fd/atmosphere.F90 | 273 ++++++++++++++- sorc/chgres_cube.fd/program_setup.f90 | 14 +- .../chgres_cube.fd/thompson_mp_climo_data.F90 | 329 ++++++++++++++++++ sorc/chgres_cube.fd/write_data.F90 | 173 ++++++++- 5 files changed, 780 insertions(+), 10 deletions(-) create mode 100644 sorc/chgres_cube.fd/thompson_mp_climo_data.F90 diff --git a/sorc/chgres_cube.fd/CMakeLists.txt b/sorc/chgres_cube.fd/CMakeLists.txt index d1eb87408..3c5f6f6cc 100644 --- a/sorc/chgres_cube.fd/CMakeLists.txt +++ b/sorc/chgres_cube.fd/CMakeLists.txt @@ -8,6 +8,7 @@ set(fortran_src search_util.f90 static_data.F90 surface.F90 + thompson_mp_climo_data.F90 utils.f90 write_data.F90) diff --git a/sorc/chgres_cube.fd/atmosphere.F90 b/sorc/chgres_cube.fd/atmosphere.F90 index e3cebba4e..03e7e6869 100644 --- a/sorc/chgres_cube.fd/atmosphere.F90 +++ b/sorc/chgres_cube.fd/atmosphere.F90 @@ -49,7 +49,15 @@ module atmosphere use program_setup, only : vcoord_file_target_grid, & regional, & tracers, num_tracers, & - atm_weight_file + atm_weight_file, & + use_thomp_mp_climo + + use thompson_mp_climo_data, only : read_thomp_mp_climo_data, & + cleanup_thomp_mp_climo_input_data, & + qnifa_climo_input_grid, & + qnwfa_climo_input_grid, & + thomp_pres_climo_input_grid, & + lev_thomp_mp_climo implicit none @@ -106,6 +114,26 @@ module atmosphere type(esmf_field), public :: zh_target_grid ! 3-d height +! Fields associated with thompson microphysics climatological tracers. + + type(esmf_field) :: qnifa_climo_b4adj_target_grid + ! number concentration of ice + ! friendly aerosols before vert adj + type(esmf_field), public :: qnifa_climo_target_grid + ! number concentration of ice + ! friendly aerosols on target + ! horiz/vert grid. + type(esmf_field) :: qnwfa_climo_b4adj_target_grid + ! number concentration of water + ! friendly aerosols before vert adj + type(esmf_field), public :: qnwfa_climo_target_grid + ! number concentration of water + ! friendly aerosols on target + ! horiz/vert grid. + type(esmf_field) :: thomp_pres_climo_b4adj_target_grid + ! pressure of each level on + ! target grid + public :: atmosphere_driver contains @@ -388,6 +416,16 @@ subroutine atmosphere_driver(localpet) call convert_winds +!----------------------------------------------------------------------------------- +! If selected, process thompson microphysics climatological fields. +!----------------------------------------------------------------------------------- + + if (use_thomp_mp_climo) then + call read_thomp_mp_climo_data + call horiz_interp_thomp_mp_climo + call vintg_thomp_mp_climo + endif + !----------------------------------------------------------------------------------- ! Write target data to file. !----------------------------------------------------------------------------------- @@ -1115,6 +1153,231 @@ subroutine read_vcoord_info end subroutine read_vcoord_info +!----------------------------------------------------------------------------------- +! Horizontally interpolate thompson microphysics data to the target model grid. +!----------------------------------------------------------------------------------- + + subroutine horiz_interp_thomp_mp_climo + + implicit none + + integer :: isrctermprocessing, rc + + type(esmf_regridmethod_flag) :: method + type(esmf_routehandle) :: regrid_bl + + isrctermprocessing=1 + + print*,"- CALL FieldCreate FOR TARGET GRID THOMP CLIMO QNIFA BEFORE ADJUSTMENT." + qnifa_climo_b4adj_target_grid = ESMF_FieldCreate(target_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_thomp_mp_climo/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- CALL FieldCreate FOR TARGET GRID THOMP CLIMO QNWFA BEFORE ADJUSTMENT." + qnwfa_climo_b4adj_target_grid = ESMF_FieldCreate(target_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_thomp_mp_climo/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- CALL FieldCreate FOR TARGET GRID THOMP CLIMO PRESSURE BEFORE ADJUSTMENT." + thomp_pres_climo_b4adj_target_grid = ESMF_FieldCreate(target_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_thomp_mp_climo/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- CALL FieldCreate FOR TARGET GRID THOMP CLIMO QNIFA." + qnifa_climo_target_grid = ESMF_FieldCreate(target_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_target/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- CALL FieldCreate FOR TARGET GRID THOMP CLIMO QNWFA." + qnwfa_climo_target_grid = ESMF_FieldCreate(target_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_target/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- CALL FieldRegridStore FOR THOMPSON CLIMO FIELDS." + + method=ESMF_REGRIDMETHOD_BILINEAR + + call ESMF_FieldRegridStore(qnifa_climo_input_grid, & + qnifa_climo_b4adj_target_grid, & + polemethod=ESMF_POLEMETHOD_ALLAVG, & + srctermprocessing=isrctermprocessing, & + extrapmethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & + routehandle=regrid_bl, & + regridmethod=method, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldRegridStore", rc) + + print*,"- CALL Field_Regrid FOR THOMP CLIMO QNIFA." + call ESMF_FieldRegrid(qnifa_climo_input_grid, & + qnifa_climo_b4adj_target_grid, & + routehandle=regrid_bl, & + termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldRegrid", rc) + + print*,"- CALL Field_Regrid FOR THOMP CLIMO QNWFA." + call ESMF_FieldRegrid(qnwfa_climo_input_grid, & + qnwfa_climo_b4adj_target_grid, & + routehandle=regrid_bl, & + termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldRegrid", rc) + + print*,"- CALL Field_Regrid FOR THOMP PRESSURE." + call ESMF_FieldRegrid(thomp_pres_climo_input_grid, & + thomp_pres_climo_b4adj_target_grid, & + routehandle=regrid_bl, & + termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldRegrid", rc) + + print*,"- CALL FieldRegridRelease." + call ESMF_FieldRegridRelease(routehandle=regrid_bl, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldRegridRelease", rc) + +!----------------------------------------------------------------------------------- +! Free up input data memory. +!----------------------------------------------------------------------------------- + + call cleanup_thomp_mp_climo_input_data + + end subroutine horiz_interp_thomp_mp_climo + +!----------------------------------------------------------------------------------- +! Vertically interpolate thompson mp climo tracers to the target model levels. +!----------------------------------------------------------------------------------- + + SUBROUTINE VINTG_THOMP_MP_CLIMO + + implicit none + + INTEGER :: CLB(3), CUB(3), RC + INTEGER :: IM, KM1, KM2, NT + INTEGER :: I, J, K + + REAL(ESMF_KIND_R8), ALLOCATABLE :: Z1(:,:,:), Z2(:,:,:) + REAL(ESMF_KIND_R8), ALLOCATABLE :: C1(:,:,:,:),C2(:,:,:,:) + + REAL(ESMF_KIND_R8), POINTER :: QNIFA1PTR(:,:,:) ! input + REAL(ESMF_KIND_R8), POINTER :: QNIFA2PTR(:,:,:) ! target + REAL(ESMF_KIND_R8), POINTER :: QNWFA1PTR(:,:,:) ! input + REAL(ESMF_KIND_R8), POINTER :: QNWFA2PTR(:,:,:) ! target + REAL(ESMF_KIND_R8), POINTER :: P1PTR(:,:,:) ! input pressure + REAL(ESMF_KIND_R8), POINTER :: P2PTR(:,:,:) ! target pressure + + print*,"- VERTICALY INTERPOLATE THOMP MP CLIMO TRACERS." + + print*,"- CALL FieldGet FOR 3-D THOMP PRES." + call ESMF_FieldGet(thomp_pres_climo_b4adj_target_grid, & + computationalLBound=clb, & + computationalUBound=cub, & + farrayPtr=p1ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + +! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +! The '1'/'2' arrays hold fields before/after interpolation. +! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + NT= 2 ! number of thomp tracers + + ALLOCATE(Z1(CLB(1):CUB(1),CLB(2):CUB(2),lev_thomp_mp_climo)) + ALLOCATE(Z2(CLB(1):CUB(1),CLB(2):CUB(2),LEV_TARGET)) + ALLOCATE(C1(CLB(1):CUB(1),CLB(2):CUB(2),lev_thomp_mp_climo,NT)) + ALLOCATE(C2(CLB(1):CUB(1),CLB(2):CUB(2),LEV_TARGET,NT)) + + Z1 = -LOG(P1PTR) + + print*,"- CALL FieldGet FOR 3-D ADJUSTED PRESS" + call ESMF_FieldGet(pres_target_grid, & + farrayPtr=P2PTR, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + Z2 = -LOG(P2PTR) + +!print*,'pres check 1 ', p1ptr(clb(1),clb(2),:) +!print*,'pres check 2 ', p2ptr(clb(1),clb(2),:) + + print*,"- CALL FieldGet FOR qnifa before vertical adjustment." + call ESMF_FieldGet(qnifa_climo_b4adj_target_grid, & + farrayPtr=QNIFA1PTR, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + C1(:,:,:,1) = QNIFA1PTR(:,:,:) + + print*,"- CALL FieldGet FOR qnwfa before vertical adjustment." + call ESMF_FieldGet(qnwfa_climo_b4adj_target_grid, & + farrayPtr=QNWFA1PTR, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + C1(:,:,:,2) = QNWFA1PTR(:,:,:) + +! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +! PERFORM LAGRANGIAN ONE-DIMENSIONAL INTERPOLATION +! THAT IS 4TH-ORDER IN INTERIOR, 2ND-ORDER IN OUTSIDE INTERVALS +! AND 1ST-ORDER FOR EXTRAPOLATION. +! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + IM = (CUB(1)-CLB(1)+1) * (CUB(2)-CLB(2)+1) + KM1= LEV_THOMP_MP_CLIMO + KM2= LEV_TARGET + + CALL TERP3(IM,1,1,1,1,NT,(IM*KM1),(IM*KM2), & + KM1,IM,IM,Z1,C1,KM2,IM,IM,Z2,C2) + + print*,"- CALL FieldGet FOR ADJUSTED climo qnifa." + call ESMF_FieldGet(qnifa_climo_target_grid, & + farrayPtr=QNIFA2PTR, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR ADJUSTED climo qnwfa." + call ESMF_FieldGet(qnwfa_climo_target_grid, & + farrayPtr=QNWFA2PTR, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + DO K=1,LEV_TARGET + DO I=CLB(1),CUB(1) + DO J=CLB(2),CUB(2) + QNIFA2PTR(I,J,K) = C2(I,J,K,1) + QNWFA2PTR(I,J,K) = C2(I,J,K,2) + ENDDO + ENDDO + ENDDO + + DEALLOCATE (Z1, Z2, C1, C2) + + call ESMF_FieldDestroy(qnifa_climo_b4adj_target_grid, rc=rc) + call ESMF_FieldDestroy(qnwfa_climo_b4adj_target_grid, rc=rc) + call ESMF_FieldDestroy(thomp_pres_climo_b4adj_target_grid, rc=rc) + + END SUBROUTINE VINTG_THOMP_MP_CLIMO + SUBROUTINE VINTG !$$$ SUBPROGRAM DOCUMENTATION BLOCK ! @@ -1784,6 +2047,14 @@ subroutine cleanup_target_atm_data deallocate(tracers_target_grid) + if (ESMF_FieldIsCreated(qnifa_climo_target_grid)) then + call ESMF_FieldDestroy(qnifa_climo_target_grid, rc=rc) + endif + + if (ESMF_FieldIsCreated(qnwfa_climo_target_grid)) then + call ESMF_FieldDestroy(qnwfa_climo_target_grid, rc=rc) + endif + end subroutine cleanup_target_atm_data end module atmosphere diff --git a/sorc/chgres_cube.fd/program_setup.f90 b/sorc/chgres_cube.fd/program_setup.f90 index fb38e362d..ed6935457 100644 --- a/sorc/chgres_cube.fd/program_setup.f90 +++ b/sorc/chgres_cube.fd/program_setup.f90 @@ -92,6 +92,8 @@ module program_setup ! satpsi_target Saturated soil potential, target grid ! sfc_files_input_grid File names containing input surface data. ! Not used for 'grib2' input type. +! thomp_mp_climo_file Path/name to the Thompson MP climatology +! file. ! tracers Name of each atmos tracer to be processed. ! These names will be used to identify ! the tracer records in the output files. @@ -99,6 +101,9 @@ module program_setup ! tracers_input Name of each atmos tracer record in ! the input file. May be different from ! value in 'tracers'. +! use_thomp_mp_climo When true, read and process Thompson +! MP climatological tracers. False, +! when 'thomp_mp_climo_file' is NULL. ! vcoord_file_target_grid Vertical coordinate definition file ! wltsmc_input/target Wilting point soil moisture content ! input/target grids @@ -125,6 +130,7 @@ module program_setup character(len=500), public :: orog_files_target_grid(6) = "NULL" character(len=500), public :: sfc_files_input_grid(6) = "NULL" character(len=500), public :: vcoord_file_target_grid = "NULL" + character(len=500), public :: thomp_mp_climo_file= "NULL" character(len=6), public :: cres_target_grid = "NULL" character(len=500), public :: atm_weight_file="NULL" character(len=25), public :: input_type="restart" @@ -153,6 +159,7 @@ module program_setup logical, public :: convert_nst = .false. logical, public :: convert_sfc = .false. + logical, public :: use_thomp_mp_climo=.false. real, allocatable, public :: drysmc_input(:), drysmc_target(:) real, allocatable, public :: maxsmc_input(:), maxsmc_target(:) @@ -201,7 +208,7 @@ subroutine read_setup_namelist atm_weight_file, tracers, & tracers_input,phys_suite, & halo_bndy, & - halo_blend + halo_blend, thomp_mp_climo_file print*,"- READ SETUP NAMELIST" @@ -287,6 +294,11 @@ subroutine read_setup_namelist call error_handler("UNRECOGNIZED INPUT DATA TYPE.", 1) end select + if (trim(thomp_mp_climo_file) /= "NULL") then + use_thomp_mp_climo=.true. + print*,"- WILL PROCESS CLIMO THOMPSON MP TRACERS FROM FILE: ", trim(thomp_mp_climo_file) + endif + end subroutine read_setup_namelist subroutine read_varmap diff --git a/sorc/chgres_cube.fd/thompson_mp_climo_data.F90 b/sorc/chgres_cube.fd/thompson_mp_climo_data.F90 new file mode 100644 index 000000000..82104324a --- /dev/null +++ b/sorc/chgres_cube.fd/thompson_mp_climo_data.F90 @@ -0,0 +1,329 @@ + module thompson_mp_climo_data + +!----------------------------------------------------------------------------------- +! Module to read the Thompson climatological MP data file and set up the +! associated esmf field and grid objects. +!----------------------------------------------------------------------------------- + + use esmf + use netcdf + use program_setup, only : cycle_mon, cycle_day, cycle_hour, & + thomp_mp_climo_file + + implicit none + + private + + integer :: i_thomp_mp_climo + integer :: j_thomp_mp_climo + integer, public :: lev_thomp_mp_climo + + type(esmf_grid) :: thomp_mp_climo_grid + + type(esmf_field), public :: qnifa_climo_input_grid + type(esmf_field), public :: qnwfa_climo_input_grid + type(esmf_field), public :: thomp_pres_climo_input_grid + + public :: read_thomp_mp_climo_data + public :: cleanup_thomp_mp_climo_input_data + + contains + +!----------------------------------------------------------------------------------- +! Read Thompson climatological MP data file and time interpolate data to current +! cycle time. +!----------------------------------------------------------------------------------- + + subroutine read_thomp_mp_climo_data + + implicit none + + integer :: error, ncid, rc, clb(2), cub(2) + integer :: i, j, localpet, npets, id_var + integer :: jda(8), jdow, jdoy, jday, id_dim + integer :: mm, mmm, mmp, mon1, mon2 + + real(esmf_kind_r8), allocatable :: dummy3d(:,:,:) + real(esmf_kind_r8), allocatable :: dummy3d_mon1(:,:,:) + real(esmf_kind_r8), allocatable :: dummy3d_mon2(:,:,:) + real(esmf_kind_r8), pointer :: lat_ptr(:,:), lon_ptr(:,:) + real(esmf_kind_r8), allocatable :: lons(:), lats(:) + real :: rjday, dayhf(13), wei1m, wei2m + + type(esmf_vm) :: vm + + type(esmf_polekind_flag) :: polekindflag(2) + + data dayhf/ 15.5, 45.0, 74.5,105.0,135.5,166.0, & + 196.5,227.5,258.0,288.5,319.0,349.5,380.5/ + +!----------------------------------------------------------------------------------- +! Open the file and read the grid dimensions and latitude/longitude. +!----------------------------------------------------------------------------------- + + print*,"- READ THOMP_MP_CLIMO_FILE: ", trim(thomp_mp_climo_file) + error=nf90_open(trim(thomp_mp_climo_file),nf90_nowrite,ncid) + call netcdf_err(error, 'opening: '//trim(thomp_mp_climo_file) ) + + error=nf90_inq_dimid(ncid, 'lat', id_dim) + call netcdf_err(error, 'reading lat id') + error=nf90_inquire_dimension(ncid,id_dim,len=j_thomp_mp_climo) + call netcdf_err(error, 'reading lat') + + error=nf90_inq_dimid(ncid, 'lon', id_dim) + call netcdf_err(error, 'reading lon id') + error=nf90_inquire_dimension(ncid,id_dim,len=i_thomp_mp_climo) + call netcdf_err(error, 'reading lon') + + error=nf90_inq_dimid(ncid, 'plev', id_dim) + call netcdf_err(error, 'reading plev id') + error=nf90_inquire_dimension(ncid,id_dim,len=lev_thomp_mp_climo) + call netcdf_err(error, 'reading plev') + + allocate(lons(i_thomp_mp_climo)) + allocate(lats(j_thomp_mp_climo)) + error=nf90_inq_varid(ncid, 'lon', id_var) + call netcdf_err(error, 'reading lon field id' ) + error=nf90_get_var(ncid, id_var, lons) + call netcdf_err(error, 'reading grid longitude' ) + error=nf90_inq_varid(ncid, 'lat', id_var) + call netcdf_err(error, 'reading lat field id' ) + error=nf90_get_var(ncid, id_var, lats) + call netcdf_err(error, 'reading grid latitude' ) + +!----------------------------------------------------------------------------------- +! Now that we have the grid information, create the esmf grid object. +!----------------------------------------------------------------------------------- + + print*,"- CALL VMGetGlobal" + call ESMF_VMGetGlobal(vm, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN VMGetGlobal", rc) + + print*,"- CALL VMGet" + call ESMF_VMGet(vm, localPet=localpet, petCount=npets, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN VMGet", rc) + + polekindflag(1:2) = ESMF_POLEKIND_MONOPOLE + + print*,"- CALL GridCreate1PeriDim FOR THOMP MP CLIMO GRID." + thomp_mp_climo_grid = ESMF_GridCreate1PeriDim(minIndex=(/1,1/), & + maxIndex=(/i_thomp_mp_climo,j_thomp_mp_climo/), & + polekindflag=polekindflag, & + periodicDim=1, & + poleDim=2, & + coordSys=ESMF_COORDSYS_SPH_DEG, & + regDecomp=(/1,npets/), & + indexflag=ESMF_INDEX_GLOBAL, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridCreate1PeriDim", rc) + + print*,"- CALL GridAddCoord FOR THOMP MP CLIMO GRID." + call ESMF_GridAddCoord(thomp_mp_climo_grid, & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridAddCoord", rc) + +!----------------------------------------------------------------------------------- +! Set the grid object lat/lon. +!----------------------------------------------------------------------------------- + + print*,"- CALL GridGetCoord FOR INPUT GRID X-COORD." + nullify(lon_ptr) + call ESMF_GridGetCoord(thomp_mp_climo_grid, & + staggerLoc=ESMF_STAGGERLOC_CENTER, & + coordDim=1, & + farrayPtr=lon_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridGetCoord", rc) + + print*,"- CALL GridGetCoord FOR INPUT GRID Y-COORD." + nullify(lat_ptr) + call ESMF_GridGetCoord(thomp_mp_climo_grid, & + staggerLoc=ESMF_STAGGERLOC_CENTER, & + coordDim=2, & + computationalLBound=clb, & + computationalUBound=cub, & + farrayPtr=lat_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridGetCoord", rc) + + do i = clb(1), cub(1) + lon_ptr(i,:) = lons(i) + enddo + + do j = clb(2), cub(2) + lat_ptr(:,j) = lats(j) + enddo + +!----------------------------------------------------------------------------------- +! Create esmf fields for the two tracers and 3-d pressure. +!----------------------------------------------------------------------------------- + + print*,"- CALL FieldCreate FOR QNIFA INPUT CLIMO." + qnifa_climo_input_grid = ESMF_FieldCreate(thomp_mp_climo_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_thomp_mp_climo/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- CALL FieldCreate FOR QNWFA INPUT CLIMO." + qnwfa_climo_input_grid = ESMF_FieldCreate(thomp_mp_climo_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_thomp_mp_climo/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- CALL FieldCreate FOR THOMP PRESS CLIMO." + thomp_pres_climo_input_grid = ESMF_FieldCreate(thomp_mp_climo_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lev_thomp_mp_climo/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + +!----------------------------------------------------------------------------------- +! Data are monthly and valid at the 15th of the month. Compute time interpolation +! weights for the current cycle. +!----------------------------------------------------------------------------------- + + jda=0 + jda(1) = 2007 + if (cycle_mon == 2 .and. cycle_day == 29) then ! leap year + jda(2) = 3 + jda(3) = 1 + else + jda(2) = cycle_mon + jda(3) = cycle_day + endif + + jda(5) = cycle_hour + jdow = 0 + jdoy = 0 + jday = 0 + call w3doxdat(jda,jdow,jdoy,jday) + rjday = float(jdoy) + float(jda(5)) / 24. + if(rjday < dayhf(1)) rjday = rjday + 365. + + do mm=1,12 + mmm = mm + mmp = mm + 1 + if(rjday >= dayhf(mmm) .and. rjday < dayhf(mmp)) then + mon1 = mmm + mon2 = mmp + exit + endif + enddo + + wei1m = (dayhf(mon2)-rjday)/(dayhf(mon2)-dayhf(mon1)) + wei2m = 1.0 - wei1m + + if (mon2==13) mon2=1 + + print*,"- BOUNDING MONTHS AND INTERPOLATION WEIGHTS: ", mon1, wei1m, mon2, wei2m + +!----------------------------------------------------------------------------------- +! Read tracers and 3-d pressure for each bounding month. Then linearly +! interpolate in time. +!----------------------------------------------------------------------------------- + + if (localpet == 0) then + allocate(dummy3d(i_thomp_mp_climo, j_thomp_mp_climo, lev_thomp_mp_climo)) + dummy3d = 0.0 + allocate(dummy3d_mon1(i_thomp_mp_climo, j_thomp_mp_climo, lev_thomp_mp_climo)) + dummy3d_mon1 = 0.0 + allocate(dummy3d_mon2(i_thomp_mp_climo, j_thomp_mp_climo, lev_thomp_mp_climo)) + dummy3d_mon2 = 0.0 + else + allocate(dummy3d(0,0,0)) + allocate(dummy3d_mon1(0,0,0)) + allocate(dummy3d_mon2(0,0,0)) + endif + + if (localpet == 0) then + print*,"- READ QNIFA FOR BOUNDING MONTH 1" + error=nf90_inq_varid(ncid, 'nifa', id_var) + call netcdf_err(error, 'reading nifa field id' ) + error=nf90_get_var(ncid, id_var, dummy3d_mon1, start=(/1,1,1,mon1/), & + count=(/i_thomp_mp_climo,j_thomp_mp_climo,lev_thomp_mp_climo,1/) ) + call netcdf_err(error, 'reading nifa month1 field' ) + print*,"- READ QNIFA FOR BOUNDING MONTH 2" + error=nf90_get_var(ncid, id_var, dummy3d_mon2, start=(/1,1,1,mon2/), & + count=(/i_thomp_mp_climo,j_thomp_mp_climo,lev_thomp_mp_climo,1/) ) + call netcdf_err(error, 'reading nifa month2 field' ) + dummy3d(:,:,:) = wei1m * dummy3d_mon1 + wei2m * dummy3d_mon2 + endif + + print*,"- CALL FieldScatter FOR qnifa input climo." + call ESMF_FieldScatter(qnifa_climo_input_grid, dummy3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ QNWFA FOR BOUNDING MONTH 1" + error=nf90_inq_varid(ncid, 'nwfa', id_var) + call netcdf_err(error, 'reading nwfa field id' ) + error=nf90_get_var(ncid, id_var, dummy3d_mon1, start=(/1,1,1,mon1/), & + count=(/i_thomp_mp_climo,j_thomp_mp_climo,lev_thomp_mp_climo,1/) ) + call netcdf_err(error, 'reading nwfa month1 field' ) + print*,"- READ QNWFA FOR BOUNDING MONTH 2" + error=nf90_get_var(ncid, id_var, dummy3d_mon2, start=(/1,1,1,mon2/), & + count=(/i_thomp_mp_climo,j_thomp_mp_climo,lev_thomp_mp_climo,1/) ) + call netcdf_err(error, 'reading nwfa month2 field' ) + dummy3d(:,:,:) = wei1m * dummy3d_mon1 + wei2m * dummy3d_mon2 + endif + + print*,"- CALL FieldScatter FOR qnwfa input climo." + call ESMF_FieldScatter(qnwfa_climo_input_grid, dummy3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ PRESSURE FOR BOUNDING MONTH 1" + error=nf90_inq_varid(ncid, 'prs', id_var) + call netcdf_err(error, 'reading prs field id' ) + error=nf90_get_var(ncid, id_var, dummy3d_mon1, start=(/1,1,1,mon1/), & + count=(/i_thomp_mp_climo,j_thomp_mp_climo,lev_thomp_mp_climo,1/) ) + call netcdf_err(error, 'reading prs month1 field' ) + print*,"- READ PRESSURE FOR BOUNDING MONTH 2" + error=nf90_get_var(ncid, id_var, dummy3d_mon2, start=(/1,1,1,mon2/), & + count=(/i_thomp_mp_climo,j_thomp_mp_climo,lev_thomp_mp_climo,1/) ) + call netcdf_err(error, 'reading prs month2 field' ) + dummy3d(:,:,:) = wei1m * dummy3d_mon1 + wei2m * dummy3d_mon2 + endif + + print*,"- CALL FieldScatter FOR thomp press." + call ESMF_FieldScatter(thomp_pres_climo_input_grid, dummy3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + error=nf90_close(ncid) + + deallocate(lons, lats, dummy3d, dummy3d_mon1, dummy3d_mon2) + + end subroutine read_thomp_mp_climo_data + +!----------------------------------------------------------------------------------- +! Cleanup routine +!----------------------------------------------------------------------------------- + + subroutine cleanup_thomp_mp_climo_input_data + + implicit none + + integer :: rc + + call ESMF_GridDestroy(thomp_mp_climo_grid, rc=rc) + call ESMF_FieldDestroy(thomp_pres_climo_input_grid, rc=rc) + call ESMF_FieldDestroy(qnifa_climo_input_grid, rc=rc) + call ESMF_FieldDestroy(qnwfa_climo_input_grid, rc=rc) + + end subroutine cleanup_thomp_mp_climo_input_data + + end module thompson_mp_climo_data diff --git a/sorc/chgres_cube.fd/write_data.F90 b/sorc/chgres_cube.fd/write_data.F90 index 5d11f67eb..0e04e7330 100644 --- a/sorc/chgres_cube.fd/write_data.F90 +++ b/sorc/chgres_cube.fd/write_data.F90 @@ -27,7 +27,7 @@ subroutine write_fv3_atm_header_netcdf(localpet) vcoord_target, & levp1_target - use program_setup, only : num_tracers + use program_setup, only : num_tracers, use_thomp_mp_climo implicit none @@ -39,6 +39,7 @@ subroutine write_fv3_atm_header_netcdf(localpet) integer :: header_buffer_val = 16384 integer :: error, ncid, dim_nvcoord integer :: dim_levp1, id_ntrac, id_vcoord + integer :: num_tracers_output real(kind=esmf_kind_r8), allocatable :: tmp(:,:) @@ -67,7 +68,9 @@ subroutine write_fv3_atm_header_netcdf(localpet) error = nf90_enddef(ncid, header_buffer_val,4,0,4) call netcdf_err(error, 'end meta define for file='//trim(outfile) ) - error = nf90_put_var( ncid, id_ntrac, num_tracers) + num_tracers_output = num_tracers + if (use_thomp_mp_climo) num_tracers_output = num_tracers + 2 + error = nf90_put_var( ncid, id_ntrac, num_tracers_output) call netcdf_err(error, 'write var ntrac for file='//trim(outfile) ) allocate(tmp(levp1_target, nvcoord_target)) @@ -111,12 +114,15 @@ subroutine write_fv3_atm_bndy_data_netcdf(localpet) u_w_target_grid, & v_w_target_grid, & temp_target_grid, & - zh_target_grid + zh_target_grid, & + qnifa_climo_target_grid, & + qnwfa_climo_target_grid use model_grid, only : i_target, ip1_target, j_target, jp1_target use program_setup, only : halo_bndy, halo_blend, & - input_type, tracers, num_tracers + input_type, tracers, num_tracers, & + use_thomp_mp_climo implicit none @@ -136,6 +142,10 @@ subroutine write_fv3_atm_bndy_data_netcdf(localpet) integer :: id_i_top, id_j_top integer :: id_i_right, id_j_right integer :: id_i_left, id_j_left + integer :: id_qnifa_bottom, id_qnifa_top + integer :: id_qnifa_right, id_qnifa_left + integer :: id_qnwfa_bottom, id_qnwfa_top + integer :: id_qnwfa_right, id_qnwfa_left integer :: id_ps_bottom, id_ps_top integer :: id_ps_right, id_ps_left integer :: id_t_bottom, id_t_top @@ -342,6 +352,50 @@ subroutine write_fv3_atm_bndy_data_netcdf(localpet) enddo + if (use_thomp_mp_climo) then + + name = "ice_aero_bottom" + error = nf90_def_var(ncid, name, NF90_FLOAT, & + (/dim_lon, dim_halo, dim_lev/), id_qnifa_bottom) + call netcdf_err(error, 'DEFINING QNIFA_BOTTOM') + + name = "ice_aero_top" + error = nf90_def_var(ncid, name, NF90_FLOAT, & + (/dim_lon, dim_halo, dim_lev/), id_qnifa_top) + call netcdf_err(error, 'DEFINING QNIFA_TOP') + + name = "ice_aero_right" + error = nf90_def_var(ncid, name, NF90_FLOAT, & + (/dim_halo, dim_lat, dim_lev/), id_qnifa_right) + call netcdf_err(error, 'DEFINING QNIFA_RIGHT') + + name = "ice_aero_left" + error = nf90_def_var(ncid, name, NF90_FLOAT, & + (/dim_halo, dim_lat, dim_lev/), id_qnifa_left) + call netcdf_err(error, 'DEFINING QNIFA_LEFT') + + name = "liq_aero_bottom" + error = nf90_def_var(ncid, name, NF90_FLOAT, & + (/dim_lon, dim_halo, dim_lev/), id_qnwfa_bottom) + call netcdf_err(error, 'DEFINING QNWFA_BOTTOM') + + name = "liq_aero_top" + error = nf90_def_var(ncid, name, NF90_FLOAT, & + (/dim_lon, dim_halo, dim_lev/), id_qnwfa_top) + call netcdf_err(error, 'DEFINING QNWFA_TOP') + + name = "liq_aero_right" + error = nf90_def_var(ncid, name, NF90_FLOAT, & + (/dim_halo, dim_lat, dim_lev/), id_qnwfa_right) + call netcdf_err(error, 'DEFINING QNWFA_RIGHT') + + name = "liq_aero_left" + error = nf90_def_var(ncid, name, NF90_FLOAT, & + (/dim_halo, dim_lat, dim_lev/), id_qnwfa_left) + call netcdf_err(error, 'DEFINING QNWFA_LEFT') + + endif + error = nf90_def_var(ncid, 'i_w_bottom', NF90_INT, & (/dim_lonp/), id_i_w_bottom) call netcdf_err(error, 'DEFINING I_W_BOTTOM') @@ -758,6 +812,58 @@ subroutine write_fv3_atm_bndy_data_netcdf(localpet) call netcdf_err(error, 'WRITING T RIGHT' ) endif + if (use_thomp_mp_climo) then + + print*,"- CALL FieldGather FOR TARGET GRID CLIMO QNIFA FOR TILE: ", tile + call ESMF_FieldGather(qnifa_climo_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + + if (localpet == 0) then + dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:) + dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1) + error = nf90_put_var( ncid, id_qnifa_top, dum3d_top) + call netcdf_err(error, 'WRITING QNIFA CLIMO TOP' ) + dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:) + dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1) + error = nf90_put_var( ncid, id_qnifa_bottom, dum3d_bottom) + call netcdf_err(error, 'WRITING QNIFA CLIMO BOTTOM' ) + dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:) + dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1) + error = nf90_put_var( ncid, id_qnifa_left, dum3d_left) + call netcdf_err(error, 'WRITING QNIFA CLIMO LEFT' ) + dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:) + dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1) + error = nf90_put_var( ncid, id_qnifa_right, dum3d_right) + call netcdf_err(error, 'WRITING QNIFA CLIMO RIGHT' ) + endif + + print*,"- CALL FieldGather FOR TARGET GRID CLIMO QNWFA FOR TILE: ", tile + call ESMF_FieldGather(qnwfa_climo_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + + if (localpet == 0) then + dum3d_top(:,:,:) = data_one_tile_3d(i_start_top:i_end_top,j_start_top:j_end_top,:) + dum3d_top(:,:,1:lev_target) = dum3d_top(:,:,lev_target:1:-1) + error = nf90_put_var( ncid, id_qnwfa_top, dum3d_top) + call netcdf_err(error, 'WRITING QNWFA CLIMO TOP' ) + dum3d_bottom(:,:,:) = data_one_tile_3d(i_start_bottom:i_end_bottom,j_start_bottom:j_end_bottom,:) + dum3d_bottom(:,:,1:lev_target) = dum3d_bottom(:,:,lev_target:1:-1) + error = nf90_put_var( ncid, id_qnwfa_bottom, dum3d_bottom) + call netcdf_err(error, 'WRITING QNWFA CLIMO BOTTOM' ) + dum3d_left(:,:,:) = data_one_tile_3d(i_start_left:i_end_left,j_start_left:j_end_left,:) + dum3d_left(:,:,1:lev_target) = dum3d_left(:,:,lev_target:1:-1) + error = nf90_put_var( ncid, id_qnwfa_left, dum3d_left) + call netcdf_err(error, 'WRITING QNWFA CLIMO LEFT' ) + dum3d_right(:,:,:) = data_one_tile_3d(i_start_right:i_end_right,j_start_right:j_end_right,:) + dum3d_right(:,:,1:lev_target) = dum3d_right(:,:,lev_target:1:-1) + error = nf90_put_var( ncid, id_qnwfa_right, dum3d_right) + call netcdf_err(error, 'WRITING QNWFA CLIMO RIGHT' ) + endif + + endif + deallocate(dum3d_top, dum3d_bottom, dum3d_left, dum3d_right, data_one_tile_3d) !--------------------------------------------------------------------------- @@ -1091,13 +1197,16 @@ subroutine write_fv3_atm_data_netcdf(localpet) use netcdf use program_setup, only : halo=>halo_bndy, & - input_type, tracers, num_tracers + input_type, tracers, num_tracers, & + use_thomp_mp_climo use atmosphere, only : lev_target, & levp1_target, & ps_target_grid, & zh_target_grid, & dzdt_target_grid, & + qnifa_climo_target_grid, & + qnwfa_climo_target_grid, & tracers_target_grid, & temp_target_grid, & delp_target_grid, & @@ -1134,11 +1243,11 @@ subroutine write_fv3_atm_data_netcdf(localpet) integer :: id_lat_w, id_lon_w integer :: id_w, id_zh, id_u_w integer :: id_v_w, id_u_s, id_v_s - integer :: id_t, id_delp + integer :: id_t, id_delp, id_qnifa, id_qnwfa integer :: i_start, i_end, j_start, j_end integer :: i_target_out, j_target_out integer :: ip1_target_out, jp1_target_out - integer :: ip1_end, jp1_end + integer :: ip1_end, jp1_end, num_tracers_output real(esmf_kind_r8), allocatable :: data_one_tile(:,:) real(esmf_kind_r8), allocatable :: data_one_tile_3d(:,:,:) @@ -1194,7 +1303,9 @@ subroutine write_fv3_atm_data_netcdf(localpet) call netcdf_err(error, 'DEFINING LEV DIMENSION' ) error = nf90_def_dim(ncid, 'levp', levp1_target, dim_levp1) call netcdf_err(error, 'DEFINING LEVP DIMENSION' ) - error = nf90_def_dim(ncid, 'ntracer', num_tracers, dim_ntracer) + num_tracers_output = num_tracers + if (use_thomp_mp_climo) num_tracers_output = num_tracers + 2 + error = nf90_def_dim(ncid, 'ntracer', num_tracers_output, dim_ntracer) call netcdf_err(error, 'DEFINING NTRACER DIMENSION' ) !--- define global attributes @@ -1289,6 +1400,18 @@ subroutine write_fv3_atm_data_netcdf(localpet) call netcdf_err(error, 'DEFINING TRACERS COORD' ) enddo + if (use_thomp_mp_climo) then + error = nf90_def_var(ncid, 'ice_aero', NF90_FLOAT, (/dim_lon,dim_lat,dim_lev/), id_qnifa) + call netcdf_err(error, 'DEFINING QNIFA' ) + error = nf90_put_att(ncid, id_qnifa, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING QNIFA COORD' ) + + error = nf90_def_var(ncid, 'liq_aero', NF90_FLOAT, (/dim_lon,dim_lat,dim_lev/), id_qnwfa) + call netcdf_err(error, 'DEFINING QNWFA' ) + error = nf90_put_att(ncid, id_qnwfa, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING QNWFA COORD' ) + endif + error = nf90_def_var(ncid, 'u_w', NF90_FLOAT, (/dim_lonp,dim_lat,dim_lev/), id_u_w) call netcdf_err(error, 'DEFINING U_W' ) error = nf90_put_att(ncid, id_u_w, "coordinates", "geolon_w geolat_w") @@ -1463,6 +1586,40 @@ subroutine write_fv3_atm_data_netcdf(localpet) enddo +! qnifa + + if (use_thomp_mp_climo) then + do tile = 1, num_tiles_target_grid + print*,"- CALL FieldGather FOR TARGET GRID QNIFA FOR TILE: ", tile + call ESMF_FieldGather(qnifa_climo_target_grid, data_one_tile_3d, rootPet=tile-1, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + enddo + + if (localpet < num_tiles_target_grid) then + dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:) + dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1) + error = nf90_put_var( ncid, id_qnifa, dum3d) + call netcdf_err(error, 'WRITING QNIFA RECORD' ) + endif + +! qnwfa + + do tile = 1, num_tiles_target_grid + print*,"- CALL FieldGather FOR TARGET GRID QNWFA FOR TILE: ", tile + call ESMF_FieldGather(qnwfa_climo_target_grid, data_one_tile_3d, rootPet=tile-1, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + enddo + + if (localpet < num_tiles_target_grid) then + dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:) + dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1) + error = nf90_put_var( ncid, id_qnwfa, dum3d) + call netcdf_err(error, 'WRITING QNWFA RECORD' ) + endif + endif + deallocate(dum3d, data_one_tile_3d) ! lat/lon_s From 2d2c3387b8fb36159c14ecd6145e178564a41db8 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Mon, 27 Jul 2020 13:55:29 -0400 Subject: [PATCH 026/192] feature/cmakemod This commit references #122 (#124) Point to develop of the authoritative repo. --- .gitmodules | 2 +- cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 5db8ad97a..5efb05cac 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "cmake"] path = cmake url = https://github.com/NOAA-EMC/CMakeModules - branch = release/public-v1 + branch = develop diff --git a/cmake b/cmake index f38685844..ff93c2d2c 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit f38685844f8a92defd7c7fb811befe71a2c954f5 +Subproject commit ff93c2d2ca7df9e8ba6372b70f5d58110c9210f1 From 7371edaf3b7c94b5557c254296e1d17a68f7c5b1 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Thu, 13 Aug 2020 12:11:51 -0400 Subject: [PATCH 027/192] Add extended Schmidt gnomonic grid capability Add capability to create regional extended Schmidt gnomonic grids (from Jim Purser). Includes new program to compute the global equivalent resolution for a regional grid (from Gerard). Move programs filter_topo, global_equiv_resol, regional_esg_grid and shave from fre-nctools.fd to its own directory. fre-nctools.fd should only contain the GFDL tools. For details, see #4 and #125 --- driver_scripts/driver_grid.cray.sh | 42 +- driver_scripts/driver_grid.dell.sh | 42 +- driver_scripts/driver_grid.hera.sh | 42 +- driver_scripts/driver_grid.jet.sh | 46 +- reg_tests/grid_gen/c96.uniform.sh | 2 +- reg_tests/grid_gen/driver.cray.sh | 9 +- reg_tests/grid_gen/driver.dell.sh | 8 +- reg_tests/grid_gen/driver.hera.sh | 6 +- reg_tests/grid_gen/driver.jet.sh | 6 +- .../{c96.regional.sh => gfdl.regional.sh} | 20 +- sorc/CMakeLists.txt | 1 + sorc/fre-nctools.fd/CMakeLists.txt | 2 - sorc/grid_tools.fd/CMakeLists.txt | 4 + .../filter_topo.fd}/CMakeLists.txt | 0 .../filter_topo.fd}/filter_topo.F90 | 70 +- .../global_equiv_resol.fd/CMakeLists.txt | 10 + .../global_equiv_resol.f90 | 185 ++ .../regional_esg_grid.fd/CMakeLists.txt | 20 + .../regional_esg_grid.fd/pesg.f90 | 1846 +++++++++++++++ .../regional_esg_grid.fd/pfun.f90 | 283 +++ .../regional_esg_grid.fd/pietc.f90 | 96 + .../regional_esg_grid.fd/pietc_s.f90 | 95 + .../regional_esg_grid.fd/pkind.f90 | 13 + .../regional_esg_grid.fd/pmat.f90 | 1097 +++++++++ .../regional_esg_grid.fd/pmat2.f90 | 1267 ++++++++++ .../regional_esg_grid.fd/pmat4.f90 | 2060 +++++++++++++++++ .../regional_esg_grid.fd/pmat5.f90 | 987 ++++++++ .../regional_esg_grid.fd/psym2.f90 | 462 ++++ .../regional_esg_grid.f90 | 180 ++ .../shave.fd/CMakeLists.txt | 0 .../shave.fd/shave_nc.F90 | 0 ush/fv3gfs_driver_grid.sh | 252 +- ush/fv3gfs_filter_topo.sh | 33 +- ush/fv3gfs_make_grid.sh | 113 +- ush/fv3gfs_make_orog.sh | 5 +- 35 files changed, 9057 insertions(+), 247 deletions(-) rename reg_tests/grid_gen/{c96.regional.sh => gfdl.regional.sh} (79%) create mode 100644 sorc/grid_tools.fd/CMakeLists.txt rename sorc/{fre-nctools.fd/tools/filter_topo => grid_tools.fd/filter_topo.fd}/CMakeLists.txt (100%) rename sorc/{fre-nctools.fd/tools/filter_topo => grid_tools.fd/filter_topo.fd}/filter_topo.F90 (97%) create mode 100644 sorc/grid_tools.fd/global_equiv_resol.fd/CMakeLists.txt create mode 100644 sorc/grid_tools.fd/global_equiv_resol.fd/global_equiv_resol.f90 create mode 100644 sorc/grid_tools.fd/regional_esg_grid.fd/CMakeLists.txt create mode 100644 sorc/grid_tools.fd/regional_esg_grid.fd/pesg.f90 create mode 100644 sorc/grid_tools.fd/regional_esg_grid.fd/pfun.f90 create mode 100644 sorc/grid_tools.fd/regional_esg_grid.fd/pietc.f90 create mode 100644 sorc/grid_tools.fd/regional_esg_grid.fd/pietc_s.f90 create mode 100644 sorc/grid_tools.fd/regional_esg_grid.fd/pkind.f90 create mode 100644 sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 create mode 100644 sorc/grid_tools.fd/regional_esg_grid.fd/pmat2.f90 create mode 100644 sorc/grid_tools.fd/regional_esg_grid.fd/pmat4.f90 create mode 100644 sorc/grid_tools.fd/regional_esg_grid.fd/pmat5.f90 create mode 100644 sorc/grid_tools.fd/regional_esg_grid.fd/psym2.f90 create mode 100644 sorc/grid_tools.fd/regional_esg_grid.fd/regional_esg_grid.f90 rename sorc/{fre-nctools.fd/tools => grid_tools.fd}/shave.fd/CMakeLists.txt (100%) rename sorc/{fre-nctools.fd/tools => grid_tools.fd}/shave.fd/shave_nc.F90 (100%) diff --git a/driver_scripts/driver_grid.cray.sh b/driver_scripts/driver_grid.cray.sh index f0defe5b3..2abe26f72 100755 --- a/driver_scripts/driver_grid.cray.sh +++ b/driver_scripts/driver_grid.cray.sh @@ -33,19 +33,24 @@ # "uniform" - global uniform grid # "stretch" - global stretched grid # "nest" - global stretched grid with nest -# "regional" - stand-alone regional grid +# "regional_gfdl" - stand-alone gfdl regional grid +# "regional_esg" - stand-alone extended Schmidt gnomonic +# (esg) regional grid # 3) For "stretch" and "nest" grids, set the stretching factor - # "stretch_fac", and center lat/lon of highest resolution # tile - "target_lat" and "target_lon". # 4) For "nest" grids, set the refinement ratio - "refine_ratio", # the starting/ending i/j index location within the parent # tile - "istart_nest", "jstart_nest", "iend_nest", "jend_nest" -# 5) For "regional" grids, set the "halo". Default is three +# 5) For "regional_gfdl" grids, set the "halo". Default is three # rows/columns. -# 6) Set working directory - TMPDIR - and path to the repository +# 6) For "regional_esg" grids, set center lat/lon of grid, +# - "target_lat/lon" - the i/j dimensions - "i/jdim", the +# x/y grid spacing - "delx/y", and halo. +# 7) Set working directory - TMPDIR - and path to the repository # clone - home_dir. -# 7) Submit script: "cat $script | bsub". -# 8) All files will be placed in "out_dir". +# 8) Submit script: "cat $script | bsub". +# 9) All files will be placed in "out_dir". # #----------------------------------------------------------------------- @@ -57,14 +62,18 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export res=96 -export gtype=regional # 'uniform', 'stretch', 'nest', or 'regional' +export gtype=uniform # 'uniform', 'stretch', 'nest' + # 'regional_gfdl', 'regional_esg' -if [ $gtype = stretch ]; then +if [ $gtype = uniform ]; then + export res=96 +elif [ $gtype = stretch ]; then + export res=96 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=35.5 # Center latitude of the highest resolution tile -elif [ $gtype = nest ] || [ $gtype = regional ]; then +elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then + export res=96 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=35.5 # Center latitude of the highest resolution tile @@ -74,6 +83,19 @@ elif [ $gtype = nest ] || [ $gtype = regional ]; then export iend_nest=166 # Ending i-direction index of nest grid in parent tile supergrid export jend_nest=164 # Ending j-direction index of nest grid in parent tile supergrid export halo=3 +elif [ $gtype = regional_esg ] ; then + export res=-999 # equivalent res is computed. + export target_lon=-97.5 # Center longitude of grid + export target_lat=35.5 # Center latitude of grid + export idim=301 # Dimension of grid in 'i' direction + export jdim=200 # Dimension of grid in 'j' direction + export delx=0.0585 # Grid spacing (in degrees) in the 'i' direction + # on the SUPERGRID (which has twice the resolution of + # the model grid). The physical grid spacing in the 'i' + # direction is related to delx as follows: + # distance = 2*delx*(circumf_Earth/360 deg) + export dely=0.0585 # Grid spacing (in degrees) in the 'j' direction. + export halo=3 # number of row/cols for halo fi #----------------------------------------------------------------------- @@ -85,7 +107,7 @@ fi export home_dir=$LS_SUBCWD/.. export TMPDIR=/gpfs/hps3/stmp/$LOGNAME/fv3_grid.$gtype -export out_dir=/gpfs/hps3/stmp/$LOGNAME/C${res} +export out_dir=/gpfs/hps3/stmp/$LOGNAME/my_grids export NODES=1 export APRUN="aprun -n 1 -N 1 -j 1 -d 1 -cc depth" diff --git a/driver_scripts/driver_grid.dell.sh b/driver_scripts/driver_grid.dell.sh index 67ebbefa0..a1d891fe7 100755 --- a/driver_scripts/driver_grid.dell.sh +++ b/driver_scripts/driver_grid.dell.sh @@ -35,19 +35,24 @@ # "uniform" - global uniform grid # "stretch" - global stretched grid # "nest" - global stretched grid with nest -# "regional" - stand-alone regional grid +# "regional_gfdl" - stand-alone gfdl regional grid +# "regional_esg" - stand-alone extended Schmidt gnomonic +# (esg) regional grid # 3) For "stretch" and "nest" grids, set the stretching factor - # "stretch_fac", and center lat/lon of highest resolution # tile - "target_lat" and "target_lon". # 4) For "nest" grids, set the refinement ratio - "refine_ratio", # the starting/ending i/j index location within the parent # tile - "istart_nest", "jstart_nest", "iend_nest", "jend_nest" -# 5) For "regional" grids, set the "halo". Default is three +# 5) For "regional_gfdl" grids, set the "halo". Default is three # rows/columns. -# 6) Set working directory - TMPDIR - and path to the repository +# 6) For "regional_esg" grids, set center lat/lon of grid, +# - "target_lat/lon" - the i/j dimensions - "i/jdim", the +# x/y grid spacing - "delx/y", and halo. +# 7) Set working directory - TMPDIR - and path to the repository # clone - home_dir. -# 7) Submit script: "cat $script | bsub". -# 8) All files will be placed in "out_dir". +# 8) Submit script: "cat $script | bsub". +# 9) All files will be placed in "out_dir". # #----------------------------------------------------------------------- @@ -59,14 +64,18 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export res=96 -export gtype=regional # 'uniform', 'stretch', 'nest', or 'regional' +export gtype=uniform # 'uniform', 'stretch', 'nest', + # 'regional_gfdl', 'regional_esg' -if [ $gtype = stretch ]; then +if [ $gtype = uniform ]; then + export res=96 +elif [ $gtype = stretch ]; then + export res=96 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=35.5 # Center latitude of the highest resolution tile -elif [ $gtype = nest ] || [ $gtype = regional ]; then +elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then + export res=96 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=35.5 # Center latitude of the highest resolution tile @@ -76,6 +85,19 @@ elif [ $gtype = nest ] || [ $gtype = regional ]; then export iend_nest=166 # Ending i-direction index of nest grid in parent tile supergrid export jend_nest=164 # Ending j-direction index of nest grid in parent tile supergrid export halo=3 +elif [ $gtype = regional_esg ] ; then + export res=-999 # equivalent res is computed. + export target_lon=-97.5 # Center longitude of grid + export target_lat=35.5 # Center latitude of grid + export idim=301 # Dimension of grid in 'i' direction + export jdim=200 # Dimension of grid in 'j' direction + export delx=0.0585 # Grid spacing (in degrees) in the 'i' direction + # on the SUPERGRID (which has twice the resolution of + # the model grid). The physical grid spacing in the 'i' + # direction is related to delx as follows: + # distance = 2*delx*(circumf_Earth/360 deg) + export dely=0.0585 # Grid spacing (in degrees) in the 'j' direction. + export halo=3 # number of row/cols for halo fi #----------------------------------------------------------------------- @@ -87,7 +109,7 @@ fi export home_dir=$LS_SUBCWD/.. export TMPDIR=/gpfs/dell1/stmp/$LOGNAME/fv3_grid.$gtype -export out_dir=/gpfs/dell1/stmp/$LOGNAME/C${res} +export out_dir=/gpfs/dell1/stmp/$LOGNAME/my_grids #----------------------------------------------------------------------- # Should not need to change anything below here. diff --git a/driver_scripts/driver_grid.hera.sh b/driver_scripts/driver_grid.hera.sh index 0bf50e2c2..50f13fbee 100755 --- a/driver_scripts/driver_grid.hera.sh +++ b/driver_scripts/driver_grid.hera.sh @@ -33,19 +33,24 @@ # "uniform" - global uniform grid # "stretch" - global stretched grid # "nest" - global stretched grid with nest -# "regional" - stand-alone regional grid +# "regional_gfdl" - stand-alone gfdl regional grid +# "regional_esg" - stand-alone extended Schmidt gnomonic +# (esg) regional grid # 3) For "stretch" and "nest" grids, set the stretching factor - # "stretch_fac", and center lat/lon of highest resolution # tile - "target_lat" and "target_lon". # 4) For "nest" grids, set the refinement ratio - "refine_ratio", # the starting/ending i/j index location within the parent # tile - "istart_nest", "jstart_nest", "iend_nest", "jend_nest" -# 5) For "regional" grids, set the "halo". Default is three +# 5) For "regional_gfdl" grids, set the "halo". Default is three # rows/columns. -# 6) Set working directory - TMPDIR - and path to the repository +# 6) For "regional_esg" grids, set center lat/lon of grid, +# - "target_lat/lon" - the i/j dimensions - "i/jdim", the +# x/y grid spacing - "delx/y", and halo. +# 7) Set working directory - TMPDIR - and path to the repository # clone - home_dir. -# 7) Submit script: "sbatch $script". -# 8) All files will be placed in "out_dir". +# 8) Submit script: "sbatch $script". +# 9) All files will be placed in "out_dir". # #----------------------------------------------------------------------- @@ -59,14 +64,18 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export res=96 -export gtype=uniform # 'uniform', 'stretch', 'nest', or 'regional' +export gtype=uniform # 'uniform', 'stretch', 'nest' + # 'regional_gfdl', 'regional_esg' -if [ $gtype = stretch ]; then +if [ $gtype = uniform ]; then + export res=96 +elif [ $gtype = stretch ]; then + export res=96 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=35.5 # Center latitude of the highest resolution tile -elif [ $gtype = nest ] || [ $gtype = regional ]; then +elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then + export res=96 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=35.5 # Center latitude of the highest resolution tile @@ -76,6 +85,19 @@ elif [ $gtype = nest ] || [ $gtype = regional ]; then export iend_nest=166 # Ending i-direction index of nest grid in parent tile supergrid export jend_nest=164 # Ending j-direction index of nest grid in parent tile supergrid export halo=3 # Lateral boundary halo +elif [ $gtype = regional_esg ] ; then + export res=-999 # equivalent res is computed. + export target_lon=-97.5 # Center longitude of grid + export target_lat=35.5 # Center latitude of grid + export idim=301 # Dimension of grid in 'i' direction + export jdim=200 # Dimension of grid in 'j' direction + export delx=0.0585 # Grid spacing (in degrees) in the 'i' direction + # on the SUPERGRID (which has twice the resolution of + # the model grid). The physical grid spacing in the 'i' + # direction is related to delx as follows: + # distance = 2*delx*(circumf_Earth/360 deg) + export dely=0.0585 # Grid spacing (in degrees) in the 'j' direction. + export halo=3 # number of row/cols for halo fi #----------------------------------------------------------------------- @@ -87,7 +109,7 @@ fi export home_dir=$SLURM_SUBMIT_DIR/.. export TMPDIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/fv3_grid.$gtype -export out_dir=/scratch2/NCEPDEV/stmp1/$LOGNAME/C${res} +export out_dir=/scratch2/NCEPDEV/stmp1/$LOGNAME/my_grids #----------------------------------------------------------------------- # Should not need to change anything below here. diff --git a/driver_scripts/driver_grid.jet.sh b/driver_scripts/driver_grid.jet.sh index a71d5e155..179864abd 100755 --- a/driver_scripts/driver_grid.jet.sh +++ b/driver_scripts/driver_grid.jet.sh @@ -1,13 +1,13 @@ #!/bin/bash #SBATCH -J fv3_grid_driver -#SBATCH -A emcda +#SBATCH -A hfv3gfs #SBATCH --open-mode=truncate #SBATCH -o log.fv3_grid_driver #SBATCH -e log.fv3_grid_driver #SBATCH --nodes=1 --ntasks-per-node=24 #SBATCH --partition=xjet -#SBATCH -q windfall +#SBATCH -q batch #SBATCH -t 00:10:00 #----------------------------------------------------------------------- @@ -34,19 +34,24 @@ # "uniform" - global uniform grid # "stretch" - global stretched grid # "nest" - global stretched grid with nest -# "regional" - stand-alone regional grid +# "regional_gfdl" - stand-alone gfdl regional grid +# "regional_esg" - stand-alone extended Schmidt gnomonic +# (esg) regional grid # 3) For "stretch" and "nest" grids, set the stretching factor - # "stretch_fac", and center lat/lon of highest resolution # tile - "target_lat" and "target_lon". # 4) For "nest" grids, set the refinement ratio - "refine_ratio", # the starting/ending i/j index location within the parent # tile - "istart_nest", "jstart_nest", "iend_nest", "jend_nest" -# 5) For "regional" grids, set the "halo". Default is three +# 5) For "regional_gfdl" grids, set the "halo". Default is three # rows/columns. -# 6) Set working directory - TMPDIR - and path to the repository +# 6) For "regional_esg" grids, set center lat/lon of grid, +# - "target_lat/lon" - the i/j dimensions - "i/jdim", the +# x/y grid spacing - "delx/y", and halo. +# 7) Set working directory - TMPDIR - and path to the repository # clone - home_dir. -# 7) Submit script: "sbatch $script". -# 8) All files will be placed in "out_dir". +# 8) Submit script: "sbatch $script". +# 9) All files will be placed in "out_dir". # #----------------------------------------------------------------------- @@ -60,14 +65,18 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export res=96 -export gtype=regional # 'uniform', 'stretch', 'nest', or 'regional' +export gtype=uniform # 'uniform', 'stretch', 'nest' + # 'regional_gfdl', 'regional_esg' -if [ $gtype = stretch ]; then +if [ $gtype = uniform ]; then + export res=96 +elif [ $gtype = stretch ]; then + export res=96 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=35.5 # Center latitude of the highest resolution tile -elif [ $gtype = nest ] || [ $gtype = regional ]; then +elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then + export res=96 export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=35.5 # Center latitude of the highest resolution tile @@ -77,6 +86,19 @@ elif [ $gtype = nest ] || [ $gtype = regional ]; then export iend_nest=166 # Ending i-direction index of nest grid in parent tile supergrid export jend_nest=164 # Ending j-direction index of nest grid in parent tile supergrid export halo=3 # Lateral boundary halo +elif [ $gtype = regional_esg ] ; then + export res=-999 # equivalent resolution is computed + export target_lon=-97.5 # Center longitude of grid + export target_lat=35.5 # Center latitude of grid + export idim=301 # Dimension of grid in 'i' direction + export jdim=200 # Dimension of grid in 'j' direction + export delx=0.0585 # Grid spacing (in degrees) in the 'i' direction + # on the SUPERGRID (which has twice the resolution of + # the model grid). The physical grid spacing in the 'i' + # direction is related to delx as follows: + # distance = 2*delx*(circumf_Earth/360 deg) + export dely=0.0585 # Grid spacing (in degrees) in the 'j' direction. + export halo=3 # number of row/cols for halo fi #----------------------------------------------------------------------- @@ -88,7 +110,7 @@ fi export home_dir=$SLURM_SUBMIT_DIR/.. export TMPDIR=/lfs4/HFIP/emcda/$LOGNAME/stmp/fv3_grid.$gtype -export out_dir=/lfs4/HFIP/emcda/$LOGNAME/stmp/C${res} +export out_dir=/lfs4/HFIP/emcda/$LOGNAME/stmp/my_grids #----------------------------------------------------------------------- # Should not need to change anything below here. diff --git a/reg_tests/grid_gen/c96.uniform.sh b/reg_tests/grid_gen/c96.uniform.sh index 61f28009d..d01f5f66d 100755 --- a/reg_tests/grid_gen/c96.uniform.sh +++ b/reg_tests/grid_gen/c96.uniform.sh @@ -35,7 +35,7 @@ echo "Ending at: " `date` # Compare output to baseline set of data. #----------------------------------------------------------------------------- -cd $out_dir +cd $out_dir/C96 test_failed=0 for files in *tile*.nc ./fix_sfc/*tile*.nc diff --git a/reg_tests/grid_gen/driver.cray.sh b/reg_tests/grid_gen/driver.cray.sh index 40267adbd..535ce28f4 100755 --- a/reg_tests/grid_gen/driver.cray.sh +++ b/reg_tests/grid_gen/driver.cray.sh @@ -44,6 +44,7 @@ export machine=WCOSS_C export KMP_AFFINITY=disabled export NCCMP=/gpfs/hps3/emc/global/noscrub/George.Gayno/util/netcdf/nccmp export HOMEreg=/gpfs/hps3/emc/global/noscrub/George.Gayno/ufs_utils.git/reg_tests/grid_gen/baseline_data +export NCDUMP=/gpfs/hps/usrx/local/prod/NetCDF/4.2/intel/sandybridge/bin/ncdump rm -fr $WORK_DIR @@ -58,16 +59,16 @@ bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.uniform -W 0:15 -extsched 'CRAYLINUX[]' "export NODES=1; $PWD/c96.uniform.sh" #----------------------------------------------------------------------------- -# C96 regional grid +# gfdl regional grid #----------------------------------------------------------------------------- -bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.regional -W 0:10 -M 2400 \ - -w 'ended(c96.uniform)' -extsched 'CRAYLINUX[]' "export NODES=1; $PWD/c96.regional.sh" +bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J gfdl.regional -W 0:10 -M 2400 \ + -w 'ended(c96.uniform)' -extsched 'CRAYLINUX[]' "export NODES=1; $PWD/gfdl.regional.sh" #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- -bsub -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J summary -R "rusage[mem=100]" -W 0:01 -w 'ended(c96.regional)' "grep -a '<<<' $LOG_FILE >> $SUM_FILE" +bsub -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J summary -R "rusage[mem=100]" -W 0:01 -w 'ended(gfdl.regional)' "grep -a '<<<' $LOG_FILE >> $SUM_FILE" exit diff --git a/reg_tests/grid_gen/driver.dell.sh b/reg_tests/grid_gen/driver.dell.sh index 7ceac48e7..8027b84e3 100755 --- a/reg_tests/grid_gen/driver.dell.sh +++ b/reg_tests/grid_gen/driver.dell.sh @@ -56,15 +56,15 @@ bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.uniform -W 0:15 -R "span[ptile=24]" -R "affinity[core(1):distribute=balance]" "$PWD/c96.uniform.sh" #----------------------------------------------------------------------------- -# C96 regional grid +# GFDL regional grid #----------------------------------------------------------------------------- -bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J c96.regional -W 0:10 -x -n 24 -w 'ended(c96.uniform)' \ - -R "span[ptile=24]" -R "affinity[core(1):distribute=balance]" "$PWD/c96.regional.sh" +bsub -e $LOG_FILE -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J gfdl.regional -W 0:10 -x -n 24 -w 'ended(c96.uniform)' \ + -R "span[ptile=24]" -R "affinity[core(1):distribute=balance]" "$PWD/gfdl.regional.sh" #----------------------------------------------------------------------------- # Create summary log. #----------------------------------------------------------------------------- bsub -o $LOG_FILE -q $QUEUE -P $PROJECT_CODE -J summary -R "affinity[core(1)]" -R "rusage[mem=100]" -W 0:01 \ - -w 'ended(c96.regional)' "grep -a '<<<' $LOG_FILE >> $SUM_FILE" + -w 'ended(gfdl.regional)' "grep -a '<<<' $LOG_FILE >> $SUM_FILE" diff --git a/reg_tests/grid_gen/driver.hera.sh b/reg_tests/grid_gen/driver.hera.sh index 3483bfb52..ad19573fd 100755 --- a/reg_tests/grid_gen/driver.hera.sh +++ b/reg_tests/grid_gen/driver.hera.sh @@ -59,11 +59,11 @@ TEST1=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:15:00 -A $PROJECT_ -o $LOG_FILE -e $LOG_FILE ./c96.uniform.sh) #----------------------------------------------------------------------------- -# C96 regional grid +# gfdl regional grid #----------------------------------------------------------------------------- -TEST2=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.regional \ - -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST1 ./c96.regional.sh) +TEST2=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J gfdl.regional \ + -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST1 ./gfdl.regional.sh) #----------------------------------------------------------------------------- # Create summary log. diff --git a/reg_tests/grid_gen/driver.jet.sh b/reg_tests/grid_gen/driver.jet.sh index 3ec9726a7..a340582b2 100755 --- a/reg_tests/grid_gen/driver.jet.sh +++ b/reg_tests/grid_gen/driver.jet.sh @@ -59,11 +59,11 @@ TEST1=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:15:00 -A $PROJECT_ --partition=xjet -o $LOG_FILE -e $LOG_FILE ./c96.uniform.sh) #----------------------------------------------------------------------------- -# C96 regional grid +# gfdl regional grid #----------------------------------------------------------------------------- -TEST2=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.regional \ - --partition=xjet -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST1 ./c96.regional.sh) +TEST2=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J gfdl.regional \ + --partition=xjet -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST1 ./gfdl.regional.sh) #----------------------------------------------------------------------------- # Create summary log. diff --git a/reg_tests/grid_gen/c96.regional.sh b/reg_tests/grid_gen/gfdl.regional.sh similarity index 79% rename from reg_tests/grid_gen/c96.regional.sh rename to reg_tests/grid_gen/gfdl.regional.sh index 39a7e54d4..54fb934d8 100755 --- a/reg_tests/grid_gen/c96.regional.sh +++ b/reg_tests/grid_gen/gfdl.regional.sh @@ -1,18 +1,18 @@ #!/bin/bash #----------------------------------------------------------------------- -# Create a C96 regional grid. Compare output to a set +# Create a regional gfdl grid. Compare output to a set # of baseline files using the 'nccmp' utility. This script is # run by the machine specific driver script. #----------------------------------------------------------------------- set -x -export TMPDIR=${WORK_DIR}/c96.regional.work -export out_dir=${WORK_DIR}/c96.regional +export TMPDIR=${WORK_DIR}/gfdl.regional.work +export out_dir=${WORK_DIR}/gfdl.regional -export res=96 -export gtype=regional +export res=96 # global resolution in which grid is embedded. +export gtype=regional_gfdl export stretch_fac=1.5 # Stretching factor for the grid export target_lon=-97.5 # Center longitude of the highest resolution tile export target_lat=35.5 # Center latitude of the highest resolution tile @@ -34,7 +34,7 @@ $home_dir/ush/fv3gfs_driver_grid.sh iret=$? if [ $iret -ne 0 ]; then set +x - echo "<<< C96 REGIONAL TEST FAILED. <<<" + echo "<<< GFDL REGIONAL TEST FAILED. <<<" exit $iret fi @@ -44,14 +44,14 @@ echo "Ending at: " `date` # Compare output to baseline set of data. #----------------------------------------------------------------------------- -cd $out_dir +cd $out_dir/C424 test_failed=0 for files in *tile*.nc ./fix_sfc/*tile*.nc do if [ -f $files ]; then echo CHECK $files - $NCCMP -dmfqS $files $HOMEreg/c96.regional/$files + $NCCMP -dmfqS $files $HOMEreg/gfdl.regional/$files iret=$? if [ $iret -ne 0 ]; then test_failed=1 @@ -61,9 +61,9 @@ done set +x if [ $test_failed -ne 0 ]; then - echo "<<< C96 REGIONAL TEST FAILED. >>>" + echo "<<< GFDL REGIONAL TEST FAILED. >>>" else - echo "<<< C96 REGIONAL TEST PASSED. >>>" + echo "<<< GFDL REGIONAL TEST PASSED. >>>" fi exit 0 diff --git a/sorc/CMakeLists.txt b/sorc/CMakeLists.txt index b5c8884ef..fbf3ce95c 100644 --- a/sorc/CMakeLists.txt +++ b/sorc/CMakeLists.txt @@ -13,6 +13,7 @@ add_subdirectory(nemsio_get.fd) add_subdirectory(nemsio_chgdate.fd) add_subdirectory(mkgfsnemsioctl.fd) add_subdirectory(fre-nctools.fd) +add_subdirectory(grid_tools.fd) add_subdirectory(chgres_cube.fd) add_subdirectory(orog.fd) add_subdirectory(sfc_climo_gen.fd) diff --git a/sorc/fre-nctools.fd/CMakeLists.txt b/sorc/fre-nctools.fd/CMakeLists.txt index cec8e70db..66f79bfef 100644 --- a/sorc/fre-nctools.fd/CMakeLists.txt +++ b/sorc/fre-nctools.fd/CMakeLists.txt @@ -2,5 +2,3 @@ add_subdirectory(shared_lib) add_subdirectory(tools/fregrid) add_subdirectory(tools/make_solo_mosaic) add_subdirectory(tools/make_hgrid) -add_subdirectory(tools/filter_topo) -add_subdirectory(tools/shave.fd) diff --git a/sorc/grid_tools.fd/CMakeLists.txt b/sorc/grid_tools.fd/CMakeLists.txt new file mode 100644 index 000000000..a4e66910c --- /dev/null +++ b/sorc/grid_tools.fd/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(shave.fd) +add_subdirectory(filter_topo.fd) +add_subdirectory(regional_esg_grid.fd) +add_subdirectory(global_equiv_resol.fd) diff --git a/sorc/fre-nctools.fd/tools/filter_topo/CMakeLists.txt b/sorc/grid_tools.fd/filter_topo.fd/CMakeLists.txt similarity index 100% rename from sorc/fre-nctools.fd/tools/filter_topo/CMakeLists.txt rename to sorc/grid_tools.fd/filter_topo.fd/CMakeLists.txt diff --git a/sorc/fre-nctools.fd/tools/filter_topo/filter_topo.F90 b/sorc/grid_tools.fd/filter_topo.fd/filter_topo.F90 similarity index 97% rename from sorc/fre-nctools.fd/tools/filter_topo/filter_topo.F90 rename to sorc/grid_tools.fd/filter_topo.fd/filter_topo.F90 index 309eb9b34..156986810 100644 --- a/sorc/fre-nctools.fd/tools/filter_topo/filter_topo.F90 +++ b/sorc/grid_tools.fd/filter_topo.fd/filter_topo.F90 @@ -21,15 +21,14 @@ program filter_topo real, parameter :: tiny_number=1.d-8 - real:: cd4 = 0.16 ! Dimensionless coeff for del-4 difussion (with FCT) - real:: peak_fac = 1.05 ! overshoot factor for the mountain peak - real:: max_slope = 0.15 ! max allowable terrain slope: 1 --> 45 deg - ! 0.15 for C768 or lower; 0.25 C1536; 0.3 for C3072 - integer :: n_del2_weak = 12 + real:: cd4 ! Dimensionless coeff for del-4 difussion (with FCT) + real:: peak_fac ! overshoot factor for the mountain peak + real:: max_slope ! max allowable terrain slope: 1 --> 45 deg + + integer :: n_del2_weak logical :: zs_filter = .true. logical :: zero_ocean = .true. ! if true, no diffusive flux into water/ocean area - integer :: refine_ratio = 1 ! default parent-to-nest space ratio real :: res = 48. ! real value of the 'c' resolution real :: stretch_fac = 1.0 logical :: nested = .false. & @@ -40,8 +39,7 @@ program filter_topo character(len=128) :: mask_field = "slmsk" character(len=128) :: grid_file = "atmos_mosaic.nc" namelist /filter_topo_nml/ topo_file, topo_field, mask_field, grid_file, zero_ocean, & - zs_filter, cd4, n_del2_weak, peak_fac, max_slope, stretch_fac, refine_ratio, res, & - nested, grid_type, regional + zs_filter, stretch_fac, res, nested, grid_type, regional integer :: stdunit = 6 integer :: ntiles = 0 @@ -61,10 +59,8 @@ program filter_topo !--- read namelist call read_namelist() - !--- compute filter constants for the regional resolution - if(regional)then - call compute_filter_constants - endif + !--- compute filter constants according to grid resolution. + call compute_filter_constants !--- read the target grid. call read_grid_file(regional) @@ -1146,7 +1142,7 @@ subroutine two_delta_filter(is, ie, js, je, isd, ied, jsd, jed, npx, npy, ntiles real:: a1(is-1:ie+2) real:: a2(is:ie,js-1:je+2) real:: a3(is:ie,js:je,ntiles) - real:: smax, smin, m_slope, fac + real:: smax, m_slope, fac integer:: i,j, nt, t integer:: is1, ie2, js1, je2 @@ -1763,6 +1759,18 @@ subroutine read_namelist end subroutine read_namelist + subroutine check(status) + use netcdf + integer,intent(in) :: status +! + if(status /= nf90_noerr) then + write(0,*) ' check netcdf status = ', status + write(0,'("error ", a)') trim(nf90_strerror(status)) + write(0,*) "Stopped" + stop 4 + endif + end subroutine check + !####################################################################### ! compute resolution-dependent values for the filtering. @@ -1770,39 +1778,32 @@ subroutine compute_filter_constants ! set the given values for various cube resolutions (c48, c96, c192, c384, c768, c1152, c3072) - integer,parameter :: nres=7 + integer,parameter :: nres=8 integer :: index1,index2,n - real :: factor,res_regional - - real,dimension(1:nres) :: cube_res=(/48.,96.,192.,384.,768.,1152.,3072./) + real :: factor - real,dimension(1:nres) :: n_del2_weak_vals=(/4.,8.,12.,12.,16.,20.,24./) - real,dimension(1:nres) :: cd4_vals =(/0.12,0.12,0.15,0.15,0.15,0.15,0.15/) - real,dimension(1:nres) :: max_slope_vals =(/0.12,0.12,0.12,0.12,0.12,0.16,0.30/) - real,dimension(1:nres) :: peak_fac_vals =(/1.1,1.1,1.05,1.0,1.0,1.0,1.0/) - -!------------------------------------------------------------------ -! What is the equivalent cube resolution of this regional domain -! where res is the parent cube's resolution? -!------------------------------------------------------------------ + real,dimension(1:nres) :: cube_res=(/48.,96.,128.,192.,384.,768.,1152.,3072./) - res_regional=res*stretch_fac*real(refine_ratio) + real,dimension(1:nres) :: n_del2_weak_vals=(/4.,8.,8.,12.,12.,16.,20.,24./) + real,dimension(1:nres) :: cd4_vals =(/0.12,0.12,0.13,0.15,0.15,0.15,0.15,0.15/) + real,dimension(1:nres) :: max_slope_vals =(/0.12,0.12,0.12,0.12,0.12,0.12,0.16,0.30/) + real,dimension(1:nres) :: peak_fac_vals =(/1.1,1.1,1.1,1.05,1.0,1.0,1.0,1.0/) - if(res_regionalcube_res(nres))then + elseif(res>cube_res(nres))then index1 = nres index2 = nres factor = 0. else do n=2,nres - if(res_regional<=cube_res(n))then + if(res<=cube_res(n))then index2 = n index1 = n-1 - factor = (res_regional-cube_res(n-1))/(cube_res(n)-cube_res(n-1)) + factor = (res-cube_res(n-1))/(cube_res(n)-cube_res(n-1)) exit endif enddo @@ -1813,6 +1814,13 @@ subroutine compute_filter_constants max_slope = max_slope_vals(index1)+factor*(max_slope_vals(index2)-max_slope_vals(index1)) peak_fac = peak_fac_vals(index1)+factor*(peak_fac_vals(index2)-peak_fac_vals(index1)) + print*,'' + print*,'- FILTER COEFFICIENTS FOR RESOLUTION ', res + print*,'- CD4: ', cd4 + print*,'- N_DEL2_WEAK: ', n_del2_weak + print*,'- MAX_SLOPE: ', max_slope + print*,'- PEAK_FAC: ', peak_fac + end subroutine compute_filter_constants end program filter_topo diff --git a/sorc/grid_tools.fd/global_equiv_resol.fd/CMakeLists.txt b/sorc/grid_tools.fd/global_equiv_resol.fd/CMakeLists.txt new file mode 100644 index 000000000..549735ac1 --- /dev/null +++ b/sorc/grid_tools.fd/global_equiv_resol.fd/CMakeLists.txt @@ -0,0 +1,10 @@ +set(fortran_src + global_equiv_resol.f90) + +set(exe_name global_equiv_resol) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + NetCDF::NetCDF_Fortran) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/grid_tools.fd/global_equiv_resol.fd/global_equiv_resol.f90 b/sorc/grid_tools.fd/global_equiv_resol.fd/global_equiv_resol.f90 new file mode 100644 index 000000000..7bd9c813f --- /dev/null +++ b/sorc/grid_tools.fd/global_equiv_resol.fd/global_equiv_resol.f90 @@ -0,0 +1,185 @@ +!======================================================================= +program global_equiv_resol +!======================================================================= + + use netcdf + + implicit none + + integer, parameter :: dp = kind(1.0d0) + real(dp), parameter :: pi_geom = 4.0*atan(1.0), & + radius_Earth = 6371000.0 + + character(len=256) :: grid_fn + integer :: ncid, nxSG_dimid, nySG_dimid, dASG_varid, num_args + integer :: nxSG, nySG, nx, ny, RES_equiv + real(dp) :: avg_cell_size, min_cell_size, max_cell_size + real(dp), dimension(:,:), allocatable :: & + quarter_dA_ll, quarter_dA_lr, quarter_dA_ur, quarter_dA_ul, & + dASG, dA, sqrt_dA +! +!======================================================================= +! +! Read in the name of the file from the command line. The command-line +! call to this program should have exactly one argument consisting of +! the path to the NetCDF grid specification file to be read in. If this +! is not the case, print out a usage message and exit. +! +!======================================================================= +! + num_args = command_argument_count() + if (num_args == 1) then + call get_command_argument(1, grid_fn) + else + WRITE(*,500) + WRITE(*,500) "Exactly one argument must be specified to program global_equiv_resol." + WRITE(*,500) "Usage:" + WRITE(*,500) + WRITE(*,500) " global_equiv_resol path_to_grid_file" + WRITE(*,500) + WRITE(*,500) "where path_to_grid_file is the path to the NetCDF grid file. Actual " + WRITE(*,500) "number of specified command line arguments is:" + WRITE(*,510) " num_args = ", num_args + WRITE(*,500) "Stopping." +500 FORMAT(A) +510 FORMAT(A, I3) + STOP + end if +! +!======================================================================= +! +! Open the grid file and read in the dimensions of the supergrid. The +! supergrid is a grid that has twice the resolution of the actual/compu- +! tational grid. In the file, the names of the supergrid dimensions are +! nx and ny. Here, however, we reserve those names for the dimensions +! of the actual grid (since in the FV3 code and in other data files, nx +! and ny are used to denote the dimensions of the actual grid) and in- +! stead use the variables nxSG and nySG to denote the dimensions of the +! supergrid. +! +!======================================================================= +! + WRITE(*,500) + WRITE(*,500) "Opening NetCDF grid file for reading/writing:" + WRITE(*,500) " grid_fn = " // trim(grid_fn) + + call check( nf90_open(trim(grid_fn), NF90_WRITE, ncid) ) + + call check( nf90_inq_dimid(ncid, "nx", nxSG_dimid) ) + call check( nf90_inquire_dimension(ncid, nxSG_dimid, len=nxSG) ) + + call check( nf90_inq_dimid(ncid, "ny", nySG_dimid) ) + call check( nf90_inquire_dimension(ncid, nySG_dimid, len=nySG) ) + + WRITE(*,500) + WRITE(*,500) "Dimensions of supergrid are:" + WRITE(*,520) " nxSG = ", nxSG + WRITE(*,520) " nySG = ", nySG +520 FORMAT(A, I7) +! +!======================================================================= +! +! Read in the cell areas on the supergrid. Then add the areas of the +! four supergrid cells that make up one grid cell to obtain the cell +! areas on the actual grid. +! +!======================================================================= +! + allocate(dASG(0:nxSG-1, 0:nySG-1)) + call check( nf90_inq_varid(ncid, "area", dASG_varid) ) + call check( nf90_get_var(ncid, dASG_varid, dASG) ) + + nx = nxSG/2 + ny = nySG/2 + + WRITE(*,500) + WRITE(*,500) "Dimensions of (actual, i.e. computational) grid are:" + WRITE(*,520) " nx = ", nx + WRITE(*,520) " ny = ", ny + + allocate(quarter_dA_ll(0:nx-1, 0:ny-1)) + allocate(quarter_dA_lr(0:nx-1, 0:ny-1)) + allocate(quarter_dA_ul(0:nx-1, 0:ny-1)) + allocate(quarter_dA_ur(0:nx-1, 0:ny-1)) + + quarter_dA_ll = dASG(0:nxSG-1:2, 0:nySG-1:2) + quarter_dA_lr = dASG(0:nxSG-1:2, 1:nySG-1:2) + quarter_dA_ur = dASG(1:nxSG-1:2, 1:nySG-1:2) + quarter_dA_ul = dASG(1:nxSG-1:2, 0:nySG-1:2) + + allocate(dA(0:nx-1, 0:ny-1)) + allocate(sqrt_dA(0:nx-1, 0:ny-1)) + + dA = quarter_dA_ll + quarter_dA_lr + quarter_dA_ur + quarter_dA_ul +! +!======================================================================= +! +! Calculate a typical/representative cell size for each cell by taking +! the square root of the area of the cell. Then calculate the minimum, +! maximum, and average cell sizes over the whole grid. +! +!======================================================================= +! + sqrt_dA = sqrt(dA) + min_cell_size = minval(sqrt_dA) + max_cell_size = maxval(sqrt_dA) + avg_cell_size = sum(sqrt_dA)/(nx*ny) + + WRITE(*,500) + WRITE(*,500) "Minimum, maximum, and average cell sizes are (based on square" + WRITE(*,500) "root of cell area):" + WRITE(*,530) " min_cell_size = ", min_cell_size + WRITE(*,530) " max_cell_size = ", max_cell_size + WRITE(*,530) " avg_cell_size = ", avg_cell_size +530 FORMAT(A, G) +! +!======================================================================= +! +! Use the average cell size to calculate an equivalent global uniform +! cubed-sphere resolution (in units of number of cells) for the regional +! grid. This is the RES that a global uniform (i.e. stretch factor of +! 1) cubed-sphere grid would need to have in order to have the same no- +! minal cell size as the average cell size of the regional grid. +! +!======================================================================= +! + RES_equiv = nint( (2.0*pi_geom*radius_Earth)/(4.0*avg_cell_size) ) + + WRITE(*,500) + WRITE(*,500) "Equivalent global uniform cubed-sphere resolution is:" + WRITE(*,530) " RES_equiv = ", RES_equiv +! +!======================================================================= +! +! Write the average cell size and equivalent global resolution to the +! grid file as a global attributes. +! +!======================================================================= +! + WRITE(*,500) + WRITE(*,500) "Writing avg_cell_size and RES_equiv to the grid specification" + WRITE(*,500) "file as global attributes..." + + call check( nf90_redef(ncid) ) + call check( nf90_put_att(ncid, NF90_GLOBAL, "avg_cell_size", avg_cell_size) ) + call check( nf90_put_att(ncid, NF90_GLOBAL, "RES_equiv", RES_equiv) ) + call check( nf90_enddef(ncid) ) + + call check( nf90_close(ncid) ) + + WRITE(*,500) + WRITE(*,500) "Done." + +end program global_equiv_resol + + +subroutine check(status) + use netcdf + integer,intent(in) :: status +! + if(status /= nf90_noerr) then + write(0,*) ' check netcdf status = ', status + write(0,'("error ", a)') trim(nf90_strerror(status)) + stop "Stopped" + endif +end subroutine check diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/CMakeLists.txt b/sorc/grid_tools.fd/regional_esg_grid.fd/CMakeLists.txt new file mode 100644 index 000000000..2e3e93295 --- /dev/null +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/CMakeLists.txt @@ -0,0 +1,20 @@ +set(fortran_src + pesg.f90 + pfun.f90 + pietc.f90 + pietc_s.f90 + pkind.f90 + pmat.f90 + pmat2.f90 + pmat4.f90 + pmat5.f90 + psym2.f90 + regional_esg_grid.f90) + +set(exe_name regional_esg_grid) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + NetCDF::NetCDF_Fortran) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pesg.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pesg.f90 new file mode 100644 index 000000000..862d02b07 --- /dev/null +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pesg.f90 @@ -0,0 +1,1846 @@ +! +! *********************** +! * pesg.f90 * +! * R. J. Purser * +! * NOAA/NCEP/EMC * +! * May 2020 * +! * * +! * jim.purser@noaa.gov * +! *********************** +! Suite of routines to perform the 2-parameter family of Extended +! Schmidt Gnomonic (ESG) regional grid mappings, and to optimize the +! the two parameters, A and K, of those mappings for a given rectangular +! domain's principal (median) semi-arcs with respect to a domain-averaged +! measure of distortion. This criterion is itself endowed with a parameter, +! lam (for "lambda" in [0,1) ) which gives weight to additional weight +! areal inhomogeneities instead of treating all distortion components +! equally. +! +! DEPENDENCIES +! Libraries: pmat, psym2, pfun +! Modules: pkind, pietc, pietc_s +!============================================================================= +module pesg +!============================================================================= +use pkind, only: spi,dp +use pietc, only: F,T,u0,u1,u2,o2,rtod,dtor,pih,pi2 +implicit none +private +public :: xctoxm_ak,xmtoxc_ak,get_edges,bestesg_geo,bestesg_map, & + hgrid_ak_rr,hgrid_ak_rc,hgrid_ak_dd,hgrid_ak_dc,hgrid_ak, & + gtoxm_ak_rr,gtoxm_ak_dd,xmtog_ak_rr,xmtog_ak_dd + +interface xctoxs; module procedure xctoxs; end interface +interface xstoxc; module procedure xstoxc,xstoxc1; end interface +interface xstoxt; module procedure xstoxt; end interface +interface xttoxs; module procedure xttoxs,xttoxs1; end interface +interface xttoxm; module procedure xttoxm; end interface +interface zttozm; module procedure zttozm; end interface +interface xmtoxt; module procedure xmtoxt,xmtoxt1; end interface +interface zmtozt; module procedure zmtozt,zmtozt1; end interface +interface xctoxm_ak; module procedure xctoxm_ak; end interface +interface xmtoxc_ak + module procedure xmtoxc_ak,xmtoxc_vak,xmtoxc_vak1; end interface +interface get_edges; module procedure get_edges; end interface +interface get_qx; module procedure get_qx,get_qxd; end interface +interface get_qofv;module procedure get_qofv,get_qofvd,get_qsofvs;end interface +interface get_meanq; module procedure get_meanqd,get_meanqs; end interface +interface guessak_map; module procedure guessak_map; end interface +interface guessak_geo; module procedure guessak_geo; end interface +interface bestesg_geo; module procedure bestesg_geo; end interface +interface bestesg_map; module procedure bestesg_map; end interface +interface hgrid_ak_rr;module procedure hgrid_ak_rr,hgrid_ak_rr_c; end interface +interface hgrid_ak_rc; module procedure hgrid_ak_rc; end interface +interface hgrid_ak_dd;module procedure hgrid_ak_dd,hgrid_ak_dd_c; end interface +interface hgrid_ak_dc; module procedure hgrid_ak_dc; end interface +interface hgrid_ak; module procedure hgrid_ak,hgrid_ak_c; end interface +interface gtoxm_ak_rr + module procedure gtoxm_ak_rr_m,gtoxm_ak_rr_g; end interface +interface gtoxm_ak_dd + module procedure gtoxm_ak_dd_m,gtoxm_ak_dd_g; end interface +interface xmtog_ak_rr + module procedure xmtog_ak_rr_m,xmtog_ak_rr_g; end interface +interface xmtog_ak_dd + module procedure xmtog_ak_dd_m,xmtog_ak_dd_g; end interface + +interface gaulegh; module procedure gaulegh; end interface + +contains + +!============================================================================= +subroutine xctoxs(xc,xs)! [xctoxs] +!============================================================================= +! Inverse of xstoxc. I.e., cartesians to stereographic +!============================================================================= +implicit none +real(dp),dimension(3),intent(in ):: xc +real(dp),dimension(2),intent(out):: xs +!----------------------------------------------------------------------------- +real(dp):: zp +!============================================================================= +zp=u1+xc(3); xs=xc(1:2)/zp +end subroutine xctoxs + +!============================================================================= +subroutine xstoxc(xs,xc,xcd)! [xstoxc] +!============================================================================= +! Standard transformation from polar stereographic map coordinates, xs, to +! cartesian, xc, assuming the projection axis is polar. +! xcd=d(xc)/d(xs) is the jacobian matrix, encoding distortion and metric. +!============================================================================= +use pmat4, only: outer_product +implicit none +real(dp),dimension(2), intent(in ):: xs +real(dp),dimension(3), intent(out):: xc +real(dp),dimension(3,2),intent(out):: xcd +!----------------------------------------------------------------------------- +real(dp):: zp +!============================================================================= +zp=u2/(u1+dot_product(xs,xs)); xc(1:2)=xs*zp; xc(3)=zp +xcd=-outer_product(xc,xs)*zp; xcd(1,1)=xcd(1,1)+zp; xcd(2,2)=xcd(2,2)+zp +xc(3)=xc(3)-u1 +end subroutine xstoxc +!============================================================================= +subroutine xstoxc1(xs,xc,xcd,xcdd)! [xstoxc] +!============================================================================= +! Standard transformation from polar stereographic map coordinates, xs, to +! cartesian, xc, assuming the projection axis is polar. +! xcd=d(xc)/d(xs) is the jacobian matrix, encoding distortion and metric. +! xcdd is the further derivative, wrt xs, of xcd. +!============================================================================= +use pmat4, only: outer_product +implicit none +real(dp),dimension(2), intent(in ):: xs +real(dp),dimension(3), intent(out):: xc +real(dp),dimension(3,2), intent(out):: xcd +real(dp),dimension(3,2,2),intent(out):: xcdd +!----------------------------------------------------------------------------- +real(dp),dimension(3,2):: zpxcdxs +real(dp),dimension(3) :: zpxc +real(dp) :: zp +integer(spi) :: i +!============================================================================= +zp=u2/(u1+dot_product(xs,xs)); xc(1:2)=xs*zp; xc(3)=zp +xcd=-outer_product(xc,xs)*zp +zpxc=zp*xc; xc(3)=xc(3)-u1; xcdd=u0 +do i=1,2 + zpxcdxs=xcd*xc(i) + xcdd(:,i,i)=xcdd(:,i,i)-zpxc + xcdd(:,i,:)=xcdd(:,i,:)-zpxcdxs + xcdd(:,:,i)=xcdd(:,:,i)-zpxcdxs + xcdd(i,:,i)=xcdd(i,:,i)-zpxc(1:2) + xcdd(i,i,:)=xcdd(i,i,:)-zpxc(1:2) +enddo +do i=1,2; xcd(i,i)=xcd(i,i)+zp; enddo +end subroutine xstoxc1 + +!============================================================================= +subroutine xstoxt(k,xs,xt,ff)! [xstoxt] +!============================================================================= +! Inverse of xttoxs. +!============================================================================= +implicit none +real(dp), intent(in ):: k +real(dp),dimension(2),intent(in ):: xs +real(dp),dimension(2),intent(out):: xt +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp):: s,sc +!============================================================================= +s=k*(xs(1)*xs(1)+xs(2)*xs(2)); sc=u1-s +ff=abs(s)>=u1; if(ff)return +xt=u2*xs/sc +end subroutine xstoxt + +!============================================================================= +subroutine xttoxs(k,xt,xs,xsd,ff)! [xttoxs +!============================================================================= +! Scaled gnomonic plane xt to standard stereographic plane xs +!============================================================================= +use pmat4, only: outer_product +implicit none +real(dp), intent(in ):: k +real(dp),dimension(2), intent(in ):: xt +real(dp),dimension(2), intent(out):: xs +real(dp),dimension(2,2),intent(out):: xsd +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp),dimension(2):: rspd +real(dp) :: s,sp,rsp,rsppi,rsppis +integer(spi) :: i +!============================================================================= +s=k*dot_product(xt,xt); sp=u1+s +ff=(sp<=u0); if(ff)return +rsp=sqrt(sp) +rsppi=u1/(u1+rsp) +rsppis=rsppi**2 +xs=xt*rsppi +rspd=k*xt/rsp +xsd=-outer_product(xt,rspd)*rsppis +do i=1,2; xsd(i,i)=xsd(i,i)+rsppi; enddo +end subroutine xttoxs +!============================================================================= +subroutine xttoxs1(k,xt,xs,xsd,xsdd,xs1,xsd1,ff)! [xttoxs] +!============================================================================= +! Like xttoxs, but also, return the derivatives, wrt K, of xs and xsd +!============================================================================= +use pmat4, only: outer_product +implicit none +real(dp), intent(in ):: k +real(dp),dimension(2), intent(in ):: xt +real(dp),dimension(2), intent(out):: xs ,xs1 +real(dp),dimension(2,2), intent(out):: xsd,xsd1 +real(dp),dimension(2,2,2),intent(out):: xsdd +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp),dimension(2,2):: rspdd +real(dp),dimension(2) :: rspd,rspd1,rsppid +real(dp) :: s,sp,rsp,rsppi,rsppis,s1,rsp1 +integer(spi) :: i +!============================================================================= +s1=dot_product(xt,xt); s=k*s1; sp=u1+s +ff=(sp<=u0); if(ff)return +rsp=sqrt(sp); rsp1=o2*s1/rsp +rsppi=u1/(u1+rsp); rsppis=rsppi**2 +xs=xt*rsppi; xs1=-xt*rsp1*rsppis +rspd=k*xt/rsp; rspd1=(xt*rsp-k*xt*rsp1)/sp +rsppid=-rspd*rsppis +xsd1=-outer_product(xt,rspd1-u2*rspd*rsp1*rsppi) +do i=1,2; xsd1(i,i)=xsd1(i,i)-rsp1; enddo; xsd1=xsd1*rsppis + +xsd=-outer_product(xt,rspd)*rsppis +do i=1,2; xsd(i,i)=xsd(i,i)+rsppi; enddo + +rspdd=-outer_product(xt,rspd)*rsppi +xsdd=u0 +do i=1,2; xsdd(i,:,i)= rsppid; enddo +do i=1,2; xsdd(i,i,:)=xsdd(i,i,:)+rsppid; enddo +do i=1,2; xsdd(:,:,i)=xsdd(:,:,i)+u2*rspdd*rsppid(i); enddo +do i=1,2; rspdd(i,i)=rspdd(i,i)+rsp*rsppi; enddo +do i=1,2; xsdd(i,:,:)=xsdd(i,:,:)-xt(i)*rspdd*rsppi*k/sp; enddo +end subroutine xttoxs1 + +!============================================================================= +subroutine xttoxm(a,xt,xm,ff)! [xttoxm] +!============================================================================= +! Inverse of xmtoxt +!============================================================================= +implicit none +real(dp), intent(in ):: a +real(dp),dimension(2),intent(in ):: xt +real(dp),dimension(2),intent(out):: xm +logical ,intent(out):: ff +!----------------------------------------------------------------------------- +integer(spi):: i +!============================================================================= +do i=1,2; call zttozm(a,xt(i),xm(i),ff); if(ff)return; enddo +end subroutine xttoxm + +!============================================================================= +subroutine xmtoxt(a,xm,xt,xtd,ff)! [xmtoxt] +!============================================================================= +! Like zmtozt, but for 2-vector xm and xt, and 2*2 diagonal Jacobian xtd +!============================================================================= +implicit none +real(dp), intent(in ):: a +real(dp),dimension(2), intent(in ):: xm +real(dp),dimension(2), intent(out):: xt +real(dp),dimension(2,2),intent(out):: xtd +logical, intent(out):: ff +!----------------------------------------------------------------------------- +integer(spi):: i +!============================================================================= +xtd=u0; do i=1,2; call zmtozt(a,xm(i),xt(i),xtd(i,i),ff); if(ff)return; enddo +end subroutine xmtoxt +!============================================================================= +subroutine xmtoxt1(a,xm,xt,xtd,xt1,xtd1,ff)! [xmtoxt] +!============================================================================= +! Like zmtozt1, but for 2-vector xm and xt, and 2*2 diagonal Jacobian xtd +! Also, the derivatives, wrt a, of these quantities. +!============================================================================= +implicit none +real(dp), intent(in ):: a +real(dp),dimension(2), intent(in ):: xm +real(dp),dimension(2), intent(out):: xt,xt1 +real(dp),dimension(2,2), intent(out):: xtd,xtd1 +logical, intent(out):: ff +!----------------------------------------------------------------------------- +integer(spi):: i +!============================================================================= +xtd=u0 +xtd1=u0 +do i=1,2 + call zmtozt1(a,xm(i),xt(i),xtd(i,i),xt1(i),xtd1(i,i),ff) + if(ff)return +enddo +end subroutine xmtoxt1 + +!============================================================================= +subroutine zttozm(a,zt,zm,ff)! [zttozm] +!============================================================================= +! Inverse of zmtozt +!============================================================================= +implicit none +real(dp),intent(in ):: a,zt +real(dp),intent(out):: zm +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp):: ra,razt +!============================================================================= +ff=F +if (a>u0)then; ra=sqrt( a); razt=ra*zt; zm=atan (razt)/ra +elseif(a=u1; if(ff)return + zm=atanh(razt)/ra +else ; zm=zt +endif +end subroutine zttozm + +!============================================================================= +subroutine zmtozt(a,zm,zt,ztd,ff)! [zmtozt] +!============================================================================= +! Evaluate the function, zt = tan(sqrt(A)*z)/sqrt(A), and its derivative, ztd, +! for positive and negative A and for the limiting case, A --> 0 +!============================================================================= +implicit none +real(dp),intent(in ):: a,zm +real(dp),intent(out):: zt,ztd +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp):: ra +!============================================================================= +ff=f +if (a>u0)then; ra=sqrt( a); zt=tan (ra*zm)/ra; ff=abs(ra*zm)>=pih +elseif(au0)then;ra=sqrt( a);razm=ra*zm; zt=tan(razm)/ra; ff=abs(razm)>=pih +rad=o2/ra +zt1=(rad*zm/ra)*((-u2*sin(razm*o2)**2-sinoxm(razm))/cos(razm)+(tan(razm))**2) +elseif(anasp)stop 'Guessak_geo; Aspect ratio out of range' +if(iarc0<0 .or. iarc1>narc)stop 'Guessak_geo; Major semi-arc is out of range' + +! Bilinearly interpolate A and K from crude table into a 2-vector: +ak=(/wx0*(wa0*adarc(iasp0,iarc0)+wa1*adarc(iasp1,iarc0))+ & + wx1*(wa0*adarc(iasp0,iarc1)+wa1*adarc(iasp1,iarc1)), & + wx0*(wa0*kdarc(iasp0,iarc0)+wa1*kdarc(iasp1,iarc0))+ & + wx1*(wa0*kdarc(iasp0,iarc1)+wa1*kdarc(iasp1,iarc1))/) +end subroutine guessak_geo + +!============================================================================= +subroutine bestesg_geo(lam,garcx,garcy, a,k,marcx,marcy,q,ff)! [bestesg_geo] +!============================================================================= +! Get the best Extended Schmidt Gnomonic parameter, (a,k), for the given +! geographical half-spans, garcx and garcy, as well as the corresponding +! map-space half-spans, garcx and garcy (in degrees) and the quality +! diagnostic, Q(lam) for this optimal parameter choice. If this process +! fails for any reason, the failure is alerted by a raised flag, FF, and +! the other output arguments must then be taken to be meaningless. +! +! The diagnostic Q measures the variance over the domain of a local measure +! of grid distortion. A logarithmic measure of local grid deformation is +! give by L=log(J^t.J)/2, where J is the mapping Jacobian matrix, dX/dx, +! where X is the cartesian unit 3-vector representation of the image of the +! mapping of the map-coordinate 2-vector, x. +! The Frobenius squared-norm, Trace(L*L), of L is the basis for the simplest +! (lam=0) definition of the variance of L, but (Trace(L))**2 is another. +! Here, we weight both contributions, by lam and (1-lam) respectively, with +! 0 <= lam <1, to compute the variance Q(lam,a,k), and search for the (a,k) +! that minimizes this Q. +! +! The domain averages are computed by double Gauss-Legendre quadrature (i.e., +! in both the x and y directions), but restricted to a mere quadrant of the +! domain (since bilateral symmetry pertains across both domain medians, +! yielding a domain mean L that is strictly diagonal. +!============================================================================= +use pietc, only: u5,o5,s18,s36,s54,s72,ms18,ms36,ms54,ms72 +use pmat, only: inv +use psym2, only: chol2 +implicit none +real(dp),intent(in ):: lam,garcx,garcy +real(dp),intent(out):: a,k,marcx,marcy,q +logical ,intent(out):: FF +!----------------------------------------------------------------------------- +integer(spi),parameter :: nit=200,mit=20,ngh=25 +real(dp) ,parameter :: u2o5=u2*o5,& + f18=u2o5*s18,f36=u2o5*s36,f54=u2o5*s54,& + f72=u2o5*s72,mf18=-f18,mf36=-f36,mf54=-f54,& + mf72=-f72,& !<- (Fourier transform coefficients) + r=0.001_dp,rr=r*r,dang=pi2*o5,crit=1.e-14_dp +real(dp),dimension(ngh) :: wg,xg +real(dp),dimension(0:4,0:4):: em5 ! <- Fourier matrix for 5 points +real(dp),dimension(0:4) :: qs +real(dp),dimension(2,0:4) :: aks,mas +real(dp),dimension(2,2) :: basis0,basis,hess,el,gadak,gadma,madga,madak +real(dp),dimension(2) :: ak,dak,dma,vec2,grad,qdak,qdma,ga,ma,gat +real(dp) :: s,tgarcx,tgarcy,asp,ang +integer(spi) :: i,it +logical :: flip +data em5/o5,u2o5, u0,u2o5, u0,& ! <-The Fourier matrix for 5 points. Applied + o5, f18, f72,mf54, f36,& ! to the five 72-degree spaced values in a + o5,mf54, f36, f18,mf72,& ! column-vector, the product vector has the + o5,mf54,mf36, f18, f72,& ! components, wave-0, cos and sin wave-1, + o5, f18,mf72,mf54,mf36/ ! cos and sin wave-2. +! First guess upper-triangular basis regularizing the samples used to +! estimate the Hessian of q by finite differencing: +data basis0/0.1_dp,u0, 0.3_dp,0.3_dp/ +!============================================================================= +ff=lam=u1 +if(ff)then; print'("In bestesg_geo; lam out of range")';return; endif +ff= garcx<=u0 .or. garcy<=u0 +if(ff)then + print'("In bestesg_geo; a nonpositive domain parameter, garcx or garcy")' + return +endif +call gaulegh(ngh,xg,wg)! <- Prepare Gauss-Legendre nodes xg and weights wg +flip=garcy>garcx +if(flip)then; tgarcx=garcy; tgarcy=garcx! <- Switch +else ; tgarcx=garcx; tgarcy=garcy! <- Don't switch +endif +ga=(/tgarcx,tgarcy/) +asp=tgarcy/tgarcx +basis=basis0 + +call guessak_geo(asp,tgarcx,ak) +ma=ga*dtor*0.9_dp ! Shrink first estimate, to start always within bounds + +! Perform a Newton iteration (except with imperfect Hessian) to find the +! parameter vector, ak, at which the derivative of Q at constant geographical +! semi-axes, ga, as given, goes to zero. The direct evaluation of the +! Q-derivative at constant ma (which is what is actually computed in +! get_meanq) therefore needs modification to obtain Q-derivarive at constant +! ga: +! dQ/d(ak)|_ga = dQ/d(ak)|_ma - dQ/d(ma)|_ak*d(ma)/d(ga)|_ak*d(ga)/d(ak)|_ma +! +! Since the Hessian evaluation is only carried out at constant map-space +! semi-axes, ma, it is not ideal for this problem; consequently, the allowance +! of newton iterations, nit, is much more liberal than we allow for the +! companion routine, bestesg_map, where the constant ma condition WAS +! appropriate. +do it=1,nit + call get_meanq(ngh,lam,xg,wg,ak,ma,q,qdak,qdma,gat,gadak,gadma,ff) + if(ff)return + madga=gadma; call inv(madga)! <- d(ma)/d(ga)|_ak ("at constant ak") + madak=-matmul(madga,gadak) + qdak=qdak+matmul(qdma,madak)! dQ/d(ak)|_ga + if(it<=mit)then ! <- Only recompute aks if the basis is new +! Place five additional sample points around the stencil-ellipse: + do i=0,4 + ang=i*dang ! steps of 72 degrees + vec2=(/cos(ang),sin(ang)/)*r ! points on a circle of radius r ... + dak=matmul(basis,vec2) + dma=matmul(madak,dak) + aks(:,i)=ak+dak ! ... become points on an ellipse. + mas(:,i)=ma+dma + enddo + call get_meanq(5,ngh,lam,xg,wg,aks,mas, qs,ff) + endif + grad=matmul(qdak,basis)/q ! <- New grad estimate, accurate to near roundoff + if(itnit)print'("WARNING; Relatively inferior convergence in bestesg_geo")' +a=ak(1) +k=ak(2) +if(flip)then; marcx=ma(2); marcy=ma(1)! Remember to switch back +else ; marcx=ma(1); marcy=ma(2)! don't switch +endif +end subroutine bestesg_geo + +!============================================================================= +subroutine bestesg_map(lam,marcx,marcy, a,k,garcx,garcy,q,ff) ![bestesg_map] +!============================================================================= +! Get the best Extended Schmidt Gnomonic parameter, (a,k), for the given +! map-coordinate half-spans, marcx and marcy, as well as the corresponding +! geographical half-spans, garcx and garcy (in degrees) and the quality +! diagnostic, Q(lam) for this optimal parameter choice. If this process +! fails for any reason, the failure is alerted by a raised flag, FF, and +! the other output arguments must then be taken to be meaningless. +! +! The diagnostic Q measures the variance over the domain of a local measure +! of grid distortion. A logarithmic measure of local grid deformation is +! give by L=log(J^t.J)/2, where J is the mapping Jacobian matrix, dX/dx, +! where X is the cartesian unit 3-vector representation of the image of the +! mapping of the map-coordinate 2-vector, x. +! The Frobenius squared-norm, Trace(L*L), of L is the basis for the simplest +! (lam=0) definition of the variance of L, but (Trace(L))**2 is another. +! Here, we weight both contributions, by lam and (1-lam) respectively, with +! 0 <= lam <1, to compute the variance Q(lam,a,k), and search for the (a,k) +! that minimizes this Q. +! +! The domain averages are computed by double Gauss-Legendre quadrature (i.e., +! in both the x and y directions), but restricted to a mere quadrant of the +! domain (since bilateral symmetry pertains across both domain medians, +! yielding a domain mean L that is strictly diagonal. +!============================================================================= +use pietc, only: u5,o5,s18,s36,s54,s72,ms18,ms36,ms54,ms72 +use psym2, only: chol2 +implicit none +real(dp),intent(in ):: lam,marcx,marcy +real(dp),intent(out):: a,k,garcx,garcy,q +logical ,intent(out):: FF +!----------------------------------------------------------------------------- +integer(spi),parameter :: nit=25,mit=7,ngh=25 +real(dp),parameter :: u2o5=u2*o5, & + f18=u2o5*s18,f36=u2o5*s36,f54=u2o5*s54, & + f72=u2o5*s72,mf18=-f18,mf36=-f36,mf54=-f54,& + mf72=-f72,& !<- (Fourier) + r=0.001_dp,rr=r*r,dang=pi2*o5,crit=1.e-12_dp +real(dp),dimension(ngh) :: wg,xg +real(dp),dimension(0:4,0:4):: em5 ! <- Fourier matrix for 5 points +real(dp),dimension(0:4) :: qs ! <-Sampled q, its Fourier coefficients +real(dp),dimension(2,0:4) :: aks,mas! <- tiny elliptical array of ak +real(dp),dimension(2,2) :: basis0,basis,hess,el,gadak,gadma +real(dp),dimension(2) :: ak,dak,vec2,grad,qdak,qdma,ga,ma +real(dp) :: s,tmarcx,tmarcy,asp,ang +integer(spi) :: i,it +logical :: flip +data em5/o5,u2o5, u0,u2o5, u0,& ! <-The Fourier matrix for 5 points. Applied + o5, f18, f72,mf54, f36,& ! to the five 72-degree spaced values in a + o5,mf54, f36, f18,mf72,& ! column-vector, the product vector has the + o5,mf54,mf36, f18, f72,& ! components, wave-0, cos and sin wave-1, + o5, f18,mf72,mf54,mf36/ ! cos and sin wave-2. +! First guess upper-triangular basis regularizing the samples used to +! estimate the Hessian of q by finite differencing: +data basis0/0.1_dp,u0, 0.3_dp,0.3_dp/ +!============================================================================= +ff=lam=u1 +if(ff)then; print'("In bestesg_map; lam out of range")';return; endif +ff= marcx<=u0 .or. marcy<=u0 +if(ff)then + print'("In bestesg_map; a nonpositive domain parameter, marcx or marcy")' + return +endif +call gaulegh(ngh,xg,wg) +flip=marcy>marcx +if(flip)then; tmarcx=marcy; tmarcy=marcx! <- Switch +else ; tmarcx=marcx; tmarcy=marcy! <- Don't switch +endif +ma=(/tmarcx,tmarcy/); do i=0,4; mas(:,i)=ma; enddo +asp=tmarcy/tmarcx +basis=basis0 + +call guessak_map(asp,tmarcx,ak) + +do it=1,nit + call get_meanq(ngh,lam,xg,wg,ak,ma,q,qdak,qdma,ga,gadak,gadma,ff) + if(ff)return + if(it<=mit)then +! Place five additional sample points around the stencil-ellipse: + do i=0,4 + ang=i*dang ! steps of 72 degrees + vec2=(/cos(ang),sin(ang)/)*r ! points on a circle of radius r ... + aks(:,i)=ak+matmul(basis,vec2) ! ... become points on an ellipse. + enddo + call get_meanq(5,ngh,lam,xg,wg,aks,mas, qs,ff) + endif + grad=matmul(qdak,basis)/q ! <- New grad estimate, accurate to near roundoff + if(itnit)print'("WARNING; Relatively inferior convergence in bestesg_map")' +a=ak(1) +k=ak(2) +if(flip)then; garcx=ga(2); garcy=ga(1)! Remember to switch back +else ; garcx=ga(1); garcy=ga(2)! don't switch +endif +end subroutine bestesg_map + +!============================================================================= +subroutine hgrid_ak_rr(lx,ly,nx,ny,A,K,plat,plon,pazi, & ! [hgrid_ak_rr] + delx,dely, glat,glon,garea, ff) +!============================================================================= +! Use a and k as the parameters of an Extended Schmidt-transformed +! Gnomonic (ESG) mapping centered at (plat,plon) and twisted about this center +! by an azimuth angle of pazi counterclockwise (these angles in radians). +! +! Assume the radius of the earth is unity, and using the central mapping +! point as the coordinate origin, set up the grid with central x-spacing delx +! and y-spacing dely. The grid index location of the left-lower +! corner of the domain is (lx,ly) (typically both NEGATIVE). +! The numbers of the grid spaces in x and y directions are nx and ny. +! (Note that, for a centered rectangular grid lx and ly are negative and, in +! magnitude, half the values of nx and ny respectively.) +! Return the latitude and longitude, in radians again, of the grid points thus +! defined in the arrays, glat and glon, and return a rectangular array, garea, +! of dimensions nx-1 by ny-1, that contains the areas of each of the grid +! cells +! +! If all goes well, return a lowered failure flag, ff=.false. . +! But if, for some reason, it is not possible to complete this task, +! return the raised failure flag, ff=.TRUE. . +!============================================================================= +use pmat4, only: sarea +use pmat5, only: ctogr +implicit none +integer(spi), intent(in ):: lx,ly,nx,ny +real(dp), intent(in ):: a,k,plat,plon,pazi, & + delx,dely +real(dp),dimension(lx:lx+nx ,ly:ly+ny ),intent(out):: glat,glon +real(dp),dimension(lx:lx+nx-1,ly:ly+ny-1),intent(out):: garea +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp),dimension(3,3):: prot,azirot +real(dp),dimension(3,2):: xcd +real(dp),dimension(3) :: xc +real(dp),dimension(2) :: xm +real(dp) :: clat,slat,clon,slon,cazi,sazi,& + rlat,drlata,drlatb,drlatc, & + rlon,drlona,drlonb,drlonc +integer(spi) :: ix,iy,mx,my +!============================================================================= +clat=cos(plat); slat=sin(plat) +clon=cos(plon); slon=sin(plon) +cazi=cos(pazi); sazi=sin(pazi) + +azirot(:,1)=(/ cazi, sazi, u0/) +azirot(:,2)=(/-sazi, cazi, u0/) +azirot(:,3)=(/ u0, u0, u1/) + +prot(:,1)=(/ -slon, clon, u0/) +prot(:,2)=(/-slat*clon, -slat*slon, clat/) +prot(:,3)=(/ clat*clon, clat*slon, slat/) +prot=matmul(prot,azirot) +mx=lx+nx ! Index of the 'right' edge of the rectangular grid +my=ly+ny ! Index of the 'top' edge of the rectangular grid +do iy=ly,my + xm(2)=iy*dely + do ix=lx,mx + xm(1)=ix*delx + call xmtoxc_ak(a,k,xm,xc,xcd,ff) + if(ff)return + xcd=matmul(prot,xcd) + xc =matmul(prot,xc ) + call ctogr(xc,glat(ix,iy),glon(ix,iy)) + enddo +enddo + +! Compute the areas of the quadrilateral grid cells: +do iy=ly,my-1 + do ix=lx,mx-1 + rlat =glat(ix ,iy ) + drlata=glat(ix+1,iy )-rlat + drlatb=glat(ix+1,iy+1)-rlat + drlatc=glat(ix ,iy+1)-rlat + rlon =glon(ix ,iy ) + drlona=glon(ix+1,iy )-rlon + drlonb=glon(ix+1,iy+1)-rlon + drlonc=glon(ix ,iy+1)-rlon +! If 'I' is the grid point (ix,iy), 'A' is (ix+1,iy); 'B' is (ix+1,iy+1) +! and 'C' is (ix,iy+1), then the area of the grid cell IABC is the sum of +! the areas of the traingles, IAB and IBC (the latter being the negative +! of the signed area of triangle, ICB): + garea(ix,iy)=sarea(rlat, drlata,drlona, drlatb,drlonb) & + -sarea(rlat, drlatc,drlonc, drlatb,drlonb) + enddo +enddo +end subroutine hgrid_ak_rr +!============================================================================= +subroutine hgrid_ak_rr_c(lx,ly,nx,ny,a,k,plat,plon,pazi, & ! [hgrid_ak_rr] + delx,dely, glat,glon,garea,dx,dy,angle_dx,angle_dy, ff) +!============================================================================= +! Use a and k as the parameters of an extended Schmidt-transformed +! gnomonic (ESG) mapping centered at (plat,plon) and twisted about this center +! by an azimuth angle of pazi counterclockwise (these angles in radians). +! +! Using the central mapping point as the coordinate origin, set up the grid +! with central x-spacing delx and y-spacing dely in nondimensional units, +! (i.e., as if the earth had unit radius) and with the location of the left- +! lower corner of the grid at center-relative grid index pair, (lx,ly) and +! with the number of the grid spaces in x and y directions given by nx and ny. +! (Note that, for a centered rectangular grid lx and ly are negative and, in +! magnitude, half the values of nx and ny respectively.) +! Return the latitude and longitude, again, in radians, of the grid pts thus +! defined in the arrays, glat and glon; return a rectangular array, garea, +! of dimensions nx-1 by ny-1, that contains the areas of each of the grid +! cells in nondimensional "steradian" units. +! +! In this version, these grid cell areas are computed by 2D integrating the +! scalar jacobian of the transformation, using a 4th-order centered scheme. +! The estimated grid steps, dx and dy, are returned at the grid cell edges, +! using the same 4th-order scheme to integrate the 1D projected jacobian. +! The angles, relative to local east and north, are returned respectively +! as angle_dx and angle_dy at grid cell corners, in radians counterclockwise. +! +! if all goes well, return a .FALSE. failure flag, ff. If, for some +! reason, it is not possible to complete this task, return the failure flag +! as .TRUE. +!============================================================================= +use pmat4, only: cross_product,triple_product +use pmat5, only: ctogr +implicit none +integer(spi), intent(in ):: lx,ly,nx,ny +real(dp), intent(in ):: a,k,plat,plon,pazi, & + delx,dely +real(dp),dimension(lx:lx+nx ,ly:ly+ny ),intent(out):: glat,glon +real(dp),dimension(lx:lx+nx-1,ly:ly+ny-1),intent(out):: garea +real(dp),dimension(lx:lx+nx-1,ly:ly+ny ),intent(out):: dx +real(dp),dimension(lx:lx+nx ,ly:ly+ny-1),intent(out):: dy +real(dp),dimension(lx:lx+nx ,ly:ly+ny ),intent(out):: angle_dx,angle_dy +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp),dimension(lx-1:lx+nx+1,ly-1:ly+ny+1):: gat ! Temporary area array +real(dp),dimension(lx-1:lx+nx+1,ly :ly+ny ):: dxt ! Temporary dx array +real(dp),dimension(lx :lx+nx ,ly-1:ly+ny+1):: dyt ! Temporary dy array +real(dp),dimension(3,3):: prot,azirot +real(dp),dimension(3,2):: xcd,eano +real(dp),dimension(2,2):: xcd2 +real(dp),dimension(3) :: xc,east,north +real(dp),dimension(2) :: xm +real(dp) :: clat,slat,clon,slon,cazi,sazi,delxy +integer(spi) :: ix,iy,mx,my,lxm,lym,mxp,myp +!============================================================================= +delxy=delx*dely +clat=cos(plat); slat=sin(plat) +clon=cos(plon); slon=sin(plon) +cazi=cos(pazi); sazi=sin(pazi) + +azirot(:,1)=(/ cazi, sazi, u0/) +azirot(:,2)=(/-sazi, cazi, u0/) +azirot(:,3)=(/ u0, u0, u1/) + +prot(:,1)=(/ -slon, clon, u0/) +prot(:,2)=(/-slat*clon, -slat*slon, clat/) +prot(:,3)=(/ clat*clon, clat*slon, slat/) +prot=matmul(prot,azirot) + +mx=lx+nx ! Index of the 'right' edge of the rectangular grid +my=ly+ny ! Index of the 'top' edge of the rectangular grid +lxm=lx-1; mxp=mx+1 ! Indices of extra left and right edges +lym=ly-1; myp=my+1 ! Indices of extra bottom and top edges + +!-- main body of horizontal grid: +do iy=ly,my + xm(2)=iy*dely + do ix=lx,mx + xm(1)=ix*delx + call xmtoxc_ak(a,k,xm,xc,xcd,ff); if(ff)return + xcd=matmul(prot,xcd) + xc =matmul(prot,xc ) + call ctogr(xc,glat(ix,iy),glon(ix,iy)) + east=(/-xc(2),xc(1),u0/); east=east/sqrt(dot_product(east,east)) + north=cross_product(xc,east) + eano(:,1)=east; eano(:,2)=north + xcd2=matmul(transpose(eano),xcd) + angle_dx(ix,iy)=atan2( xcd2(2,1),xcd2(1,1)) + angle_dy(ix,iy)=atan2(-xcd2(1,2),xcd2(2,2)) + dxt(ix,iy)=sqrt(dot_product(xcd2(:,1),xcd2(:,1)))*delx + dyt(ix,iy)=sqrt(dot_product(xcd2(:,2),xcd2(:,2)))*dely + gat(ix,iy)=triple_product(xc,xcd(:,1),xcd(:,2))*delxy + enddo +enddo + +!-- extra left edge, gat, dxt only: +xm(1)=lxm*delx +do iy=ly,my + xm(2)=iy*dely + call xmtoxc_ak(a,k,xm,xc,xcd,ff); if(ff)return + xcd=matmul(prot,xcd) + xc =matmul(prot,xc ) + east=(/-xc(2),xc(1),u0/); east=east/sqrt(dot_product(east,east)) + north=cross_product(xc,east) + eano(:,1)=east; eano(:,2)=north + xcd2=matmul(transpose(eano),xcd) + dxt(lxm,iy)=sqrt(dot_product(xcd2(:,1),xcd2(:,1)))*delx + gat(lxm,iy)=triple_product(xc,xcd(:,1),xcd(:,2))*delxy +enddo + +!-- extra right edge, gat, dxt only: +xm(1)=mxp*delx +do iy=ly,my + xm(2)=iy*dely + call xmtoxc_ak(a,k,xm,xc,xcd,ff); if(ff)return + xcd=matmul(prot,xcd) + xc =matmul(prot,xc ) + east=(/-xc(2),xc(1),u0/); east=east/sqrt(dot_product(east,east)) + north=cross_product(xc,east) + eano(:,1)=east; eano(:,2)=north + xcd2=matmul(transpose(eano),xcd) + dxt(mxp,iy)=sqrt(dot_product(xcd2(:,1),xcd2(:,1)))*delx + gat(mxp,iy)=triple_product(xc,xcd(:,1),xcd(:,2))*delxy +enddo + +!-- extra bottom edge, gat, dyt only: +xm(2)=lym*dely +do ix=lx,mx + xm(1)=ix*delx + call xmtoxc_ak(a,k,xm,xc,xcd,ff); if(ff)return + xcd=matmul(prot,xcd) + xc =matmul(prot,xc ) + east=(/-xc(2),xc(1),u0/); east=east/sqrt(dot_product(east,east)) + north=cross_product(xc,east) + eano(:,1)=east; eano(:,2)=north + xcd2=matmul(transpose(eano),xcd) + dyt(ix,lym)=sqrt(dot_product(xcd2(:,2),xcd2(:,2)))*dely + gat(ix,lym)=triple_product(xc,xcd(:,1),xcd(:,2))*delxy +enddo + +!-- extra top edge, gat, dyt only: +xm(2)=myp*dely +do ix=lx,mx + xm(1)=ix*delx + call xmtoxc_ak(a,k,xm,xc,xcd,ff); if(ff)return + xcd=matmul(prot,xcd) + xc =matmul(prot,xc ) + east=(/-xc(2),xc(1),u0/); east=east/sqrt(dot_product(east,east)) + north=cross_product(xc,east) + eano(:,1)=east; eano(:,2)=north + xcd2=matmul(transpose(eano),xcd) + dyt(ix,myp)=sqrt(dot_product(xcd2(:,2),xcd2(:,2)))*dely + gat(ix,myp)=triple_product(xc,xcd(:,1),xcd(:,2))*delxy +enddo + +! Extra four corners, gat only: +xm(2)=lym*dely +!-- extra bottom left corner: +xm(1)=lxm*delx +call xmtoxc_ak(a,k,xm,xc,xcd,ff); if(ff)return +xcd=matmul(prot,xcd) +xc =matmul(prot,xc ) +gat(lxm,lym)=triple_product(xc,xcd(:,1),xcd(:,2))*delxy + +!-- extra bottom right corner: +xm(1)=mxp*delx +call xmtoxc_ak(a,k,xm,xc,xcd,ff); if(ff)return +xcd=matmul(prot,xcd) +xc =matmul(prot,xc ) +gat(mxp,lym)=triple_product(xc,xcd(:,1),xcd(:,2))*delxy + +xm(2)=myp*dely +!-- extra top left corner: +xm(1)=lxm*delx +call xmtoxc_ak(a,k,xm,xc,xcd,ff); if(ff)return +xcd=matmul(prot,xcd) +xc =matmul(prot,xc ) +gat(lxm,myp)=triple_product(xc,xcd(:,1),xcd(:,2))*delxy + +!-- extra top right corner: +xm(1)=mxp*delx +call xmtoxc_ak(a,k,xm,xc,xcd,ff); if(ff)return +xcd=matmul(prot,xcd) +xc =matmul(prot,xc ) +gat(mxp,myp)=triple_product(xc,xcd(:,1),xcd(:,2))*delxy + +!-- 4th-order averaging over each central interval using 4-pt. stencils: +dx =(13_dp*(dxt(lx :mx-1,:)+dxt(lx+1:mx ,:)) & + -(dxt(lxm:mx-2,:)+dxt(lx+2:mxp,:)))/24_dp +dy =(13_dp*(dyt(:,ly :my-1)+dyt(:,ly+1:my )) & + -(dyt(:,lym:my-2)+dyt(:,ly+2:myp)))/24_dp +gat(lx:mx-1,:)=(13_dp*(gat(lx :mx-1,:)+gat(lx+1:mx ,:)) & + -(gat(lxm:mx-2,:)+gat(lx+2:mxp,:)))/24_dp +garea =(13_dp*(gat(lx:mx-1,ly :my-1)+gat(lx:mx-1,ly+1:my )) & + -(gat(lx:mx-1,lym:my-2)+gat(lx:mx-1,ly+2:myp)))/24_dp +end subroutine hgrid_ak_rr_c + +!============================================================================= +subroutine hgrid_ak_rc(lx,ly,nx,ny,A,K,plat,plon,pazi, & ! [hgrid_ak_rc] + delx,dely, xc,xcd,garea, ff) +!============================================================================= +! Use a and k as the parameters of an Extended Schmidt-transformed +! Gnomonic (ESG) mapping centered at (plat,plon) and twisted about this center +! by an azimuth angle of pazi counterclockwise (these angles in radians). +! +! Assume the radius of the earth is unity, and using the central mapping +! point as the coordinate origin, set up the grid with central x-spacing delx +! and y-spacing dely. The grid index location of the left-lower +! corner of the domain is (lx,ly) (typically both NEGATIVE). +! The numbers of the grid spaces in x and y directions are nx and ny. +! (Note that, for a centered rectangular grid lx and ly are negative and, in +! magnitude, half the values of nx and ny respectively.) +! Return the unit cartesian vectors xc of the grid points and their jacobian +! matrices xcd wrt the map coordinates, and return a rectangular array, garea, +! of dimensions nx-1 by ny-1, that contains the areas of each of the grid +! cells +! +! If all goes well, return a lowered failure flag, ff=.false. . +! But if, for some reason, it is not possible to complete this task, +! return the raised failure flag, ff=.TRUE. . +!============================================================================= +use pmat4, only: sarea +use pmat5, only: ctogr +implicit none +integer(spi),intent(in ):: lx,ly,nx,ny +real(dp), intent(in ):: a,k,plat,plon,pazi,delx,dely +real(dp),dimension(3, lx:lx+nx ,ly:ly+ny ),intent(out):: xc +real(dp),dimension(3,2,lx:lx+nx ,ly:ly+ny ),intent(out):: xcd +real(dp),dimension( lx:lx+nx-1,ly:ly+ny-1),intent(out):: garea +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp),dimension(3,3):: prot,azirot +real(dp),dimension(2) :: xm +real(dp) :: clat,slat,clon,slon,cazi,sazi, & + rlat,rlata,rlatb,rlatc,drlata,drlatb,drlatc, & + rlon,rlona,rlonb,rlonc,drlona,drlonb,drlonc +integer(spi) :: ix,iy,mx,my +!============================================================================= +clat=cos(plat); slat=sin(plat) +clon=cos(plon); slon=sin(plon) +cazi=cos(pazi); sazi=sin(pazi) + +azirot(:,1)=(/ cazi, sazi, u0/) +azirot(:,2)=(/-sazi, cazi, u0/) +azirot(:,3)=(/ u0, u0, u1/) + +prot(:,1)=(/ -slon, clon, u0/) +prot(:,2)=(/-slat*clon, -slat*slon, clat/) +prot(:,3)=(/ clat*clon, clat*slon, slat/) +prot=matmul(prot,azirot) +mx=lx+nx ! Index of the 'right' edge of the rectangular grid +my=ly+ny ! Index of the 'top' edge of the rectangular grid +do iy=ly,my + xm(2)=iy*dely + do ix=lx,mx + xm(1)=ix*delx + call xmtoxc_ak(a,k,xm,xc(:,ix,iy),xcd(:,:,ix,iy),ff) + if(ff)return + xcd(:,:,ix,iy)=matmul(prot,xcd(:,:,ix,iy)) + xc (:, ix,iy)=matmul(prot,xc (:, ix,iy)) + enddo +enddo + +! Compute the areas of the quadrilateral grid cells: +do iy=ly,my-1 + do ix=lx,mx-1 + call ctogr(xc(:,ix ,iy ),rlat ,rlon ) + call ctogr(xc(:,ix+1,iy ),rlata,rlona) + call ctogr(xc(:,ix+1,iy+1),rlatb,rlonb) + call ctogr(xc(:,ix ,iy+1),rlatc,rlonc) + drlata=rlata-rlat; drlona=rlona-rlon + drlatb=rlatb-rlat; drlonb=rlonb-rlon + drlatc=rlatc-rlat; drlonc=rlonc-rlon + +! If 'I' is the grid point (ix,iy), 'A' is (ix+1,iy); 'B' is (ix+1,iy+1) +! and 'C' is (ix,iy+1), then the area of the grid cell IABC is the sum of +! the areas of the triangles, IAB and IBC (the latter being the negative +! of the signed area of triangle, ICB): + garea(ix,iy)=sarea(rlat, drlata,drlona, drlatb,drlonb) & + -sarea(rlat, drlatc,drlonc, drlatb,drlonb) + enddo +enddo +end subroutine hgrid_ak_rc + +!============================================================================= +subroutine hgrid_ak_dd(lx,ly,nx,ny,a,k,pdlat,pdlon,pdazi, & ! [hgrid_ak_dd] + delx,dely, gdlat,gdlon,garea, ff) +!============================================================================= +! Use a and k as the parameters of an Extended Schmidt-transformed +! Gnomonic (ESG) mapping centered at (pdlat,pdlon) and twisted about this +! center. +! by an azimuth angle of pdazi counterclockwise (these angles in degrees). +! Like hgrid_ak_rr, return the grid points' lats and lons, except that here +! the angles are returned in degrees. Garea, the area of each grid cell, is +! returned as in hgrid_ak_rr, and a failure flag, ff, raised when a failure +! occurs anywhere in these calculations. +!============================================================================ +implicit none +integer(spi), intent(in ):: lx,ly,nx,ny +real(dp), intent(in ):: A,K,pdlat,pdlon,& + pdazi,delx,dely +real(dp),dimension(lx:lx+nx ,ly:ly+ny ),intent(out):: gdlat,gdlon +real(dp),dimension(lx:lx+nx-1,ly:ly+ny-1),intent(out):: garea +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp):: plat,plon,pazi +!============================================================================= +plat=pdlat*dtor ! Convert these angles from degrees to radians +plon=pdlon*dtor ! +pazi=pdazi*dtor ! +call hgrid_ak_rr(lx,ly,nx,ny,A,K,plat,plon,pazi, & + delx,dely, gdlat,gdlon,garea, ff) +if(ff)return +gdlat=gdlat*rtod ! Convert these angles from radians to degrees +gdlon=gdlon*rtod ! +end subroutine hgrid_ak_dd +!============================================================================= +subroutine hgrid_ak_dd_c(lx,ly,nx,ny,a,k,pdlat,pdlon,pdazi, &! [hgrid_ak_dd] + delx,dely, gdlat,gdlon,garea,dx,dy,dangle_dx,dangle_dy, ff) +!============================================================================= +! Like hgrid_ak_rr_c, except all the angle arguments (but not delx,dely) +! are in degrees instead of radians. +!============================================================================= +implicit none +integer(spi), intent(in ):: lx,ly,nx,ny +real(dp), intent(in ):: a,k,pdlat,pdlon,& + pdazi,delx,dely +real(dp),dimension(lx:lx+nx ,ly:ly+ny ),intent(out):: gdlat,gdlon +real(dp),dimension(lx:lx+nx-1,ly:ly+ny-1),intent(out):: garea +real(dp),dimension(lx:lx+nx-1,ly:ly+ny ),intent(out):: dx +real(dp),dimension(lx:lx+nx ,ly:ly+ny-1),intent(out):: dy +real(dp),dimension(lx:lx+nx ,ly:ly+ny ),intent(out):: dangle_dx,dangle_dy +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp):: plat,plon,pazi +!============================================================================= +plat=pdlat*dtor ! Convert these angles from degrees to radians +plon=pdlon*dtor ! +pazi=pdazi*dtor ! +call hgrid_ak_rr_c(lx,ly,nx,ny,A,K,plat,plon,pazi, & + delx,dely, gdlat,gdlon,garea,dx,dy,dangle_dx,dangle_dy, ff) +if(ff)return +gdlat =gdlat *rtod ! Convert these angles from radians to degrees +gdlon =gdlon *rtod ! +dangle_dx=dangle_dx*rtod ! +dangle_dy=dangle_dy*rtod ! +end subroutine hgrid_ak_dd_c + +!============================================================================= +subroutine hgrid_ak_dc(lx,ly,nx,ny,a,k,pdlat,pdlon,pdazi, & ! [hgrid_ak_dc] + delx,dely, xc,xcd,garea, ff) +!============================================================================= +! Use a and k as the parameters of an Extended Schmidt-transformed +! Gnomonic (ESG) mapping centered at (pdlat,pdlon) and twisted about this +! center by an azimuth angle of pdazi counterclockwise (these angles in +! degrees). +! Like hgrid_ak_rx, return the grid points' cartesians xc and Jacobian +! matrices, xcd. Garea, the area of each grid cell, is also +! returned as in hgrid_ak_rx, and a failure flag, ff, raised when a failure +! occurs anywhere in these calculations. +!============================================================================ +implicit none +integer(spi),intent(in ):: lx,ly,nx,ny +real(dp), intent(in ):: A,K,pdlat,pdlon,pdazi,delx,dely +real(dp),dimension(3, lx:lx+nx ,ly:ly+ny ),intent(out):: xc +real(dp),dimension(3,2,lx:lx+nx ,ly:ly+ny ),intent(out):: xcd +real(dp),dimension( lx:lx+nx-1,ly:ly+ny-1),intent(out):: garea +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp):: plat,plon,pazi +!============================================================================= +plat=pdlat*dtor +plon=pdlon*dtor +pazi=pdazi*dtor +call hgrid_ak_rc(lx,ly,nx,ny,A,K,plat,plon,pazi, & + delx,dely, xc,xcd,garea, ff) +end subroutine hgrid_ak_dc + +!============================================================================= +subroutine hgrid_ak(lx,ly,nx,ny,a,k,plat,plon,pazi, & ! [hgrid_ak] + re,delxre,delyre, glat,glon,garea, ff) +!============================================================================= +! Like hgrid_ak_rr_c except the argument list includes the earth radius, re, +! and this is used to express the map-space grid increments in the dimensional +! units, delxre, delyre on entry, and to express the grid cell areas, garea, +! in dimensional units upon return. +! The gridded lats and lons, glat and glon, remain in radians. +!============================================================================ +implicit none +integer(spi), intent(in ):: lx,ly,nx,ny +real(dp), intent(in ):: a,k,plat,plon,pazi, & + re,delxre,delyre +real(dp),dimension(lx:lx+nx ,ly:ly+ny ),intent(out):: glat,glon +real(dp),dimension(lx:lx+nx-1,ly:ly+ny-1),intent(out):: garea +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp):: delx,dely,rere +!============================================================================= +delx=delxre/re ! <- set nondimensional grid step delx +dely=delyre/re ! <- set nondimensional grid step dely +call hgrid_ak_rr(lx,ly,nx,ny,a,k,plat,plon,pazi, & + delx,dely, glat,glon,garea, ff) +if(ff)return +rere=re*re +garea=garea*rere ! <- Convert from steradians to physical area units. +end subroutine hgrid_ak + +!============================================================================= +subroutine hgrid_ak_c(lx,ly,nx,ny,a,k,plat,plon,pazi, & ! [hgrid_ak] + re,delxre,delyre, glat,glon,garea,dx,dy,dangle_dx,dangle_dy, ff) +!============================================================================= +! Like hgrid_ak_rr_c except the argument list includes the earth radius, re, +! and this is used to express the map-space grid increments in the dimensional +! units, delxre, delyre on entry, and to express the grid cell areas, garea, +! and the x- and y- grid steps, dx and dy, in dimensional units upon return. +! The gridded lats and lons, glat and glon, remain in radians. +! Also, in order for the argument list to remain compatible with an earlier +! version of this routine, the relative rotations of the steps, dangle_dx +! and dangle_dy, are returned as degrees instead of radians (all other angles +! in the argument list, i.e., plat,plon,pazi,glat,glon, remain radians). +!============================================================================= +implicit none +integer(spi), intent(in ):: lx,ly,nx,ny +real(dp), intent(in ):: a,k,plat,plon,pazi, & + re,delxre,delyre +real(dp),dimension(lx:lx+nx ,ly:ly+ny ),intent(out):: glat,glon +real(dp),dimension(lx:lx+nx-1,ly:ly+ny-1),intent(out):: garea +real(dp),dimension(lx:lx+nx-1,ly:ly+ny ),intent(out):: dx +real(dp),dimension(lx:lx+nx ,ly:ly+ny-1),intent(out):: dy +real(dp),dimension(lx:lx+nx ,ly:ly+ny ),intent(out):: dangle_dx,dangle_dy +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp):: delx,dely,rere +!============================================================================= +delx=delxre/re ! <- set nondimensional grid step delx +dely=delyre/re ! <- set nondimensional grid step dely +call hgrid_ak_rr_c(lx,ly,nx,ny,a,k,plat,plon,pazi, & + delx,dely, glat,glon,garea,dx,dy,dangle_dx,dangle_dy, ff) +if(ff)return +rere=re*re +garea=garea*rere ! <- Convert from steradians to physical area units. +dx=dx*re ! <- Convert from nondimensional to physical length units. +dy=dy*re ! <- +dangle_dx=dangle_dx*rtod ! <-Convert from radians to degrees +dangle_dy=dangle_dy*rtod ! <-Convert from radians to degrees +end subroutine hgrid_ak_c + +!============================================================================= +subroutine gaulegh(m,x,w)! [gaulegh] +!============================================================================= +! This Gauss-Legendre quadrature integrates exactly any even polynomial +! up to degree m*4-2 in the half-interval [0,1]. This code is liberally +! adapted from the algorithm given in Press et al., Numerical Recipes. +!============================================================================= +implicit none +integer(spi), intent(IN ):: m ! <- number of nodes in half-interval +real(dp),dimension(m),intent(OUT):: x,w ! <- nodes and weights +!----------------------------------------------------------------------------- +integer(spi),parameter:: nit=8 +real(dp), parameter:: eps=3.e-14_dp +integer(spi) :: i,ic,j,jm,it,m2,m4p,m4p3 +real(dp) :: z,zzm,p1,p2,p3,pp,z1 +!============================================================================= +m2=m*2; m4p=m*4+1; m4p3=m4p+2 +do i=1,m; ic=m4p3-4*i + z=cos(pih*ic/m4p); zzm=z*z-u1 + do it=1,nit + p1=u1; p2=u0 + do j=1,m2; jm=j-1; p3=p2; p2=p1; p1=((j+jm)*z*p2-jm*p3)/j; enddo + pp=m2*(z*p1-p2)/zzm; z1=z; z=z1-p1/pp; zzm=z*z-u1 + if(abs(z-z1) <= eps)exit + enddo + x(i)=z; w(i)=-u2/(zzm*pp*pp) +enddo +end subroutine gaulegh + +!============================================================================= +subroutine gtoxm_ak_rr_m(A,K,plat,plon,pazi,lat,lon,xm,ff)! [gtoxm_ak_rr] +!============================================================================= +! Given the map specification (angles in radians), the grid spacing (in +! map-space units) and the sample lat-lon (in radian), return the the +! image in map space in a 2-vector in grid units. If the transformation +! is invalid, return a .true. failure flag. +!============================================================================= +use pmat5, only: grtoc +implicit none +real(dp), intent(in ):: a,k,plat,plon,pazi,lat,lon +real(dp),dimension(2),intent(out):: xm +logical, intent(out):: ff +real(dp),dimension(3,3):: prot,azirot +real(dp) :: clat,slat,clon,slon,cazi,sazi +real(dp),dimension(3) :: xc +!============================================================================= +clat=cos(plat); slat=sin(plat) +clon=cos(plon); slon=sin(plon) +cazi=cos(pazi); sazi=sin(pazi) + +azirot(:,1)=(/ cazi, sazi, u0/) +azirot(:,2)=(/-sazi, cazi, u0/) +azirot(:,3)=(/ u0, u0, u1/) + +prot(:,1)=(/ -slon, clon, u0/) +prot(:,2)=(/-slat*clon, -slat*slon, clat/) +prot(:,3)=(/ clat*clon, clat*slon, slat/) +prot=matmul(prot,azirot) + +call grtoc(lat,lon,xc) +xc=matmul(transpose(prot),xc) +call xctoxm_ak(a,k,xc,xm,ff) +end subroutine gtoxm_ak_rr_m +!============================================================================= +subroutine gtoxm_ak_rr_g(A,K,plat,plon,pazi,delx,dely,lat,lon,&! [gtoxm_ak_rr] + xm,ff) +!============================================================================= +! Given the map specification (angles in radians), the grid spacing (in +! map-space units) and the sample lat-lon (in radian), return the the +! image in map space in a 2-vector in grid units. If the transformation +! is invalid, return a .true. failure flag. +!============================================================================= +implicit none +real(dp), intent(in ):: a,k,plat,plon,pazi,delx,dely,lat,lon +real(dp),dimension(2),intent(out):: xm +logical, intent(out):: ff +!============================================================================= +call gtoxm_ak_rr_m(A,K,plat,plon,pazi,lat,lon,xm,ff); if(ff)return +xm(1)=xm(1)/delx; xm(2)=xm(2)/dely +end subroutine gtoxm_ak_rr_g + +!============================================================================= +subroutine gtoxm_ak_dd_m(A,K,pdlat,pdlon,pdazi,dlat,dlon,&! [gtoxm_ak_dd] + xm,ff) +!============================================================================= +! Like gtoxm_ak_rr_m, except input angles are expressed in degrees +!============================================================================= +implicit none +real(dp), intent(in ):: a,k,pdlat,pdlon,pdazi,dlat,dlon +real(dp),dimension(2),intent(out):: xm +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp):: plat,plon,pazi,lat,lon +!============================================================================= +plat=pdlat*dtor ! Convert these angles from degrees to radians +plon=pdlon*dtor ! +pazi=pdazi*dtor ! +lat=dlat*dtor +lon=dlon*dtor +call gtoxm_ak_rr_m(A,K,plat,plon,pazi,lat,lon,xm,ff) +end subroutine gtoxm_ak_dd_m +!============================================================================= +subroutine gtoxm_ak_dd_g(A,K,pdlat,pdlon,pdazi,delx,dely,&! [gtoxm_ak_dd] +dlat,dlon, xm,ff) +!============================================================================= +! Like gtoxm_ak_rr_g, except input angles are expressed in degrees +!============================================================================= +implicit none +real(dp), intent(in ):: a,k,pdlat,pdlon,pdazi,delx,dely,dlat,dlon +real(dp),dimension(2),intent(out):: xm +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp):: plat,plon,pazi,lat,lon +!============================================================================= +plat=pdlat*dtor ! Convert these angles from degrees to radians +plon=pdlon*dtor ! +pazi=pdazi*dtor ! +lat=dlat*dtor +lon=dlon*dtor +call gtoxm_ak_rr_g(A,K,plat,plon,pazi,delx,dely,lat,lon,xm,ff) +end subroutine gtoxm_ak_dd_g + +!============================================================================= +subroutine xmtog_ak_rr_m(A,K,plat,plon,pazi,xm,lat,lon,ff)! [xmtog_ak_rr] +!============================================================================= +! Given the ESG map specified by parameters (A,K) and geographical +! orientation, plat,plon,pazi (radians), and a position, in map-space +! coordinates given by the 2-vector, xm, return the geographical +! coordinates, lat and lon (radians). If the transformation is invalid for +! any reason, return instead with a raised failure flag, FF= .true. +!============================================================================= +use pmat5, only: ctogr +implicit none +real(dp), intent(in ):: a,k,plat,plon,pazi +real(dp),dimension(2),intent(in ):: xm +real(dp), intent(out):: lat,lon +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp),dimension(3,2):: xcd +real(dp),dimension(3,3):: prot,azirot +real(dp) :: clat,slat,clon,slon,cazi,sazi +real(dp),dimension(3) :: xc +!============================================================================= +clat=cos(plat); slat=sin(plat) +clon=cos(plon); slon=sin(plon) +cazi=cos(pazi); sazi=sin(pazi) + +azirot(:,1)=(/ cazi, sazi, u0/) +azirot(:,2)=(/-sazi, cazi, u0/) +azirot(:,3)=(/ u0, u0, u1/) + +prot(:,1)=(/ -slon, clon, u0/) +prot(:,2)=(/-slat*clon, -slat*slon, clat/) +prot(:,3)=(/ clat*clon, clat*slon, slat/) +prot=matmul(prot,azirot) +call xmtoxc_ak(a,k,xm,xc,xcd,ff); if(ff)return +xc=matmul(prot,xc) +call ctogr(xc,lat,lon) +end subroutine xmtog_ak_rr_m +!============================================================================= +subroutine xmtog_ak_rr_g(A,K,plat,plon,pazi,delx,dely,xm,&! [xmtog_ak_rr] + lat,lon,ff) +!============================================================================= +! For an ESG map with parameters, (A,K), and geographical orientation, +! given by plon,plat,pazi (radians), and given a point in grid-space units +! as the 2-vector, xm, return the geographical coordinates, lat, lon, (radians) +! of this point. If instead the transformation is invalid for any reason, then +! return the raised failure flag, FF=.true. +!============================================================================= +implicit none +real(dp), intent(in ):: a,k,plat,plon,pazi,delx,dely +real(dp),dimension(2),intent(in ):: xm +real(dp), intent(out):: lat,lon +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp),dimension(2):: xmt +!============================================================================= +xmt(1)=xm(1)*delx ! Convert from grid units to intrinsic map-space units +xmt(2)=xm(2)*dely ! +call xmtog_ak_rr_m(A,K,plat,plon,pazi,xmt,lat,lon,ff) +end subroutine xmtog_ak_rr_g + +!============================================================================= +subroutine xmtog_ak_dd_m(A,K,pdlat,pdlon,pdazi,xm,dlat,dlon,ff)! [xmtog_ak_dd] +!============================================================================= +! Like xmtog_ak_rr_m, except angles are expressed in degrees +!============================================================================= +use pmat5, only: ctogr +implicit none +real(dp), intent(in ):: a,k,pdlat,pdlon,pdazi +real(dp),dimension(2),intent(in ):: xm +real(dp), intent(out):: dlat,dlon +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp):: plat,plon,pazi,lat,lon +!============================================================================= +plat=pdlat*dtor ! Convert these angles from degrees to radians +plon=pdlon*dtor ! +pazi=pdazi*dtor ! +call xmtog_ak_rr_m(A,K,plat,plon,pazi,xm,lat,lon,ff) +dlat=lat*rtod +dlon=lon*rtod +end subroutine xmtog_ak_dd_m +!============================================================================= +subroutine xmtog_ak_dd_g(A,K,pdlat,pdlon,pdazi,delx,dely,xm,&! [xmtog_ak_dd] + dlat,dlon,ff) +!============================================================================= +! Like xmtog_ak_rr_g, except angles are expressed in degrees +!============================================================================= +implicit none +real(dp), intent(in ):: a,k,pdlat,pdlon,pdazi,delx,dely +real(dp),dimension(2),intent(in ):: xm +real(dp), intent(out):: dlat,dlon +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp),dimension(2):: xmt +real(dp) :: plat,plon,pazi,lat,lon +!============================================================================= +xmt(1)=xm(1)*delx ! Convert from grid units to intrinsic map-space units +xmt(2)=xm(2)*dely ! +plat=pdlat*dtor ! Convert these angles from degrees to radians +plon=pdlon*dtor ! +pazi=pdazi*dtor ! +call xmtog_ak_rr_m(A,K,plat,plon,pazi,xmt,lat,lon,ff) +dlat=lat*rtod +dlon=lon*rtod +end subroutine xmtog_ak_dd_g + +end module pesg + diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pfun.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pfun.f90 new file mode 100644 index 000000000..6a60fe359 --- /dev/null +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pfun.f90 @@ -0,0 +1,283 @@ +! +! ********************************* +! * module pfun * +! * R. J. Purser * +! * NCEP/EMC 2017 * +! ********************************* +! Direct dependencies: +! Modules: pkind, pietc_s, pietc +! +!============================================================================= +module pfun +!============================================================================= +use pkind, only: sp,dp +implicit none +private +public:: gd,gdi,hav,havh,ahav,ahavh,sech,sechs,atanh,sinoxm,sinox,& + sinhoxm,sinhox + +interface gd; module procedure gd_s, gd_d; end interface +interface gdi; module procedure gdi_s, gdi_d; end interface +interface hav; module procedure hav_s, hav_d; end interface +interface havh; module procedure havh_s, havh_d; end interface +interface ahav; module procedure ahav_s, ahav_d; end interface +interface ahavh; module procedure ahavh_s, ahavh_d; end interface +interface atanh; module procedure atanh_s, atanh_d; end interface +interface sech; module procedure sech_s, sech_d; end interface +interface sechs; module procedure sechs_s, sechs_d; end interface +interface sinoxm; module procedure sinoxm_d; end interface +interface sinox; module procedure sinox_d; end interface +interface sinhoxm; module procedure sinhoxm_d;end interface +interface sinhox; module procedure sinhox_d; end interface + +contains + +!============================================================================= +function gd_s(x) result(y)! [gd] +!============================================================================= +! Gudermannian function +implicit none +real(sp),intent(in ):: x +real(sp) :: y +y=atan(sinh(x)) +end function gd_s +!============================================================================= +function gd_d(x) result(y)! [gd] +!============================================================================= +implicit none +real(dp),intent(in ):: x +real(dp) :: y +y=atan(sinh(x)) +end function gd_d + +!============================================================================= +function gdi_s(y) result(x)! [gdi] +!============================================================================= +! Inverse Gudermannian function +implicit none +real(sp),intent(in ):: y +real(sp) :: x +x=atanh(sin(y)) +end function gdi_s +!============================================================================= +function gdi_d(y) result(x)! [gdi] +!============================================================================= +implicit none +real(dp),intent(in ):: y +real(dp) :: x +x=atanh(sin(y)) +end function gdi_d + +!============================================================================= +function hav_s(t) result(a)! [hav] +!============================================================================= +! Haversine function +use pietc_s, only: o2 +implicit none +real(sp),intent(in ):: t +real(sp) :: a +a=(sin(t*o2))**2 +end function hav_s +!============================================================================= +function hav_d(t) result(a)! [hav] +!============================================================================= +use pietc, only: o2 +implicit none +real(dp),intent(in ):: t +real(dp) :: a +a=(sin(t*o2))**2 +end function hav_d + +!============================================================================= +function havh_s(t) result(a)! [havh] +!============================================================================= +! Note the minus sign in the hyperbolic-haversine definition +use pietc_s, only: o2 +implicit none +real(sp),intent(in ):: t +real(sp) :: a +a=-(sinh(t*o2))**2 +end function havh_s +!============================================================================= +function havh_d(t) result(a)! [havh] +!============================================================================= +use pietc, only: o2 +implicit none +real(dp),intent(in ):: t +real(dp) :: a +a=-(sinh(t*o2))**2 +end function havh_d + +!============================================================================= +function ahav_s(a) result(t)! [ahav] +!============================================================================= +use pietc_s, only: u2 +! Arc-haversine function +implicit none +real(sp),intent(in ):: a +real(sp) :: t +t=u2*asin(sqrt(a)) +end function ahav_s +!============================================================================= +function ahav_d(a) result(t)! [ahav] +!============================================================================= +use pietc, only: u2 +implicit none +real(dp),intent(in ):: a +real(dp) :: t +t=u2*asin(sqrt(a)) +end function ahav_d + +!============================================================================= +function ahavh_s(a) result(t)! [ahavh] +!============================================================================= +use pietc_s, only: u2 +! Note the minus sign in the hyperbolic arc-haversine definition +implicit none +real(sp),intent(in ):: a +real(sp) :: t +t=u2*asinh(sqrt(-a)) +end function ahavh_s +!============================================================================= +function ahavh_d(a) result(t)! [ahavh] +!============================================================================= +use pietc, only: u2 +implicit none +real(dp),intent(in ):: a +real(dp) :: t +t=u2*asinh(sqrt(-a)) +end function ahavh_d + +!============================================================================= +function atanh_s(t) result(a)! [atanh] +!============================================================================= +use pietc_s, only: u1,o2,o3,o5 +implicit none +real(sp),intent(IN ):: t +real(sp) :: a,tt +real(sp),parameter :: o7=u1/7_sp,o9=u1/9_sp +!============================================================================= +if(abs(t)>=u1)stop 'In atanh; no solution' +if(abs(t)>1.e-3_sp)then; a=log((u1+t)/(u1-t))*o2 +else; tt=t*t; a=t*(u1+tt*(o3+tt*(o5+tt*(o7+tt*o9)))) +endif +end function atanh_s +!============================================================================= +function atanh_d(t) result(a)! [atanh] +!============================================================================= +use pietc, only: u1,o2,o3,o5 +implicit none +real(dp),intent(IN ):: t +real(dp) :: a,tt +real(dp),parameter :: o7=u1/7_dp,o9=u1/9_dp +!============================================================================= +if(abs(t)>=u1)stop 'In atanh; no solution' +if(abs(t)>1.e-3_dp)then; a=log((u1+t)/(u1-t))*o2 +else; tt=t*t; a=t*(u1+tt*(o3+tt*(o5+tt*(o7+tt*o9)))) +endif +end function atanh_d + +!============================================================================= +function sech_s(x)result(r)! [sech] +!============================================================================= +! This indirect way of computing 1/cosh(x) avoids overflows at large x +use pietc_s, only: u1,u2 +implicit none +real(sp),intent(in ):: x +real(sp) :: r +real(sp) :: e,ax +ax=abs(x) +e=exp(-ax) +r=e*u2/(u1+e*e) +end function sech_s +!============================================================================= +function sech_d(x)result(r)! [sech] +!============================================================================= +use pietc, only: u1,u2 +implicit none +real(dp),intent(in ):: x +real(dp) :: r +real(dp) :: e,ax +ax=abs(x) +e=exp(-ax) +r=e*u2/(u1+e*e) +end function sech_d + +!============================================================================= +function sechs_s(x)result(r)! [sechs] +!============================================================================= +implicit none +real(sp),intent(in ):: x +real(sp) :: r +r=sech(x)**2 +end function sechs_s +!============================================================================= +function sechs_d(x)result(r)! [sechs] +!============================================================================= +implicit none +real(dp),intent(in ):: x +real(dp) :: r +r=sech(x)**2 +end function sechs_d + +!============================================================================= +function sinoxm_d(x) result(r)! [sinoxm] +!============================================================================= +! Evaluate the symmetric real function sin(x)/x-1 +use pietc, only: u1 +implicit none +real(dp),intent(in ):: x +real(dp) :: r +!----------------------------------------------------------------------------- +real(dp):: xx +!============================================================================= +xx=x*x +if(xx > .05_dp)then; r=sin(x)/x-u1 +else ; r=-xx*(u1-xx*(u1-xx*(u1-xx*(u1-xx*(u1-xx/& + 156._dp)/110._dp)/72._dp)/42._dp)/20._dp)/6._dp +endif +end function sinoxm_d + +!============================================================================= +function sinox_d(x) result(r)! [sinox] +!============================================================================= +! Evaluate the symmetric real function sin(x)/x +use pietc, only: u1 +implicit none +real(dp),intent(in ):: x +real(dp) :: r +!============================================================================= +r=sinoxm(x)+u1 +end function sinox_d + +!============================================================================= +function sinhoxm_d(x) result(r)! [sinhoxm] +!============================================================================= +! Evaluate the symmetric real function sinh(x)/x-1 +use pietc, only: u1 +implicit none +real(dp),intent(in ):: x +real(dp) :: r +!----------------------------------------------------------------------------- +real(dp):: xx +!============================================================================= +xx=x*x +if(xx > .05_dp)then; r=sinh(x)/x-u1 +else; r=xx*(u1+xx*(u1+xx*(u1+xx*(u1+xx*(u1+xx/& + 156._dp)/110._dp)/72._dp)/42._dp)/20._dp)/6._dp +endif +end function sinhoxm_d + +!============================================================================= +function sinhox_d(x) result(r)! [sinhox] +!============================================================================= +! Evaluate the symmetric real function sinh(x)/x +use pietc, only: u1 +implicit none +real(dp),intent(in ):: x +real(dp) :: r +!============================================================================= +r=sinhoxm(x)+u1 +end function sinhox_d + +end module pfun diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pietc.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pietc.f90 new file mode 100644 index 000000000..b3c27e036 --- /dev/null +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pietc.f90 @@ -0,0 +1,96 @@ +! +!============================================================================= +module pietc +!============================================================================= +! R. J. Purser (jim.purser@noaa.gov) 2014 +! Some of the commonly used constants (pi etc) mainly for double-precision +! subroutines. +! ms10 etc are needed to satisfy the some (eg., gnu fortran) compilers' +! more rigorous standards regarding the way "data" statements are initialized. +! Zero and the first few units are u0,u1,u2, etc., their reciprocals being, +! o2,o3 etc and their square roots, r2,r3. Reciprocal roots are or2,or3 etc. +!============================================================================= +use pkind, only: dp,dpc +implicit none +logical ,parameter:: T=.true.,F=.false. !<- for pain-relief in logical ops +real(dp),parameter:: & + u0=0_dp,u1=1_dp,mu1=-u1,u2=2_dp,mu2=-u2,u3=3_dp,mu3=-u3,u4=4_dp, & + mu4=-u4,u5=5_dp,mu5=-u5,u6=6_dp,mu6=-u6,o2=u1/u2,o3=u1/u3,o4=u1/u4, & + o5=u1/u5,o6=u1/u6,mo2=-o2,mo3=-o3,mo4=-o4,mo5=-o5,mo6=-o6, & + pi =3.1415926535897932384626433832795028841971693993751058209749e0_dp, & + pi2=6.2831853071795864769252867665590057683943387987502116419498e0_dp, & + pih=1.5707963267948966192313216916397514420985846996875529104874e0_dp, & + rpi=1.7724538509055160272981674833411451827975494561223871282138e0_dp, & +! Important square-roots + r2 =1.4142135623730950488016887242096980785696718753769480731766e0_dp, & + r3 =1.7320508075688772935274463415058723669428052538103806280558e0_dp, & + r5 =2.2360679774997896964091736687312762354406183596115257242708e0_dp, & + or2=u1/r2,or3=u1/r3,or5=u1/r5, & +! Golden number: + phi=1.6180339887498948482045868343656381177203091798057628621354e0_dp, & +! Euler-Mascheroni constant: + euler=0.57721566490153286060651209008240243104215933593992359880e0_dp, & +! Degree to radians; radians to degrees: + dtor=pi/180,rtod=180/pi, & +! Sines of all main fractions of 90 degrees (down to ninths): + s10=.173648177666930348851716626769314796000375677184069387236241e0_dp,& + s11=.195090322016128267848284868477022240927691617751954807754502e0_dp,& + s13=.222520933956314404288902564496794759466355568764544955311987e0_dp,& + s15=.258819045102520762348898837624048328349068901319930513814003e0_dp,& + s18=.309016994374947424102293417182819058860154589902881431067724e0_dp,& + s20=.342020143325668733044099614682259580763083367514160628465048e0_dp,& + s22=.382683432365089771728459984030398866761344562485627041433800e0_dp,& + s26=.433883739117558120475768332848358754609990727787459876444547e0_dp,& + s30=o2, & + s34=.555570233019602224742830813948532874374937190754804045924153e0_dp,& + s36=.587785252292473129168705954639072768597652437643145991072272e0_dp,& + s39=.623489801858733530525004884004239810632274730896402105365549e0_dp,& + s40=.642787609686539326322643409907263432907559884205681790324977e0_dp,& + s45=or2, & + s50=.766044443118978035202392650555416673935832457080395245854045e0_dp,& + s51=.781831482468029808708444526674057750232334518708687528980634e0_dp,& + s54=.809016994374947424102293417182819058860154589902881431067724e0_dp,& + s56=.831469612302545237078788377617905756738560811987249963446124e0_dp,& + s60=r3*o2, & + s64=.900968867902419126236102319507445051165919162131857150053562e0_dp,& + s68=.923879532511286756128183189396788286822416625863642486115097e0_dp,& + s70=.939692620785908384054109277324731469936208134264464633090286e0_dp,& + s72=.951056516295153572116439333379382143405698634125750222447305e0_dp,& + s75=.965925826289068286749743199728897367633904839008404550402343e0_dp,& + s77=.974927912181823607018131682993931217232785800619997437648079e0_dp,& + s79=.980785280403230449126182236134239036973933730893336095002916e0_dp,& + s80=.984807753012208059366743024589523013670643251719842418790025e0_dp,& +! ... and their minuses: + ms10=-s10,ms11=-s11,ms13=-s13,ms15=-s15,ms18=-s18,ms20=-s20,ms22=-s22,& + ms26=-s26,ms30=-s30,ms34=-s34,ms36=-s36,ms39=-s39,ms40=-s40,ms45=-s45,& + ms50=-s50,ms51=-s51,ms54=-s54,ms56=-s56,ms60=-s60,ms64=-s64,ms68=-s68,& + ms70=-s70,ms72=-s72,ms75=-s75,ms77=-s77,ms79=-s79,ms80=-s80 + +complex(dpc),parameter:: & + c0=(u0,u0),c1=(u1,u0),mc1=-c1,ci=(u0,u1),mci=-ci,cipi=ci*pi, & +! Main fractional rotations, as unimodular complex numbers: + z000=c1 ,z010=( s80,s10),z011=( s79,s11),z013=( s77,s13),& + z015=( s75,s15),z018=( s72,s18),z020=( s70,s20),z022=( s68,s22),& + z026=( s64,s26),z030=( s60,s30),z034=( s56,s34),z036=( s54,s36),& + z039=( s51,s39),z040=( s50,s40),z045=( s45,s45),z050=( s40,s50),& + z051=( s39,s51),z054=( s36,s54),z056=( s34,s56),z060=( s30,s60),& + z064=( s26,s64),z068=( s22,s68),z070=( s20,s70),z072=( s18,s72),& + z075=( s15,s75),z077=( s13,s77),z079=( s11,s79),z080=( s10,s80),& + z090=ci, z100=(ms10,s80),z101=(ms11,s79),z103=(ms13,s77),& + z105=(ms15,s75),z108=(ms18,s72),z110=(ms20,s70),z112=(ms22,s68),& + z116=(ms26,s64),z120=(ms30,s60),z124=(ms34,s56),z126=(ms36,s54),& + z129=(ms39,s51),z130=(ms40,s50),z135=(ms45,s45),z140=(ms50,s40),& + z141=(ms51,s39),z144=(ms54,s36),z146=(ms56,s34),z150=(ms60,s30),& + z154=(ms64,s26),z158=(ms68,s22),z160=(ms70,s20),z162=(ms72,s18),& + z165=(ms75,s15),z167=(ms77,s13),z169=(ms79,s11),z170=(ms80,s10),& + z180=-z000,z190=-z010,z191=-z011,z193=-z013,z195=-z015,z198=-z018,& + z200=-z020,z202=-z022,z206=-z026,z210=-z030,z214=-z034,z216=-z036,& + z219=-z039,z220=-z040,z225=-z045,z230=-z050,z231=-z051,z234=-z054,& + z236=-z056,z240=-z060,z244=-z064,z248=-z068,z250=-z070,z252=-z072,& + z255=-z075,z257=-z077,z259=-z079,z260=-z080,z270=-z090,z280=-z100,& + z281=-z101,z283=-z103,z285=-z105,z288=-z108,z290=-z110,z292=-z112,& + z296=-z116,z300=-z120,z304=-z124,z306=-z126,z309=-z129,z310=-z130,& + z315=-z135,z320=-z140,z321=-z141,z324=-z144,z326=-z146,z330=-z150,& + z334=-z154,z338=-z158,z340=-z160,z342=-z162,z345=-z165,z347=-z167,& + z349=-z169,z350=-z170 +end module pietc diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pietc_s.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pietc_s.f90 new file mode 100644 index 000000000..6831d6667 --- /dev/null +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pietc_s.f90 @@ -0,0 +1,95 @@ +! +!============================================================================= +module pietc_s +!============================================================================= +! R. J. Purser (jim.purser@noaa.gov) 2014 +! Some of the commonly used constants (pi etc) +! ms10 etc are needed to satisfy the some (eg., gnu fortran) compilers' +! more rigorous standards regarding the way "data" statements are initialized. +! Zero and the first few units are u0,u1,u2, etc., their reciprocals being, +! o2,o3 etc and their square roots, r2,r3. Reciprocal roots are or2,or3 etc. +!============================================================================= +use pkind, only: sp,spc +implicit none +logical ,parameter:: T=.true.,F=.false. !<- for pain-relief in logical ops +real(sp),parameter:: & + u0=0_sp,u1=1_sp,mu1=-u1,u2=2_sp,mu2=-u2,u3=3_sp,mu3=-u3,u4=4_sp, & + mu4=-u4,u5=5_sp,mu5=-u5,u6=6_sp,mu6=-u6,o2=u1/u2,o3=u1/u3,o4=u1/u4, & + o5=u1/u5,o6=u1/u6,mo2=-o2,mo3=-o3,mo4=-o4,mo5=-o5,mo6=-06, & + pi =3.1415926535897932384626433832795028841971693993751058209749e0_sp, & + pi2=6.2831853071795864769252867665590057683943387987502116419498e0_sp, & + pih=1.5707963267948966192313216916397514420985846996875529104874e0_sp, & + rpi=1.7724538509055160272981674833411451827975494561223871282138e0_sp, & +! Important square-roots + r2 =1.4142135623730950488016887242096980785696718753769480731766e0_sp, & + r3 =1.7320508075688772935274463415058723669428052538103806280558e0_sp, & + r5 =2.2360679774997896964091736687312762354406183596115257242708e0_sp, & + or2=u1/r2,or3=u1/r3,or5=u1/r5, & +! Golden number: + phi=1.6180339887498948482045868343656381177203091798057628621354e0_sp, & +! Euler-Mascheroni constant: + euler=0.57721566490153286060651209008240243104215933593992359880e0_sp, & +! Degree to radians; radians to degrees: + dtor=pi/180,rtod=180/pi, & +! Sines of all main fractions of 90 degrees (down to ninths): + s10=.173648177666930348851716626769314796000375677184069387236241e0_sp,& + s11=.195090322016128267848284868477022240927691617751954807754502e0_sp,& + s13=.222520933956314404288902564496794759466355568764544955311987e0_sp,& + s15=.258819045102520762348898837624048328349068901319930513814003e0_sp,& + s18=.309016994374947424102293417182819058860154589902881431067724e0_sp,& + s20=.342020143325668733044099614682259580763083367514160628465048e0_sp,& + s22=.382683432365089771728459984030398866761344562485627041433800e0_sp,& + s26=.433883739117558120475768332848358754609990727787459876444547e0_sp,& + s30=o2, & + s34=.555570233019602224742830813948532874374937190754804045924153e0_sp,& + s36=.587785252292473129168705954639072768597652437643145991072272e0_sp,& + s39=.623489801858733530525004884004239810632274730896402105365549e0_sp,& + s40=.642787609686539326322643409907263432907559884205681790324977e0_sp,& + s45=or2, & + s50=.766044443118978035202392650555416673935832457080395245854045e0_sp,& + s51=.781831482468029808708444526674057750232334518708687528980634e0_sp,& + s54=.809016994374947424102293417182819058860154589902881431067724e0_sp,& + s56=.831469612302545237078788377617905756738560811987249963446124e0_sp,& + s60=r3*o2, & + s64=.900968867902419126236102319507445051165919162131857150053562e0_sp,& + s68=.923879532511286756128183189396788286822416625863642486115097e0_sp,& + s70=.939692620785908384054109277324731469936208134264464633090286e0_sp,& + s72=.951056516295153572116439333379382143405698634125750222447305e0_sp,& + s75=.965925826289068286749743199728897367633904839008404550402343e0_sp,& + s77=.974927912181823607018131682993931217232785800619997437648079e0_sp,& + s79=.980785280403230449126182236134239036973933730893336095002916e0_sp,& + s80=.984807753012208059366743024589523013670643251719842418790025e0_sp,& +! ... and their minuses: + ms10=-s10,ms11=-s11,ms13=-s13,ms15=-s15,ms18=-s18,ms20=-s20,ms22=-s22,& + ms26=-s26,ms30=-s30,ms34=-s34,ms36=-s36,ms39=-s39,ms40=-s40,ms45=-s45,& + ms50=-s50,ms51=-s51,ms54=-s54,ms56=-s56,ms60=-s60,ms64=-s64,ms68=-s68,& + ms70=-s70,ms72=-s72,ms75=-s75,ms77=-s77,ms79=-s79,ms80=-s80 + +complex(spc),parameter:: & + c0=(u0,u0),c1=(u1,u0),mc1=-c1,ci=(u0,u1),mci=-ci,cipi=ci*pi, & +! Main fractional rotations, as unimodualr complex numbers: + z000=c1 ,z010=( s80,s10),z011=( s79,s11),z013=( s77,s13),& + z015=( s75,s15),z018=( s72,s18),z020=( s70,s20),z022=( s68,s22),& + z026=( s64,s26),z030=( s60,s30),z034=( s56,s34),z036=( s54,s36),& + z039=( s51,s39),z040=( s50,s40),z045=( s45,s45),z050=( s40,s50),& + z051=( s39,s51),z054=( s36,s54),z056=( s34,s56),z060=( s30,s60),& + z064=( s26,s64),z068=( s22,s68),z070=( s20,s70),z072=( s18,s72),& + z075=( s15,s75),z077=( s13,s77),z079=( s11,s79),z080=( s10,s80),& + z090=ci, z100=(ms10,s80),z101=(ms11,s79),z103=(ms13,s77),& + z105=(ms15,s75),z108=(ms18,s72),z110=(ms20,s70),z112=(ms22,s68),& + z116=(ms26,s64),z120=(ms30,s60),z124=(ms34,s56),z126=(ms36,s54),& + z129=(ms39,s51),z130=(ms40,s50),z135=(ms45,s45),z140=(ms50,s40),& + z141=(ms51,s39),z144=(ms54,s36),z146=(ms56,s34),z150=(ms60,s30),& + z154=(ms64,s26),z158=(ms68,s22),z160=(ms70,s20),z162=(ms72,s18),& + z165=(ms75,s15),z167=(ms77,s13),z169=(ms79,s11),z170=(ms80,s10),& + z180=-z000,z190=-z010,z191=-z011,z193=-z013,z195=-z015,z198=-z018,& + z200=-z020,z202=-z022,z206=-z026,z210=-z030,z214=-z034,z216=-z036,& + z219=-z039,z220=-z040,z225=-z045,z230=-z050,z231=-z051,z234=-z054,& + z236=-z056,z240=-z060,z244=-z064,z248=-z068,z250=-z070,z252=-z072,& + z255=-z075,z257=-z077,z259=-z079,z260=-z080,z270=-z090,z280=-z100,& + z281=-z101,z283=-z103,z285=-z105,z288=-z108,z290=-z110,z292=-z112,& + z296=-z116,z300=-z120,z304=-z124,z306=-z126,z309=-z129,z310=-z130,& + z315=-z135,z320=-z140,z321=-z141,z324=-z144,z326=-z146,z330=-z150,& + z334=-z154,z338=-z158,z340=-z160,z342=-z162,z345=-z165,z347=-z167,& + z349=-z169,z350=-z170 +end module pietc_s diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pkind.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pkind.f90 new file mode 100644 index 000000000..456f16b39 --- /dev/null +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pkind.f90 @@ -0,0 +1,13 @@ +module pkind +integer,parameter:: spi=selected_int_kind(6),& + dpi=selected_int_kind(12),& + sp =selected_real_kind(6,30),& + dp =selected_real_kind(15,300),& + spc=sp,dpc=dp +!private:: one_dpi; integer(8),parameter:: one_dpi=1 +!integer,parameter:: dpi=kind(one_dpi) +!integer,parameter:: sp=kind(1.0) +!integer,parameter:: dp=kind(1.0d0) +!integer,parameter:: spc=kind((1.0,1.0)) +!integer,parameter:: dpc=kind((1.0d0,1.0d0)) +end module pkind diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 new file mode 100644 index 000000000..2920bbd31 --- /dev/null +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat.f90 @@ -0,0 +1,1097 @@ +! +! ********************************************** +! * MODULE pmat * +! * R. J. Purser, NOAA/NCEP/EMC 1993 * +! * and Tsukasa Fujita, visiting scientist * +! * from JMA. * +! * Major modifications: 2002, 2009, 2012 * +! * jim.purser@noaa.gov * +! * * +! ********************************************** +! +! Utility routines for various linear inversions and Cholesky. +! Dependency: modules pkind, pietc +! Originally, these routines were copies of the purely "inversion" members +! of pmat1.f90 (a most extensive collection of matrix routines -- not just +! inversions). As well as having both single and double precision versions +! of each routine, these versions also make provision for a more graceful +! termination in cases where the system matrix is detected to be +! essentially singular (and therefore noninvertible). This provision takes +! the form of an optional "failure flag", FF, which is normally returned +! as .FALSE., but is returned as .TRUE. when inversion fails. +! In Sep 2012, these routines were collected together into pmat.f90 so +! that all the main matrix routines could be in the same library, pmat.a. +! +! DIRECT DEPENDENCIES: +! Modules: pkind, pietc +! +!============================================================================= +module pmat +!============================================================================= +use pkind, only: spi,sp,dp,spc,dpc +use pietc, only: t,f +implicit none +private +public:: ldum,udlmm,inv,L1Lm,LdLm,invl,invu +interface swpvv; module procedure sswpvv,dswpvv,cswpvv; end interface +interface ldum + module procedure sldum,dldum,cldum,sldumf,dldumf,cldumf; end interface +interface udlmm + module procedure sudlmm,dudlmm,cudlmm,sudlmv,dudlmv,cudlmv; end interface +interface inv + module procedure & +sinvmt, dinvmt, cinvmt, slinmmt, dlinmmt, clinmmt, slinmvt, dlinmvt, clinmvt, & +sinvmtf,dinvmtf,cinvmtf,slinmmtf,dlinmmtf,clinmmtf,slinmvtf,dlinmvtf,clinmvtf,& +iinvf + end interface +interface L1Lm; module procedure sL1Lm,dL1Lm,sL1Lmf,dL1Lmf; end interface +interface LdLm; module procedure sLdLm,dLdLm,sLdLmf,dLdLmf; end interface +interface invl; module procedure sinvl,dinvl,slinlv,dlinlv; end interface +interface invu; module procedure sinvu,dinvu,slinuv,dlinuv; end interface + +contains + +!============================================================================= +subroutine sswpvv(d,e)! [swpvv] +!============================================================================= +! Swap vectors +!------------- +real(sp), intent(inout) :: d(:), e(:) +real(sp) :: tv(size(d)) +!============================================================================= +tv = d; d = e; e = tv +end subroutine sswpvv +!============================================================================= +subroutine dswpvv(d,e)! [swpvv] +!============================================================================= +real(dp), intent(inout) :: d(:), e(:) +real(dp) :: tv(size(d)) +!============================================================================= +tv = d; d = e; e = tv +end subroutine dswpvv +!============================================================================= +subroutine cswpvv(d,e)! [swpvv] +!============================================================================= +complex(dpc),intent(inout) :: d(:), e(:) +complex(dpc) :: tv(size(d)) +!============================================================================= +tv = d; d = e; e = tv +end subroutine cswpvv + +!============================================================================= +subroutine sinvmt(a)! [inv] +!============================================================================= +real(sp),dimension(:,:),intent(INOUT):: a +logical :: ff +call sinvmtf(a,ff) +if(ff)stop 'In sinvmt; Unable to invert matrix' +end subroutine sinvmt +!============================================================================= +subroutine dinvmt(a)! [inv] +!============================================================================= +real(dp),dimension(:,:),intent(inout):: a +logical :: ff +call dinvmtf(a,ff) +if(ff)stop 'In dinvmt; Unable to invert matrix' +end subroutine dinvmt +!============================================================================= +subroutine cinvmt(a)! [inv] +!============================================================================= +complex(dpc),dimension(:,:),intent(inout):: a +logical :: ff +call cinvmtf(a,ff) +if(ff)stop 'In cinvmt; Unable to invert matrix' +end subroutine cinvmt +!============================================================================= +subroutine sinvmtf(a,ff)! [inv] +!============================================================================= +! Invert matrix (or flag if can't) +!---------------- +use pietc_s, only: u1 +real(sp),dimension(:,:),intent(inout):: a +logical, intent( out):: ff +integer(spi) :: m,i,j,jp,l +real(sp) :: d +integer(spi),dimension(size(a,1)):: ipiv +!============================================================================= +m=size(a,1) +if(m /= size(a,2))stop 'In sinvmtf; matrix passed to sinvmtf is not square' +! Perform a pivoted L-D-U decomposition on matrix a: +call sldumf(a,ipiv,d,ff) +if(ff)then + print '(" In sinvmtf; failed call to sldumf")' + return +endif + +! Invert upper triangular portion U in place: +do i=1,m; a(i,i)=u1/a(i,i); enddo +do i=1,m-1 + do j=i+1,m; a(i,j)=-a(j,j)*dot_product(a(i:j-1,j),a(i,i:j-1)); enddo +enddo + +! Invert lower triangular portion L in place: +do j=1,m-1; jp=j+1 + do i=jp,m; a(i,j)=-a(i,j)-dot_product(a(jp:i-1,j),a(i,jp:i-1)); enddo +enddo + +! Form the product of U**-1 and L**-1 in place +do j=1,m-1; jp=j+1 + do i=1,j; a(i,j)=a(i,j)+dot_product(a(jp:m,j),a(i,jp:m)); enddo + do i=jp,m; a(i,j)=dot_product(a(i:m,j),a(i,i:m)); enddo +enddo + +! Permute columns according to ipiv +do j=m-1,1,-1; l=ipiv(j); call sswpvv(a(:,j),a(:,l)); enddo +end subroutine sinvmtf +!============================================================================= +subroutine dinvmtf(a,ff)! [inv] +!============================================================================= +real(dp),dimension(:,:),intent(inout):: a +logical, intent( out):: ff +integer(spi) :: m,i,j,jp,l +real(dp) :: d +integer(spi), dimension(size(a,1)) :: ipiv +!============================================================================= +m=size(a,1) +if(m /= size(a,2))stop 'In inv; matrix passed to dinvmtf is not square' +! Perform a pivoted L-D-U decomposition on matrix a: +call dldumf(a,ipiv,d,ff) +if(ff)then + print '(" In dinvmtf; failed call to dldumf")' + return +endif + +! Invert upper triangular portion U in place: +do i=1,m; a(i,i)=1_dp/a(i,i); enddo +do i=1,m-1 + do j=i+1,m; a(i,j)=-a(j,j)*dot_product(a(i:j-1,j),a(i,i:j-1)); enddo +enddo + +! Invert lower triangular portion L in place: +do j=1,m-1; jp=j+1 + do i=jp,m; a(i,j)=-a(i,j)-dot_product(a(jp:i-1,j),a(i,jp:i-1)); enddo +enddo + +! Form the product of U**-1 and L**-1 in place +do j=1,m-1; jp=j+1 + do i=1,j; a(i,j)=a(i,j)+dot_product(a(jp:m,j),a(i,jp:m)); enddo + do i=jp,m; a(i,j)=dot_product(a(i:m,j),a(i,i:m)); enddo +enddo + +! Permute columns according to ipiv +do j=m-1,1,-1; l=ipiv(j); call dswpvv(a(:,j),a(:,l)); enddo +end subroutine dinvmtf +!============================================================================= +subroutine cinvmtf(a,ff)! [inv] +!============================================================================= +use pietc, only: c1 +complex(dpc),dimension(:,:),intent(INOUT):: a +logical, intent( OUT):: ff +integer(spi) :: m,i,j,jp,l +complex(dpc) :: d +integer(spi),dimension(size(a,1)):: ipiv +!============================================================================= +m=size(a,1) +if(m /= size(a,2))stop 'In inv; matrix passed to cinvmtf is not square' +! Perform a pivoted L-D-U decomposition on matrix a: +call cldumf(a,ipiv,d,ff) +if(ff)then + print '(" In cinvmtf; failed call to cldumf")' + return +endif + +! Invert upper triangular portion U in place: +do i=1,m; a(i,i)=c1/a(i,i); enddo +do i=1,m-1 + do j=i+1,m; a(i,j)=-a(j,j)*sum(a(i:j-1,j)*a(i,i:j-1)); enddo +enddo + +! Invert lower triangular portion L in place: +do j=1,m-1; jp=j+1 + do i=jp,m; a(i,j)=-a(i,j)-sum(a(jp:i-1,j)*a(i,jp:i-1)); enddo +enddo + +! Form the product of U**-1 and L**-1 in place +do j=1,m-1; jp=j+1 + do i=1,j; a(i,j)=a(i,j)+sum(a(jp:m,j)*a(i,jp:m)); enddo + do i=jp,m; a(i,j)=sum(a(i:m,j)*a(i,i:m)); enddo +enddo + +! Permute columns according to ipiv +do j=m-1,1,-1; l=ipiv(j); call cswpvv(a(:,j),a(:,l)); enddo +end subroutine cinvmtf + +!============================================================================= +subroutine slinmmt(a,b)! [inv] +!============================================================================= +real(sp),dimension(:,:),intent(inout):: a,b +logical :: ff +call slinmmtf(a,b,ff) +if(ff)stop 'In slinmmt; unable to invert linear system' +end subroutine slinmmt +!============================================================================= +subroutine dlinmmt(a,b)! [inv] +!============================================================================= +real(dp),dimension(:,:),intent(inout):: a,b +logical :: ff +call dlinmmtf(a,b,ff) +if(ff)stop 'In dlinmmt; unable to invert linear system' +end subroutine dlinmmt +!============================================================================= +subroutine clinmmt(a,b)! [inv] +!============================================================================= +complex(dpc),dimension(:,:),intent(inout):: a,b +logical :: ff +call clinmmtf(a,b,ff) +if(ff)stop 'In clinmmt; unable to invert linear system' +end subroutine clinmmt +!============================================================================= +subroutine slinmmtf(a,b,ff)! [inv] +!============================================================================= +real(sp), dimension(:,:),intent(inout):: a,b +logical, intent( out):: ff +integer(spi),dimension(size(a,1)) :: ipiv +integer(spi) :: m +real(sp) :: d +!============================================================================= +m=size(a,1) +if(m /= size(a,2))stop 'In inv; matrix passed to slinmmtf is not square' +if(m /= size(b,1))& + stop 'In inv; matrix and vectors in slinmmtf have unmatched sizes' +call sldumf(a,ipiv,d,ff) +if(ff)then + print '("In slinmmtf; failed call to sldumf")' + return +endif +call sudlmm(a,b,ipiv) +end subroutine slinmmtf +!============================================================================= +subroutine dlinmmtf(a,b,ff)! [inv] +!============================================================================= +real(dp),dimension(:,:), intent(inout):: a,b +logical, intent( out):: ff +integer(spi),dimension(size(a,1)):: ipiv +integer(spi):: m +real(dp) :: d +!============================================================================= +m=size(a,1) +if(m /= size(a,2))stop 'In inv; matrix passed to dlinmmtf is not square' +if(m /= size(b,1))& + stop 'In inv; matrix and vectors in dlinmmtf have unmatched sizes' +call dldumf(a,ipiv,d,ff) +if(ff)then + print '("In dlinmmtf; failed call to dldumf")' + return +endif +call dudlmm(a,b,ipiv) +end subroutine dlinmmtf +!============================================================================= +subroutine clinmmtf(a,b,ff)! [inv] +!============================================================================= +complex(dpc),dimension(:,:),intent(INOUT):: a,b +logical, intent( OUT):: ff +integer(spi),dimension(size(a,1)):: ipiv +integer(spi) :: m +complex(dpc) :: d +!============================================================================= +m=size(a,1) +if(m /= size(a,2))stop 'In inv; matrix passed to dlinmmtf is not square' +if(m /= size(b,1))& + stop 'In inv; matrix and vectors in dlinmmtf have unmatched sizes' +call cldumf(a,ipiv,d,ff) +if(ff)then + print '("In clinmmtf; failed call to cldumf")' + return +endif +call cudlmm(a,b,ipiv) +end subroutine clinmmtf + +!============================================================================= +subroutine slinmvt(a,b)! [inv] +!============================================================================= +real(sp),dimension(:,:),intent(inout):: a +real(sp),dimension(:), intent(inout):: b +logical:: ff +call slinmvtf(a,b,ff) +if(ff)stop 'In slinmvt; matrix singular, unable to continue' +end subroutine slinmvt +!============================================================================= +subroutine dlinmvt(a,b)! [inv] +!============================================================================= +real(dp),dimension(:,:),intent(inout):: a +real(dp),dimension(:), intent(inout):: b +logical :: ff +call dlinmvtf(a,b,ff) +if(ff)stop 'In dlinmvt; matrix singular, unable to continue' +end subroutine dlinmvt +!============================================================================= +subroutine clinmvt(a,b)! [inv] +!============================================================================= +complex(dpc), dimension(:,:),intent(inout):: a +complex(dpc), dimension(:), intent(inout):: b +logical :: ff +call clinmvtf(a,b,ff) +if(ff)stop 'In clinmvt; matrix singular, unable to continue' +end subroutine clinmvt +!============================================================================= +subroutine slinmvtf(a,b,ff)! [inv] +!============================================================================= +real(sp),dimension(:,:),intent(inout):: a +real(sp),dimension(:), intent(inout):: b +logical, intent( out):: ff +integer(spi),dimension(size(a,1)) :: ipiv +real(sp) :: d +!============================================================================= +if(size(a,1) /= size(a,2).or. size(a,1) /= size(b))& + stop 'In inv; In slinmvtf; incompatible array dimensions' +call sldumf(a,ipiv,d,ff) +if(ff)then + print '("In slinmvtf; failed call to sldumf")' + return +endif +call sudlmv(a,b,ipiv) +end subroutine slinmvtf +!============================================================================= +subroutine dlinmvtf(a,b,ff)! [inv] +!============================================================================= +real(dp),dimension(:,:),intent(inout):: a +real(dp),dimension(:), intent(inout):: b +logical, intent( out):: ff +integer(spi), dimension(size(a,1)) :: ipiv +real(dp) :: d +!============================================================================= +if(size(a,1) /= size(a,2).or. size(a,1) /= size(b))& + stop 'In inv; incompatible array dimensions passed to dlinmvtf' +call dldumf(a,ipiv,d,ff) +if(ff)then + print '("In dlinmvtf; failed call to dldumf")' + return +endif +call dudlmv(a,b,ipiv) +end subroutine dlinmvtf +!============================================================================= +subroutine clinmvtf(a,b,ff)! [inv] +!============================================================================= +complex(dpc),dimension(:,:),intent(inout):: a +complex(dpc),dimension(:), intent(inout):: b +logical, intent( out):: ff +integer, dimension(size(a,1)) :: ipiv +complex(dpc) :: d +!============================================================================= +if(size(a,1) /= size(a,2).or. size(a,1) /= size(b))& + stop 'In inv; incompatible array dimensions passed to clinmvtf' +call cldumf(a,ipiv,d,ff) +if(ff)then + print '("In clinmvtf; failed call to cldumf")' + return +endif +call cudlmv(a,b,ipiv) +end subroutine clinmvtf + +!============================================================================= +subroutine iinvf(imat,ff)! [inv] +!============================================================================= +! Invert integer square array, imat, if possible, but flag ff=.true. +! if not possible. (Determinant of imat must be +1 or -1 +!============================================================================= +integer(spi),dimension(:,:),intent(INOUT):: imat +logical, intent( OUT):: ff +!----------------------------------------------------------------------------- +real(dp),parameter :: eps=1.e-6_dp +real(dp),dimension(size(imat,1),size(imat,1)):: dmat +integer(spi) :: m,i,j +!============================================================================= +m=size(imat,1) +if(m /= size(imat,2))stop 'In inv; matrix passed to iinvf is not square' +dmat=imat; call inv(dmat,ff) +if(.not.ff)then + do j=1,m + do i=1,m + imat(i,j)=nint(dmat(i,j)); if(abs(dmat(i,j)-imat(i,j))>eps)ff=t + enddo + enddo +endif +end subroutine iinvf + +!============================================================================= +subroutine sldum(a,ipiv,d)! [ldum] +!============================================================================= +real(sp), intent(inout) :: a(:,:) +real(sp), intent( out) :: d +integer(spi),intent( out) :: ipiv(:) +logical:: ff +call sldumf(a,ipiv,d,ff) +if(ff)stop 'In sldum; matrix singular, unable to continue' +end subroutine sldum +!============================================================================= +subroutine dldum(a,ipiv,d)! [ldum] +!============================================================================= +real(dp), intent(inout) :: a(:,:) +real(dp), intent( out) :: d +integer(spi),intent( out) :: ipiv(:) +logical:: ff +call dldumf(a,ipiv,d,ff) +if(ff)stop 'In dldum; matrix singular, unable to continue' +end subroutine dldum +!============================================================================= +subroutine cldum(a,ipiv,d)! [ldum] +!============================================================================= +complex(dpc),intent(inout) :: a(:,:) +complex(dpc),intent(out ) :: d +integer(spi),intent(out ) :: ipiv(:) +logical:: ff +call cldumf(a,ipiv,d,ff) +if(ff)stop 'In cldum; matrix singular, unable to continue' +end subroutine cldum +!============================================================================= +subroutine sldumf(a,ipiv,d,ff)! [ldum] +!============================================================================= +! R.J.Purser, NCEP, Washington D.C. 1996 +! SUBROUTINE LDUM +! perform l-d-u decomposition of square matrix a in place with +! pivoting. +! +! <-> a square matrix to be factorized +! <-- ipiv array encoding the pivoting sequence +! <-- d indicator for possible sign change of determinant +! <-- ff: failure flag, set to .true. when determinant of a vanishes. +!============================================================================= +use pietc_s,only: u0,u1 +real(sp), intent(inout) :: a(:,:) +real(sp), intent( out) :: d +integer(spi),intent( out) :: ipiv(:) +logical, intent( out) :: ff +integer(spi):: m,i, j, jp, ibig, jm +real(sp) :: s(size(a,1)), aam, aa, abig, ajj, ajji, aij +!============================================================================= +ff=f +m=size(a,1) +do i=1,m + aam=u0 + do j=1,m + aa=abs(a(i,j)) + if(aa > aam)aam=aa + enddo + if(aam == u0)then + print '("In sldumf; row ",i6," of matrix vanishes")',i + ff=t + return + endif + s(i)=u1/aam +enddo +d=1_sp +ipiv(m)=m +do j=1,m-1 + jp=j+1 + abig=s(j)*abs(a(j,j)) + ibig=j + do i=jp,m + aa=s(i)*abs(a(i,j)) + if(aa > abig)then + ibig=i + abig=aa + endif + enddo +! swap rows, recording changed sign of determinant + ipiv(j)=ibig + if(ibig /= j)then + d=-d + call sswpvv(a(j,:),a(ibig,:)) + s(ibig)=s(j) + endif + ajj=a(j,j) + if(ajj == u0)then + jm=j-1 + print '(" failure in sldumf:"/" matrix singular, rank=",i3)',jm + ff=t + return + endif + ajji=u1/ajj + do i=jp,m + aij=ajji*a(i,j) + a(i,j)=aij + a(i,jp:m) = a(i,jp:m) - aij*a(j,jp:m) + enddo +enddo +end subroutine sldumf +!============================================================================= +subroutine dldumf(a,ipiv,d,ff)! [ldum] +!============================================================================= +use pietc, only: u0,u1 +real(dp), intent(inout) :: a(:,:) +real(dp), intent( out) :: d +integer, intent( out) :: ipiv(:) +logical(spi),intent( out) :: ff +integer(spi) :: m,i, j, jp, ibig, jm +real(dp) :: s(size(a,1)), aam, aa, abig, ajj, ajji, aij +!============================================================================= +ff=f +m=size(a,1) +do i=1,m + aam=u0 + do j=1,m + aa=abs(a(i,j)) + if(aa > aam)aam=aa + enddo + if(aam == u0)then + print '("In dldumf; row ",i6," of matrix vanishes")',i + ff=t + return + endif + s(i)=u1/aam +enddo +d=u1 +ipiv(m)=m +do j=1,m-1 + jp=j+1 + abig=s(j)*abs(a(j,j)) + ibig=j + do i=jp,m + aa=s(i)*abs(a(i,j)) + if(aa > abig)then + ibig=i + abig=aa + endif + enddo + ! swap rows, recording changed sign of determinant + ipiv(j)=ibig + if(ibig /= j)then + d=-d + call dswpvv(a(j,:),a(ibig,:)) + s(ibig)=s(j) + endif + ajj=a(j,j) + if(ajj == u0)then + jm=j-1 + print '(" Failure in dldumf:"/" matrix singular, rank=",i3)',jm + ff=t + return + endif + ajji=u1/ajj + do i=jp,m + aij=ajji*a(i,j) + a(i,j)=aij + a(i,jp:m) = a(i,jp:m) - aij*a(j,jp:m) + enddo +enddo +end subroutine dldumf +!============================================================================= +subroutine cldumf(a,ipiv,d,ff)! [ldum] +!============================================================================= +use pietc, only: u0,u1,c0,c1 +complex(dpc), intent(inout) :: a(:,:) +complex(dpc), intent( out) :: d +integer(spi), intent( out) :: ipiv(:) +logical, intent( out) :: ff +integer(spi) :: m,i, j, jp, ibig, jm +complex(dpc) :: ajj, ajji, aij +real(dp) :: aam,aa,abig +real(dp),dimension(size(a,1)):: s +!============================================================================= +ff=f +m=size(a,1) +do i=1,m + aam=u0 + do j=1,m + aa=abs(a(i,j)) + if(aa > aam)aam=aa + enddo + if(aam == u0)then + print '("In cldumf; row ",i6," of matrix vanishes")',i + ff=t + return + endif + s(i)=u1/aam +enddo +d=c1 +ipiv(m)=m +do j=1,m-1 + jp=j+1 + abig=s(j)*abs(a(j,j)) + ibig=j + do i=jp,m + aa=s(i)*abs(a(i,j)) + if(aa > abig)then + ibig=i + abig=aa + endif + enddo + ! swap rows, recording changed sign of determinant + ipiv(j)=ibig + if(ibig /= j)then + d=-d + call cswpvv(a(j,:),a(ibig,:)) + s(ibig)=s(j) + endif + ajj=a(j,j) + if(ajj == c0)then + jm=j-1 + print '(" Failure in cldumf:"/" matrix singular, rank=",i3)',jm + ff=t + return + endif + ajji=c1/ajj + do i=jp,m + aij=ajji*a(i,j) + a(i,j)=aij + a(i,jp:m) = a(i,jp:m) - aij*a(j,jp:m) + enddo +enddo +end subroutine cldumf + +!============================================================================= +subroutine sudlmm(a,b,ipiv)! [udlmm] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1993 +! SUBROUTINE UDLMM +! use l-u factors in A to back-substitute for several rhs in B, using ipiv to +! define the pivoting permutation used in the l-u decomposition. +! +! --> A L-D-U factorization of linear system matrux +! <-> B rt-hand-sides vectors on input, corresponding solutions on return +! --> IPIV array encoding the pivoting sequence +!============================================================================= +use pietc_s, only: u1 +integer(spi),dimension(:), intent(in) :: ipiv +real(sp), dimension(:,:),intent(in) :: a +real(sp), dimension(:,:),intent(inout) :: b +integer(spi):: m,i, k, l +real(sp) :: s,aiii +!============================================================================= +m=size(a,1) +do k=1,size(b,2) !loop over columns of b + do i=1,m + l=ipiv(i) + s=b(l,k) + b(l,k)=b(i,k) + s = s - sum(b(1:i-1,k)*a(i,1:i-1)) + b(i,k)=s + enddo + b(m,k)=b(m,k)/a(m,m) + do i=m-1,1,-1 + aiii=u1/a(i,i) + b(i,k) = b(i,k) - sum(b(i+1:m,k)*a(i,i+1:m)) + b(i,k)=b(i,k)*aiii + enddo +enddo +end subroutine sudlmm +!============================================================================= +subroutine dudlmm(a,b,ipiv)! [udlmm] +!============================================================================= +use pietc, only: u1 +integer(spi),dimension(:), intent(in ) :: ipiv +real(dp), dimension(:,:),intent(in ) :: a +real(dp), dimension(:,:),intent(inout) :: b +integer(spi):: m,i, k, l +real(dp) :: s,aiii +!============================================================================= +m=size(a,1) +do k=1, size(b,2)!loop over columns of b + do i=1,m + l=ipiv(i) + s=b(l,k) + b(l,k)=b(i,k) + s = s - sum(b(1:i-1,k)*a(i,1:i-1)) + b(i,k)=s + enddo + b(m,k)=b(m,k)/a(m,m) + do i=m-1,1,-1 + aiii=u1/a(i,i) + b(i,k) = b(i,k) - sum(b(i+1:m,k)*a(i,i+1:m)) + b(i,k)=b(i,k)*aiii + enddo +enddo +end subroutine dudlmm +!============================================================================= +subroutine cudlmm(a,b,ipiv)! [udlmm] +!============================================================================= +use pietc, only: c1 +integer(spi),dimension(:), intent(in ) :: ipiv +complex(dpc),dimension(:,:),intent(in ) :: a +complex(dpc),dimension(:,:),intent(inout) :: b +integer(spi):: m,i, k, l +complex(dpc):: s,aiii +!============================================================================= +m=size(a,1) +do k=1, size(b,2)!loop over columns of b + do i=1,m + l=ipiv(i) + s=b(l,k) + b(l,k)=b(i,k) + s = s - sum(b(1:i-1,k)*a(i,1:i-1)) + b(i,k)=s + enddo + b(m,k)=b(m,k)/a(m,m) + do i=m-1,1,-1 + aiii=c1/a(i,i) + b(i,k) = b(i,k) - sum(b(i+1:m,k)*a(i,i+1:m)) + b(i,k)=b(i,k)*aiii + enddo +enddo +end subroutine cudlmm + +!============================================================================= +subroutine sudlmv(a,b,ipiv)! [udlmv] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1993 +! SUBROUTINE UDLMV +! use l-u factors in A to back-substitute for 1 rhs in B, using ipiv to +! define the pivoting permutation used in the l-u decomposition. +! +! --> A L-D-U factorization of linear system matrix +! <-> B right-hand-side vector on input, corresponding solution on return +! --> IPIV array encoding the pivoting sequence +!============================================================================= +use pietc_s, only: u1 +integer(spi),dimension(:), intent(in ):: ipiv +real(sp), dimension(:,:),intent(in ):: a +real(sp), dimension(:), intent(inout):: b +integer(spi):: m,i, l +real(sp) :: s,aiii +!============================================================================= +m=size(a,1) +do i=1,m + l=ipiv(i) + s=b(l) + b(l)=b(i) + s = s - sum(b(1:i-1)*a(i,1:i-1)) + b(i)=s +enddo +b(m)=b(m)/a(m,m) +do i=m-1,1,-1 + aiii=u1/a(i,i) + b(i) = b(i) - sum(b(i+1:m)*a(i,i+1:m)) + b(i)=b(i)*aiii +enddo +end subroutine sudlmv +!============================================================================= +subroutine dudlmv(a,b,ipiv)! [udlmv] +!============================================================================= +use pietc, only: u1 +integer(spi),dimension(:), intent(in ) :: ipiv(:) +real(dp), dimension(:,:),intent(in ) :: a(:,:) +real(dp), dimension(:), intent(inout) :: b(:) +integer(spi):: m,i, l +real(dp) :: s,aiii +!============================================================================= +m=size(a,1) +do i=1,m + l=ipiv(i) + s=b(l) + b(l)=b(i) + s = s - sum(b(1:i-1)*a(i,1:i-1)) + b(i)=s +enddo +b(m)=b(m)/a(m,m) +do i=m-1,1,-1 + aiii=u1/a(i,i) + b(i) = b(i) - sum(b(i+1:m)*a(i,i+1:m)) + b(i)=b(i)*aiii +enddo +end subroutine dudlmv +!============================================================================= +subroutine cudlmv(a,b,ipiv)! [udlmv] +!============================================================================= +use pietc, only: c1 +integer(spi),dimension(:), intent(in ) :: ipiv(:) +complex(dpc),dimension(:,:),intent(in ) :: a(:,:) +complex(dpc),dimension(:), intent(inout) :: b(:) +integer(spi):: m,i, l +complex(dpc):: s,aiii +!============================================================================= +m=size(a,1) +do i=1,m + l=ipiv(i) + s=b(l) + b(l)=b(i) + s = s - sum(b(1:i-1)*a(i,1:i-1)) + b(i)=s +enddo +b(m)=b(m)/a(m,m) +do i=m-1,1,-1 + aiii=c1/a(i,i) + b(i)= b(i) - sum(b(i+1:m)*a(i,i+1:m)) + b(i)=b(i)*aiii +enddo +end subroutine cudlmv + +!============================================================================= +subroutine sl1lm(a,b) ! [l1lm] +!============================================================================= +! Cholesky, M -> L*U, U(i,j)=L(j,i) +!============================================================================= +real(sp),intent(in ):: a(:,:) +real(sp),intent(inout):: b(:,:) +!----------------------------------------------------------------------------- +logical:: ff +call sl1lmf(a,b,ff) +if(ff)stop 'In sl1lm; matrix singular, unable to continue' +end subroutine sl1lm +!============================================================================= +subroutine dl1lm(a,b) ! [l1lm] +!============================================================================= +! Cholesky, M -> L*U, U(i,j)=L(j,i) +!============================================================================= +real(dp),intent(in ):: a(:,:) +real(dp),intent(inout):: b(:,:) +!----------------------------------------------------------------------------- +logical:: ff +call dl1lmf(a,b,ff) +if(ff)stop 'In dl1lm; matrix singular, unable to continue' +end subroutine dl1lm + +!============================================================================= +subroutine sl1lmf(a,b,ff)! [L1Lm] +!============================================================================= +! Cholesky, M -> L*U, U(i,j)=L(j,i) +!============================================================================= +use pietc_s, only: u0 +real(sp),intent(in ):: a(:,:) +real(sp),intent(inout):: b(:,:) +logical, intent( out):: ff +!----------------------------------------------------------------------------- +integer(spi):: m,j, jm, jp, i +real(sp) :: s, bjji +!============================================================================= +m=size(a,1) +ff=f +do j=1,m + jm=j-1 + jp=j+1 + s = a(j,j) - sum(b(j,1:jm)*b(j,1:jm)) + ff=(S <= u0) + if(ff)then + print '("sL1Lmf detects nonpositive a, rank=",i6)',jm + return + endif + b(j,j)=sqrt(s) + bjji=1_sp/b(j,j) + do i=jp,m + s = a(i,j) - sum(b(i,1:jm)*b(j,1:jm)) + b(i,j)=s*bjji + enddo + b(1:jm,j) = u0 +enddo +end subroutine sl1lmf +!============================================================================= +subroutine dl1lmf(a,b,ff) ! [L1Lm] +!============================================================================= +use pietc, only: u0,u1 +real(dp),intent(in ) :: a(:,:) +real(dp),intent(inout) :: b(:,:) +logical, intent( out) :: ff +!----------------------------------------------------------------------------- +integer(spi):: m,j, jm, jp, i +real(dp) :: s, bjji +!============================================================================= +m=size(a,1) +ff=f +do j=1,m + jm=j-1 + jp=j+1 + s = a(j,j) - sum(b(j,1:jm)*b(j,1:jm)) + ff=(s <= u0) + if(ff)then + print '("dL1LMF detects nonpositive A, rank=",i6)',jm + return + endif + b(j,j)=sqrt(s) + bjji=u1/b(j,j) + do i=jp,m + s = a(i,j) - sum(b(i,1:jm)*b(j,1:jm)) + b(i,j)=s*bjji + enddo + b(1:jm,j) = u0 +enddo +end subroutine dl1lmf + +!============================================================================= +subroutine sldlm(a,b,d)! [LdLm] +!============================================================================= +! Modified Cholesky decompose Q --> L*D*U, U(i,j)=L(j,i) +!============================================================================= +real(sp),intent(in ):: a(:,:) +real(sp),intent(inout):: b(:,:) +real(sp),intent( out):: d(:) +!----------------------------------------------------------------------------- +logical:: ff +call sldlmf(a,b,d,ff) +if(ff)stop 'In sldlm; matrix singular, unable to continue' +end subroutine sldlm +!============================================================================= +subroutine dldlm(a,b,d)! [LdLm] +!============================================================================= +real(dp),intent(in ):: a(:,:) +real(dp),intent(inout):: b(:,:) +real(dp),intent( out):: d(:) +!----------------------------------------------------------------------------- +logical:: ff +call dldlmf(a,b,d,ff) +if(ff)stop 'In dldlm; matrix singular, unable to continue' +end subroutine dldlm + +!============================================================================= +subroutine sldlmf(a,b,d,ff) ! [LDLM] +!============================================================================= +! Modified Cholesky decompose Q --> L*D*U +!============================================================================= +use pietc_s, only: u0,u1 +real(sp), intent(in ):: a(:,:) +real(sp), intent(inout):: b(:,:) +real(sp), intent( out):: d(:) +logical, intent( out):: ff +!----------------------------------------------------------------------------- +integer(spi):: m,j, jm, jp, i +real(sp) :: bjji +!============================================================================= +m=size(a,1) +ff=f +do j=1,m + jm=j-1 + jp=j+1 + d(j)=a(j,j) - sum(b(1:jm,j)*b(j,1:jm)) + b(j,j) = u1 + ff=(d(j) == u0) + if(ff)then + print '("In sldlmf; singularity of matrix detected")' + print '("Rank of matrix: ",i6)',jm + return + endif + bjji=u1/d(j) + do i=jp,m + b(j,i)=a(i,j) - dot_product(b(1:jm,j),b(i,1:jm)) + b(i,j)=b(j,i)*bjji + enddo + b(1:jm,j)=u0 +enddo +end subroutine sldlmf +!============================================================================= +subroutine dldlmf(a,b,d,ff) ! [LDLM] +!============================================================================= +! Modified Cholesky Q --> L*D*U, U(i,j)=L(j,i) +!============================================================================= +use pietc, only: u0,u1 +real(dp), intent(IN ) :: a(:,:) +real(dp), intent(INOUT) :: b(:,:) +real(dp), intent( OUT) :: d(:) +logical, intent( OUT) :: ff +!----------------------------------------------------------------------------- +integer(spi):: m,j, jm, jp, i +real(dp) :: bjji +!============================================================================= +m=size(a,1) +ff=f +do j=1,m; jm=j-1; jp=j+1 + d(j)=a(j,j) - sum(b(1:jm,j)*b(j,1:jm)) + b(j,j) = 1 + ff=(d(j) == u0) + if(ff)then + print '("In dldlmf; singularity of matrix detected")' + print '("Rank of matrix: ",i6)',jm + return + endif + bjji=u1/d(j) + do i=jp,m + b(j,i)=a(i,j) - dot_product(b(1:jm,j),b(i,1:jm)) + b(i,j)=b(j,i)*bjji + enddo + b(1:jm,j)=u0 +enddo +end subroutine dldlmf + +!============================================================================== +subroutine sinvu(a)! [invu] +!============================================================================== +! Invert the upper triangular matrix in place by transposing, calling +! invl, and transposing again. +!============================================================================== +real(sp),dimension(:,:),intent(inout):: a +a=transpose(a); call sinvl(a); a=transpose(a) +end subroutine sinvu +!============================================================================== +subroutine dinvu(a)! [invu] +!============================================================================== +real(dp),dimension(:,:),intent(inout):: a +a=transpose(a); call dinvl(a); a=transpose(a) +end subroutine dinvu +!============================================================================== +subroutine sinvl(a)! [invl] +!============================================================================== +! Invert lower triangular matrix in place +!============================================================================== +use pietc_s, only: u0,u1 +real(sp), intent(inout) :: a(:,:) +integer(spi):: m,j, i +m=size(a,1) +do j=m,1,-1 + a(1:j-1,j) = u0 + a(j,j)=u1/a(j,j) + do i=j+1,m + a(i,j)=-a(i,i)*sum(a(j:i-1,j)*a(i,j:i-1)) + enddo +enddo +end subroutine sinvl +!============================================================================== +subroutine dinvl(a)! [invl] +!============================================================================== +use pietc, only: u0,u1 +real(dp), intent(inout) :: a(:,:) +integer(spi):: m,j, i +m=size(a,1) +do j=m,1,-1 + a(1:j-1,j) = u0 + a(j,j)=u1/a(j,j) + do i=j+1,m + a(i,j)=-a(i,i)*sum(a(j:i-1,j)*a(i,j:i-1)) + enddo +enddo +end subroutine dinvl + +!============================================================================== +subroutine slinlv(a,u)! [invl] +!============================================================================== +! Solve linear system involving lower triangular system matrix. +!============================================================================== +real(sp),intent(in ) :: a(:,:) +real(sp),intent(inout) :: u(:) +integer(spi):: i +if(size(a,1) /= size(a,2) .or. size(a,1) /= size(u))& + stop 'In slinlv; incompatible array dimensions' +do i=1,size(u); u(i)=(u(i) - sum(u(:i-1)*a(i,:i-1)))/a(i,i); enddo +end subroutine slinlv +!============================================================================== +subroutine dlinlv(a,u)! [invl] +!============================================================================== +real(dp),intent(in ) :: a(:,:) +real(dp),intent(inout) :: u(:) +integer(spi):: i +if(size(a,1) /= size(a,2) .or. size(a,1) /= size(u))& + stop 'In dlinlv; incompatible array dimensions' +do i=1,size(u); u(i)=(u(i) - sum(u(:i-1)*a(i,:i-1)))/a(i,i); enddo +end subroutine dlinlv + +!============================================================================== +subroutine slinuv(a,u)! [invu] +!============================================================================== +! Solve linear system involving upper triangular system matrix. +!============================================================================== +real(sp),intent(in ) :: a(:,:) +real(sp),intent(inout) :: u(:) +integer(spi):: i +if(size(a,1) /= size(a,2) .or. size(a,1) /= size(u))& + stop 'In linuv; incompatible array dimensions' +do i=size(u),1,-1; u(i)=(u(i) - sum(a(i+1:,i)*u(i+1:)))/a(i,i); enddo +end subroutine slinuv +!============================================================================== +subroutine dlinuv(a,u)! [invu] +!============================================================================== +real(dp), intent(in ) :: a(:,:) +real(dp), intent(inout) :: u(:) +integer(spi) :: i +if(size(a,1) /= size(a,2) .or. size(a,1) /= size(u))& + stop 'In dlinuv; incompatible array dimensions' +do i=size(u),1,-1; u(i)=(u(i) - sum(a(i+1:,i)*u(i+1:)))/a(i,i); enddo +end subroutine dlinuv + +end module pmat + diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat2.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat2.f90 new file mode 100644 index 000000000..fde52673e --- /dev/null +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat2.f90 @@ -0,0 +1,1267 @@ +! +! ********************************************** +! * MODULE pmat2 * +! * R. J. Purser, NOAA/NCEP/EMC 1994/1999 * +! * jim.purser@noaa.gov * +! * Tsukasa Fujita (JMA) 1999 * +! * * +! ********************************************** +! +! Routines dealing with the operations of banded matrices +! The three special routines allow the construction of compact or +! conventional interpolation and differencing stencils to a general +! order of accuracy. These are: +! AVCO: Averaging, or interpolating; +! DFCO: Differentiating (once); +! DFCO2: Differentiating (twice). +! +! Other routines provide the tools for applying compact schemes, and for +! the construction and application of recursive filters. +! +! Programmers: R. J. Purser and T. Fujita +! National Centers for Environmental Prediction. +! Last modified (Purser): January 6th 2005 +! added nonredundant ldltb and ltdlbv routines for symmetric matrices, +! and remove obsolescent routines. +! January 6rd 2014 +! +! DIRECT DEPENDENCIES +! Libraries[their modules]: pmat[pmat] +! Additional Modules : pkind +! +!============================================================================= +module pmat2 +!============================================================================ +use pkind, only: spi,sp,dp,dpc +implicit none +private +public:: avco,dfco,dfco2, clipb,cad1b,csb1b,cad2b,csb2b, & + ldub,ldltb,udlb,l1ubb,l1ueb,ltdlbv, & + udlbv,udlbx,udlby,udlvb,udlxb,udlyb,u1lbv,u1lbx,u1lby,u1lvb,u1lxb, & + u1lyb,linbv,wrtb +real(dp),parameter:: zero=0 + +interface AVCO; module procedure AVCO, DAVCO, TAVCO; end interface +interface DFCO; module procedure DFCO, DDFCO, TDFCO; end interface +interface DFCO2; module procedure DFCO2, DDFCO2, TDFCO2; end interface +interface CLIPB; module procedure clib, clib_d, clib_c; end interface +interface CAD1B; module procedure CAD1B; end interface +interface CSB1B; module procedure CSB1B; end interface +interface CAD2B; module procedure CAD2B; end interface +interface CSB2B; module procedure CSB2B; end interface +interface LDUB; module procedure LDUB, DLDUB; end interface +interface LDLTB; module procedure LDLTB, DLDLTB; end interface +interface L1UBB; module procedure L1UBB, DL1UBB; end interface +interface L1UEB; module procedure L1UEB, DL1UEB; end interface +interface ltDLBV; module procedure ltdlbv,dltdlbv; end interface +interface UDLB; module procedure UDLB, DUDLB; end interface +interface UDLBV; module procedure UDLBV, dudlbv; end interface +interface UDLBX; module procedure UDLBX; end interface +interface UDLBY; module procedure UDLBY; end interface +interface UDLVB; module procedure UDLVB; end interface +interface UDLXB; module procedure UDLXB; end interface +interface UDLYB; module procedure UDLYB; end interface +interface U1LBV; module procedure U1LBV; end interface +interface U1LBX; module procedure U1LBX; end interface +interface U1LBY; module procedure U1LBY; end interface +interface U1LVB; module procedure U1LVB; end interface +interface U1LXB; module procedure U1LXB; end interface +interface U1LYB; module procedure U1LYB; end interface +interface LINBV; module procedure LINBV; end interface +interface WRTB; module procedure WRTB; end interface +contains + +!============================================================================= +subroutine AVCO(na,nb,za,zb,z0,a,b) ! [AVCO] +!============================================================================= +! SUBROUTINE AVCO +! R.J.Purser, National Centers for Environmental Prediction, Washington D.C. +! jim.purser@noaa.gov 1999 +! +! Compute one row of the coefficients for the compact mid-interval +! interpolation scheme characterized by matrix equation of the form, +! A.t = B.s (*) +! Where s is the vector of "source" values, t the staggered "target" values. +! +! --> NA: number of t-points operated on by this row of the A of (*) +! --> NB: number of s-points operated on by this row of the B of (*) +! --> ZA: coordinates of t-points used in this row of (*) +! --> ZB: coordinates of s-points used in this row of (*) +! --> Z0: nominal point of application of this row of (*) +! <-- A: the NA coefficients A for this scheme +! <-- B: the NB coefficients B for this scheme +!============================================================================= +use pietc, only: u0,u1 +use pmat, only: inv +implicit none +integer(spi),intent(in ):: na,nb +real(sp), intent(in ):: za(na),zb(nb),z0 +real(sp), intent(out):: a(na),b(nb) +!----------------------------------------------------------------------------- +integer(spi) :: na1,nab,i +real(sp), dimension(na+nb,na+nb):: w +real(sp), dimension(na) :: za0,pa +real(sp), dimension(nb) :: zb0,pb +real(sp), dimension(na+nb) :: ab +!============================================================================= +na1=na+1; nab=na+nb +za0=za-z0; zb0=zb-z0 +pa=u1; pb=-u1 +w=u0; ab=u0 +w(1,1:na)=u1; ab(1)=u1 +do i=2,nab; w(i,1:na)=pa; pa=pa*za0; w(i,na1:nab)=pb; pb=pb*zb0; enddo +call INV(w,ab) +a=ab(1:na); b=ab(na1:nab) +end subroutine AVCO +!============================================================================= +subroutine DAVCO(na,nb,za,zb,z0,a,b) ! [AVCO] +!============================================================================= +use pietc, only: u0,u1 +use pmat, only: inv +implicit none +integer(spi),intent(IN ):: na,nb +real(dp), intent(IN ):: za(na),zb(nb),z0 +real(dp), intent(OUT):: a(na),b(nb) +!----------------------------------------------------------------------------- +integer(spi) :: na1,nab,i +real(dp),dimension(na+nb,na+nb):: w +real(dp),dimension(na) :: za0,pa +real(dp),dimension(nb) :: zb0,pb +real(dp),dimension(na+nb) :: ab +!============================================================================= +na1=na+1; nab=na+nb +za0=za-z0; zb0=zb-z0 +pa=u1; pb=-u1 +w=u0; ab=u0 +w(1,1:na)=u1; ab(1)=u1 +do i=2,nab; w(i,1:na)=pa; pa=pa*za0; w(i,na1:nab)=pb; pb=pb*zb0; enddo +call INV(w,ab) +a=ab(1:na); b=ab(na1:nab) +end subroutine DAVCO +!============================================================================= +subroutine TAVCO(xa,xb,a,b)! [AVCO] +!============================================================================= +implicit none +real(dp),dimension(:),intent(IN ):: xa,xb +real(dp),dimension(:),intent(OUT):: a,b +!----------------------------------------------------------------------------- +integer(spi):: na,nb +!============================================================================= +na=size(xa); if(na /= size(a))stop 'In tavco; sizes of a and xa different' +nb=size(xb); if(nb /= size(b))stop 'In tavco; sizes of b and xb different' +call DAVCO(na,nb,xa,xb,zero,a,b) +end subroutine TAVCO + +!============================================================================= +subroutine DFCO(na,nb,za,zb,z0,a,b)! [DFCO] +!============================================================================= +! R.J.Purser, National Centers for Environmental Prediction, Washington D.C. +! jim.purser@noaa.gov 1999 +! SUBROUTINE DFCO +! +! Compute one row of the coefficients for either the compact differencing or +! quadrature scheme characterized by matrix equation of the form, +! A.d = B.c (*) +! In either case, d is the derivative of c. +! +! --> NA: number of d-points operated on by this row of the A of (*) +! --> NB: number of c-points operated on by this row of the B of (*) +! --> ZA: coordinates of d-points used in this row of (*) +! --> ZB: coordinates of c-points used in this row of (*) +! --> Z0: nominal point of application of this row of (*) +! <-- A: the A-coefficients for this scheme +! <-- B: the B-coefficients for this scheme +!============================================================================= +use pietc_s, only: u0,u1 +use pmat, only: inv +implicit none +integer(spi),intent(IN ) :: na,nb +real(sp), intent(IN ) :: za(na),zb(nb),z0 +real(sp), intent(OUT) :: a(na),b(nb) +!----------------------------------------------------------------------------- +integer(spi):: na1,nab,i +real(sp), dimension(na+nb,na+nb):: w +real(sp), dimension(na) :: za0,pa +real(sp), dimension(nb) :: zb0,pb +real(sp), dimension(na+nb) :: ab +!============================================================================= +na1=na+1; nab=na+nb +za0=za-z0; zb0=zb-z0 +pa=u1; pb=-u1 +w=u0; ab=u0 +w(1,1:na)=u1; ab(1)=u1 +do i=3,nab; w(i,1:na) =pa*(i-2); pa=pa*za0; enddo +do i=2,nab; w(i,na1:nab)=pb; pb=pb*zb0; enddo +call INV(w,ab) +a=ab(1:na); b=ab(na1:nab) +end subroutine DFCO +!============================================================================= +subroutine DDFCO(na,nb,za,zb,z0,a,b) ! Real(dp) version of [DFCO] +!============================================================================= +use pietc, only: u0,u1 +use pmat, only: inv +implicit none +integer(spi),intent(in) :: na,nb +real(dp), intent(in) :: za(na),zb(nb),z0 +real(dp), intent(out):: a(na),b(nb) +!----------------------------------------------------------------------------- +integer(spi) :: na1,nab,i +real(dp), dimension(na+nb,na+nb):: w +real(dp), dimension(na) :: za0,pa +real(dp), dimension(nb) :: zb0,pb +real(dp), dimension(na+nb) :: ab +!============================================================================= +na1=na+1; nab=na+nb +za0=za-z0; zb0=zb-z0 +pa=u1; pb=-u1 +w=u0; ab=u0 +w(1,1:na)=u1; ab(1)=u1 +do i=3,nab; w(i,1:na) =pa*(i-2); pa=pa*za0; enddo +do i=2,nab; w(i,na1:nab)=pb; pb=pb*zb0; enddo +call INV(w,ab) +a=ab(1:na); b=ab(na1:nab) +end subroutine DDFCO +!============================================================================= +subroutine TDFCO(xa,xb,a,b)! [DFCO] +!============================================================================= +implicit none +real(dp),dimension(:),intent(IN ):: xa,xb +real(dp),dimension(:),intent(OUT):: a,b +!----------------------------------------------------------------------------- +integer(spi):: na,nb +!============================================================================= +na=size(xa); if(na /= size(a))stop 'In tdfco; sizes of a and xa different' +nb=size(xb); if(nb /= size(b))stop 'In tdfco; sizes of b and xb different' +call DDFCO(na,nb,xa,xb,zero,a,b) +end subroutine TDFCO + +!============================================================================= +subroutine DFCO2(na,nb,za,zb,z0,a,b)! [DFCO2] +!============================================================================= +! SUBROUTINE DFCO2 +! R.J.Purser, National Centers for Environmental Prediction, Washington D.C. +! jim.purser@noaa.gov 1999 +! +! Compute one row of the coefficients for either the compact second- +! differencing scheme characterized by matrix equation of the form, +! A.d = B.c (*) +! Where d is the second-derivative of c. +! +! --> NA: number of d-points operated on by this row of the A of (*) +! --> NB: number of c-points operated on by this row of the B of (*) +! --> ZA: coordinates of d-points used in this row of (*) +! --> ZB: coordinates of c-points used in this row of (*) +! --> Z0: nominal point of application of this row of (*) +! <-- A: the NA coefficients A for this scheme +! <-- B: the NB coefficients B for this scheme +!============================================================================= +use pietc_s, only: u0,u1 +use pmat, only: inv +implicit none +integer(spi), intent(IN ):: na,nb +real(sp), intent(IN ):: za(na),zb(nb),z0 +real(sp), intent(OUT):: a(na),b(nb) +!----------------------------------------------------------------------------- +integer(spi) :: na1,nab,i +real(sp), dimension(na+nb,na+nb):: w +real(sp), dimension(na) :: za0,pa +real(sp), dimension(nb) :: zb0,pb +real(sp), dimension(na+nb) :: ab +!============================================================================= +na1=na+1; nab=na+nb +za0=za-z0; zb0=zb-z0 +pa=u1; pb=-u1 +w=u0; ab=u0 +w(1,1:na)=u1; ab(1)=u1 +do i=4,nab; w(i,1:na) =pa*(i-2)*(i-3); pa=pa*za0; enddo +do i=2,nab; w(i,na1:nab)=pb; pb=pb*zb0; enddo +call INV(w,ab) +a=ab(1:na); b=ab(na1:nab) +end subroutine DFCO2 +!============================================================================= +subroutine DDFCO2(na,nb,za,zb,z0,a,b) ! Real(dp) version of [DFCO2] +!============================================================================= +use pietc, only: u0,u1 +use pmat, only: inv +implicit none +integer(spi),intent(IN ) :: na,nb +real(dp), intent(IN ) :: za(na),zb(nb),z0 +real(dp), intent(OUT) :: a(na),b(nb) +!----------------------------------------------------------------------------- +integer(spi) :: na1,nab,i +real(dp), dimension(na+nb,na+nb):: w +real(dp), dimension(na) :: za0,pa +real(dp), dimension(nb) :: zb0,pb +real(dp), dimension(na+nb) :: ab +!============================================================================= +na1=na+1; nab=na+nb +za0=za-z0; zb0=zb-z0 +pa=u1; pb=-u1 +w=u0; ab=u0 +w(1,1:na)=u1; ab(1)=u1 +do i=4,nab; w(i,1:na) =pa*(i-2)*(i-3); pa=pa*za0; enddo +do i=2,nab; w(i,na1:nab)=pb; pb=pb*zb0; enddo +call INV(w,ab) +a=ab(1:na); b=ab(na1:nab) +end subroutine ddfco2 +!============================================================================= +subroutine TDFCO2(xa,xb,a,b)! [DFCO2] +!============================================================================= +real(dp),dimension(:),intent(IN ):: xa,xb +real(dp),dimension(:),intent(OUT):: a,b +!----------------------------------------------------------------------------- +integer(spi):: na,nb +!============================================================================= +na=size(xa); if(na /= size(a))stop 'In tdfco2; sizes of a and xa different' +nb=size(xb); if(nb /= size(b))stop 'In tdfco2; sizes of b and xb different' +call DDFCO2(na,nb,xa,xb,zero,a,b) +end subroutine TDFCO2 + + +!============================================================================= +pure subroutine CLIB(m1,m2,mah1,mah2,a)! [CLIPB] +!============================================================================= +use pietc_s, only: u0 +implicit none +integer(spi), intent(IN ) :: m1, m2, mah1, mah2 +real(sp), intent(INOUT) :: a(m1,-mah1:mah2) +integer(spi):: j +do j=1,mah1; a(1:min(m1,j),-j)=u0; enddo +do j=m2-m1+1,mah2; a(max(1,m2-j+1):m1,j)=u0; enddo +end subroutine CLIB +!============================================================================= +pure subroutine clib_d(m1,m2,mah1,mah2,a)! [CLIPB] +!============================================================================= +use pietc, only: u0 +implicit none +integer(spi),intent(IN ) :: m1, m2, mah1, mah2 +real(dp), intent(INOUT) :: a(m1,-mah1:mah2) +integer(spi):: j +do j=1,mah1; a(1:min(m1,j),-j)=u0; enddo +do j=m2-m1+1,mah2; a(max(1,m2-j+1):m1,j)=u0; enddo +end subroutine clib_d +!============================================================================= +pure subroutine clib_c(m1,m2,mah1,mah2,a)! [CLIPB] +!============================================================================= +use pietc, only: c0 +implicit none +integer(spi), intent(IN ) :: m1, m2, mah1, mah2 +complex(dpc), intent(INOUT) :: a(m1,-mah1:mah2) +integer(spi):: j +do j=1,mah1; a(1:min(m1,j),-j)=c0; enddo +do j=m2-m1+1,mah2; a(max(1,m2-j+1):m1,j)=c0; enddo +end subroutine clib_c + +!============================================================================= +subroutine CAD1B(m1,mah1,mah2,mirror2,a)! [CAD1B] +!============================================================================= +! Incorporate operand symmetry near end-1 of a band matrix operator +! +! <-> A: Input as unclipped operator, output as symmetrized and clipped. +! m1, m2: Sizes of implied full matrix +! mah1, mah2: Left and right semi-bandwidths of A. +! mirror2: 2*location of symmetry axis relative to end-1 operand element. +! Note: although m2 is not used here, it IS used in companion routines +! cad2b and csb2b; it is retained in the interests of uniformity. +!============================================================================= +use pietc_s, only: u0 +implicit none +integer(spi),intent(IN ):: m1,mah1,mah2,mirror2 +real(sp), intent(INOUT):: a(0:m1-1,-mah1:mah2) +!----------------------------------------------------------------------------- +integer(spi):: i,i2,jm,jp,jpmax +!============================================================================= +if(mirror2+mah1 > mah2)stop 'In CAD1B; mah2 insufficient' +do i=0,m1-1; i2=i*2; jpmax=mirror2+mah1-i2; if(jpmax <= -mah1)exit + do jm=-mah1,mah2; jp=mirror2-jm-i2; if(jp <= jm)exit + a(i,jp)=a(i,jp)+a(i,jm) ! Reflect and add + a(i,jm)=u0 ! zero the exterior part + enddo +enddo +end subroutine CAD1B + +!============================================================================= +subroutine CSB1B(m1,mah1,mah2,mirror2,a)! [CSB1B] +!============================================================================= +! Like cad1b, but for antisymmetric operand +!============================================================================= +use pietc_s, only: u0 +implicit none +integer(spi),intent(IN ):: m1,mah1,mah2,mirror2 +real(sp), intent(INOUT):: a(0:m1-1,-mah1:mah2) +!----------------------------------------------------------------------------- +integer(spi):: i,i2,jm,jp,jpmax +!============================================================================= +if(mirror2+mah1 > mah2)stop 'In CSB1B; mah2 insufficient' +do i=0,m1-1; i2=i*2; jpmax=mirror2+mah1-i2; if(jpmax < -mah1)exit + do jm=-mah1,mah2; jp=mirror2-jm-i2; if(jp < jm)exit + a(i,jp)=a(i,jp)-a(i,jm) ! Reflect and subtract + a(i,jm)=u0 ! zero the exterior part + enddo +enddo +end subroutine CSB1B + +!============================================================================= +subroutine CAD2B(m1,m2,mah1,mah2,mirror2,a)! [CAD2B] +!============================================================================= +! Incorporate operand symmetry near end-2 of a band matrix operator +! +! <-> A: Input as unclipped operator, output as symmetrized and clipped. +! m1, m2: Sizes of implied full matrix +! mah1, mah2: Left and right semi-bandwidths of A. +! mirror2: 2*location of symmetry axis relative to end-2 operand element. +!============================================================================= +use pietc_s, only: u0 +implicit none +integer(spi),intent(IN ):: m1,m2,mah1,mah2,mirror2 +real(sp), intent(INOUT):: a(1-m1:0,m1-m2-mah1:m1-m2+mah2) +!----------------------------------------------------------------------------- +integer(spi):: i,i2,jm,jp,jmmin,nah1,nah2 +!============================================================================= +nah1=mah1+m2-m1; nah2=mah2+m1-m2 ! Effective 2nd-index bounds of A +if(mirror2-nah1 > -nah2)stop 'In CAD2B; mah1 insufficient' +do i=0,1-m1,-1; i2=i*2; jmmin=mirror2-nah2-i2; if(jmmin >= nah2)exit + do jp=nah2,nah1,-1; jm=mirror2-jp-i2; if(jm >= jp)exit + a(i,jm)=a(i,jm)+a(i,jp) ! Reflect and add + a(i,jp)=u0 ! zero the exterior part + enddo +enddo +end subroutine CAD2B + +!============================================================================= +subroutine CSB2B(m1,m2,mah1,mah2,mirror2,a)! [CSB2B] +!============================================================================= +use pietc_s, only: u0 +implicit none +integer(spi),intent(IN ):: m1,m2,mah1,mah2,mirror2 +real(sp), intent(INOUT):: a(1-m1:0,m1-m2-mah1:m1-m2+mah2) +!----------------------------------------------------------------------------- +integer(spi):: i,i2,jm,jp,jmmin,nah1,nah2 +!============================================================================= +nah1=mah1+m2-m1; nah2=mah2+m1-m2 ! Effective 2nd-index bounds of A +if(mirror2-nah1 > -nah2)stop 'In CSB2B; mah1 insufficient' +do i=0,1-m1,-1; i2=i*2; jmmin=mirror2-nah2-i2; if(jmmin > nah2)exit + do jp=nah2,nah1,-1; jm=mirror2-jp-i2; if(jm > jp)exit + a(i,jm)=a(i,jm)-a(i,jp) ! Reflect and subtract + a(i,jp)=u0 ! zero the exterior part + enddo +enddo +end subroutine CSB2B + +!============================================================================= +subroutine LDUB(m,mah1,mah2,a)! [LDUB] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1994 +! SUBROUTINE LDUB +! Compute [L]*[D**-1]*[U] decomposition of asymmetric band-matrix +! +! <-> A: input as the asymmetric band matrix. On output, it contains +! the [L]*[D**-1]*[U] factorization of the input matrix, where +! [L] is lower triangular with unit main diagonal +! [D] is a diagonal matrix +! [U] is upper triangular with unit main diagonal +! --> M: The number of rows of array A +! --> MAH1: the left half-bandwidth of fortran array A +! --> MAH2: the right half-bandwidth of fortran array A +!============================================================================= +use pietc_s, only: u0,u1 +implicit none +integer(spi),intent(IN ):: m,mah1, mah2 +real(sp), intent(INOUT):: a(m,-mah1:mah2) +!----------------------------------------------------------------------------- +integer(spi):: j, imost, jmost, jp, i +real(sp) :: ajj, ajji, aij +!============================================================================= +do j=1,m + imost=min(m,j+mah1) + jmost=min(m,j+mah2) + jp=j+1 + ajj=a(j,0) + if(ajj == u0)then + print '(" Failure in LDUB:"/" Matrix requires pivoting or is singular")' + stop + endif + ajji=u1/ajj + a(j,0)=ajji + do i=jp,imost + aij=ajji*a(i,j-i) + a(i,j-i)=aij + a(i,jp-i:jmost-i)=a(i,jp-i:jmost-i)-aij*a(j,1:jmost-j) + enddo + a(j,1:jmost-j)=ajji*a(j,1:jmost-j) +enddo +end subroutine LDUB +!============================================================================= +subroutine DLDUB(m,mah1,mah2,a) ! Real(dp) version of [LDUB] +!============================================================================= +use pietc, only: u0,u1 +implicit none +integer(spi),intent(IN ):: m,mah1, mah2 +real(dp), intent(INOUT):: a(m,-mah1:mah2) +!----------------------------------------------------------------------------- +integer(spi):: j, imost, jmost, jp, i +real(dp) :: ajj, ajji, aij +!============================================================================= +do j=1,m + imost=min(m,j+mah1) + jmost=min(m,j+mah2) + jp=j+1 + ajj=a(j,0) + if(ajj == u0)then + print '(" Fails in LDUB_d:"/" Matrix requires pivoting or is singular")' + stop + endif + ajji=u1/ajj + a(j,0)=ajji + do i=jp,imost + aij=ajji*a(i,j-i) + a(i,j-i)=aij + a(i,jp-i:jmost-i)=a(i,jp-i:jmost-i)-aij*a(j,1:jmost-j) + enddo + a(j,1:jmost-j)=ajji*a(j,1:jmost-j) +enddo +end subroutine DLDUB + +!============================================================================= +subroutine LDLTB(m,mah1,a) ! Real(sp) version of [LDLTB] +!============================================================================= +use pietc_s, only: u0,u1 +integer(spi),intent(IN ):: m,mah1 +real(sp), intent(INOUT):: a(m,-mah1:0) +!----------------------------------------------------------------------------- +integer(spi):: j, imost, jp, i,k +real(sp) :: ajj, ajji, aij +!============================================================================= +do j=1,m + imost=min(m,j+mah1) + jp=j+1 + ajj=a(j,0) + if(ajj == u0)then + print '(" Fails in LDLTB:"/" Matrix requires pivoting or is singular")' + stop + endif + ajji=u1/ajj + a(j,0)=ajji + do i=jp,imost + aij=a(i,j-i) + a(i,j-i)=ajji*aij + do k=jp,i + a(i,k-i)=a(i,k-i)-aij*a(k,j-k) + enddo + enddo +enddo +end subroutine LDLTB +!============================================================================= +subroutine DLDLTB(m,mah1,a) ! Real(dp) version of [LDLTB] +!============================================================================= +use pietc, only: u0,u1 +integer(spi),intent(IN ) :: m,mah1 +real(dp), intent(INOUT) :: a(m,-mah1:0) +!----------------------------------------------------------------------------- +integer(spi):: j, imost, jp, i,k +real(dp) :: ajj, ajji, aij +!============================================================================= +do j=1,m + imost=min(m,j+mah1) + jp=j+1 + ajj=a(j,0) + if(ajj == u0)then + print '(" Fails in LDLTB_d:"/" Matrix requires pivoting or is singular")' + stop + endif + ajji=u1/ajj + a(j,0)=ajji + do i=jp,imost + aij=a(i,j-i) + a(i,j-i)=ajji*aij + do k=jp,i + a(i,k-i)=a(i,k-i)-aij*a(k,j-k) + enddo + enddo +enddo +end subroutine DLDLTB + +!============================================================================= +subroutine UDLB(m,mah1,mah2,a) ! Reversed-index version of ldub [UDLB] +!============================================================================= +implicit none +integer(spi), intent(IN ) :: m,mah1,mah2 +real(sp),dimension(m,-mah1:mah2),intent(INOUT) :: a(m,-mah1:mah2) +!----------------------------------------------------------------------------- +real(sp),dimension(m,-mah2:mah1):: at +!============================================================================= +at=a(m:1:-1,mah2:-mah1:-1); call LDUB(m,mah2,mah1,at) +a=at(m:1:-1,mah1:-mah2:-1) +end subroutine UDLB +!============================================================================= +subroutine DUDLB(m,mah1,mah2,a) ! real(dp) version of udlb [UDLB] +!============================================================================= +implicit none +integer(spi), intent(IN ) :: m,mah1,mah2 +real(dp),dimension(m,-mah1:mah2),intent(INOUT) :: a(m,-mah1:mah2) +!----------------------------------------------------------------------------- +real(dp),dimension(m,-mah2:mah1):: at +!============================================================================= +at=a(m:1:-1,mah2:-mah1:-1); call DLDUB(m,mah2,mah1,at) +a=at(m:1:-1,mah1:-mah2:-1) +end subroutine DUDLB + +!============================================================================= +subroutine L1UBB(m,mah1,mah2,mbh1,mbh2,a,b)! [L1UBB] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1996 +! SUBROUTINE L1UBB +! Form the [L]*[D]*[U] decomposition of asymmetric band-matrix [A] replace +! lower triangular elements of [A] by [D**-1]*[L]*[D], the upper by [U], +! replace matrix [B] by [D**-1]*[B]. +! +! <-> A input as band matrix, output as lower and upper triangulars with 1s +! implicitly assumed to lie on the main diagonal. The product of these +! triangular matrices is [D**-1]*[A], where [D] is a diagonal matrix. +! <-> B in as band matrix, out as same but premultiplied by diagonal [D**-1] +! --> M Number of rows of A and B +! --> MAH1 left half-width of fortran array A +! --> MAH2 right half-width of fortran array A +! --> MBH1 left half-width of fortran array B +! --> MBH2 right half-width of fortran array B +!============================================================================= +use pietc_s, only: u0,u1 +implicit none +integer(spi), intent(IN ) :: m,mah1, mah2, mbh1, mbh2 +real(sp), intent(INOUT) :: a(m,-mah1:mah2), b(m,-mbh1:mbh2) +!----------------------------------------------------------------------------- +integer(spi):: j, imost, jmost, jleast, jp, i +real(sp) :: ajj, ajji, aij +!============================================================================= +do j=1,m + imost=min(m,j+mah1) + jmost=min(m,j+mah2) + jleast=max(1,j-mah1) + jp=j+1 + ajj=a(j,0) + if(ajj == u0)stop 'In L1UBB; zero element found in diagonal factor' + ajji=u1/ajj + a(j,jleast-j:jmost-j) = ajji * a(j,jleast-j:jmost-j) + do i=jp,imost + aij=a(i,j-i) + a(i,jp-i:jmost-i) = a(i,jp-i:jmost-i) - aij*a(j,jp-j:jmost-j) + enddo + a(j,0)=u1 + b(j,-mbh1:mbh2) = ajji * b(j,-mbh1:mbh2) +enddo +end subroutine L1UBB +!============================================================================= +subroutine DL1UBB(m,mah1,mah2,mbh1,mbh2,a,b) ! Real(dp) version of [L1UBB] +!============================================================================= +use pietc, only: u0,u1 +implicit none +integer(spi),intent(IN ) :: m,mah1, mah2, mbh1, mbh2 +real(dp), intent(INOUT) :: a(m,-mah1:mah2), b(m,-mbh1:mbh2) +!----------------------------------------------------------------------------- +integer(spi):: j, imost, jmost, jleast, jp, i +real(dp) :: ajj, ajji, aij +!============================================================================= +do j=1,m + imost=min(m,j+mah1) + jmost=min(m,j+mah2) + jleast=max(1,j-mah1) + jp=j+1 + ajj=a(j,0) + if(ajj == u0)stop 'In L1UBB_d; zero element found in diagonal factor' + ajji=u1/ajj + a(j,jleast-j:jmost-j) = ajji * a(j,jleast-j:jmost-j) + do i=jp,imost + aij=a(i,j-i) + a(i,jp-i:jmost-i) = a(i,jp-i:jmost-i) - aij*a(j,jp-j:jmost-j) + enddo + a(j,0)=u1 + b(j,-mbh1:mbh2) = ajji * b(j,-mbh1:mbh2) +enddo +end subroutine DL1UBB + +!============================================================================= +subroutine L1UEB(m,mah1,mah2,mbh1,mbh2,a,b)! [L1UEB] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1998 +! SUBROUTINE L1UEB +! Form the [L]*[D]*[U] decomposition of asymmetric band-matrix [A] replace +! all but row zero of the +! lower triangular elements of [A] by [D**-1]*[L]*[D], the upper by [U], +! replace matrix [B] by [D**-1]*[B]. +! This is a special adaptation of L1UBB used to process quadarature weights +! for QEDBV etc in which the initial quadrature value is provided as input +! instead of being implicitly assumed zero (which is the case for QZDBV etc). +! +! <-> A input as band matrix, output as lower and upper triangulars with 1s +! implicitly assumed to lie on the main diagonal. The product of these +! triangular matrices is [D**-1]*[A], where [D] is a diagonal matrix. +! <-> B in as band matrix, out as same but premultiplied by diagonal [D**-1] +! --> M number of rows of B, one less than the rows of A (which has "row 0") +! --> MAH1 left half-width of fortran array A +! --> MAH2 right half-width of fortran array A +! --> MBH1 left half-width of fortran array B +! --> MBH2 right half-width of fortran array B +!============================================================================= +use pietc_s, only: u0,u1 +implicit none +integer(spi),intent(IN ) :: m,mah1, mah2, mbh1, mbh2 +real(sp), intent(INOUT) :: a(0:m,-mah1:mah2), b(m,-mbh1:mbh2) +!----------------------------------------------------------------------------- +integer(spi):: j, imost, jmost, jleast, jp, i +real(sp) :: ajj, ajji, aij +!============================================================================= +do j=1,m + imost=min(m,j+mah1) + jmost=min(m,j+mah2) + jleast=max(0,j-mah1) + jp=j+1 + ajj=a(j,0) + if(ajj == u0)stop 'In L1UEB; zero element found in diagonal factor' + ajji=u1/ajj + a(j,jleast-j:jmost-j) = ajji * a(j,jleast-j:jmost-j) + do i=jp,imost + aij=a(i,j-i) + a(i,jp-i:jmost-i) = a(i,jp-i:jmost-i) - aij*a(j,jp-j:jmost-j) + enddo + a(j,0)=u1 + b(j,-mbh1:mbh2) = ajji * b(j,-mbh1:mbh2) +enddo +end subroutine L1UEB +!============================================================================= +subroutine DL1UEB(m,mah1,mah2,mbh1,mbh2,a,b) ! Real(dp) version of [L1UEB] +!============================================================================= +use pietc, only: u0,u1 +implicit none +integer(spi),intent(IN ):: m,mah1, mah2, mbh1, mbh2 +real(dp), intent(INOUT):: a(0:,-mah1:), b(:,-mbh1:) +!----------------------------------------------------------------------------- +integer(spi):: j, imost, jmost, jleast, jp, i +real(dp) :: ajj, ajji, aij +!============================================================================= +do j=1,m + imost=min(m,j+mah1) + jmost=min(m,j+mah2) + jleast=max(0,j-mah1) + jp=j+1 + ajj=a(j,0) + if(ajj == u0)stop 'In L1UEB_D; zero element found in diagonal factor' + ajji=u1/ajj + a(j,jleast-j:jmost-j) = ajji * a(j,jleast-j:jmost-j) + do i=jp,imost + aij=a(i,j-i) + a(i,jp-i:jmost-i) = a(i,jp-i:jmost-i) - aij*a(j,jp-j:jmost-j) + enddo + a(j,0)=u1 + b(j,-mbh1:mbh2) = ajji * b(j,-mbh1:mbh2) +enddo +end subroutine DL1UEB + +!============================================================================= +subroutine UDLBV(m,mah1,mah2,a,v)! [UDLBV] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1994 +! SUBROUTINE UDLBV +! BACk-substitution step of linear inversion involving +! Banded matrix and Vector. +! +! --> A encodes the (L)*(D**-1)*(U) factorization of the linear-system +! matrix, as supplied by subroutine LDUB +! <-> V input as right-hand-side vector, output as solution vector +! --> M the number of rows assumed for A and for V +! --> MAH1 the left half-bandwidth of fortran array A +! --> MAH2 the right half-bandwidth of fortran array A +!============================================================================= +implicit none +integer(spi),intent(IN ):: m, mah1, mah2 +real(sp), intent(IN ):: a(m,-mah1:mah2) +real(sp), intent(INOUT):: v(m) +!----------------------------------------------------------------------------- +integer(spi):: i, j +real(sp) :: vj +!============================================================================= +do j=1,m + vj=v(j) + do i=j+1,min(m,j+mah1); v(i)=v(i)-a(i,j-i)*vj; enddo; v(j)=a(j,0)*vj +enddo +do j=m,2,-1 + vj=v(j) + do i=max(1,j-mah2),j-1; v(i)=v(i)-a(i,j-i)*vj; enddo +enddo +end subroutine UDLBV +!============================================================================= +subroutine dudlbv(m,mah1,mah2,a,v)! [udlbv] +!============================================================================= +implicit none +integer(spi),intent(IN ) :: m, mah1, mah2 +real(dp), intent(IN ) :: a(m,-mah1:mah2) +real(dp), intent(INOUT) :: v(m) +!----------------------------------------------------------------------------- +integer(spi):: i, j +real(dp) :: vj +!============================================================================= +do j=1,m + vj=v(j) + do i=j+1,min(m,j+mah1); v(i)=v(i)-a(i,j-i)*vj; enddo; v(j)=a(j,0)*vj +enddo +do j=m,2,-1 + vj=v(j) + do i=max(1,j-mah2),j-1; v(i)=v(i)-a(i,j-i)*vj; enddo +enddo +end subroutine dudlbv + +!============================================================================= +subroutine ltdlbv(m,mah1,a,v)! [ltdlbv] +!============================================================================= +! Like udlbv, except assuming a is the ltdl decomposition of a SYMMETRIC +! banded matrix, with only the non-upper part provided (to avoid redundancy) +!============================================================================= +implicit none +integer(spi),intent(IN ) :: m, mah1 +real(sp), intent(IN ) :: a(m,-mah1:0) +real(sp), intent(INOUT) :: v(m) +!----------------------------------------------------------------------------- +integer(spi):: i, j +real(sp) :: vj +!============================================================================= +do j=1,m + vj=v(j) + do i=j+1,min(m,j+mah1); v(i)=v(i)-a(i,j-i)*vj; enddo; v(j)=a(j,0)*vj +enddo +do j=m,2,-1 + vj=v(j) + do i=max(1,j-mah1),j-1; v(i)=v(i)-a(j,i-j)*vj; enddo +enddo +end subroutine ltdlbv +!============================================================================= +subroutine dltdlbv(m,mah1,a,v)! [ltdlbv] +!============================================================================= +! Like udlbv, except assuming a is the ltdl decomposition of a SYMMETRIC +! banded matrix, with only the non-upper part provided (to avoid redundancy) +!============================================================================= +implicit none +integer(spi),intent(IN ) :: m, mah1 +real(dp), intent(IN ) :: a(m,-mah1:0) +real(dp), intent(INOUT) :: v(m) +!----------------------------------------------------------------------------- +integer(spi):: i, j +real(dp) :: vj +!============================================================================= +do j=1,m + vj=v(j) + do i=j+1,min(m,j+mah1); v(i)=v(i)-a(i,j-i)*vj; enddo; v(j)=a(j,0)*vj +enddo +do j=m,2,-1 + vj=v(j) + do i=max(1,j-mah1),j-1; v(i)=v(i)-a(j,i-j)*vj; enddo +enddo +end subroutine dltdlbv + +!============================================================================= +subroutine UDLBX(mx,mah1,mah2,my,a,v)! [UDLBX] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1994 +! SUBROUTINE UDLBX +! BACk-substitution step of parallel linear inversion involving +! Banded matrix and X-Vectors. +! +! --> A encodes the (L)*(D**-1)*(U) factorization of the linear-system +! matrix, as supplied by subroutine LDUB or, if N=NA, by LDUB +! <-> V input as right-hand-side vectors, output as solution vectors +! --> MX the number of rows assumed for A and length of +! X-vectors stored in V +! --> MAH1 the left half-bandwidth of fortran array A +! --> MAH2 the right half-bandwidth of fortran array A +! --> MY number of parallel X-vectors inverted +!============================================================================= +implicit none +integer(spi),intent(IN ) :: mx, mah1, mah2, my +real(sp), intent(IN ) :: a(mx,-mah1:mah2) +real(sp), intent(INOUT) :: v(mx,my) +!----------------------------------------------------------------------------- +integer(spi):: jx, ix +!============================================================================= +do jx=1,mx + do ix=jx+1,min(mx,jx+mah1); v(ix,:) = v(ix,:) - a(ix,jx-ix)*v(jx,:); enddo + v(jx,:) = a(jx,0) * v(jx,:) +enddo +do jx=mx,2,-1 + do ix=max(1,jx-mah2),jx-1; v(ix,:) = v(ix,:) - a(ix,jx-ix)*v(jx,:); enddo +enddo +end subroutine UDLBX + +!============================================================================= +subroutine UDLBY(my,mah1,mah2,mx,a,v)! [UDLBY] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1994 +! SUBROUTINE UDLBY +! BACk-substitution step of parallel linear inversion involving +! Banded matrix and Y-Vectors. +! +! --> A encodes the (L)*(D**-1)*(U) factorization of the linear-system +! matrix, as supplied by subroutine LDUB or, if N=NA, by LDUB +! <-> V input as right-hand-side vectors, output as solution vectors +! --> MY the number of rows assumed for A and length of +! Y-vectors stored in V +! --> MAH1 the left half-bandwidth of fortran array A +! --> MAH2 the right half-bandwidth of fortran array A +! --> MX number of parallel Y-vectors inverted +!============================================================================= +implicit none +integer(spi),intent(IN ) :: my, mah1, mah2, mx +real(sp), intent(IN ) :: a(my,-mah1:mah2) +real(sp), intent(INOUT) :: v(mx,my) +!----------------------------------------------------------------------------- +integer(spi):: iy, jy +!============================================================================= +do jy=1,my + do iy=jy+1,min(my,jy+mah1); v(:,iy) = v(:,iy)-a(iy,jy-iy)*v(:,jy); enddo + v(:,jy)=a(jy,0)*v(:,jy) +enddo +do jy=my,2,-1 + do iy=max(1,jy-mah2),jy-1; v(:,iy)=v(:,iy)-a(iy,jy-iy)*v(:,jy); enddo +enddo +end subroutine UDLBY + +!============================================================================= +subroutine UDLVB(m,mah1,mah2,v,a)! [UDLVB] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1994 +! SUBROUTINE UDLVB +! BACk-substitution step of linear inversion involving +! row-Vector and Banded matrix. +! +! <-> V input as right-hand-side row-vector, output as solution vector +! --> A encodes the (L)*(D**-1)*(U) factorization of the linear-system +! matrix, as supplied by subroutine LDUB +! --> M the number of rows assumed for A and columns for V +! --> MAH1 the left half-bandwidth of fortran array A +! --> MAH2 the right half-bandwidth of fortran array A +!============================================================================= +implicit none +integer(spi), intent(IN ) :: m, mah1, mah2 +real(sp), intent(IN ) :: a(m,-mah1:mah2) +real(sp), intent(INOUT) :: v(m) +!----------------------------------------------------------------------------- +integer(spi):: i, j +real(sp) :: vi +!============================================================================= +do i=1,m + vi=v(i) + do j=i+1,min(m,i+mah2); v(j)=v(j)-vi*a(i,j-i); enddo + v(i)=vi*a(i,0) +enddo +do i=m,2,-1 + vi=v(i) + do j=max(1,i-mah1),i-1; v(j)=v(j)-vi*a(i,j-i); enddo +enddo +end subroutine UDLVB + +!============================================================================= +subroutine UDLXB(mx,mah1,mah2,my,v,a)! [UDLXB] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1994 +! SUBROUTINE UDLXB +! BACk-substitution step of parallel linear inversion involving +! Banded matrix and row-X-Vectors. +! +! <-> V input as right-hand-side vectors, output as solution vectors +! --> A encodes the (L)*(D**-1)*(U) factorization of the linear-system +! matrix, as supplied by subroutine LDUB +! --> MX the number of rows assumed for A and length of +! X-vectors stored in V +! --> MAH1 the left half-bandwidth of fortran array A +! --> MAH2 the right half-bandwidth of fortran array A +! --> MY number of parallel X-vectors inverted +!============================================================================= +implicit none +integer(spi),intent(IN ) :: mx, mah1, mah2, my +real(sp), intent(IN ) :: a(mx,-mah1:mah2) +real(sp), intent(INOUT) :: v(mx,my) +!----------------------------------------------------------------------------- +integer(spi):: ix, jx +!============================================================================= +do ix=1,mx + do jx=ix+1,min(mx,ix+mah2); v(jx,:)=v(jx,:)-v(ix,:)*a(ix,jx-ix); enddo + v(ix,:)=v(ix,:)*a(ix,0) +enddo +do ix=mx,2,-1 + do jx=max(1,ix-mah1),ix-1; v(jx,:)=v(jx,:)-v(ix,:)*a(ix,jx-ix); enddo +enddo +end subroutine UDLXB + +!============================================================================= +subroutine UDLYB(my,mah1,mah2,mx,v,a)! [UDLYB] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1994 +! SUBROUTINE UDLYB +! BACk-substitution step of parallel linear inversion involving +! Banded matrix and row-Y-Vectors. +! +! <-> V input as right-hand-side vectors, output as solution vectors +! --> A encodes the (L)*(D**-1)*(U) factorization of the linear-system +! matrix, as supplied by subroutine LDUB +! --> MY the number of rows assumed for A and length of +! Y-vectors stored in V +! --> MAH1 the left half-bandwidth of fortran array A +! --> MAH2 the right half-bandwidth of fortran array A +! --> MX number of parallel Y-vectors inverted +!============================================================================= +implicit none +integer(spi),intent(IN ) :: my, mah1, mah2, mx +real(sp), intent(IN ) :: a(my,-mah1:mah2) +real(sp), intent(INOUT) :: v(mx,my) +!----------------------------------------------------------------------------- +integer(spi):: iy, jy +!============================================================================= +do iy=1,my + do jy=iy+1,min(my,iy+mah2); v(:,jy)=v(:,jy)-v(:,iy)*a(iy,jy-iy); enddo + v(:,iy)=v(:,iy)*a(iy,0) +enddo +do iy=my,2,-1 + do jy=max(1,iy-mah1),iy-1; v(:,jy)=v(:,jy)-v(:,iy)*a(iy,jy-iy); enddo +enddo +end subroutine UDLYB + +!============================================================================= +subroutine U1LBV(m,mah1,mah2,a,v)! [U1LBV] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1996 +! SUBROUTINE U1LBV +! BACk-substitution step ((U**-1)*(L**-1)) of linear inversion involving +! special Banded matrix and right-Vector. +! +! --> A encodes the [L]*[U] factorization of the linear-system +! matrix, as supplied by subroutine L1UBB +! <-> V input as right-hand-side vector, output as solution vector +! --> M the number of rows assumed for A and for V +! --> MAH1 the left half-bandwidth of fortran array A +! --> MAH2 the right half-bandwidth of fortran array A +!============================================================================= +implicit none +integer(spi),intent(IN ) :: m, mah1, mah2 +real(sp), intent(IN ) :: a(m,-mah1:mah2) +real(sp), intent(INOUT) :: v(m) +!----------------------------------------------------------------------------- +integer(spi):: i, j +real(sp) :: vj +!============================================================================= +do j=1,m + vj=v(j) + do i=j+1,min(m,j+mah1); v(i)=v(i)-a(i,j-i)*vj; enddo +enddo +do j=m,2,-1 + vj=v(j) + do i=max(1,j-mah2),j-1; v(i)=v(i)-a(i,j-i)*vj; enddo +enddo +end subroutine U1LBV + +!============================================================================= +subroutine U1LBX(mx,mah1,mah2,my,a,v)! [U1LBX] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1996 +! SUBROUTINE U1LBX +! Special BaCk-substitution step of parallel linear inversion involving +! Banded matrix and X-right-Vectors. +! +! --> A encodes the [L]*[U] factorization of the linear-system +! matrix, as supplied by subroutine L1UBB +! <-> V input as right-hand-side vectors, output as solution vectors +! --> MX the number of rows assumed for A and length of +! X-vectors stored in V +! --> MAH1 the left half-bandwidth of fortran array A +! --> MAH2 the right half-bandwidth of fortran array A +! --> MY number of parallel X-vectors inverted +!============================================================================= +implicit none +integer(spi),intent(IN ) :: mx, mah1, mah2, my +real(sp), intent(IN ) :: a(mx,-mah1:mah2) +real(sp), intent(INOUT) :: v(mx,my) +!----------------------------------------------------------------------------- +integer(spi):: ix, jx +!============================================================================= +do jx=1,mx + do ix=jx+1,min(mx,jx+mah1); v(ix,:)=v(ix,:)-a(ix,jx-ix)*v(jx,:); enddo +enddo +do jx=mx,2,-1 + do ix=max(1,jx-mah2),jx-1; v(ix,:)=v(ix,:)-a(ix,jx-ix)*v(jx,:); enddo +enddo +end subroutine U1LBX + +!============================================================================= +subroutine U1LBY(my,mah1,mah2,mx,a,v)! [U1LBY] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1996 +! SUBROUTINE U1LBY +! Special BaCk-substitution step of parallel linear inversion involving +! Banded matrix and Y-right-Vectors. +! +! --> A encodes the [L]*[U] factorization of the linear-system +! matrix, as supplied by subroutine L1UBB +! <-> V input as right-hand-side vectors, output as solution vectors +! --> MY the number of rows assumed for A and length of +! Y-vectors stored in V +! --> MAH1 the left half-bandwidth of fortran array A +! --> MAH2 the right half-bandwidth of fortran array A +! --> MX number of parallel Y-vectors inverted +!============================================================================= +implicit none +integer(spi),intent(IN ) :: my, mah1, mah2, mx +real(sp), intent(IN ) :: a(my,-mah1:mah2) +real(sp), intent(INOUT) :: v(mx,my) +!----------------------------------------------------------------------------- +integer(spi):: iy, jy +!============================================================================= +do jy=1,my + do iy=jy+1,min(my,jy+mah1); v(:,iy)=v(:,iy)-a(iy,jy-iy)*v(:,jy); enddo +enddo +do jy=my,2,-1 + do iy=max(1,jy-mah2),jy-1; v(:,iy)=v(:,iy)-a(iy,jy-iy)*v(:,jy); enddo +enddo +end subroutine U1LBY + +!============================================================================= +subroutine U1LVB(m,mah1,mah2,v,a)! [U1LVB] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1996 +! SUBROUTINE U1LVB +! Special BaCk-substitution step of linear inversion involving +! left-Vector and Banded matrix. +! +! <-> V input as right-hand-side row-vector, output as solution vector +! --> A encodes the special [L]*[U] factorization of the linear-system +! matrix, as supplied by subroutine L1UBB +! --> M the number of rows assumed for A and columns for V +! --> MAH1 the left half-bandwidth of fortran array A +! --> MAH2 the right half-bandwidth of fortran array A +!============================================================================= +implicit none +integer(spi),intent(IN ) :: m, mah1, mah2 +real(sp), intent(IN ) :: a(m,-mah1:mah2) +real(sp), intent(INOUT) :: v(m) +!----------------------------------------------------------------------------- +integer(spi):: i, j +real(sp) :: vi +!============================================================================= +do i=1,m + vi=v(i) + do j=i+1,min(m,i+mah2); v(j)=v(j)-vi*a(i,j-i); enddo +enddo +do i=m,2,-1 + vi=v(i) + do j=max(1,i-mah1),i-1; v(j)=v(j)-vi*a(i,j-i); enddo +enddo +end subroutine U1LVB + +!============================================================================= +subroutine U1LXB(mx,mah1,mah2,my,v,a)! [U1LXB] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1996 +! SUBROUTINE U1LXB +! Special BaCk-substitution step of parallel linear inversion involving +! Banded matrix and X-left-Vectors. +! +! <-> V input as right-hand-side vectors, output as solution vectors +! --> A encodes the special [L]*[U] factorization of the linear-system +! matrix, as supplied by subroutine L1UBB +! --> MX the number of rows assumed for A and length of +! X-vectors stored in V +! --> MAH1 the left half-bandwidth of fortran array A +! --> MAH2 the right half-bandwidth of fortran array A +! --> MY number of parallel X-vectors inverted +!============================================================================= +implicit none +integer(spi),intent(IN ) :: mx, mah1, mah2, my +real(sp), intent(IN ) :: a(mx,-mah1:mah2) +real(sp), intent(INOUT) :: v(mx,my) +!----------------------------------------------------------------------------- +integer(spi):: ix, jx +!============================================================================= +do ix=1,mx + do jx=ix+1,min(mx,ix+mah2); v(jx,:)=v(jx,:)-v(ix,:)*a(ix,jx-ix); enddo +enddo +do ix=mx,2,-1 + do jx=max(1,ix-mah1),ix-1; v(jx,:)=v(jx,:)-v(ix,:)*a(ix,jx-ix); enddo +enddo +end subroutine U1LXB + +!============================================================================= +subroutine U1LYB(my,mah1,mah2,mx,v,a)! [U1LYB] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1996 +! SUBROUTINE U1LYB +! Special BaCk-substitution step of parallel linear inversion involving +! special Banded matrix and Y-left-Vectors. +! +! <-> V input as right-hand-side vectors, output as solution vectors +! --> A encodes the [L]*[U] factorization of the linear-system +! matrix, as supplied by subroutine L1UBB +! --> MY the number of rows assumed for A and length of +! Y-vectors stored in V +! --> MAH1 the left half-bandwidth of fortran array A +! --> MAH2 the right half-bandwidth of fortran array A +! --> MX number of parallel Y-vectors inverted +!============================================================================= +implicit none +integer(spi),intent(IN ) :: my, mah1, mah2, mx +real(sp), intent(IN ) :: a(my,-mah1:mah2) +real(sp), intent(INOUT) :: v(mx,my) +!----------------------------------------------------------------------------- +integer(spi):: iy, jy +!============================================================================= +do iy=1,my + do jy=iy+1,min(my,iy+mah2); v(:,jy)=v(:,jy)-v(:,iy)*a(iy,jy-iy); enddo +enddo +do iy=my,2,-1 + do jy=max(1,iy-mah1),iy-1; v(:,jy)=v(:,jy)-v(:,iy)*a(iy,jy-iy); enddo +enddo +end subroutine U1LYB + +!============================================================================= +subroutine LINBV(m,mah1,mah2,a,v)! [LINBV] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1994 +! SUBROUTINE LINBV +! Solve LINear system with square Banded-matrix and vector V +! +! <-> A system matrix on input, its [L]*[D**-1]*[U] factorization on exit +! <-> V vector of right-hand-sides on input, solution vector on exit +! --> M order of matrix A +! --> MAH1 left half-bandwidth of A +! --> MAH2 right half-bandwidth of A +!============================================================================= +implicit none +integer(spi),intent(IN ) :: m, mah1, mah2 +real(sp), intent(INOUT) :: a(m,-mah1:mah2), v(m) +!============================================================================= +call LDUB(m,mah1,mah2,a) +call UDLBV(m,mah1,mah2,a,v) +end subroutine LINBV + +!============================================================================= +subroutine WRTB(m1,m2,mah1,mah2,a)! [WRTB] +!============================================================================= +implicit none +integer(spi),intent(IN) :: m1, m2, mah1, mah2 +real(sp), intent(IN) :: a(m1,-mah1:mah2) +!----------------------------------------------------------------------------- +integer(spi):: i1, i2, i, j1, j2, j, nj1 +!============================================================================= +do i1=1,m1,20 + i2=min(i1+19,m1) + print '(7x,6(i2,10x))',(j,j=-mah1,mah2) + do i=i1,i2 + j1=max(-mah1,1-i) + j2=min(mah2,m2-i) + nj1=j1+mah1 + if(nj1==0)print '(1x,i3,6(1x,e12.5))', i,(a(i,j),j=j1,j2) + if(nj1==1)print '(1x,i3,12x,5(1x,e12.5))',i,(a(i,j),j=j1,j2) + if(nj1==2)print '(1x,i3,24x,4(1x,e12.5))',i,(a(i,j),j=j1,j2) + if(nj1==3)print '(1x,i3,36x,3(1x,e12.5))',i,(a(i,j),j=j1,j2) + if(nj1==4)print '(1x,i3,48x,2(1x,e12.5))',i,(a(i,j),j=j1,j2) + if(nj1==5)print '(1x,i3,60x,1(1x,e12.5))',i,(a(i,j),j=j1,j2) + enddo + read(*,*) +enddo +end subroutine WRTB + +end module pmat2 diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/pmat4.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat4.f90 new file mode 100644 index 000000000..1e03e7d11 --- /dev/null +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/pmat4.f90 @@ -0,0 +1,2060 @@ +! +! ********************************************** +! * MODULE pmat4 * +! * R. J. Purser, NOAA/NCEP/EMC Oct 2005 * +! * 18th May 2012 * +! * jim.purser@noaa.gov * +! * * +! ********************************************** +! +! Euclidean geometry, geometric (stereographic) projections, +! related transformations (Mobius). +! Package for handy vector and matrix operations in Euclidean geometry. +! This package is primarily intended for 3D operations and three of the +! functions (Cross_product, Triple_product and Axial) do not possess simple +! generalizations to a generic number N of dimensions. The others, while +! admitting such N-dimensional generalizations, have not all been provided +! with such generic forms here at the time of writing, though some of these +! may be added at a future date. +! +! May 2017: Added routines to facilitate manipulation of 3D rotations, +! their representations by axial vectors, and routines to compute the +! exponentials of matrices (without resort to eigen methods). Also added +! Quaternion and spinor representations of 3D rotations, and their +! conversion routines. +! +! FUNCTION: +! absv: Absolute magnitude of vector as its euclidean length +! Normalized: Normalized version of given real vector +! Orthogonalized: Orthogonalized version of second vector rel. to first unit v. +! Cross_product: Vector cross-product of the given 2 vectors +! Outer_product: outer-product matrix of the given 2 vectors +! Triple_product: Scalar triple product of given 3 vectors +! Det: Determinant of given matrix +! Axial: Convert axial-vector <--> 2-form (antisymmetric matrix) +! Diag: Diagnl of given matrix, or diagonal matrix of given elements +! Trace: Trace of given matrix +! Identity: Identity 3*3 matrix, or identity n*n matrix for a given n +! Sarea: Spherical area subtended by three vectors, or by lat-lon +! increments forming a triangle or quadrilateral +! Huarea: Spherical area subtended by right-angled spherical triangle +! SUBROUTINE: +! Gram: Right-handed orthogonal basis and rank, nrank. The first +! nrank basis vectors span the column range of matrix given, +! OR ("plain" version) simple unpivoted Gram-Schmidt of a +! square matrix. +! +! In addition, we include routines that relate to stereographic projections +! and some associated mobius transformation utilities, since these complex +! operations have a strong geometrical flavor. +! +! DIRECT DEPENDENCIES +! Libraries[their Modules]: pmat[pmat] +! Additional Modules : pkind, pietc +! +!============================================================================ +module pmat4 +!============================================================================ +use pkind, only: spi,sp,dp,dpc +implicit none +private +public:: absv,normalized,orthogonalized, & + cross_product,outer_product,triple_product,det,axial, & + diag,trace,identity,sarea,huarea,dlltoxy, & + normalize,gram,rowops,corral, & + axtoq,qtoax, & + rottoax,axtorot,spintoq,qtospin,rottoq,qtorot,mulqq, & + expmat,zntay,znfun, & + ctoz,ztoc,setmobius, & + mobius,mobiusi + +interface absv; module procedure absv_s,absv_d; end interface +interface normalized;module procedure normalized_s,normalized_d;end interface +interface orthogonalized + module procedure orthogonalized_s,orthogonalized_d; end interface +interface cross_product + module procedure cross_product_s,cross_product_d, & + triple_cross_product_s,triple_cross_product_d; end interface +interface outer_product + module procedure outer_product_s,outer_product_d,outer_product_i + end interface +interface triple_product + module procedure triple_product_s,triple_product_d; end interface +interface det; module procedure det_s,det_d,det_i,det_id; end interface +interface axial + module procedure axial3_s,axial3_d,axial33_s,axial33_d; end interface +interface diag + module procedure diagn_s,diagn_d,diagn_i,diagnn_s,diagnn_d,diagnn_i + end interface +interface trace; module procedure trace_s,trace_d,trace_i; end interface +interface identity; module procedure identity_i,identity3_i; end interface +interface huarea; module procedure huarea_s,huarea_d; end interface +interface sarea + module procedure sarea_s,sarea_d,dtarea_s,dtarea_d,dqarea_s,dqarea_d + end interface +interface dlltoxy; module procedure dlltoxy_s,dlltoxy_d; end interface +interface hav; module procedure hav_s, hav_d; end interface +interface normalize;module procedure normalize_s,normalize_d; end interface +interface gram + module procedure gram_s,gram_d,graml_d,plaingram_s,plaingram_d,rowgram + end interface +interface rowops; module procedure rowops; end interface +interface corral; module procedure corral; end interface +interface rottoax; module procedure rottoax; end interface +interface axtorot; module procedure axtorot; end interface +interface spintoq; module procedure spintoq; end interface +interface qtospin; module procedure qtospin; end interface +interface rottoq; module procedure rottoq; end interface +interface qtorot; module procedure qtorot; end interface +interface axtoq; module procedure axtoq; end interface +interface qtoax; module procedure qtoax; end interface +interface setem; module procedure setem; end interface +interface mulqq; module procedure mulqq; end interface +interface expmat; module procedure expmat,expmatd,expmatdd; end interface +interface zntay; module procedure zntay; end interface +interface znfun; module procedure znfun; end interface +interface ctoz; module procedure ctoz; end interface +interface ztoc; module procedure ztoc,ztocd; end interface +interface setmobius;module procedure setmobius,zsetmobius; end interface +interface mobius; module procedure zmobius,cmobius; end interface +interface mobiusi; module procedure zmobiusi; end interface + +contains + +!============================================================================= +function absv_s(a)result(s)! [absv] +!============================================================================= +implicit none +real(sp),dimension(:),intent(in):: a +real(sp) :: s +s=sqrt(dot_product(a,a)) +end function absv_s +!============================================================================= +function absv_d(a)result(s)! [absv] +!============================================================================= +implicit none +real(dp),dimension(:),intent(in):: a +real(dp) :: s +s=sqrt(dot_product(a,a)) +end function absv_d + +!============================================================================= +function normalized_s(a)result(b)! [normalized] +!============================================================================= +use pietc_s, only: u0 +implicit none +real(sp),dimension(:),intent(IN):: a +real(sp),dimension(size(a)) :: b +real(sp) :: s +s=absv_s(a); if(s==u0)then; b=u0;else;b=a/s;endif +end function normalized_s +!============================================================================= +function normalized_d(a)result(b)! [normalized] +!============================================================================= +use pietc, only: u0 +implicit none +real(dp),dimension(:),intent(IN):: a +real(dp),dimension(size(a)) :: b +real(dp) :: s +s=absv_d(a); if(s==u0)then; b=u0;else;b=a/s;endif +end function normalized_d + +!============================================================================= +function orthogonalized_s(u,a)result(b)! [orthogonalized] +!============================================================================= +implicit none +real(sp),dimension(:),intent(in):: u,a +real(sp),dimension(size(u)) :: b +real(sp) :: s +! Note: this routine assumes u is already normalized +s=dot_product(u,a); b=a-u*s +end function orthogonalized_s +!============================================================================= +function orthogonalized_d(u,a)result(b)! [orthogonalized] +!============================================================================= +implicit none +real(dp),dimension(:),intent(in):: u,a +real(dp),dimension(size(u)) :: b +real(dp) :: s +! Note: this routine assumes u is already normalized +s=dot_product(u,a); b=a-u*s +end function orthogonalized_d + +!============================================================================= +function cross_product_s(a,b)result(c)! [cross_product] +!============================================================================= +implicit none +real(sp),dimension(3),intent(in):: a,b +real(sp),dimension(3) :: c +c(1)=a(2)*b(3)-a(3)*b(2); c(2)=a(3)*b(1)-a(1)*b(3); c(3)=a(1)*b(2)-a(2)*b(1) +end function cross_product_s +!============================================================================= +function cross_product_d(a,b)result(c)! [cross_product] +!============================================================================= +implicit none +real(dp),dimension(3),intent(in):: a,b +real(dp),dimension(3) :: c +c(1)=a(2)*b(3)-a(3)*b(2); c(2)=a(3)*b(1)-a(1)*b(3); c(3)=a(1)*b(2)-a(2)*b(1) +end function cross_product_d +!============================================================================= +function triple_cross_product_s(u,v,w)result(x)! [cross_product] +!============================================================================= +! Deliver the triple-cross-product, x, of the +! three 4-vectors, u, v, w, with the sign convention +! that ordered, {u,v,w,x} form a right-handed quartet +! in the generic case (determinant >= 0). +!============================================================================= +implicit none +real(sp),dimension(4),intent(in ):: u,v,w +real(sp),dimension(4) :: x +!----------------------------------------------------------------------------- +real(sp):: uv12,uv13,uv14,uv23,uv24,uv34 +!============================================================================= +uv12=u(1)*v(2)-u(2)*v(1); uv13=u(1)*v(3)-u(3)*v(1); uv14=u(1)*v(4)-u(4)*v(1) + uv23=u(2)*v(3)-u(3)*v(2); uv24=u(2)*v(4)-u(4)*v(2) + uv34=u(3)*v(4)-u(4)*v(3) +x(1)=-uv23*w(4)+uv24*w(3)-uv34*w(2) +x(2)= uv13*w(4)-uv14*w(3) +uv34*w(1) +x(3)=-uv12*w(4) +uv14*w(2)-uv24*w(1) +x(4)= uv12*w(3)-uv13*w(2)+uv23*w(1) +end function triple_cross_product_s +!============================================================================= +function triple_cross_product_d(u,v,w)result(x)! [cross_product] +!============================================================================= +implicit none +real(dp),dimension(4),intent(in ):: u,v,w +real(dp),dimension(4) :: x +!----------------------------------------------------------------------------- +real(dp):: uv12,uv13,uv14,uv23,uv24,uv34 +!============================================================================= +uv12=u(1)*v(2)-u(2)*v(1); uv13=u(1)*v(3)-u(3)*v(1); uv14=u(1)*v(4)-u(4)*v(1) + uv23=u(2)*v(3)-u(3)*v(2); uv24=u(2)*v(4)-u(4)*v(2) + uv34=u(3)*v(4)-u(4)*v(3) +x(1)=-uv23*w(4)+uv24*w(3)-uv34*w(2) +x(2)= uv13*w(4)-uv14*w(3) +uv34*w(1) +x(3)=-uv12*w(4) +uv14*w(2)-uv24*w(1) +x(4)= uv12*w(3)-uv13*w(2)+uv23*w(1) +end function triple_cross_product_d + +!============================================================================= +function outer_product_s(a,b)result(c)! [outer_product] +!============================================================================= +implicit none +real(sp),dimension(:), intent(in ):: a +real(sp),dimension(:), intent(in ):: b +real(sp),DIMENSION(size(a),size(b)):: c +integer(spi) :: nb,i +nb=size(b) +do i=1,nb; c(:,i)=a*b(i); enddo +end function outer_product_s +!============================================================================= +function outer_product_d(a,b)result(c)! [outer_product] +!============================================================================= +implicit none +real(dp),dimension(:), intent(in ):: a +real(dp),dimension(:), intent(in ):: b +real(dp),dimension(size(a),size(b)):: c +integer(spi) :: nb,i +nb=size(b) +do i=1,nb; c(:,i)=a*b(i); enddo +end function outer_product_d +!============================================================================= +function outer_product_i(a,b)result(c)! [outer_product] +!============================================================================= +implicit none +integer(spi),dimension(:), intent(in ):: a +integer(spi),dimension(:), intent(in ):: b +integer(spi),dimension(size(a),size(b)):: c +integer(spi) :: nb,i +nb=size(b) +do i=1,nb; c(:,i)=a*b(i); enddo +end function outer_product_i + +!============================================================================= +function triple_product_s(a,b,c)result(tripleproduct)! [triple_product] +!============================================================================= +implicit none +real(sp),dimension(3),intent(IN ):: a,b,c +real(sp) :: tripleproduct +tripleproduct=dot_product( cross_product(a,b),c ) +end function triple_product_s +!============================================================================= +function triple_product_d(a,b,c)result(tripleproduct)! [triple_product] +!============================================================================= +implicit none +real(dp),dimension(3),intent(IN ):: a,b,c +real(dp) :: tripleproduct +tripleproduct=dot_product( cross_product(a,b),c ) +end function triple_product_d + +!============================================================================= +function det_s(a)result(det)! [det] +!============================================================================= +use pietc_s, only: u0 +implicit none +real(sp),dimension(:,:),intent(IN ) :: a +real(sp) :: det +real(sp),dimension(size(a,1),size(a,1)):: b +integer(spi) :: n,nrank +n=size(a,1) +if(n==3)then + det=triple_product(a(:,1),a(:,2),a(:,3)) +else + call gram(a,b,nrank,det) + if(nranku0 +implicit none +real(sp),dimension(3),intent(IN ):: v1,v2,v3 +real(sp) :: area +!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +real(sp) :: s123,a1,a2,b,d1,d2,d3 +real(sp),dimension(3) :: u0,u1,u2,u3,x,y +!============================================================================= +area=zero +u1=normalized(v1); u2=normalized(v2); u3=normalized(v3) +s123=triple_product(u1,u2,u3) +if(s123==zero)return + +d1=dot_product(u3-u2,u3-u2) +d2=dot_product(u1-u3,u1-u3) +d3=dot_product(u2-u1,u2-u1) + +! Triangle that is not degenerate. Cyclically permute, so side 3 is longest: +if(d3u0 +implicit none +real(dp),dimension(3),intent(IN ):: v1,v2,v3 +real(dp) :: area +!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +real(dp) :: s123,a1,a2,b,d1,d2,d3 +real(dp),dimension(3) :: u0,u1,u2,u3,x,y +!============================================================================= +area=zero +u1=normalized(v1); u2=normalized(v2); u3=normalized(v3) +s123=triple_product(u1,u2,u3) +if(s123==zero)return + +d1=dot_product(u3-u2,u3-u2) +d2=dot_product(u1-u3,u1-u3) +d3=dot_product(u2-u1,u2-u1) + +! Triangle that is not degenerate. Cyclically permute, so side 3 is longest: +if(d3nrank)exit + ab(k:m,k:n)=matmul( transpose(a(:,k:m)),b(:,k:n) ) + ii =maxloc( abs( ab(k:m,k:n)) )+k-1 + val=maxval( abs( ab(k:m,k:n)) ) + if(val<=vcrit)then + nrank=k-1 + exit + endif + i=ii(1) + j=ii(2) + tv=b(:,j) + b(:,j)=-b(:,k) + b(:,k)=tv + tv=a(:,i) + a(:,i)=-a(:,k) + a(:,k)=tv + w(k:n)=matmul( transpose(b(:,k:n)),tv ) + b(:,k)=matmul(b(:,k:n),w(k:n) ) + s=dot_product(b(:,k),b(:,k)) + s=sqrt(s) + if(w(k)nrank)exit + ab(k:m,k:n)=matmul( transpose(a(:,k:m)),b(:,k:n) ) + ii =maxloc( abs( ab(k:m,k:n)) )+k-1 + val=maxval( abs( ab(k:m,k:n)) ) + if(val<=vcrit)then + nrank=k-1 + exit + endif + i=ii(1) + j=ii(2) + tv=b(:,j) + b(:,j)=-b(:,k) + b(:,k)=tv + tv=a(:,i) + a(:,i)=-a(:,k) + a(:,k)=tv + w(k:n)=matmul( transpose(b(:,k:n)),tv ) + b(:,k)=matmul(b(:,k:n),w(k:n) ) + s=dot_product(b(:,k),b(:,k)) + s=sqrt(s) + if(w(k)nrank)exit + ab(k:m,k:n)=matmul( transpose(a(:,k:m)),b(:,k:n) ) + ii =maxloc( abs( ab(k:m,k:n)) )+k-1 + val=maxval( abs( ab(k:m,k:n)) ) + if(val<=vcrit)then + nrank=k-1 + exit + endif + i=ii(1) + j=ii(2) + tv=b(:,j) + b(:,j)=-b(:,k) + b(:,k)=tv + tv=a(:,i) + a(:,i)=-a(:,k) + a(:,k)=tv + w(k:n)=matmul( transpose(b(:,k:n)),tv ) + b(:,k)=matmul(b(:,k:n),w(k:n) ) + s=dot_product(b(:,k),b(:,k)) + s=sqrt(s) + if(w(k)u0)then + ldet=ldet+log(s) + else + detsign=0 + endif + + b(:,k)=b(:,k)/s + do l=k,n + do j=l+1,n + s=dot_product(b(:,l),b(:,j)) + b(:,j)=normalized( b(:,j)-b(:,l)*s ) + enddo + enddo +enddo +end subroutine graml_d + +!============================================================================= +subroutine plaingram_s(b,nrank)! [gram] +!============================================================================= +! A "plain" (unpivoted) version of Gram-Schmidt, for square matrices only. +use pietc_s, only: u0 +implicit none +real(sp),dimension(:,:),intent(INOUT) :: b +integer(spi), intent( OUT) :: nrank +!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +real(sp),parameter :: crit=1.e-5_sp +real(sp) :: val,vcrit +integer(spi) :: j,k,n +!============================================================================= +n=size(b,1); if(n/=size(b,2))stop 'In gram; matrix needs to be square' +val=maxval(abs(b)) +nrank=0 +if(val==0)then + b=u0 + return +endif +vcrit=val*crit +do k=1,n + val=sqrt(dot_product(b(:,k),b(:,k))) + if(val<=vcrit)then + b(:,k:n)=u0 + return + endif + b(:,k)=b(:,k)/val + nrank=k + do j=k+1,n + b(:,j)=b(:,j)-b(:,k)*dot_product(b(:,k),b(:,j)) + enddo +enddo +end subroutine plaingram_s + +!============================================================================= +subroutine plaingram_d(b,nrank)! [gram] +!============================================================================= +! A "plain" (unpivoted) version of Gram-Schmidt, for square matrices only. +use pietc, only: u0 +implicit none +real(dp),dimension(:,:),intent(INOUT):: b +integer(spi), intent( OUT):: nrank +!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +real(dp),parameter:: crit=1.e-9_dp +real(dp) :: val,vcrit +integer(spi) :: j,k,n +!============================================================================= +n=size(b,1); if(n/=size(b,2))stop 'In gram; matrix needs to be square' +val=maxval(abs(b)) +nrank=0 +if(val==u0)then + b=u0 + return +endif +vcrit=val*crit +do k=1,n + val=sqrt(dot_product(b(:,k),b(:,k))) + if(val<=vcrit)then + b(:,k:n)=u0 + return + endif + b(:,k)=b(:,k)/val + nrank=k + do j=k+1,n + b(:,j)=b(:,j)-b(:,k)*dot_product(b(:,k),b(:,j)) + enddo +enddo +end subroutine plaingram_d + +!============================================================================= +subroutine rowgram(m,n,a,ipiv,tt,b,rank)! [gram] +!============================================================================= +! Without changing (tall) rectangular input matrix a, perform pivoted gram- +! Schmidt operations to orthogonalize the rows, until rows that remain become +! negligible. Record the pivoting sequence in ipiv, and the row-normalization +! in tt(j,j) and the row-orthogonalization in tt(i,j), for i>j. Note that +! tt(i,j)=0 for i=n please' +nepss=n*epss +rank=n +aa=a +tt=u0 +do ii=1,n + +! At this stage, all rows less than ii are already orthonormalized and are +! orthogonal to all rows at and beyond ii. Find the norms of these lower +! rows and pivot the largest of them into position ii: + maxp=u0 + maxi=ii + do i=ii,m + p(i)=dot_product(aa(i,:),aa(i,:)) + if(p(i)>maxp)then + maxp=p(i) + maxi=i + endif + enddo + if(maxpu0,one=>u1,two=>u2 +implicit none +real(dp),dimension(3,3),intent(IN ):: rot +real(dp),dimension(0:3),intent(OUT):: q +!------------------------------------------------------------------------------ +real(dp),dimension(3,3) :: t1,t2 +real(dp),dimension(3) :: u1,u2 +real(dp) :: gamma,gammah,s,ss +integer(spi) :: i,j +integer(spi),dimension(1):: ii +!============================================================================== +! construct the orthogonal matrix, t1, whose third row is the rotation axis +! of rot: +t1=rot; do i=1,3; t1(i,i)=t1(i,i)-1; u1(i)=dot_product(t1(i,:),t1(i,:)); enddo +ii=maxloc(u1); j=ii(1); ss=u1(j) +if(ss<1.e-16_dp)then + q=zero; q(0)=one; return +endif +t1(j,:)=t1(j,:)/sqrt(ss) +if(j/=1)then + u2 =t1(1,:) + t1(1,:)=t1(j,:) + t1(j,:)=u2 +endif +do i=2,3 + t1(i,:)=t1(i,:)-dot_product(t1(1,:),t1(i,:))*t1(1,:) + u1(i)=dot_product(t1(i,:),t1(i,:)) +enddo +if(u1(3)>u1(2))then + j=3 +else + j=2 +endif +ss=u1(j) +if(ss==zero)stop 'In rotov; invalid rot' +if(j/=2)t1(2,:)=t1(3,:) +t1(2,:)=t1(2,:)/sqrt(ss) + +! Form t1(3,:) as the cross product of t1(1,:) and t1(2,:) +t1(3,1)=t1(1,2)*t1(2,3)-t1(1,3)*t1(2,2) +t1(3,2)=t1(1,3)*t1(2,1)-t1(1,1)*t1(2,3) +t1(3,3)=t1(1,1)*t1(2,2)-t1(1,2)*t1(2,1) + +! Project rot into the frame whose axes are the rows of t1: +t2=matmul(t1,matmul(rot,transpose(t1))) + +! Obtain the rotation angle, gamma, implied by rot, and gammah=gamma/2: +gamma=atan2(t2(2,1),t2(1,1)); gammah=gamma/two + +! Hence deduce coefficients (in the form of a real 4-vector) of one of the two +! possible equivalent spinors: +s=sin(gammah) +q(0)=cos(gammah) +q(1:3)=t1(3,:)*s +end subroutine rottoq + +!============================================================================== +subroutine qtorot(q,rot)! [qtorot] +!============================================================================== +! Go from quaternion to rotation matrix representations +!============================================================================== +implicit none +real(dp),dimension(0:3),intent(IN ):: q +real(dp),dimension(3,3),intent(OUT):: rot +!============================================================================= +call setem(q(0),q(1),q(2),q(3),rot) +end subroutine qtorot + +!============================================================================= +subroutine axtoq(v,q)! [axtoq] +!============================================================================= +! Go from an axial 3-vector to its equivalent quaternion +!============================================================================= +implicit none +real(dp),dimension(3), intent(in ):: v +real(dp),dimension(0:3),intent(out):: q +!----------------------------------------------------------------------------- +real(dp),dimension(3,3):: rot +!============================================================================= +call axtorot(v,rot) +call rottoq(rot,q) +end subroutine axtoq + +!============================================================================= +subroutine qtoax(q,v)! [qtoax] +!============================================================================= +! Go from quaternion to axial 3-vector +!============================================================================= +implicit none +real(dp),dimension(0:3),intent(in ):: q +real(dp),dimension(3), intent(out):: v +!----------------------------------------------------------------------------- +real(dp),dimension(3,3):: rot +!============================================================================= +call qtorot(q,rot) +call rottoax(rot,v) +end subroutine qtoax + +!============================================================================= +subroutine setem(c,d,e,g,r)! [setem] +!============================================================================= +implicit none +real(dp), intent(IN ):: c,d,e,g +real(dp),dimension(3,3),intent(OUT):: r +!----------------------------------------------------------------------------- +real(dp):: cc,dd,ee,gg,de,dg,eg,dc,ec,gc +!============================================================================= +cc=c*c; dd=d*d; ee=e*e; gg=g*g +de=d*e; dg=d*g; eg=e*g +dc=d*c; ec=e*c; gc=g*c +r(1,1)=cc+dd-ee-gg; r(2,2)=cc-dd+ee-gg; r(3,3)=cc-dd-ee+gg +r(2,3)=2*(eg-dc); r(3,1)=2*(dg-ec); r(1,2)=2*(de-gc) +r(3,2)=2*(eg+dc); r(1,3)=2*(dg+ec); r(2,1)=2*(de+gc) +end subroutine setem + +!============================================================================= +function mulqq(a,b)result(c)! [mulqq] +!============================================================================= +! Multiply quaternions, a*b, assuming operation performed from right to left +!============================================================================= +implicit none +real(dp),dimension(0:3),intent(IN ):: a,b +real(dp),dimension(0:3) :: c +!------------------------------------------- +c(0)=a(0)*b(0) -a(1)*b(1) -a(2)*b(2) -a(3)*b(3) +c(1)=a(0)*b(1) +a(1)*b(0) +a(2)*b(3) -a(3)*b(2) +c(2)=a(0)*b(2) +a(2)*b(0) +a(3)*b(1) -a(1)*b(3) +c(3)=a(0)*b(3) +a(3)*b(0) +a(1)*b(2) -a(2)*b(1) +end function mulqq +!============================================================================= +subroutine expmat(n,a,b,detb)! [expmat] +!============================================================================= +! Evaluate the exponential, b, of a matrix, a, of degree n. +! Apply the iterated squaring method, m times, to the approximation to +! exp(a/(2**m)) obtained as a Taylor expansion of degree L +! See Fung, T. C., 2004, Int. J. Numer. Meth. Engng, 59, 1273--1286. +!============================================================================= +use pietc, only: u0,u1,u2,o2 +implicit none +integer(spi), intent(IN ):: n +real(dp),dimension(n,n),intent(IN ):: a +real(dp),dimension(n,n),intent(OUT):: b +real(dp), intent(OUT):: detb +!----------------------------------------------------------------------------- +integer(spi),parameter :: L=5 +real(dp),dimension(n,n):: c,p +real(dp) :: t +integer(spi) :: i,m +!============================================================================= +m=10+floor(log(u1+maxval(abs(a)))/log(u2)) +t=o2**m +c=a*t +p=c +b=p +do i=2,L + p=matmul(p,c)/i + b=b+p +enddo +do i=1,m + b=b*u2+matmul(b,b) +enddo +do i=1,n + b(i,i)=b(i,i)+u1 +enddo +detb=u0; do i=1,n; detb=detb+a(i,i); enddo; detb=exp(detb) +end subroutine expmat + +!============================================================================= +subroutine expmatd(n,a,b,bd,detb,detbd)! [expmat] +!============================================================================= +! Like expmat, but for the 1st derivatives also. +!============================================================================= +use pietc, only: u0,u1,u2,o2 +implicit none +integer(spi), intent(IN ):: n +real(dp),dimension(n,n), intent(IN ):: a +real(dp),dimension(n,n), intent(OUT):: b +real(dp),dimension(n,n,(n*(n+1))/2),intent(OUT):: bd +real(dp), intent(OUT):: detb +real(dp),dimension((n*(n+1))/2), intent(OUT):: detbd +!----------------------------------------------------------------------------- +integer(spi),parameter :: L=5 +real(dp),dimension(n,n) :: c,p +real(dp),dimension(n,n,(n*(n+1))/2):: pd,cd +real(dp) :: t +integer(spi) :: i,j,k,m,n1 +!============================================================================= +n1=(n*(n+1))*o2 +m=10+floor(log(u1+maxval(abs(a)))/log(u2)) +t=o2**m +c=a*t +p=c +pd=u0 +do k=1,n + pd(k,k,k)=t +enddo +k=n +do i=1,n-1 + do j=i+1,n + k=k+1 + pd(i,j,k)=t + pd(j,i,k)=t + enddo +enddo +if(k/=n1)stop 'In expmatd; n1 is inconsistent with n' +cd=pd +b=p +bd=pd + +do i=2,L + do k=1,n1 + pd(:,:,k)=(matmul(cd(:,:,k),p)+matmul(c,pd(:,:,k)))/i + enddo + p=matmul(c,p)/i + b=b+p + bd=bd+pd +enddo +do i=1,m + do k=1,n1 + bd(:,:,k)=2*bd(:,:,k)+matmul(bd(:,:,k),b)+matmul(b,bd(:,:,k)) + enddo + b=b*u2+matmul(b,b) +enddo +do i=1,n + b(i,i)=b(i,i)+u1 +enddo +detb=u0; do i=1,n; detb=detb+a(i,i); enddo; detb=exp(detb) +detbd=u0; do k=1,n; detbd(k)=detb; enddo +end subroutine expmatd + +!============================================================================= +subroutine expmatdd(n,a,b,bd,bdd,detb,detbd,detbdd)! [expmat] +!============================================================================= +! Like expmat, but for the 1st and 2nd derivatives also. +!============================================================================= +use pietc, only: u0,u1,u2,o2 +implicit none +integer(spi), intent(IN ):: n +real(dp),dimension(n,n), intent(IN ):: a +real(dp),dimension(n,n), intent(OUT):: b +real(dp),dimension(n,n,(n*(n+1))/2), intent(OUT):: bd +real(dp),dimension(n,n,(n*(n+1))/2,(n*(n+1))/2),intent(OUT):: bdd +real(dp), intent(OUT):: detb +real(dp),dimension((n*(n+1))/2), intent(OUT):: detbd +real(dp),dimension((n*(n+1))/2,(n*(n+1))/2), intent(OUT):: detbdd +!----------------------------------------------------------------------------- +integer(spi),parameter :: L=5 +real(dp),dimension(n,n) :: c,p +real(dp),dimension(n,n,(n*(n+1))/2) :: pd,cd +real(dp),dimension(n,n,(n*(n+1))/2,(n*(n+1))/2):: pdd,cdd +real(dp) :: t +integer(spi) :: i,j,k,ki,kj,m,n1 +!============================================================================= +n1=(n*(n+1))/2 +m=10+floor(log(u1+maxval(abs(a)))/log(u2)) +t=o2**m +c=a*t +p=c +pd=u0 +pdd=u0 +do k=1,n + pd(k,k,k)=t +enddo +k=n +do i=1,n-1 + do j=i+1,n + k=k+1 + pd(i,j,k)=t + pd(j,i,k)=t + enddo +enddo +if(k/=n1)stop 'In expmatd; n1 is inconsistent with n' +cd=pd +cdd=u0 +b=p +bd=pd +bdd=u0 + +do i=2,L + do ki=1,n1 + do kj=1,n1 + pdd(:,:,ki,kj)=(matmul(cd(:,:,ki),pd(:,:,kj)) & + + matmul(cd(:,:,kj),pd(:,:,ki)) & + + matmul(c,pdd(:,:,ki,kj)))/i + enddo + enddo + do k=1,n1 + pd(:,:,k)=(matmul(cd(:,:,k),p)+matmul(c,pd(:,:,k)))/i + enddo + p=matmul(c,p)/i + b=b+p + bd=bd+pd + bdd=bdd+pdd +enddo +do i=1,m + do ki=1,n1 + do kj=1,n1 + bdd(:,:,ki,kj)=u2*bdd(:,:,ki,kj) & + +matmul(bdd(:,:,ki,kj),b) & + +matmul(bd(:,:,ki),bd(:,:,kj)) & + +matmul(bd(:,:,kj),bd(:,:,ki)) & + +matmul(b,bdd(:,:,ki,kj)) + enddo + enddo + do k=1,n1 + bd(:,:,k)=2*bd(:,:,k)+matmul(bd(:,:,k),b)+matmul(b,bd(:,:,k)) + enddo + b=b*u2+matmul(b,b) +enddo +do i=1,n + b(i,i)=b(i,i)+u1 +enddo +detb=u0; do i=1,n; detb=detb+a(i,i); enddo; detb=exp(detb) +detbd=u0; do k=1,n; detbd(k)=detb; enddo +detbdd=u0; do ki=1,n; do kj=1,n; detbdd(ki,kj)=detb; enddo; enddo +end subroutine expmatdd + +!============================================================================= +subroutine zntay(n,z,zn)! [zntay] +!============================================================================= +use pietc, only: u2 +implicit none +integer(spi), intent(IN ):: n +real(dp), intent(IN ):: z +real(dp), intent(OUT):: zn +!----------------------------------------------------------------------------- +integer(spi),parameter:: ni=100 +real(dp),parameter :: eps0=1.e-16_dp +integer(spi) :: i,i2,n2 +real(dp) :: t,eps,z2 +!============================================================================= +z2=z*u2 +n2=n*2 +t=1 +do i=1,n + t=t/(i*2-1) +enddo +eps=t*eps0 +zn=t +t=t +do i=1,ni + i2=i*2 + t=t*z2/(i2*(i2+n2-1)) + zn=zn+t + if(abs(t)u0)then + zn=cosh(rz2) + znd=sinh(rz2)/rz2 + zndd=(zn-znd)/z2 + znddd=(znd-u3*zndd)/z2 + do i=1,n + i2p3=i*2+3 + zn=znd + znd=zndd + zndd=znddd + znddd=(znd-i2p3*zndd)/z2 + enddo + else + zn=cos(rz2) + znd=sin(rz2)/rz2 + zndd=-(zn-znd)/z2 + znddd=-(znd-u3*zndd)/z2 + do i=1,n + i2p3=i*2+3 + zn=znd + znd=zndd + zndd=znddd + znddd=-(znd-i2p3*zndd)/z2 + enddo + endif +endif +end subroutine znfun + +!============================================================================= +! Utility code for various Mobius transformations. If aa1,bb1,cc1,dd1 are +! the coefficients for one transformation, and aa2,bb2,cc2,dd2 are the +! coefficients for a second one, then the coefficients for the mapping +! of a test point, zz, by aa1 etc to zw, followed by a mapping of zw, by +! aa2 etc to zv, is equivalent to a single mapping zz-->zv by the transformatn +! with coefficients aa3,bb3,cc3,dd3, such that, as 2*2 complex matrices: +! +! [ aa3, bb3 ] [ aa2, bb2 ] [ aa1, bb1 ] +! [ ] = [ ] * [ ] +! [ cc3, dd3 ] [ cc2, dd2 ] [ cc1, dd1 ] . +! +! Note that the determinant of these matrices is always +1 +! +!============================================================================= +subroutine ctoz(v, z,infz)! [ctoz] +!============================================================================= +use pietc, only: u0,u1 +implicit none +real(dp),dimension(3),intent(IN ):: v +complex(dpc), intent(OUT):: z +logical, intent(OUT):: infz +!----------------------------------------------------------------------------- +real(dp) :: rr,zzpi +!============================================================================= +infz=.false. +z=cmplx(v(1),v(2),dpc) +if(v(3)>u0)then + zzpi=u1/(u1+v(3)) +else + rr=v(1)**2+v(2)**2 + infz=(rr==u0); if(infz)return ! <- The point is mapped to infinity (90S) + zzpi=(u1-v(3))/rr +endif +z=z*zzpi +end subroutine ctoz + +!============================================================================= +subroutine ztoc(z,infz, v)! [ztoc] +!============================================================================= +implicit none +complex(dpc), intent(IN ):: z +logical, intent(IN ):: infz +real(dp),dimension(3),intent(OUT):: v +!----------------------------------------------------------------------------- +real(dp),parameter:: zero=0_dp,one=1_dp,two=2_dp +real(dp) :: r,q,rs,rsc,rsbi +!============================================================================= +if(infz)then; v=(/zero,zero,-one/); return; endif +r=real(z); q=aimag(z); rs=r*r+q*q +rsc=one-rs +rsbi=one/(one+rs) +v(1)=two*rsbi*r +v(2)=two*rsbi*q +v(3)=rsc*rsbi +end subroutine ztoc + +!============================================================================= +subroutine ztocd(z,infz, v,vd)! [ztoc] +!============================================================================= +! The convention adopted for the complex derivative is that, for a complex +! infinitesimal map displacement, delta_z, the corresponding infinitesimal +! change of cartesian vector position is delta_v given by: +! delta_v = Real(vd*delta_z). +! Thus, by a kind of Cauchy-Riemann relation, Imag(vd)=v CROSS Real(vd). +! THE DERIVATIVE FOR THE IDEAL POINT AT INFINITY HAS NOT BEEN CODED YET!!! +!============================================================================= +implicit none +complex(dpc), intent(IN ):: z +logical, intent(IN ):: infz +real(dp),dimension(3), intent(OUT):: v +complex(dpc),dimension(3),intent(OUT):: vd +!----------------------------------------------------------------------------- +real(dp),parameter :: zero=0_dp,one=1_dp,two=2_dp,four=4_dp +real(dp) :: r,q,rs,rsc,rsbi,rsbis +real(dp),dimension(3):: u1,u2 +integer(spi) :: i +!============================================================================= +if(infz)then; v=(/zero,zero,-one/); return; endif +r=real(z); q=aimag(z); rs=r*r+q*q +rsc=one-rs +rsbi=one/(one+rs) +rsbis=rsbi**2 +v(1)=two*rsbi*r +v(2)=two*rsbi*q +v(3)=rsc*rsbi +u1(1)=two*(one+q*q-r*r)*rsbis +u1(2)=-four*r*q*rsbis +u1(3)=-four*r*rsbis +u2=cross_product(v,u1) +do i=1,3 + vd(i)=cmplx(u1(i),-u2(i),dpc) +enddo +end subroutine ztocd + +!============================================================================ +subroutine setmobius(xc0,xc1,xc2, aa,bb,cc,dd)! [setmobius] +!============================================================================ +! Find the Mobius transformation complex coefficients, aa,bb,cc,dd, +! with aa*dd-bb*cc=1, for a standard (north-)polar stereographic transformation +! that takes cartesian point, xc0 to the north pole, xc1 to (lat=0,lon=0), +! xc2 to the south pole (=complex infinity). +!============================================================================ +implicit none +real(dp),dimension(3),intent(IN ):: xc0,xc1,xc2 +complex(dpc), intent(OUT):: aa,bb,cc,dd +!---------------------------------------------------------------------------- +real(dp),parameter:: zero=0_dp,one=1_dp +logical :: infz0,infz1,infz2 +complex(dpc) :: z0,z1,z2,z02,z10,z21 +!============================================================================ +call ctoz(xc0,z0,infz0) +call ctoz(xc1,z1,infz1) +call ctoz(xc2,z2,infz2) +z21=z2-z1 +z02=z0-z2 +z10=z1-z0 + +if( (z0==z1.and.infz0.eqv.infz1).or.& + (z1==z2.and.infz1.eqv.infz2).or.& + (z2==z0.and.infz2.eqv.infz0)) & + stop 'In setmobius; anchor points must be distinct' + +if(infz2 .or. (.not.infz0 .and. abs(z0) XE three cartesian components. +! <-- RLAT radians latitude +! <-- RLON radians longitude +!============================================================================= +use pietc_s, only: u0 +implicit none +real(sp),dimension(3),intent(IN ):: xe +real(sp), intent(OUT):: rlat,rlon +!----------------------------------------------------------------------------- +real(sp) :: r +!============================================================================= +r=sqrt(xe(1)**2+xe(2)**2) +rlat=atan2(xe(3),r) +if(r==u0)then + rlon=u0 +else + rlon=atan2(xe(2),xe(1)) +endif +end subroutine sctogr +!============================================================================= +subroutine dctogr(xe,rlat,rlon)! [ctogr] +!============================================================================= +use pietc, only: u0 +implicit none +real(dp),dimension(3),intent(IN ):: xe +real(dp), intent(OUT):: rlat,rlon +!----------------------------------------------------------------------------- +real(dp) :: r +!============================================================================= +r=sqrt(xe(1)**2+xe(2)**2) +rlat=atan2(xe(3),r) +if(r==u0)then + rlon=u0 +else + rlon=atan2(xe(2),xe(1)) +endif +end subroutine dctogr + +!============================================================================= +subroutine sgrtoc(rlat,rlon,xe)! [grtoc] +!============================================================================= +implicit none +real(sp), intent(IN ):: rlat,rlon +real(sp),dimension(3),intent(OUT):: xe +!----------------------------------------------------------------------------- +real(sp) :: sla,cla,slo,clo +!============================================================================= +sla=sin(rlat); cla=cos(rlat) +slo=sin(rlon); clo=cos(rlon) +xe(1)=cla*clo; xe(2)=cla*slo; xe(3)=sla +end subroutine sgrtoc +!============================================================================= +subroutine dgrtoc(rlat,rlon,xe)! [grtoc] +!============================================================================= +implicit none +real(dp), intent(IN ):: rlat,rlon +real(dp),dimension(3),intent(OUT):: xe +!----------------------------------------------------------------------------- +real(dp) :: sla,cla,slo,clo +!============================================================================= +sla=sin(rlat); cla=cos(rlat) +slo=sin(rlon); clo=cos(rlon) +xe(1)=cla*clo; xe(2)=cla*slo; xe(3)=sla +end subroutine dgrtoc +!============================================================================= +subroutine sgrtocd(rlat,rlon,xe,dxedlat,dxedlon)! [grtoc] +!============================================================================= +implicit none +real(sp), intent(IN ):: rlat,rlon +real(sp),dimension(3),intent(OUT):: xe,dxedlat,dxedlon +!----------------------------------------------------------------------------- +real(dp) :: rlat_d,rlon_d +real(dp),dimension(3):: xe_d,dxedlat_d,dxedlon_d +!============================================================================= +rlat_d=rlat; rlon_d=rlon +call dgrtocd(rlat_d,rlon_d,xe_d,dxedlat_d,dxedlon_d) +xe =xe_d +dxedlat=dxedlat_d +dxedlon=dxedlon_d +end subroutine sgrtocd +!============================================================================= +subroutine dgrtocd(rlat,rlon,xe,dxedlat,dxedlon)! [grtoc] +!============================================================================= +use pietc, only: u0 +implicit none +real(dp), intent(IN ):: rlat,rlon +real(dp),dimension(3),intent(OUT):: xe,dxedlat,dxedlon +!----------------------------------------------------------------------------- +real(dp) :: sla,cla,slo,clo +!============================================================================= +sla=sin(rlat); cla=cos(rlat) +slo=sin(rlon); clo=cos(rlon) +xe(1)=cla*clo; xe(2)=cla*slo; xe(3)=sla +dxedlat(1)=-sla*clo; dxedlat(2)=-sla*slo; dxedlat(3)=cla +dxedlon(1)=-cla*slo; dxedlon(2)= cla*clo; dxedlon(3)=u0 +end subroutine dgrtocd +!============================================================================= +subroutine sgrtocdd(rlat,rlon,xe,dxedlat,dxedlon, &! [grtoc] + ddxedlatdlat,ddxedlatdlon,ddxedlondlon) +!============================================================================= +implicit none +real(sp), intent(IN ):: rlat,rlon +real(sp),dimension(3),intent(OUT):: xe,dxedlat,dxedlon, & + ddxedlatdlat,ddxedlatdlon,ddxedlondlon +!----------------------------------------------------------------------------- +real(dp) :: rlat_d,rlon_d +real(dp),dimension(3):: xe_d,dxedlat_d,dxedlon_d, & + ddxedlatdlat_d,ddxedlatdlon_d,ddxedlondlon_d +!============================================================================= +rlat_d=rlat; rlon_d=rlon +call dgtocdd(rlat_d,rlon_d,xe_d,dxedlat_d,dxedlon_d, & + ddxedlatdlat_d,ddxedlatdlon_d,ddxedlondlon_d) +xe =xe_d +dxedlat =dxedlat_d +dxedlon =dxedlon_d +ddxedlatdlat=ddxedlatdlat_d +ddxedlatdlon=ddxedlatdlon_d +ddxedlondlon=ddxedlondlon_d +end subroutine sgrtocdd +!============================================================================= +subroutine dgrtocdd(rlat,rlon,xe,dxedlat,dxedlon, &! [grtoc] + ddxedlatdlat,ddxedlatdlon,ddxedlondlon) +!============================================================================= +use pietc, only: u0 +implicit none +real(dp), intent(IN ):: rlat,rlon +real(dp),dimension(3),intent(OUT):: xe,dxedlat,dxedlon, & + ddxedlatdlat,ddxedlatdlon,ddxedlondlon +!----------------------------------------------------------------------------- +real(dp) :: sla,cla,slo,clo +!============================================================================= +sla=sin(rlat); cla=cos(rlat) +slo=sin(rlon); clo=cos(rlon) +xe(1)=cla*clo; xe(2)=cla*slo; xe(3)=sla +dxedlat(1)=-sla*clo; dxedlat(2)=-sla*slo; dxedlat(3)=cla +dxedlon(1)=-cla*slo; dxedlon(2)= cla*clo; dxedlon(3)=u0 +ddxedlatdlat(1)=-cla*clo +ddxedlatdlat(2)=-cla*slo +ddxedlatdlat(3)=-sla +ddxedlatdlon(1)= sla*slo +ddxedlatdlon(2)=-sla*clo +ddxedlatdlon(3)= u0 +ddxedlondlon(1)=-cla*clo +ddxedlondlon(2)=-cla*slo +ddxedlondlon(3)= u0 +end subroutine dgrtocdd + +!============================================================================= +subroutine sctog(xe,dlat,dlon)! [ctog] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1994 +! SUBROUTINE CTOG +! Transform "Cartesian" to "Geographical" coordinates, where the +! geographical coordinates refer to latitude and longitude (degrees) +! and cartesian coordinates are standard earth-centered cartesian +! coordinates: xe(3) pointing north, xe(1) pointing to the 0-meridian. +! --> XE three cartesian components. +! <-- DLAT degrees latitude +! <-- DLON degrees longitude +!============================================================================= +use pietc_s, only: u0,rtod +implicit none +real(sp),dimension(3),intent(IN ):: xe +real(sp), intent(OUT):: dlat,dlon +!----------------------------------------------------------------------------- +real(sp) :: r +!============================================================================= +r=sqrt(xe(1)**2+xe(2)**2) +dlat=atan2(xe(3),r)*rtod +if(r==u0)then + dlon=u0 +else + dlon=atan2(xe(2),xe(1))*rtod +endif +end subroutine sctog + +!============================================================================= +subroutine dctog(xe,dlat,dlon)! [ctog] +!============================================================================= +use pietc, only: u0,rtod +implicit none +real(dp),dimension(3),intent(IN ):: xe +real(dp), intent(OUT):: dlat,dlon +!----------------------------------------------------------------------------- +real(dp) :: r +!============================================================================= +r=sqrt(xe(1)**2+xe(2)**2) +dlat=atan2(xe(3),r)*rtod +if(r==u0)then + dlon=u0 +else + dlon=atan2(xe(2),xe(1))*rtod +endif +end subroutine dctog + +!============================================================================= +subroutine sgtoc(dlat,dlon,xe)! [gtoc] +!============================================================================= +! R.J.Purser, National Meteorological Center, Washington D.C. 1994 +! SUBROUTINE GTOC +! Transform "Geographical" to "Cartesian" coordinates, where the +! geographical coordinates refer to latitude and longitude (degrees) +! and cartesian coordinates are standard earth-centered cartesian +! coordinates: xe(3) pointing north, xe(1) pointing to the 0-meridian. +! --> DLAT degrees latitude +! --> DLON degrees longitude +! <-- XE three cartesian components. +!============================================================================= +use pietc_s, only: dtor +implicit none +real(sp), intent(IN ):: dlat,dlon +real(sp),dimension(3),intent(OUT):: xe +!----------------------------------------------------------------------------- +real(sp) :: rlat,rlon,sla,cla,slo,clo +!============================================================================= +rlat=dtor*dlat; rlon=dtor*dlon +sla=sin(rlat); cla=cos(rlat) +slo=sin(rlon); clo=cos(rlon) +xe(1)=cla*clo; xe(2)=cla*slo; xe(3)=sla +end subroutine sgtoc +!============================================================================= +subroutine dgtoc(dlat,dlon,xe)! [gtoc] +!============================================================================= +use pietc, only: dtor +implicit none +real(dp), intent(IN ):: dlat,dlon +real(dp),dimension(3),intent(OUT):: xe +!----------------------------------------------------------------------------- +real(dp) :: rlat,rlon,sla,cla,slo,clo +!============================================================================= +rlat=dtor*dlat; rlon=dtor*dlon +sla=sin(rlat); cla=cos(rlat) +slo=sin(rlon); clo=cos(rlon) +xe(1)=cla*clo; xe(2)=cla*slo; xe(3)=sla +end subroutine dgtoc +!============================================================================= +subroutine sgtocd(dlat,dlon,xe,dxedlat,dxedlon)! [gtoc] +!============================================================================= +implicit none +real(sp), intent(IN ):: dlat,dlon +real(sp),dimension(3),intent(OUT):: xe,dxedlat,dxedlon +!----------------------------------------------------------------------------- +real(dp) :: dlat_d,dlon_d +real(dp),dimension(3):: xe_d,dxedlat_d,dxedlon_d +!============================================================================= +dlat_d=dlat; dlon_d=dlon +call dgtocd(dlat_d,dlon_d,xe_d,dxedlat_d,dxedlon_d) +xe =xe_d +dxedlat=dxedlat_d +dxedlon=dxedlon_d +end subroutine sgtocd +!============================================================================= +subroutine dgtocd(dlat,dlon,xe,dxedlat,dxedlon)! [gtoc] +!============================================================================= +use pietc, only: u0,dtor +implicit none +real(dp), intent(IN ):: dlat,dlon +real(dp),dimension(3),intent(OUT):: xe,dxedlat,dxedlon +!----------------------------------------------------------------------------- +real(dp) :: rlat,rlon,sla,cla,slo,clo +!============================================================================= +rlat=dtor*dlat; rlon=dtor*dlon +sla=sin(rlat); cla=cos(rlat) +slo=sin(rlon); clo=cos(rlon) +xe(1)=cla*clo; xe(2)=cla*slo; xe(3)=sla +dxedlat(1)=-sla*clo; dxedlat(2)=-sla*slo; dxedlat(3)=cla; dxedlat=dxedlat*dtor +dxedlon(1)=-cla*slo; dxedlon(2)= cla*clo; dxedlon(3)=u0 ; dxedlon=dxedlon*dtor +end subroutine dgtocd +!============================================================================= +subroutine sgtocdd(dlat,dlon,xe,dxedlat,dxedlon, & + ddxedlatdlat,ddxedlatdlon,ddxedlondlon)! [gtoc] +!============================================================================= +implicit none +real(sp), intent(IN ):: dlat,dlon +real(sp),dimension(3),intent(OUT):: xe,dxedlat,dxedlon, & + ddxedlatdlat,ddxedlatdlon,ddxedlondlon +!----------------------------------------------------------------------------- +real(dp) :: dlat_d,dlon_d +real(dp),dimension(3):: xe_d,dxedlat_d,dxedlon_d, & + ddxedlatdlat_d,ddxedlatdlon_d,ddxedlondlon_d +!============================================================================= +dlat_d=dlat; dlon_d=dlon +call dgtocdd(dlat_d,dlon_d,xe_d,dxedlat_d,dxedlon_d, & + ddxedlatdlat_d,ddxedlatdlon_d,ddxedlondlon_d) +xe =xe_d +dxedlat =dxedlat_d +dxedlon =dxedlon_d +ddxedlatdlat=ddxedlatdlat_d +ddxedlatdlon=ddxedlatdlon_d +ddxedlondlon=ddxedlondlon_d +end subroutine sgtocdd +!============================================================================= +subroutine dgtocdd(dlat,dlon,xe,dxedlat,dxedlon, & + ddxedlatdlat,ddxedlatdlon,ddxedlondlon)! [gtoc] +!============================================================================= +use pietc, only: u0,dtor +implicit none +real(dp), intent(IN ):: dlat,dlon +real(dp),dimension(3),intent(OUT):: xe,dxedlat,dxedlon, & + ddxedlatdlat,ddxedlatdlon,ddxedlondlon +!----------------------------------------------------------------------------- +real(dp) :: rlat,rlon,sla,cla,slo,clo +!============================================================================= +rlat=dtor*dlat; rlon=dtor*dlon +sla=sin(rlat); cla=cos(rlat) +slo=sin(rlon); clo=cos(rlon) +xe(1)=cla*clo; xe(2)=cla*slo; xe(3)=sla +dxedlat(1)=-sla*clo; dxedlat(2)=-sla*slo; dxedlat(3)=cla; dxedlat=dxedlat*dtor +dxedlon(1)=-cla*slo; dxedlon(2)= cla*clo; dxedlon(3)=u0 ; dxedlon=dxedlon*dtor +ddxedlatdlat(1)=-cla*clo +ddxedlatdlat(2)=-cla*slo +ddxedlatdlat(3)=-sla +ddxedlatdlon(1)= sla*slo +ddxedlatdlon(2)=-sla*clo +ddxedlatdlon(3)= u0 +ddxedlondlon(1)=-cla*clo +ddxedlondlon(2)=-cla*slo +ddxedlondlon(3)= u0 +ddxedlatdlat=ddxedlatdlat*dtor**2 +ddxedlatdlon=ddxedlatdlon*dtor**2 +ddxedlondlon=ddxedlondlon*dtor**2 +end subroutine dgtocdd + +!============================================================================== +subroutine sgtoframem(splat,splon,sorth)! [gtoframe] +!============================================================================== +implicit none +real(sp), intent(in ):: splat,splon +real(sp),dimension(3,3),intent(out):: sorth +!------------------------------------------------------------------------------ +real(dp):: plat,plon +real(dp),dimension(3,3):: orth +!============================================================================== +plat=splat; plon=splon; call gtoframem(plat,plon,orth); sorth=orth +end subroutine sgtoframem +!============================================================================== +subroutine gtoframem(plat,plon,orth)! [gtoframe] +!============================================================================== +! From the degree lat and lo (plat and plon) return the standard orthogonal +! 3D frame at this location as an orthonormal matrix, orth. +!============================================================================== +implicit none +real(dp), intent(in ):: plat,plon +real(dp),dimension(3,3),intent(out):: orth +!------------------------------------------------------------------------------ +real(dp),dimension(3):: xp,yp,zp +!============================================================================== +call gtoframev(plat,plon, xp,yp,zp) +orth(:,1)=xp; orth(:,2)=yp; orth(:,3)=zp +end subroutine gtoframem +!============================================================================== +subroutine sgtoframev(splat,splon,sxp,syp,szp)! [gtoframe] +!============================================================================== +implicit none +real(sp), intent(in ):: splat,splon +real(sp),dimension(3),intent(out):: sxp,syp,szp +!------------------------------------------------------------------------------ +real(dp) :: plat,plon +real(dp),dimension(3):: xp,yp,zp +!============================================================================== +plat=splat; plon=splon +call gtoframev(plat,plon, xp,yp,zp) +sxp=xp; syp=yp; szp=zp +end subroutine sgtoframev +!============================================================================== +subroutine gtoframev(plat,plon, xp,yp,zp)! [gtoframe] +!============================================================================== +! Given a geographical point by its degrees lat and lon, plat and plon, +! return its standard orthogonal cartesian frame, {xp,yp,zp} in earth-centered +! coordinates. +!============================================================================= +use pietc, only: u0,u1 +implicit none +real(dp), intent(in ):: plat,plon +real(dp),dimension(3),intent(out):: xp,yp,zp +!------------------------------------------------------------------------------ +real(dp),dimension(3):: dzpdlat,dzpdlon +!============================================================================== +if(plat==90)then ! is this the north pole? + xp=(/ u0,u1, u0/) ! Assume the limiting case lat-->90 along the 0-meridian + yp=(/-u1,u0, u0/) ! + zp=(/ u0,u0, u1/) +elseif(plat==-90)then + xp=(/ u0,u1, u0/) ! Assume the limiting case lat-->90 along the 0-meridian + yp=(/ u1,u0, u0/) ! + zp=(/ u0,u0,-u1/) +else + call gtoc(plat,plon,zp,dzpdlat,dzpdlon) + xp=dzpdlon/sqrt(dot_product(dzpdlon,dzpdlon)) + yp=dzpdlat/sqrt(dot_product(dzpdlat,dzpdlat)) +endif +end subroutine gtoframev + +!============================================================================== +subroutine sparaframe(sxp,syp,szp, sxv,syv,szv)! [paraframe] +!============================================================================== +implicit none +real(sp),dimension(3),intent(in ):: sxp,syp,szp, szv +real(sp),dimension(3),intent(out):: sxv,syv +!----------------------------------------------------------------------------- +real(dp),dimension(3):: xp,yp,zp, xv,yv,zv +!============================================================================= +xp=sxp; yp=syp; zp=szp +call paraframe(xp,yp,zp, xv,yv,zv) +sxv=xv; syv=yv +end subroutine sparaframe +!============================================================================== +subroutine paraframe(xp,yp,zp, xv,yv,zv)! [paraframe] +!============================================================================== +! Take a principal reference orthonormal frame, {xp,yp,zp} and a dependent +! point defined by unit vector, zv, and complete the V-frame cartesian +! components, {xv,yv}, that are the result of parallel-transport of {xp,yp} +! along the geodesic between P and V +!============================================================================== +use pmat4, only: cross_product,normalized +implicit none +real(dp),dimension(3),intent(in ):: xp,yp,zp, zv +real(dp),dimension(3),intent(out):: xv,yv +!------------------------------------------------------------------------------ +real(dp) :: xpofv,ypofv,theta,ctheta,stheta +real(dp),dimension(3):: xq,yq +!============================================================================== +xpofv=dot_product(xp,zv) +ypofv=dot_product(yp,zv) +theta=atan2(ypofv,xpofv); ctheta=cos(theta); stheta=sin(theta) +xq=zv-zp; xq=xq-zv*dot_product(xq,zv); xq=normalized(xq) +yq=cross_product(zv,xq) +xv=xq*ctheta-yq*stheta +yv=xq*stheta+yq*ctheta +end subroutine paraframe + +!============================================================================== +subroutine sframetwist(sxp,syp,szp, sxv,syv,szv, stwist)! [frametwist] +!============================================================================== +implicit none +real(sp),dimension(3),intent(in ):: sxp,syp,szp, sxv,syv,szv +real(sp), intent(out):: stwist +!------------------------------------------------------------------------------ +real(dp),dimension(3):: xp,yp,zp, xv,yv,zv +real(dp) :: twist +!============================================================================== +xp=sxp;yp=syp; zp=szp; xv=sxv; yv=syv; zv=szv +call frametwist(xp,yp,zp, xv,yv,zv, twist) +stwist=twist +end subroutine sframetwist +!============================================================================== +subroutine frametwist(xp,yp,zp, xv,yv,zv, twist)! [frametwist] +!============================================================================== +! Given a principal cartesian orthonormal frame, {xp,yp,zp} (i.e., at P with +! Earth-centered cartesians, zp), and another similar frame {xv,yv,zv} at V +! with Earth-centered cartesians zv, find the relative rotation angle, "twist" +! by which the frame at V is rotated in the counterclockwise sense relative +! to the parallel-transportation of P's frame to V. +! Note that, by symmetry, transposing P and V leads to the opposite twist. +!============================================================================== +implicit none +real(dp),dimension(3),intent(in ):: xp,yp,zp, xv,yv,zv +real(dp), intent(out):: twist +!------------------------------------------------------------------------------ +real(dp),dimension(3):: xxv,yyv +real(dp) :: c,s +!============================================================================== +call paraframe(xp,yp,zp, xxv,yyv,zv) +c=dot_product(xv,xxv); s=dot_product(xv,yyv) +twist=atan2(s,c) +end subroutine frametwist + +!============================================================================= +subroutine sctoc(s,xc1,xc2)! [ctoc_schm] +!============================================================================= +! Evaluate schmidt transformation, xc1 --> xc2, with scaling parameter s +!============================================================================= +use pietc_s, only: u1,u2 +implicit none +real(sp), intent(IN ):: s +real(sp),dimension(3),intent(INOUT):: xc1,xc2 +!----------------------------------------------------------------------------- +real(sp) :: x,y,z,a,b,d,e,ab2,aa,bb,di,aapbb,aambb +!============================================================================= +x=xc1(1); y=xc1(2); z=xc1(3) +a=s+u1 +b=s-u1 +ab2=a*b*u2 +aa=a*a +bb=b*b +aapbb=aa+bb +aambb=aa-bb +d=aapbb-ab2*z +e=aapbb*z-ab2 +di=u1/d +xc2(1)=(aambb*x)*di +xc2(2)=(aambb*y)*di +xc2(3)=e*di +end subroutine sctoc + +!============================================================================= +subroutine sctocd(s,xc1,xc2,dxc2)! [ctoc_schm] +!============================================================================= +! Evaluate schmidt transformation, xc1 --> xc2, with scaling parameter s, +! and its jacobian, dxc2. +!============================================================================= +use pietc_s, only: u0,u1,u2 +implicit none +real(sp),intent(IN) :: s +real(sp),dimension(3), intent(INOUT):: xc1,xc2 +real(sp),dimension(3,3),intent( OUT):: dxc2 +!----------------------------------------------------------------------------- +real(sp) :: x,y,z,a,b,d,e, & + ab2,aa,bb,di,ddi,aapbb,aambb +!============================================================================= +x=xc1(1); y=xc1(2); z=xc1(3) +a=s+u1 +b=s-u1 +ab2=a*b*u2 +aa=a*a +bb=b*b +aapbb=aa+bb +aambb=aa-bb +d=aapbb-ab2*z +e=aapbb*z-ab2 +di=u1/d +xc2(1)=(aambb*x)*di +xc2(2)=(aambb*y)*di +xc2(3)=e*di +ddi=di*di + +dxc2=u0 +dxc2(1,1)=aambb*di +dxc2(1,3)=ab2*aambb*x*ddi +dxc2(2,2)=aambb*di +dxc2(2,3)=ab2*aambb*y*ddi +dxc2(3,3)=aapbb*di +ab2*e*ddi +end subroutine sctocd + +!============================================================================= +subroutine sctocdd(s,xc1,xc2,dxc2,ddxc2)! [ctoc_schm] +!============================================================================= +! Evaluate schmidt transformation, xc1 --> xc2, with scaling parameter s, +! its jacobian, dxc2, and its 2nd derivative, ddxc2. +!============================================================================= +use pietc_s, only: u0,u1,u2 +implicit none +real(sp), intent(IN ):: s +real(sp),dimension(3), intent(INOUT):: xc1,xc2 +real(sp),dimension(3,3), intent( OUT):: dxc2 +real(sp),dimension(3,3,3),intent( OUT):: ddxc2 +!----------------------------------------------------------------------------- +real(sp) :: x,y,z,a,b,d,e, & + ab2,aa,bb,di,ddi,dddi, & + aapbb,aambb +!============================================================================= +x=xc1(1); y=xc1(2); z=xc1(3) +a=s+u1 +b=s-u1 +ab2=a*b*u2 +aa=a*a +bb=b*b +aapbb=aa+bb +aambb=aa-bb +d=aapbb-ab2*z +e=aapbb*z-ab2 +di=u1/d +xc2(1)=(aambb*x)*di +xc2(2)=(aambb*y)*di +xc2(3)=e*di +ddi=di*di +dddi=ddi*di + +dxc2=u0 +dxc2(1,1)=aambb*di +dxc2(1,3)=ab2*aambb*x*ddi +dxc2(2,2)=aambb*di +dxc2(2,3)=ab2*aambb*y*ddi +dxc2(3,3)=aapbb*di +ab2*e*ddi + +ddxc2=u0 +ddxc2(1,1,3)=ab2*aambb*ddi +ddxc2(1,3,1)=ddxc2(1,1,3) +ddxc2(1,3,3)=u2*ab2**2*aambb*x*dddi +ddxc2(2,2,3)=ab2*aambb*ddi +ddxc2(2,3,2)=ddxc2(2,2,3) +ddxc2(2,3,3)=u2*ab2**2*aambb*y*dddi +ddxc2(3,3,3)=u2*ab2*(aapbb*ddi+ab2*e*dddi) +end subroutine sctocdd + +!============================================================================= +subroutine dctoc(s,xc1,xc2)! [ctoc_schm] +!============================================================================= +! Evaluate schmidt transformation, xc1 --> xc2, with scaling parameter s +!============================================================================= +use pietc, only: u1,u2 +implicit none +real(dp), intent(IN ):: s +real(dp),dimension(3),intent(INOUT):: xc1,xc2 +!----------------------------------------------------------------------------- +real(dp) :: x,y,z,a,b,d,e, & + ab2,aa,bb,di,aapbb,aambb +!============================================================================= +x=xc1(1); y=xc1(2); z=xc1(3) +a=s+u1 +b=s-u1 +ab2=a*b*u2 +aa=a*a +bb=b*b +aapbb=aa+bb +aambb=aa-bb +d=aapbb-ab2*z +e=aapbb*z-ab2 +di=u1/d +xc2(1)=(aambb*x)*di +xc2(2)=(aambb*y)*di +xc2(3)=e*di +end subroutine dctoc + +!============================================================================= +subroutine dctocd(s,xc1,xc2,dxc2)! [ctoc_schm] +!============================================================================= +! Evaluate schmidt transformation, xc1 --> xc2, with scaling parameter s, +! and its jacobian, dxc2. +!============================================================================= +use pietc, only: u0,u1,u2 +implicit none +real(dp), intent(IN ):: s +real(dp),dimension(3), intent(INOUT):: xc1,xc2 +real(dp),dimension(3,3),intent( OUT):: dxc2 +!----------------------------------------------------------------------------- +real(dp) :: x,y,z,a,b,d,e, & + ab2,aa,bb,di,ddi,aapbb,aambb +!============================================================================= +x=xc1(1); y=xc1(2); z=xc1(3) +a=s+u1 +b=s-u1 +ab2=a*b*u2 +aa=a*a +bb=b*b +aapbb=aa+bb +aambb=aa-bb +d=aapbb-ab2*z +e=aapbb*z-ab2 +di=u1/d +xc2(1)=(aambb*x)*di +xc2(2)=(aambb*y)*di +xc2(3)=e*di +ddi=di*di + +dxc2=u0 +dxc2(1,1)=aambb*di +dxc2(1,3)=ab2*aambb*x*ddi +dxc2(2,2)=aambb*di +dxc2(2,3)=ab2*aambb*y*ddi +dxc2(3,3)=aapbb*di +ab2*e*ddi +end subroutine dctocd + +!============================================================================= +subroutine dctocdd(s,xc1,xc2,dxc2,ddxc2)! [ctoc_schm] +!============================================================================= +! Evaluate schmidt transformation, xc1 --> xc2, with scaling parameter s, +! its jacobian, dxc2, and its 2nd derivative, ddxc2. +!============================================================================= +use pietc, only: u0,u1,u2 +implicit none +real(dp),intent(IN) :: s +real(dp),dimension(3), intent(INOUT):: xc1,xc2 +real(dp),dimension(3,3), intent(OUT ):: dxc2 +real(dp),dimension(3,3,3),intent(OUT ):: ddxc2 +!----------------------------------------------------------------------------- +real(dp) :: x,y,z,a,b,d,e, & + ab2,aa,bb,di,ddi,dddi, & + aapbb,aambb +!============================================================================= +x=xc1(1); y=xc1(2); z=xc1(3) +a=s+u1 +b=s-u1 +ab2=a*b*u2 +aa=a*a +bb=b*b +aapbb=aa+bb +aambb=aa-bb +d=aapbb-ab2*z +e=aapbb*z-ab2 +di=u1/d +xc2(1)=(aambb*x)*di +xc2(2)=(aambb*y)*di +xc2(3)=e*di +ddi=di*di +dddi=ddi*di + +dxc2=u0 +dxc2(1,1)=aambb*di +dxc2(1,3)=ab2*aambb*x*ddi +dxc2(2,2)=aambb*di +dxc2(2,3)=ab2*aambb*y*ddi +dxc2(3,3)=aapbb*di +ab2*e*ddi + +ddxc2=u0 +ddxc2(1,1,3)=ab2*aambb*ddi +ddxc2(1,3,1)=ddxc2(1,1,3) +ddxc2(1,3,3)=u2*ab2**2*aambb*x*dddi +ddxc2(2,2,3)=ab2*aambb*ddi +ddxc2(2,3,2)=ddxc2(2,2,3) +ddxc2(2,3,3)=u2*ab2**2*aambb*y*dddi +ddxc2(3,3,3)=u2*ab2*(aapbb*ddi+ab2*e*dddi) +end subroutine dctocdd + +!============================================================================= +subroutine plrot(rot3,n,x,y,z)! [plrot] +!============================================================================= +! Apply a constant rotation to a three dimensional polyline +!============================================================================= +implicit none +integer, intent(IN ):: n +real(sp),dimension(3,3),intent(IN ):: rot3 +real(sp),dimension(n), intent(INOUT):: x,y,z +!----------------------------------------------------------------------------- +real(sp),dimension(3) :: t +integer :: k +!============================================================================= +do k=1,n + t(1)=x(k); t(2)=y(k); t(3)=z(k) + t=matmul(rot3,t) + x(k)=t(1); y(k)=t(2); z(k)=t(3) +enddo +end subroutine plrot + +!============================================================================= +subroutine plroti(rot3,n,x,y,z)! [plroti] +!============================================================================= +! Invert the rotation of a three-dimensional polyline +!============================================================================= +implicit none +integer, intent(IN ):: n +real(sp),dimension(3,3),intent(IN ):: rot3 +real(sp),dimension(n), intent(INOUT):: x,y,z +!----------------------------------------------------------------------------- +real(sp),dimension(3) :: t +integer :: k +!============================================================================= +do k=1,n + t(1)=x(k); t(2)=y(k); t(3)=z(k) + t=matmul(t,rot3) + x(k)=t(1); y(k)=t(2); z(k)=t(3) +enddo +end subroutine plroti + +!============================================================================= +subroutine dplrot(rot3,n,x,y,z)! [plrot] +!============================================================================= +! Apply a constant rotation to a three dimensional polyline +!============================================================================= +implicit none +integer, intent(IN ):: n +real(dP),dimension(3,3),intent(IN ):: rot3 +real(dP),dimension(n), intent(INOUT):: x,y,z +!----------------------------------------------------------------------------- +real(dP),dimension(3) :: t +integer :: k +!============================================================================= +do k=1,n + t(1)=x(k); t(2)=y(k); t(3)=z(k) + t=matmul(rot3,t) + x(k)=t(1); y(k)=t(2); z(k)=t(3) +enddo +end subroutine dplrot + +!============================================================================= +subroutine dplroti(rot3,n,x,y,z)! [plroti] +!============================================================================= +! Invert the rotation of a three-dimensional polyline +!============================================================================= +implicit none +integer, intent(IN ):: n +real(dP),dimension(3,3),intent(IN ):: rot3 +real(dP),dimension(n), intent(INOUT):: x,y,z +!----------------------------------------------------------------------------- +real(dP),dimension(3) :: t +integer :: k +!============================================================================= +do k=1,n + t(1)=x(k); t(2)=y(k); t(3)=z(k) + t=matmul(t,rot3) + x(k)=t(1); y(k)=t(2); z(k)=t(3) +enddo +end subroutine dplroti + +!============================================================================= +subroutine plctoc(s,n,x,y,z)! [plctoc] +!============================================================================= +! Perform schmidt transformation with scaling parameter s to a polyline +!============================================================================= +use pietc_s, only: u1 +implicit none +integer, intent(IN ):: n +real(sp), intent(IN ):: s +real(sp),dimension(n),intent(INOUT):: x,y,z +!----------------------------------------------------------------------------- +real(sp) :: a,b,d,e,ab2,aa,bb,di,aapbb,aambb +integer :: i +!============================================================================= +a=s+u1 +b=s-u1 +ab2=a*b*2 +aa=a*a +bb=b*b +aapbb=aa+bb +aambb=aa-bb +do i=1,n + d=aapbb-ab2*z(i) + e=aapbb*z(i)-ab2 + di=1/d + x(i)=(aambb*x(i))*di + y(i)=(aambb*y(i))*di + z(i)=e*di +enddo +end subroutine plctoc + +end module pmat5 + + + diff --git a/sorc/grid_tools.fd/regional_esg_grid.fd/psym2.f90 b/sorc/grid_tools.fd/regional_esg_grid.fd/psym2.f90 new file mode 100644 index 000000000..4f112da52 --- /dev/null +++ b/sorc/grid_tools.fd/regional_esg_grid.fd/psym2.f90 @@ -0,0 +1,462 @@ +! *********************************** +! * module psym2 * +! * R. J. Purser * +! * NOAA/NCEP/EMC September 2018 * +! * jim.purser@noaa.gov * +! *********************************** +! +! A suite of routines to perform the eigen-decomposition of symmetric 2*2 +! matrices and to deliver basic analytic functions, and the derivatives +! of these functions, of such matrices. +! In addition, we include a simple cholesky routine +! +! DIRECT DEPENDENCIES +! Library: pfun +! Module: pkind, pietc, pfun +! +!============================================================================= +module psym2 +!============================================================================= +use pkind, only: spi,dp +use pietc, only: u0,u1,o2 +implicit none +private +public:: eigensym2,invsym2,sqrtsym2,expsym2,logsym2,id2222,chol2 + +real(dp),dimension(2,2,2,2):: id +data id/u1,u0,u0,u0, u0,o2,o2,u0, u0,o2,o2,u0, u0,u0,u0,u1/! Effective identity + +interface eigensym2; module procedure eigensym2,eigensym2d; end interface +interface invsym2; module procedure invsym2,invsym2d; end interface +interface sqrtsym2; module procedure sqrtsym2,sqrtsym2d; end interface +interface sqrtsym2d_e; module procedure sqrtsym2d_e; end interface +interface sqrtsym2d_t; module procedure sqrtsym2d_t; end interface +interface expsym2; module procedure expsym2,expsym2d; end interface +interface expsym2d_e; module procedure expsym2d_e; end interface +interface expsym2d_t; module procedure expsym2d_t; end interface +interface logsym2; module procedure logsym2,logsym2d; end interface +interface id2222; module procedure id2222; end interface +interface chol2; module procedure chol2; end interface + +contains + +!============================================================================= +subroutine eigensym2(em,vv,oo)! [eigensym2] +!============================================================================= +! Get the orthogonal eigenvectors, vv, and diagonal matrix of eigenvalues, oo, +! of the symmetric 2*2 matrix, em. +!============================================================================= +implicit none +real(dp),dimension(2,2),intent(in ):: em +real(dp),dimension(2,2),intent(out):: vv,oo +!----------------------------------------------------------------------------- +real(dp):: a,b,c,d,e,f,g,h +!============================================================================= +a=em(1,1); b=em(1,2); c=em(2,2) +d=a*c-b*b! <- det(em) +e=(a+c)*o2; f=(a-c)*o2 +h=sqrt(f**2+b**2) +g=sqrt(b**2+(h+abs(f))**2) +if (g==u0)then; vv(:,1)=(/u1,u0/) +elseif(f> u0)then; vv(:,1)=(/h+f,b/)/g +else ; vv(:,1)=(/b,h-f/)/g +endif +vv(:,2)=(/-vv(2,1),vv(1,1)/) +oo=matmul(transpose(vv),matmul(em,vv)) +oo(1,2)=u0; oo(2,1)=u0 +end subroutine eigensym2 +!============================================================================= +subroutine eigensym2d(em,vv,oo,vvd,ood,ff)! [eigensym2] +!============================================================================= +! For a symmetric 2*2 matrix, em, return the normalized eigenvectors, vv, and +! the diagonal matrix of eigenvalues, oo. If the two eigenvalues are equal, +! proceed no further and raise the logical failure flag, ff, to .true.; +! otherwise, return with vvd=d(vv)/d(em) and ood=d(oo)/d(em) and ff=.false., +! and maintain the symmetries between the last two of the indices of +! these derivatives. +!============================================================================= +implicit none +real(dp),dimension(2,2), intent(in ):: em +real(dp),dimension(2,2), intent(out):: vv,oo +real(dp),dimension(2,2,2,2),intent(out):: vvd,ood +logical, intent(out):: ff +!----------------------------------------------------------------------------- +real(dp),dimension(2,2):: emd,tt,vvr +real(dp) :: oodif,dtheta +integer(spi) :: i,j +!============================================================================= +call eigensym2(em,vv,oo); vvr(1,:)=-vv(2,:); vvr(2,:)=vv(1,:) +oodif=oo(1,1)-oo(2,2); ff=oodif==u0; if(ff)return +ood=0 +vvd=0 +do j=1,2 + do i=1,2 + emd=0 + if(i==j)then + emd(i,j)=u1 + else + emd(i,j)=o2; emd(j,i)=o2 + endif + tt=matmul(transpose(vv),matmul(emd,vv)) + ood(1,1,i,j)=tt(1,1) + ood(2,2,i,j)=tt(2,2) + dtheta=tt(1,2)/oodif + vvd(:,:,i,j)=vvr*dtheta + enddo +enddo +end subroutine eigensym2d + +!============================================================================= +subroutine invsym2(em,z)! [invsym2] +!============================================================================= +! Get the inverse of a 2*2 matrix (need not be symmetric in this case). +!============================================================================= +implicit none +real(dp),dimension(2,2),intent(in ):: em +real(dp),dimension(2,2),intent(out):: z +!----------------------------------------------------------------------------- +real(dp):: detem +!============================================================================= +z(1,1)=em(2,2); z(2,1)=-em(2,1); z(1,2)=-em(1,2); z(2,2)=em(1,1) +detem=em(1,1)*em(2,2)-em(2,1)*em(1,2) +z=z/detem +end subroutine invsym2 +!============================================================================= +subroutine invsym2d(em,z,zd)! [invsym2] +!============================================================================= +! Get the inverse, z,of a 2*2 symmetric matrix, em, and its derivative, zd, +! with respect to symmetric variations of its components. I.e., for a +! symmetric infinitesimal change, delta_em, in em, the resulting +! infinitesimal change in z would be: +! delta_z(i,j) = matmul(zd(i,j,:,:),delta_em) +!============================================================================= +implicit none +real(dp),dimension(2,2) ,intent(in ):: em +real(dp),dimension(2,2) ,intent(out):: z +real(dp),dimension(2,2,2,2),intent(out):: zd +!----------------------------------------------------------------------------- +integer(spi):: k,l +!============================================================================= +call invsym2(em,z) +call id2222(zd) +do l=1,2; do k=1,2 + zd(:,:,k,l)=-matmul(matmul(z,zd(:,:,k,l)),z) +enddo; enddo +end subroutine invsym2d + +!============================================================================= +subroutine sqrtsym2(em,z)! [sqrtsym2] +!============================================================================= +! Get the sqrt of a symmetric positive-definite 2*2 matrix +!============================================================================= +implicit none +real(dp),dimension(2,2),intent(in ):: em +real(dp),dimension(2,2),intent(out):: z +!----------------------------------------------------------------------------- +real(dp),dimension(2,2):: vv,oo +integer(spi) :: i +!============================================================================= +call eigensym2(em,vv,oo) +do i=1,2 +if(oo(i,i)<0)stop 'In sqrtsym2; matrix em is not non-negative' +oo(i,i)=sqrt(oo(i,i)); enddo +z=matmul(vv,matmul(oo,transpose(vv))) +end subroutine sqrtsym2 + +!============================================================================= +subroutine sqrtsym2d(x,z,zd)! [sqrtsym2] +!============================================================================= +! General routine to evaluate z=sqrt(x), and the symmetric +! derivative, zd = dz/dx, where x is a symmetric 2*2 positive-definite +! matrix. If the eigenvalues are very close together, extract their +! geometric mean for "preconditioning" a scaled version, px, of x, whose +! sqrt, and hence its derivative, can be easily obtained by the series +! expansion method. Otherwise, use the eigen-method (which entails dividing +! by the difference in the eignevalues to get zd, and which therefore +! fails when the eigenvalues become too similar). +!============================================================================= +implicit none +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):: px +real(dp) :: rdetx,lrdetx,htrpxs,q +!============================================================================= +rdetx=sqrt(x(1,1)*x(2,2)-x(1,2)*x(2,1)) ! <- sqrt(determinant of x) +lrdetx=sqrt(rdetx) +px=x/rdetx ! <- preconditioned x (has unit determinant) +htrpxs= ((px(1,1)+px(2,2))/2)**2 ! <- {half-trace-px}-squared +q=htrpxs-u1 +if(q<.05_dp)then ! <- Taylor expansion method + call sqrtsym2d_t(px,z,zd) + z=z*lrdetx; zd=zd/lrdetx +else + call sqrtsym2d_e(x,z,zd) ! <- Eigen-method +endif +end subroutine sqrtsym2d + +!============================================================================= +subroutine sqrtsym2d_e(x,z,zd)! [sqrtsym2d_e] +!============================================================================= +implicit none +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,2,2):: vvd,ood +real(dp),dimension(2,2) :: vv,oo,oori,tt +integer(spi) :: i,j +logical :: ff +!============================================================================= +call eigensym2(x,vv,oo,vvd,ood,ff) +z=u0; z(1,1)=sqrt(oo(1,1)); z(2,2)=sqrt(oo(2,2)) +z=matmul(matmul(vv,z),transpose(vv)) +oori=u0; oori(1,1)=u1/sqrt(oo(1,1)); oori(2,2)=u1/sqrt(oo(2,2)) +do j=1,2 +do i=1,2 + tt=matmul(vvd(:,:,i,j),transpose(vv)) + zd(:,:,i,j)=o2*matmul(matmul(matmul(vv,ood(:,:,i,j)),oori),transpose(vv))& + +matmul(tt,z)-matmul(z,tt) +enddo +enddo +end subroutine sqrtsym2d_e + +!============================================================================= +subroutine sqrtsym2d_t(x,z,zd)! [sqrtsym2d_t] +!============================================================================= +! Use the Taylor-series method (eigenvalues both fairly close to unity). +! For a 2*2 positive definite symmetric matrix x, try to get both the z=sqrt(x) +! and dz/dx using the binomial-expansion method applied to the intermediate +! matrix, r = (x-1). ie z=sqrt(x) = (1+r)^{1/2} = I + (1/2)*r -(1/8)*r^2 ... +! + [(-)^n *(2n)!/{(n+1)! * n! *2^{2*n-1}} ]*r^{n+1} +!============================================================================= +implicit none +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 +!----------------------------------------------------------------------------- +integer(spi),parameter :: nit=300 ! number of iterative increments allowed +real(dp),parameter :: crit=1.e-17 +real(dp),dimension(2,2) :: r,rp,rd,rpd +real(dp) :: c +integer(spi) :: i,j,n +!============================================================================= +r=x; r(1,1)=x(1,1)-1; r(2,2)=x(2,2)-1 +z=u0; z(1,1)=u1; z(2,2)=u1 +rp=r +c=o2 +do n=0,nit + z=z+c*rp + rp=matmul(rp,r) + if(sum(abs(rp))50km, C384->25km, C768->13km, C1152->8.5km, C3072->3.2km -#---------------------------------------------------------------------------------------- - -if [ $res -eq 48 ]; then - cd4=0.12; max_slope=0.12; n_del2_weak=4; peak_fac=1.1 -elif [ $res -eq 96 ]; then - cd4=0.12; max_slope=0.12; n_del2_weak=8; peak_fac=1.1 -elif [ $res -eq 128 ]; then - cd4=0.13; max_slope=0.12; n_del2_weak=8; peak_fac=1.1 -elif [ $res -eq 192 ]; then - cd4=0.15; max_slope=0.12; n_del2_weak=12; peak_fac=1.05 -elif [ $res -eq 384 ]; then - cd4=0.15; max_slope=0.12; n_del2_weak=12; peak_fac=1.0 -elif [ $res -eq 768 ]; then - cd4=0.15; max_slope=0.12; n_del2_weak=16; peak_fac=1.0 -elif [ $res -eq 1152 ]; then - cd4=0.15; max_slope=0.16; n_del2_weak=20; peak_fac=1.0 -elif [ $res -eq 3072 ]; then - cd4=0.15; max_slope=0.30; n_del2_weak=24; peak_fac=1.0 -else - echo "grid C$res not supported, exit" - exit 2 -fi - #---------------------------------------------------------------------------------- #---------------------------------------------------------------------------------- # Make grid and orography. #---------------------------------------------------------------------------------- #---------------------------------------------------------------------------------- +#---------------------------------------------------------------------------------- #---------------------------------------------------------------------------------- # Uniform, stretch or nest grid. #---------------------------------------------------------------------------------- +#---------------------------------------------------------------------------------- if [ $gtype = uniform ] || [ $gtype = stretch ] || [ $gtype = nest ]; then @@ -136,6 +131,8 @@ if [ $gtype = uniform ] || [ $gtype = stretch ] || [ $gtype = nest ]; then grid_dir=$TMPDIR/$name/grid orog_dir=$TMPDIR/$name/orog + out_dir=$out_dir/C${res} + mkdir -p $out_dir if [ $gtype = nest ]; then filter_dir=$orog_dir # nested grid topography will be filtered online @@ -175,6 +172,10 @@ if [ $gtype = uniform ] || [ $gtype = stretch ] || [ $gtype = nest ]; then tile=$(( $tile + 1 )) done aprun -j 1 -n 4 -N 4 -d 6 -cc depth cfp $TMPDIR/orog.file1 + err=$? + if [ $err != 0 ]; then + exit $err + fi rm $TMPDIR/orog.file1 else tile=1 @@ -208,7 +209,7 @@ if [ $gtype = uniform ] || [ $gtype = stretch ] || [ $gtype = nest ]; then echo "............ Execute fv3gfs_filter_topo.sh .............." echo set -x - $script_dir/fv3gfs_filter_topo.sh $res $grid_dir $orog_dir $filter_dir $cd4 $peak_fac $max_slope $n_del2_weak $script_dir + $script_dir/fv3gfs_filter_topo.sh $res $grid_dir $orog_dir $filter_dir err=$? if [ $err != 0 ]; then exit $err @@ -230,10 +231,12 @@ if [ $gtype = uniform ] || [ $gtype = stretch ] || [ $gtype = nest ]; then echo "Grid and orography files are now prepared." #---------------------------------------------------------------------------------- -# Regional grid. +#---------------------------------------------------------------------------------- +# Regional grid (gfdl or esg) +#---------------------------------------------------------------------------------- #---------------------------------------------------------------------------------- -elif [ $gtype = regional ]; then +elif [ $gtype = regional_gfdl ] || [ $gtype = regional_esg ]; then #---------------------------------------------------------------------------------- # We are now creating only 1 tile and it is tile 7 @@ -242,82 +245,107 @@ elif [ $gtype = regional ]; then export ntiles=1 halop1=$(( halo + 1 )) tile=7 - set +x # don't echo all the computation to figure out how many points to add/subtract from start/end nest values - + name=regional + grid_dir=$TMPDIR/${name}/grid + orog_dir=$TMPDIR/${name}/orog + filter_dir=$orog_dir # nested grid topography will be filtered online + rm -rf $TMPDIR/$name + mkdir -p $grid_dir $orog_dir $filter_dir + #---------------------------------------------------------------------------------- -# Number of parent points +# Create regional gfdl grid files. #---------------------------------------------------------------------------------- + + if [ $gtype = regional_gfdl ]; then + + set +x # don't echo all the computation to figure out how many points to add/subtract from start/end nest values - nptsx=`expr $iend_nest - $istart_nest + 1` - nptsy=`expr $jend_nest - $jstart_nest + 1` - -#---------------------------------------------------------------------------------- -# Number of compute grid points -#---------------------------------------------------------------------------------- + nptsx=`expr $iend_nest - $istart_nest + 1` # parent points + nptsy=`expr $jend_nest - $jstart_nest + 1` - npts_cgx=`expr $nptsx \* $refine_ratio / 2` - npts_cgy=`expr $nptsy \* $refine_ratio / 2` + idim=`expr $nptsx \* $refine_ratio / 2` # number of compute points + jdim=`expr $nptsy \* $refine_ratio / 2` #---------------------------------------------------------------------------------- # Figure out how many columns/rows to add in each direction so we have at least # 5 halo points for make_hgrid and the orography program. #---------------------------------------------------------------------------------- - index=0 - add_subtract_value=0 - while (test "$index" -le "0") - do - add_subtract_value=`expr $add_subtract_value + 1` - iend_nest_halo=`expr $iend_nest + $add_subtract_value` - istart_nest_halo=`expr $istart_nest - $add_subtract_value` - newpoints_i=`expr $iend_nest_halo - $istart_nest_halo + 1` - newpoints_cg_i=`expr $newpoints_i \* $refine_ratio / 2` - diff=`expr $newpoints_cg_i - $npts_cgx` - if [ $diff -ge 10 ]; then - index=`expr $index + 1` - fi - done - jend_nest_halo=`expr $jend_nest + $add_subtract_value` - jstart_nest_halo=`expr $jstart_nest - $add_subtract_value` - - echo "================================================================================== " - echo "For refine_ratio= $refine_ratio" - echo " iend_nest= $iend_nest iend_nest_halo= $iend_nest_halo istart_nest= $istart_nest istart_nest_halo= $istart_nest_halo" - echo " jend_nest= $jend_nest jend_nest_halo= $jend_nest_halo jstart_nest= $jstart_nest jstart_nest_halo= $jstart_nest_halo" - echo "================================================================================== " - set -x + index=0 + add_subtract_value=0 + while (test "$index" -le "0") + do + add_subtract_value=`expr $add_subtract_value + 1` + iend_nest_halo=`expr $iend_nest + $add_subtract_value` + istart_nest_halo=`expr $istart_nest - $add_subtract_value` + newpoints_i=`expr $iend_nest_halo - $istart_nest_halo + 1` + newpoints_cg_i=`expr $newpoints_i \* $refine_ratio / 2` + diff=`expr $newpoints_cg_i - $idim` + if [ $diff -ge 10 ]; then + index=`expr $index + 1` + fi + done + jend_nest_halo=`expr $jend_nest + $add_subtract_value` + jstart_nest_halo=`expr $jstart_nest - $add_subtract_value` + + echo "================================================================================== " + echo "For refine_ratio= $refine_ratio" + echo " iend_nest= $iend_nest iend_nest_halo= $iend_nest_halo istart_nest= $istart_nest istart_nest_halo= $istart_nest_halo" + echo " jend_nest= $jend_nest jend_nest_halo= $jend_nest_halo jstart_nest= $jstart_nest jstart_nest_halo= $jstart_nest_halo" + echo "================================================================================== " - export ntiles=1 - tile=7 - rn=$( echo "$stretch_fac * 10" | bc | cut -c1-2 ) - name=C${res}r${rn}n${refine_ratio}_${title} - grid_dir=$TMPDIR/${name}/grid - orog_dir=$TMPDIR/$name/orog - filter_dir=$orog_dir # nested grid topography will be filtered online - rm -rf $TMPDIR/$name - mkdir -p $grid_dir $orog_dir $filter_dir + set +x + echo + echo "............ Execute fv3gfs_make_grid.sh ................." + echo + set -x + $script_dir/fv3gfs_make_grid.sh $grid_dir $istart_nest_halo $jstart_nest_halo $iend_nest_halo $jend_nest_halo + err=$? + if [ $err != 0 ]; then + exit $err + fi + +#---------------------------------------------------------------------------------- +# Create regional esg grid files. +#---------------------------------------------------------------------------------- + + elif [ $gtype = regional_esg ]; then + + set +x + echo + echo "............ Execute fv3gfs_make_grid.sh ................." + echo + set -x + $script_dir/fv3gfs_make_grid.sh $grid_dir + err=$? + if [ $err != 0 ]; then + exit $err + fi - set +x - echo - echo "............ Execute fv3gfs_make_grid.sh ................." - echo - set -x - $script_dir/fv3gfs_make_grid.sh $grid_dir $istart_nest_halo $jstart_nest_halo $iend_nest_halo $jend_nest_halo - err=$? - if [ $err != 0 ]; then - exit $err fi - echo "Begin regional orography generation at `date`" - #---------------------------------------------------------------------------------- +# Redefine resolution for regional grids as a global equivalent resolution. +#---------------------------------------------------------------------------------- + + res=$( $NCDUMP -h ${grid_dir}/C*_grid.tile7.nc | grep -o ":RES_equiv = [0-9]\+" | grep -o "[0-9]" ) + res=${res//$'\n'/} + out_dir=$out_dir/C${res} + mkdir -p $out_dir + +#---------------------------------------------------------------------------------- +# Create orography. +# # On WCOSS_C use cfp to run multiple tiles simulatneously for the orography. # For now we only have one tile but in the future we will have more. #---------------------------------------------------------------------------------- + echo "Begin orography generation at `date`" + if [ $machine = WCOSS_C ]; then - echo "$script_dir/fv3gfs_make_orog.sh $res 7 $grid_dir $orog_dir $script_dir $topo $TMPDIR " >>$TMPDIR/orog.file1 + echo "$script_dir/fv3gfs_make_orog.sh $res $tile $grid_dir $orog_dir $script_dir $topo $TMPDIR " >>$TMPDIR/orog.file1 aprun -j 1 -n 4 -N 4 -d 6 -cc depth cfp $TMPDIR/orog.file1 + err=$? rm $TMPDIR/orog.file1 else set +x @@ -332,33 +360,37 @@ elif [ $gtype = regional ]; then fi fi + echo "Grid and orography files are now prepared." + set +x echo - echo "............ Execute fv3gfs_filter_topo.sh .............." + echo "............ Execute fv3gfs_filter_topo.sh .............." echo set -x - $script_dir/fv3gfs_filter_topo.sh $res $grid_dir $orog_dir $filter_dir $cd4 $peak_fac $max_slope $n_del2_weak $script_dir + $script_dir/fv3gfs_filter_topo.sh $res $grid_dir $orog_dir $filter_dir err=$? if [ $err != 0 ]; then exit $err fi + +#---------------------------------------------------------------------------------- +# For regional grids, shave the orography file and then the grid file, the echo +# creates the file that contains the number of required points in x and y and the +# input and output file names.This first run of shave uses a halo of 4. +# This is necessary so that chgres will create BC's with 4 rows/columns which is +# necessary for pt. +#---------------------------------------------------------------------------------- + set +x echo echo "............ Execute shave to reduce grid and orography files to required compute size .............." echo set -x - cd $filter_dir -#---------------------------------------------------------------------------------- -# Shave the orography file and then the grid file, the echo creates the input -# file that contains the number of required points in x and y and the input -# and output file names.This first run of shave uses a halo of 4. -# This is necessary so that chgres will create BC's with 4 rows/columns which is -# necessary for pt. -#---------------------------------------------------------------------------------- + cd $filter_dir - echo $npts_cgx $npts_cgy $halop1 \'$filter_dir/oro.C${res}.tile${tile}.nc\' \'$filter_dir/oro.C${res}.tile${tile}.shave.nc\' >input.shave.orog - echo $npts_cgx $npts_cgy $halop1 \'$filter_dir/C${res}_grid.tile${tile}.nc\' \'$filter_dir/C${res}_grid.tile${tile}.shave.nc\' >input.shave.grid + echo $idim $jdim $halop1 \'$filter_dir/oro.C${res}.tile${tile}.nc\' \'$filter_dir/oro.C${res}.tile${tile}.shave.nc\' >input.shave.orog + echo $idim $jdim $halop1 \'$filter_dir/C${res}_grid.tile${tile}.nc\' \'$filter_dir/C${res}_grid.tile${tile}.shave.nc\' >input.shave.grid $APRUN $exec_dir/shave input.shave.orog.halo$halo - echo $npts_cgx $npts_cgy $halo \'$filter_dir/C${res}_grid.tile${tile}.nc\' \'$filter_dir/C${res}_grid.tile${tile}.shave.nc\' >input.shave.grid.halo$halo + echo $idim $jdim $halo \'$filter_dir/oro.C${res}.tile${tile}.nc\' \'$filter_dir/oro.C${res}.tile${tile}.shave.nc\' >input.shave.orog.halo$halo + echo $idim $jdim $halo \'$filter_dir/C${res}_grid.tile${tile}.nc\' \'$filter_dir/C${res}_grid.tile${tile}.shave.nc\' >input.shave.grid.halo$halo $APRUN $exec_dir/shave input.shave.orog.halo0 - echo $npts_cgx $npts_cgy 0 \'$filter_dir/C${res}_grid.tile${tile}.nc\' \'$filter_dir/C${res}_grid.tile${tile}.shave.nc\' >input.shave.grid.halo0 + echo $idim $jdim 0 \'$filter_dir/oro.C${res}.tile${tile}.nc\' \'$filter_dir/oro.C${res}.tile${tile}.shave.nc\' >input.shave.orog.halo0 + echo $idim $jdim 0 \'$filter_dir/C${res}_grid.tile${tile}.nc\' \'$filter_dir/C${res}_grid.tile${tile}.shave.nc\' >input.shave.grid.halo0 $APRUN $exec_dir/shave input.nml < ./regional_grid.nml << EOF + ®ional_grid_nml + plon = ${target_lon} + plat = ${target_lat} + delx = ${delx} + dely = ${dely} + lx = -${lx} + ly = -${ly} + / +EOF + + $APRUN $executable + fi if [ $? -ne 0 ]; then set +x echo - echo "FATAL ERROR creating C$res grid." + echo "FATAL ERROR creating grid files." echo set -x exit 1 fi +#--------------------------------------------------------------------------------------- +# Compute the equivalent 'global' resolution for regional grids. For GFDL +# regional grids, the CRES value input to this script is the resolution of the +# global grid in which it is embedded. Compute a more realistic value. +# Program adds the equivalent resolution as a global attribute to the grid file. +# Below, this attribute is retrieved and used to rename the grid files. +#--------------------------------------------------------------------------------------- + +if [ $gtype = regional_gfdl ] || [ $gtype = regional_esg ]; then + executable=$exec_dir/global_equiv_resol + if [ ! -s $executable ]; then + set +x + echo + echo "FATAL ERROR: ${executable} does not exist." + echo + set -x + exit 1 + fi + if [ $gtype = regional_esg ]; then + $APRUN $executable regional_grid.nc + elif [ $gtype = regional_gfdl ]; then + $APRUN $executable C${res}_grid.tile7.nc + fi + if [ $? -ne 0 ]; then + set +x + echo + echo "FATAL ERROR running global_equiv_resol." + echo + set -x + exit 2 + fi +fi + #--------------------------------------------------------------------------------------- # Create mosaic file. # @@ -101,6 +176,9 @@ fi # process seven tiles at once. # # For regional grids, there is only one tile and it is tile number 7. +# +# For regional grids, rename the grid files according to their global equivalent +# resolution. #--------------------------------------------------------------------------------------- executable=$exec_dir/make_solo_mosaic @@ -128,10 +206,19 @@ elif [ $gtype = nest ]; then $APRUN $executable --num_tiles 1 --dir $outdir --mosaic C${res}_nested_mosaic --tile_file C${res}_grid.tile7.nc -elif [ $gtype = regional ];then +elif [ $gtype = regional_gfdl ];then + res_save=$res + get_res C${res}_grid.tile7.nc + mv C${res_save}_grid.tile7.nc C${res}_grid.tile7.nc $APRUN $executable --num_tiles $ntiles --dir $outdir --mosaic C${res}_mosaic --tile_file C${res}_grid.tile7.nc +elif [ $gtype = regional_esg ]; then + + get_res regional_grid.nc + mv regional_grid.nc C${res}_grid.tile7.nc + $APRUN $executable --num_tiles 1 --dir $outdir --mosaic C${res}_mosaic --tile_file C${res}_grid.tile7.nc + fi if [ $? -ne 0 ]; then diff --git a/ush/fv3gfs_make_orog.sh b/ush/fv3gfs_make_orog.sh index 7e8960d5c..532c6407f 100755 --- a/ush/fv3gfs_make_orog.sh +++ b/ush/fv3gfs_make_orog.sh @@ -1,4 +1,4 @@ -#!/bin/ksh +#!/bin/bash set -ax nargv=$# @@ -11,7 +11,6 @@ if [ $nargv -eq 6 ]; then # lat-lon grid export outdir=$3 export script_dir=$4 export is_latlon=1 - export ntiles=1 export orogfile="none" export hist_dir=$5 export TMPDIR=$6 @@ -24,7 +23,6 @@ elif [ $nargv -eq 7 ]; then # cubed-sphere grid export griddir=$3 export outdir=$4 export script_dir=$5 - export ntiles=6 export is_latlon=0 export orogfile="none" export hist_dir=$6 @@ -37,7 +35,6 @@ elif [ $nargv -eq 8 ]; then # input your own orography files export tile=$2 export griddir=$3 export outdir=$4 - export ntiles=6 export is_latlon=0 export inputorog=$5 export script_dir=$6 From d2fab3604d00064a25e4587646efe6aae6f93e95 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Mon, 17 Aug 2020 13:14:25 -0400 Subject: [PATCH 028/192] Port repository to Orion Updates to compile repo on Orion. New scripts to run regression tests on Orion. New script to run the grid creation step on Orion. Update link_fixdirs.sh to link to Orion fixed directories. Remove some references to Tide/Gyre. See #96 and #134 for more details. --- driver_scripts/driver_grid.orion.sh | 133 ++++++++++++++++++++++ fix/link_fixdirs.sh | 10 +- modulefiles/build.orion | 15 +-- modulefiles/module-setup.sh.inc | 6 - reg_tests/chgres_cube/c192.fv3.history.sh | 9 ++ reg_tests/chgres_cube/c192.gfs.grib2.sh | 9 ++ reg_tests/chgres_cube/c96.fv3.nemsio.sh | 9 ++ reg_tests/chgres_cube/c96.fv3.netcdf.sh | 9 ++ reg_tests/chgres_cube/c96.fv3.restart.sh | 9 ++ reg_tests/chgres_cube/c96.gfs.nemsio.sh | 9 ++ reg_tests/chgres_cube/c96.gfs.sigio.sh | 14 +++ reg_tests/chgres_cube/c96.regional.sh | 9 ++ reg_tests/chgres_cube/driver.orion.sh | 133 ++++++++++++++++++++++ reg_tests/global_cycle/C768.fv3gfs.sh | 9 ++ reg_tests/global_cycle/driver.orion.sh | 61 ++++++++++ reg_tests/grid_gen/c96.uniform.sh | 8 ++ reg_tests/grid_gen/driver.orion.sh | 72 ++++++++++++ reg_tests/grid_gen/gfdl.regional.sh | 8 ++ reg_tests/ice_blend/driver.orion.sh | 54 +++++++++ reg_tests/snow2mdl/driver.orion.sh | 50 ++++++++ sorc/machine-setup.sh | 9 -- ush/load_fv3gfs_modules.sh | 3 - 22 files changed, 617 insertions(+), 31 deletions(-) create mode 100755 driver_scripts/driver_grid.orion.sh create mode 100755 reg_tests/chgres_cube/driver.orion.sh create mode 100755 reg_tests/global_cycle/driver.orion.sh create mode 100755 reg_tests/grid_gen/driver.orion.sh create mode 100755 reg_tests/ice_blend/driver.orion.sh create mode 100755 reg_tests/snow2mdl/driver.orion.sh diff --git a/driver_scripts/driver_grid.orion.sh b/driver_scripts/driver_grid.orion.sh new file mode 100755 index 000000000..66a2955d5 --- /dev/null +++ b/driver_scripts/driver_grid.orion.sh @@ -0,0 +1,133 @@ +#!/bin/bash + +#SBATCH -J fv3_grid_driver +#SBATCH -A fv3-cpu +#SBATCH --open-mode=truncate +#SBATCH -o log.fv3_grid_driver +#SBATCH -e log.fv3_grid_driver +#SBATCH --nodes=1 --ntasks-per-node=24 +#SBATCH -q debug +#SBATCH -t 00:30:00 + +#----------------------------------------------------------------------- +# Driver script to create a cubic-sphere based model grid on Orion. +# +# Produces the following files (netcdf, each tile in separate file): +# 1) 'mosaic' and 'grid' files containing lat/lon and other +# records that describe the model grid. +# 2) 'oro' files containing land mask, terrain and gravity +# wave drag fields. +# 3) Surface climo fields, such as soil type, vegetation +# greenness and albedo. +# +# Note: The sfc_climo_gen program only runs with an +# mpi task count that is a multiple of six. This is +# an ESMF library requirement. Large grids may require +# tasks spread across multiple nodes. The orography code +# benefits from threads. +# +# To run, do the following: +# +# 1) Set "C" resolution, "res" - Example: res=96. +# 2) Set grid type ("gtype"). Valid choices are +# "uniform" - global uniform grid +# "stretch" - global stretched grid +# "nest" - global stretched grid with nest +# "regional_gfdl" - stand-alone gfdl regional grid +# "regional_esg" - stand-alone extended Schmidt +# gnomonic (esg) regional grid +# 3) For "stretch" and "nest" grids, set the stretching factor - +# "stretch_fac", and center lat/lon of highest resolution +# tile - "target_lat" and "target_lon". +# 4) For "nest" grids, set the refinement ratio - "refine_ratio", +# the starting/ending i/j index location within the parent +# tile - "istart_nest", "jstart_nest", "iend_nest", "jend_nest" +# 5) For "regional_gfdl" grids, set the "halo". Default is three +# rows/columns. +# 6) For "regional_esg" grids, set center lat/lon of grid, +# - "target_lat/lon" - the i/j dimensions - "i/jdim", the +# x/y grid spacing - "delx/y", and halo. +# 7) Set working directory - TMPDIR - and path to the repository +# clone - home_dir. +# 8) Submit script: "sbatch $script". +# 9) All files will be placed in "out_dir". +# +#----------------------------------------------------------------------- + +set -x + +source ../sorc/machine-setup.sh > /dev/null 2>&1 +source ../modulefiles/build.$target +module list + +#----------------------------------------------------------------------- +# Set grid specs here. +#----------------------------------------------------------------------- + +export gtype=uniform # 'uniform', 'stretch', 'nest', + # 'regional_gfdl', 'regional_esg' + +if [ $gtype = uniform ]; then + export res=96 +elif [ $gtype = stretch ]; then + export res=96 + export stretch_fac=1.5 # Stretching factor for the grid + export target_lon=-97.5 # Center longitude of the highest resolution tile + export target_lat=35.5 # Center latitude of the highest resolution tile +elif [ $gtype = nest ] || [ $gtype = regional_gfdl ]; then + export res=96 + export stretch_fac=1.5 # Stretching factor for the grid + export target_lon=-97.5 # Center longitude of the highest resolution tile + export target_lat=35.5 # Center latitude of the highest resolution tile + export refine_ratio=3 # The refinement ratio + export istart_nest=27 # Starting i-direction index of nest grid in parent tile supergrid + export jstart_nest=37 # Starting j-direction index of nest grid in parent tile supergrid + export iend_nest=166 # Ending i-direction index of nest grid in parent tile supergrid + export jend_nest=164 # Ending j-direction index of nest grid in parent tile supergrid + export halo=3 # Lateral boundary halo +elif [ $gtype = regional_esg ] ; then + export res=-999 # equivalent res is computed. + export target_lon=-97.5 # Center longitude of grid + export target_lat=35.5 # Center latitude of grid + export idim=301 # Dimension of grid in 'i' direction + export jdim=200 # Dimension of grid in 'j' direction + export delx=0.0585 # Grid spacing (in degrees) in the 'i' direction + # on the SUPERGRID (which has twice the resolution of + # the model grid). The physical grid spacing in the 'i' + # direction is related to delx as follows: + # distance = 2*delx*(circumf_Earth/360 deg) + export dely=0.0585 # Grid spacing (in degrees) in the 'j' direction. + export halo=3 # number of row/cols for halo +fi + +#----------------------------------------------------------------------- +# Check paths. +# home_dir - location of repository. +# TMPDIR - working directory. +# out_dir - where files will be placed upon completion. +#----------------------------------------------------------------------- + +export home_dir=$SLURM_SUBMIT_DIR/.. +export TMPDIR=/work/noaa/stmp/$LOGNAME/fv3_grid.$gtype +export out_dir=/work/noaa/stmp/$LOGNAME/my_grids + +#----------------------------------------------------------------------- +# Should not need to change anything below here. +#----------------------------------------------------------------------- + +export APRUN=time +export APRUN_SFC=srun +export OMP_NUM_THREADS=24 +export OMP_STACKSIZE=2048m +export machine=ORION + +ulimit -a +ulimit -s 199000000 + +#----------------------------------------------------------------------- +# Start script. +#----------------------------------------------------------------------- + +$home_dir/ush/fv3gfs_driver_grid.sh + +exit diff --git a/fix/link_fixdirs.sh b/fix/link_fixdirs.sh index 718692317..2f7017a7f 100755 --- a/fix/link_fixdirs.sh +++ b/fix/link_fixdirs.sh @@ -9,20 +9,20 @@ machine=${2} if [ $# -lt 2 ]; then set +x echo '***ERROR*** must specify two arguements: (1) RUN_ENVIR, (2) machine' - echo ' Syntax: link_fv3gfs.sh ( nco | emc ) ( cray | dell | hera | jet )' + echo ' Syntax: link_fv3gfs.sh ( nco | emc ) ( cray | dell | hera | jet | orion )' exit 1 fi if [ $RUN_ENVIR != emc -a $RUN_ENVIR != nco ]; then set +x echo '***ERROR*** unsupported run environment' - echo 'Syntax: link_fv3gfs.sh ( nco | emc ) ( cray | dell | hera | jet )' + echo 'Syntax: link_fv3gfs.sh ( nco | emc ) ( cray | dell | hera | jet | orion )' exit 1 fi -if [ $machine != cray -a $machine != hera -a $machine != dell -a $machine != jet ]; then +if [ $machine != cray -a $machine != hera -a $machine != dell -a $machine != jet -a $machine != orion ]; then set +x echo '***ERROR*** unsupported machine' - echo 'Syntax: link_fv3gfs.sh ( nco | emc ) ( cray | dell | hera | jet )' + echo 'Syntax: link_fv3gfs.sh ( nco | emc ) ( cray | dell | hera | jet | orion )' exit 1 fi @@ -43,6 +43,8 @@ elif [ $machine = "hera" ]; then FIX_DIR="/scratch1/NCEPDEV/global/glopara/fix" elif [ $machine = "jet" ]; then FIX_DIR="/lfs4/HFIP/hfv3gfs/glopara/git/fv3gfs/fix" +elif [ $machine = "orion" ]; then + FIX_DIR="/work/noaa/global/glopara/fix" fi for dir in fix_am fix_fv3 fix_orog fix_fv3_gmted2010 fix_sfc_climo; do [[ -d $dir ]] && rm -rf $dir diff --git a/modulefiles/build.orion b/modulefiles/build.orion index 0adf7b990..145ec66c8 100644 --- a/modulefiles/build.orion +++ b/modulefiles/build.orion @@ -10,22 +10,19 @@ module use -a /apps/contrib/NCEPLIBS/orion/modulefiles module load w3nco/2.1.0 module load nemsio/2.3.0 module load bacio/2.2.0 -module load sp/2.1.0 module load sfcio/1.2.0 module load sigio/2.2.0 module load gfsio/1.2.0 -module load w3emc/2.5.0 +module load w3emc/2.4.0 module load ip/3.1.0 module load nemsiogfs/2.3.0 module load landsfcutil/2.2.0 - -# George V's version. -module use -a /apps/contrib/NCEPLIBS/lib/modulefiles -module load g2-intel-sandybridge/2.5.0 - +module load g2/3.1.1 +module load sp/2.0.3 export Jasper_ROOT="/apps/jasper-1.900.1" -module load netcdf/4.7.2-parallel -module load esmf/8.0.0_ParallelNetCDF +module use -a /apps/contrib/NCEPLIBS/lib/modulefiles +module load netcdfp/4.7.4.release +module load esmflocal/8_0_0.release export WGRIB2_ROOT="/work/noaa/da/ggayno/save/wgrib2" diff --git a/modulefiles/module-setup.sh.inc b/modulefiles/module-setup.sh.inc index 48d2cd723..551381537 100644 --- a/modulefiles/module-setup.sh.inc +++ b/modulefiles/module-setup.sh.inc @@ -45,12 +45,6 @@ elif [[ -d /gpfs/hps && -e /etc/SuSE-release ]] ; then module use /gpfs/hps/nco/ops/nwprod/modulefiles module use /gpfs/hps/nco/ops/nwprod/lib/modulefiles module use /usrx/local/prod/modulefiles -elif [[ -d /dcom && -d /hwrf ]] ; then - # We are on NOAA Tide or Gyre - if ( ! eval module help > /dev/null 2>&1 ) ; then - source /usrx/local/Modules/default/init/$__ms_shell - fi - module purge elif [[ -L /usrx && "$( readlink /usrx 2> /dev/null )" =~ dell ]] ; then # We are on NOAA Mars or Venus if ( ! eval module help > /dev/null 2>&1 ) ; then diff --git a/reg_tests/chgres_cube/c192.fv3.history.sh b/reg_tests/chgres_cube/c192.fv3.history.sh index b29c66303..b76aae083 100755 --- a/reg_tests/chgres_cube/c192.fv3.history.sh +++ b/reg_tests/chgres_cube/c192.fv3.history.sh @@ -50,8 +50,17 @@ echo "Ending at: " `date` #----------------------------------------------------------------------------- # Compare output from chgres to baseline set of data. +# +# orion's nccmp utility does not work with the netcdf +# required to run ufs_utils. So swap it. #----------------------------------------------------------------------------- +machine=${machine:-NULL} +if [ $machine == 'orion' ]; then + module unload netcdfp/4.7.4.release + module load netcdf/4.7.2 +fi + cd $DATA test_failed=0 diff --git a/reg_tests/chgres_cube/c192.gfs.grib2.sh b/reg_tests/chgres_cube/c192.gfs.grib2.sh index 1ec76820f..0615f6832 100755 --- a/reg_tests/chgres_cube/c192.gfs.grib2.sh +++ b/reg_tests/chgres_cube/c192.gfs.grib2.sh @@ -45,8 +45,17 @@ echo "Ending at: " `date` #----------------------------------------------------------------------------- # Compare output from chgres to baseline set of data. +# +# orion's nccmp utility does not work with the netcdf +# required to run ufs_utils. So swap it. #----------------------------------------------------------------------------- +machine=${machine:-NULL} +if [ $machine == 'orion' ]; then + module unload netcdfp/4.7.4.release + module load netcdf/4.7.2 +fi + cd $DATA test_failed=0 diff --git a/reg_tests/chgres_cube/c96.fv3.nemsio.sh b/reg_tests/chgres_cube/c96.fv3.nemsio.sh index 43da0dc6d..5cb4fe7cf 100755 --- a/reg_tests/chgres_cube/c96.fv3.nemsio.sh +++ b/reg_tests/chgres_cube/c96.fv3.nemsio.sh @@ -41,8 +41,17 @@ echo "Ending at: " `date` #----------------------------------------------------------------------------- # Compare output from chgres to baseline set of data. +# +# orion's nccmp utility does not work with the netcdf +# required to run ufs_utils. So swap it. #----------------------------------------------------------------------------- +machine=${machine:-NULL} +if [ $machine == 'orion' ]; then + module unload netcdfp/4.7.4.release + module load netcdf/4.7.2 +fi + cd $DATA test_failed=0 diff --git a/reg_tests/chgres_cube/c96.fv3.netcdf.sh b/reg_tests/chgres_cube/c96.fv3.netcdf.sh index 8000f592c..615e39475 100755 --- a/reg_tests/chgres_cube/c96.fv3.netcdf.sh +++ b/reg_tests/chgres_cube/c96.fv3.netcdf.sh @@ -42,8 +42,17 @@ echo "Ending at: " `date` #----------------------------------------------------------------------------- # Compare output from chgres to baseline set of data. +# +# orion's nccmp utility does not work with the netcdf +# required to run ufs_utils. So swap it. #----------------------------------------------------------------------------- +machine=${machine:-NULL} +if [ $machine == 'orion' ]; then + module unload netcdfp/4.7.4.release + module load netcdf/4.7.2 +fi + cd $DATA test_failed=0 diff --git a/reg_tests/chgres_cube/c96.fv3.restart.sh b/reg_tests/chgres_cube/c96.fv3.restart.sh index 6e7107e5b..4e012a2e0 100755 --- a/reg_tests/chgres_cube/c96.fv3.restart.sh +++ b/reg_tests/chgres_cube/c96.fv3.restart.sh @@ -51,8 +51,17 @@ echo "Ending at: " `date` #----------------------------------------------------------------------------- # Compare output from chgres to baseline set of data. +# +# orion's nccmp utility does not work with the netcdf +# required to run ufs_utils. So swap it. #----------------------------------------------------------------------------- +machine=${machine:-NULL} +if [ $machine == 'orion' ]; then + module unload netcdfp/4.7.4.release + module load netcdf/4.7.2 +fi + cd $DATA test_failed=0 diff --git a/reg_tests/chgres_cube/c96.gfs.nemsio.sh b/reg_tests/chgres_cube/c96.gfs.nemsio.sh index a6d51a0b5..0f06d71d1 100755 --- a/reg_tests/chgres_cube/c96.gfs.nemsio.sh +++ b/reg_tests/chgres_cube/c96.gfs.nemsio.sh @@ -45,8 +45,17 @@ echo "Ending at: " `date` #----------------------------------------------------------------------------- # Compare output from chgres to baseline set of data. +# +# orion's nccmp utility does not work with the netcdf +# required to run ufs_utils. So swap it. #----------------------------------------------------------------------------- +machine=${machine:-NULL} +if [ $machine == 'orion' ]; then + module unload netcdfp/4.7.4.release + module load netcdf/4.7.2 +fi + cd $DATA test_failed=0 diff --git a/reg_tests/chgres_cube/c96.gfs.sigio.sh b/reg_tests/chgres_cube/c96.gfs.sigio.sh index 840dbf9eb..3a1e00fa3 100755 --- a/reg_tests/chgres_cube/c96.gfs.sigio.sh +++ b/reg_tests/chgres_cube/c96.gfs.sigio.sh @@ -9,6 +9,12 @@ set -x +# Orion won't let me set the ulimit in the driver script. Set it here. +machine=${machine:-NULL} +if [ $machine == 'orion' ]; then + ulimit -s 199000000 +fi + export DATA=$OUTDIR/c96_gfs_sigio rm -fr $DATA @@ -41,8 +47,16 @@ echo "Ending at: " `date` #----------------------------------------------------------------------------- # Compare output from chgres to baseline set of data. +# +# orion's nccmp utility does not work with the netcdf +# required to run ufs_utils. So swap it. #----------------------------------------------------------------------------- +if [ $machine == 'orion' ]; then + module unload netcdfp/4.7.4.release + module load netcdf/4.7.2 +fi + cd $DATA test_failed=0 diff --git a/reg_tests/chgres_cube/c96.regional.sh b/reg_tests/chgres_cube/c96.regional.sh index 9d15e9533..cecb199cc 100755 --- a/reg_tests/chgres_cube/c96.regional.sh +++ b/reg_tests/chgres_cube/c96.regional.sh @@ -47,8 +47,17 @@ echo "Ending at: " `date` #----------------------------------------------------------------------------- # Compare output from chgres to baseline set of data. +# +# orion's nccmp utility does not work with the netcdf +# required to run ufs_utils. So swap it. #----------------------------------------------------------------------------- +machine=${machine:-NULL} +if [ $machine == 'orion' ]; then + module unload netcdfp/4.7.4.release + module load netcdf/4.7.2 +fi + cd $DATA test_failed=0 diff --git a/reg_tests/chgres_cube/driver.orion.sh b/reg_tests/chgres_cube/driver.orion.sh new file mode 100755 index 000000000..3026082e1 --- /dev/null +++ b/reg_tests/chgres_cube/driver.orion.sh @@ -0,0 +1,133 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run the chgres_cube regression tests on Orion. +# +# Set OUTDIR to your working directory. Set the PROJECT_CODE and QUEUE +# as appropriate. To see which projects you are authorized to use, +# type "saccount_params". +# +# Invoke the script with no arguments. A series of daily-chained +# regression tests will be submitted. To check the queue, type: +# "squeue -u $LOGNAME". +# +# The run output will be stored in OUTDIR. Log output from the suite +# will be in LOG_FILE. Once the suite has completed, a summary is +# placed in SUM_FILE. +# +# A test fails when its output does not match the baseline files as +# determined by the "nccmp" utility. The baseline files are stored in +# HOMEreg. +# +#----------------------------------------------------------------------------- + +set -x + +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target +module list + +export OUTDIR=/work/noaa/stmp/$LOGNAME/chgres_reg_tests +PROJECT_CODE="fv3-cpu" +QUEUE="debug" + +#----------------------------------------------------------------------------- +# Should not have to change anything below here. HOMEufs is the root +# directory of your UFS_UTILS clone. HOMEreg contains the input data +# and baseline data for each test. +#----------------------------------------------------------------------------- + +export HOMEufs=$PWD/../.. + +export HOMEreg=/work/noaa/da/ggayno/save/ufs_utils.git/reg_tests/chgres_cube + +export NCCMP=/apps/nccmp-1.8.5/bin/nccmp + +LOG_FILE=regression.log +SUM_FILE=summary.log +rm -f $LOG_FILE $SUM_FILE + +export OMP_STACKSIZE=1024M + +export APRUN=srun + +export machine=orion + +rm -fr $OUTDIR + +#----------------------------------------------------------------------------- +# Initialize C96 using FV3 warm restart files. +#----------------------------------------------------------------------------- + +export OMP_NUM_THREADS=1 # needs to match cpus-per-task +TEST1=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.restart \ + -o $LOG_FILE -e $LOG_FILE ./c96.fv3.restart.sh) + +#----------------------------------------------------------------------------- +# Initialize C192 using FV3 tiled history files. +#----------------------------------------------------------------------------- + +export OMP_NUM_THREADS=1 # needs to match cpus-per-task +TEST2=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c192.fv3.history \ + --open-mode=append -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST1 ./c192.fv3.history.sh) + +#----------------------------------------------------------------------------- +# Initialize C96 using FV3 gaussian nemsio files. +#----------------------------------------------------------------------------- + +export OMP_NUM_THREADS=1 # needs to match cpus-per-task +TEST3=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.nemsio \ + --open-mode=append -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST2 ./c96.fv3.nemsio.sh) + +#----------------------------------------------------------------------------- +# Initialize C96 using spectral GFS sigio/sfcio files. +#----------------------------------------------------------------------------- + +export OMP_NUM_THREADS=6 # needs to match cpus-per-task +TEST4=$(sbatch --parsable --ntasks-per-node=3 --cpus-per-task=6 --nodes=2 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.gfs.sigio \ + --open-mode=append -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST3 ./c96.gfs.sigio.sh) + +#----------------------------------------------------------------------------- +# Initialize C96 using spectral GFS gaussian nemsio files. +#----------------------------------------------------------------------------- + +export OMP_NUM_THREADS=1 # needs to match cpus-per-task +TEST5=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.gfs.nemsio \ + --open-mode=append -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST4 ./c96.gfs.nemsio.sh) + +#----------------------------------------------------------------------------- +# Initialize regional C96 using FV3 gaussian nemsio files. +#----------------------------------------------------------------------------- + +export OMP_NUM_THREADS=1 # needs to match cpus-per-task +TEST6=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.regional \ + --open-mode=append -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST5 ./c96.regional.sh) + +#----------------------------------------------------------------------------- +# Initialize global C192 using GFS GRIB2 files. +#----------------------------------------------------------------------------- + +export OMP_NUM_THREADS=1 # needs to match cpus-per-task +TEST7=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_CODE -q $QUEUE -J c192.gfs.grib2 \ + --open-mode=append -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST6 ./c192.gfs.grib2.sh) + +#----------------------------------------------------------------------------- +# Initialize global C96 using FV3 gaussian netcdf files. +#----------------------------------------------------------------------------- + +export OMP_NUM_THREADS=1 # needs to match cpus-per-task +TEST8=$(sbatch --parsable --ntasks-per-node=6 --nodes=2 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J c96.fv3.netcdf \ + --open-mode=append -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST7 ./c96.fv3.netcdf.sh) + +#----------------------------------------------------------------------------- +# Create summary log. +#----------------------------------------------------------------------------- + +sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ + --open-mode=append -q $QUEUE -d afterok:$TEST8 << EOF +#!/bin/sh +grep -a '<<<' $LOG_FILE > $SUM_FILE +EOF + +exit 0 diff --git a/reg_tests/global_cycle/C768.fv3gfs.sh b/reg_tests/global_cycle/C768.fv3gfs.sh index 20909b6f3..b35743496 100755 --- a/reg_tests/global_cycle/C768.fv3gfs.sh +++ b/reg_tests/global_cycle/C768.fv3gfs.sh @@ -49,6 +49,15 @@ if [ $iret -ne 0 ]; then exit $iret fi +# orion's nccmp utility does not work with the netcdf +# required to run global_cycle. So swap it. + +machine=${machine:-NULL} +if [[ "$machine" = 'orion' ]]; then + module unload netcdfp/4.7.4.release + module load netcdf/4.7.2 +fi + test_failed=0 cd $DATA diff --git a/reg_tests/global_cycle/driver.orion.sh b/reg_tests/global_cycle/driver.orion.sh new file mode 100755 index 000000000..63c51f9f7 --- /dev/null +++ b/reg_tests/global_cycle/driver.orion.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run global_cycle regression test on Orion. +# +# Set $DATA to your working directory. Set the project code (SBATCH -A) +# and queue (SBATCH -q) as appropriate. +# +# Invoke the script as follows: sbatch $script +# +# Log output is placed in regression.log. A summary is +# placed in summary.log +# +# The test fails when its output does not match the baseline files +# as determined by the 'nccmp' utility. This baseline files are +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#SBATCH -J cycle_reg_test +#SBATCH -A fv3-cpu +#SBATCH --open-mode=truncate +#SBATCH -o regression.log +#SBATCH -e regression.log +#SBATCH --nodes=1 --ntasks-per-node=6 +#SBATCH -q debug +#SBATCH -t 00:05:00 + +set -x + +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target + +export DATA=/work/noaa/stmp/$LOGNAME/reg_tests.cycle + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +export HOMEreg=/work/noaa/da/ggayno/save/ufs_utils.git/reg_tests/global_cycle + +export OMP_NUM_THREADS_CY=2 + +export APRUNCY="srun" + +export NWPROD=$PWD/../.. + +export COMOUT=$DATA + +export NCCMP=/apps/nccmp-1.8.5/bin/nccmp + +export machine='orion' + +reg_dir=$PWD + +./C768.fv3gfs.sh + +cp $DATA/summary.log $reg_dir + +exit diff --git a/reg_tests/grid_gen/c96.uniform.sh b/reg_tests/grid_gen/c96.uniform.sh index d01f5f66d..73da0389d 100755 --- a/reg_tests/grid_gen/c96.uniform.sh +++ b/reg_tests/grid_gen/c96.uniform.sh @@ -33,8 +33,16 @@ echo "Ending at: " `date` #----------------------------------------------------------------------------- # Compare output to baseline set of data. +# +# Note: orion's nccmp utility does not work with the netcdf +# required to run ufs_utils. So swap it. #----------------------------------------------------------------------------- +if [[ "$machine" = "ORION" ]] ;then + module unload netcdfp/4.7.4.release + module load netcdf/4.7.2 +fi + cd $out_dir/C96 test_failed=0 diff --git a/reg_tests/grid_gen/driver.orion.sh b/reg_tests/grid_gen/driver.orion.sh new file mode 100755 index 000000000..2ae73ff2d --- /dev/null +++ b/reg_tests/grid_gen/driver.orion.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run grid generation regression tests on Orion. +# +# Set WORK_DIR to your working directory. Set the PROJECT_CODE and QUEUE +# as appropriate. To see which projects you are authorized to use, +# type "saccount_params". +# +# Invoke the script with no arguments. A series of daily- +# chained jobs will be submitted. To check the queue, type: +# "squeue -u $LOGNAME". +# +# Log output from the suite will be in LOG_FILE. Once the suite +# has completed, a summary is placed in SUM_FILE. +# +# A test fails when its output does not match the baseline files as +# determined by the "nccmp" utility. The baseline files are stored in +# HOMEreg +# +#----------------------------------------------------------------------------- + +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target + +set -x + +export WORK_DIR=/work/noaa/stmp/$LOGNAME/reg_tests.grid +QUEUE="batch" +PROJECT_CODE="fv3-cpu" + +#----------------------------------------------------------------------------- +# Should not have to change anything below here. +#----------------------------------------------------------------------------- + +LOG_FILE=regression.log +SUM_FILE=summary.log +export home_dir=$PWD/../.. +export APRUN=time +export APRUN_SFC=srun +export OMP_STACKSIZE=2048m +export OMP_NUM_THREADS=24 +export machine=ORION +export NCCMP=/apps/nccmp-1.8.5/bin/nccmp +export HOMEreg=/work/noaa/da/ggayno/save/ufs_utils.git/reg_tests/grid_gen/baseline_data + +rm -fr $WORK_DIR + +#----------------------------------------------------------------------------- +# C96 uniform grid +#----------------------------------------------------------------------------- + +TEST1=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:15:00 -A $PROJECT_CODE -q $QUEUE -J c96.uniform \ + -o $LOG_FILE -e $LOG_FILE ./c96.uniform.sh) + +#----------------------------------------------------------------------------- +# C96 regional grid +#----------------------------------------------------------------------------- + +TEST2=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_CODE -q $QUEUE -J gfdl.regional \ + --open-mode=append -o $LOG_FILE -e $LOG_FILE -d afterok:$TEST1 ./gfdl.regional.sh) + +#----------------------------------------------------------------------------- +# Create summary log. +#----------------------------------------------------------------------------- + +sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J grid_summary -o $LOG_FILE -e $LOG_FILE \ + --open-mode=append -q $QUEUE -d afterok:$TEST2 << EOF +#!/bin/sh +grep -a '<<<' $LOG_FILE > $SUM_FILE +EOF diff --git a/reg_tests/grid_gen/gfdl.regional.sh b/reg_tests/grid_gen/gfdl.regional.sh index 54fb934d8..05eb31e6c 100755 --- a/reg_tests/grid_gen/gfdl.regional.sh +++ b/reg_tests/grid_gen/gfdl.regional.sh @@ -42,8 +42,16 @@ echo "Ending at: " `date` #----------------------------------------------------------------------------- # Compare output to baseline set of data. +# +# Note: orion's nccmp utility does not work with the netcdf +# required to run ufs_utils. So swap it. #----------------------------------------------------------------------------- +if [[ "$machine" = "ORION" ]] ;then + module unload netcdfp/4.7.4.release + module load netcdf/4.7.2 +fi + cd $out_dir/C424 test_failed=0 diff --git a/reg_tests/ice_blend/driver.orion.sh b/reg_tests/ice_blend/driver.orion.sh new file mode 100755 index 000000000..188ede2bb --- /dev/null +++ b/reg_tests/ice_blend/driver.orion.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run ice_blend regression test on Orion. +# +# Set $DATA to your working directory. Set the project code (SBATCH -A) +# and queue (SBATCH -q) as appropriate. +# +# Invoke the script as follows: sbatch $script +# +# Log output is placed in regression.log. A summary is +# placed in summary.log +# +# The test fails when its output does not match the baseline file +# as determined by the 'cmp' command. The baseline file is +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#SBATCH -J ice_blend +#SBATCH -A fv3-cpu +#SBATCH --open-mode=truncate +#SBATCH -o regression.log +#SBATCH -e regression.log +#SBATCH --ntasks=1 +#SBATCH -q debug +#SBATCH -t 00:03:00 + +set -x + +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target + +export DATA="/work/noaa/stmp/$LOGNAME/reg_test.ice_blend" + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +export WGRIB=/apps/contrib/NCEPLIBS/orion/utils/grib_util.v1.2.0/exec/wgrib +export WGRIB2=/apps/contrib/NCEPLIBS/orion/utils/grib_util.v1.2.0/exec/wgrib2 +export COPYGB=/apps/contrib/NCEPLIBS/lib/NCEPLIBS-grib_util/v1.1.1/exec/copygb +export COPYGB2=/apps/contrib/NCEPLIBS/orion/utils/grib_util.v1.2.0/exec/copygb2 +export CNVGRIB=/apps/contrib/NCEPLIBS/orion/utils/grib_util.v1.2.0/exec/cnvgrib + +export HOMEreg=/work/noaa/da/ggayno/save/ufs_utils.git/reg_tests/ice_blend +export HOMEgfs=$PWD/../.. + +rm -fr $DATA + +./ice_blend.sh + +exit 0 diff --git a/reg_tests/snow2mdl/driver.orion.sh b/reg_tests/snow2mdl/driver.orion.sh new file mode 100755 index 000000000..fbc331510 --- /dev/null +++ b/reg_tests/snow2mdl/driver.orion.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# +# Run snow2mdl regression test on Orion. +# +# Set $DATA to your working directory. Set the project code (SBATCH -A) +# and queue (SBATCH -q) as appropriate. +# +# Invoke the script as follows: sbatch $script +# +# Log output is placed in regression.log. A summary is +# placed in summary.log +# +# The test fails when its output does not match the baseline file +# as determined by the 'cmp' command. The baseline file is +# stored in HOMEreg. +# +#----------------------------------------------------------------------------- + +#SBATCH -J snow +#SBATCH -A fv3-cpu +#SBATCH --open-mode=truncate +#SBATCH -o regression.log +#SBATCH -e regression.log +#SBATCH --ntasks=1 +#SBATCH -q debug +#SBATCH -t 00:03:00 + +set -x + +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target + +export DATA="/work/noaa/stmp/$LOGNAME/reg_tests.snow2mdl" + +#----------------------------------------------------------------------------- +# Should not have to change anything below. +#----------------------------------------------------------------------------- + +rm -fr $DATA + +export HOMEreg=/work/noaa/da/ggayno/save/ufs_utils.git/reg_tests/snow2mdl +export HOMEgfs=$PWD/../.. +export WGRIB=/apps/contrib/NCEPLIBS/orion/utils/grib_util.v1.2.0/exec/wgrib +export WGRIB2=/apps/contrib/NCEPLIBS/orion/utils/grib_util.v1.2.0/exec/wgrib2 + +./snow2mdl.sh + +exit 0 diff --git a/sorc/machine-setup.sh b/sorc/machine-setup.sh index 8389f2b0e..08e500537 100644 --- a/sorc/machine-setup.sh +++ b/sorc/machine-setup.sh @@ -77,15 +77,6 @@ elif [[ -L /usrx && "$( readlink /usrx 2> /dev/null )" =~ dell ]] ; then fi target=wcoss_dell_p3 module purge - -elif [[ -d /dcom && -d /hwrf ]] ; then - # We are on NOAA Tide or Gyre - if ( ! eval module help > /dev/null 2>&1 ) ; then - echo load the module command 1>&2 - source /usrx/local/Modules/default/init/$__ms_shell - fi - target=wcoss - module purge elif [[ -d /glade ]] ; then # We are on NCAR Yellowstone if ( ! eval module help > /dev/null 2>&1 ) ; then diff --git a/ush/load_fv3gfs_modules.sh b/ush/load_fv3gfs_modules.sh index 8972b6575..a8bb23662 100755 --- a/ush/load_fv3gfs_modules.sh +++ b/ush/load_fv3gfs_modules.sh @@ -24,9 +24,6 @@ elif [[ -d /gpfs/hps && -e /etc/SuSE-release ]] ; then elif [[ -L /usrx && "$( readlink /usrx 2> /dev/null )" =~ dell ]] ; then # We are on NOAA Mars or Venus module load module_base.wcoss_dell_p3 -elif [[ -d /dcom && -d /hwrf ]] ; then - # We are on NOAA Tide or Gyre - module load module_base.wcoss elif [[ -d /glade ]] ; then # We are on NCAR Yellowstone module load module_base.cheyenne From 7770042c6e94c7803d7b9bd74ea73501c2de8091 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Thu, 3 Sep 2020 13:30:32 -0400 Subject: [PATCH 029/192] Add lake-maker to grid generation process Adding the lake maker from Shan Sun and Ning Wang: generate lake fraction and depth on the FV3 grid and add these records to the orography files. Ensure land fraction and lake fraction are consistent. For details, see issue #111 --- driver_scripts/driver_grid.cray.sh | 26 +- driver_scripts/driver_grid.dell.sh | 21 +- driver_scripts/driver_grid.hera.sh | 19 +- driver_scripts/driver_grid.jet.sh | 19 +- driver_scripts/driver_grid.orion.sh | 19 +- sorc/CMakeLists.txt | 4 +- .../inland.fd/CMakeLists.txt | 19 + sorc/orog_mask_tools.fd/inland.fd/inland.F90 | 225 +++++ sorc/orog_mask_tools.fd/inland.fd/nb.F90 | 335 +++++++ .../orog_mask_tools.fd/lake.fd/CMakeLists.txt | 20 + .../lake.fd/enclosure_cnvx.F90 | 82 ++ .../orog_mask_tools.fd/lake.fd/find_limit.F90 | 100 ++ sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 | 896 ++++++++++++++++++ .../orog.fd/.gitignore | 0 .../orog.fd/CMakeLists.txt | 0 sorc/{ => orog_mask_tools.fd}/orog.fd/README | 0 .../orog.fd/README_OC | 0 .../orog.fd/machine.h | 0 .../orog.fd/mtnlm7_oclsm.f | 0 .../orog.fd/netcdf_io.F90 | 0 .../orog.fd/resevod.h | 0 sorc/sfc_climo_gen.fd/model_grid.F90 | 39 +- ush/fv3gfs_driver_grid.sh | 25 +- ush/fv3gfs_make_lake.sh | 99 ++ 24 files changed, 1901 insertions(+), 47 deletions(-) create mode 100644 sorc/orog_mask_tools.fd/inland.fd/CMakeLists.txt create mode 100644 sorc/orog_mask_tools.fd/inland.fd/inland.F90 create mode 100644 sorc/orog_mask_tools.fd/inland.fd/nb.F90 create mode 100644 sorc/orog_mask_tools.fd/lake.fd/CMakeLists.txt create mode 100644 sorc/orog_mask_tools.fd/lake.fd/enclosure_cnvx.F90 create mode 100644 sorc/orog_mask_tools.fd/lake.fd/find_limit.F90 create mode 100644 sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 rename sorc/{ => orog_mask_tools.fd}/orog.fd/.gitignore (100%) rename sorc/{ => orog_mask_tools.fd}/orog.fd/CMakeLists.txt (100%) rename sorc/{ => orog_mask_tools.fd}/orog.fd/README (100%) rename sorc/{ => orog_mask_tools.fd}/orog.fd/README_OC (100%) rename sorc/{ => orog_mask_tools.fd}/orog.fd/machine.h (100%) rename sorc/{ => orog_mask_tools.fd}/orog.fd/mtnlm7_oclsm.f (100%) rename sorc/{ => orog_mask_tools.fd}/orog.fd/netcdf_io.F90 (100%) rename sorc/{ => orog_mask_tools.fd}/orog.fd/resevod.h (100%) create mode 100755 ush/fv3gfs_make_lake.sh diff --git a/driver_scripts/driver_grid.cray.sh b/driver_scripts/driver_grid.cray.sh index 2abe26f72..28e68c4c7 100755 --- a/driver_scripts/driver_grid.cray.sh +++ b/driver_scripts/driver_grid.cray.sh @@ -36,21 +36,23 @@ # "regional_gfdl" - stand-alone gfdl regional grid # "regional_esg" - stand-alone extended Schmidt gnomonic # (esg) regional grid -# 3) For "stretch" and "nest" grids, set the stretching factor - +# 3) For "uniform" grids - to include lake fraction and +# depth, set "add_lake" to true, and the "lake_cutoff" value. +# 4) For "stretch" and "nest" grids, set the stretching factor - # "stretch_fac", and center lat/lon of highest resolution # tile - "target_lat" and "target_lon". -# 4) For "nest" grids, set the refinement ratio - "refine_ratio", +# 5) For "nest" grids, set the refinement ratio - "refine_ratio", # the starting/ending i/j index location within the parent # tile - "istart_nest", "jstart_nest", "iend_nest", "jend_nest" -# 5) For "regional_gfdl" grids, set the "halo". Default is three +# 6) For "regional_gfdl" grids, set the "halo". Default is three # rows/columns. -# 6) For "regional_esg" grids, set center lat/lon of grid, +# 7) For "regional_esg" grids, set center lat/lon of grid, # - "target_lat/lon" - the i/j dimensions - "i/jdim", the # x/y grid spacing - "delx/y", and halo. -# 7) Set working directory - TMPDIR - and path to the repository +# 8) Set working directory - TMPDIR - and path to the repository # clone - home_dir. -# 8) Submit script: "cat $script | bsub". -# 9) All files will be placed in "out_dir". +# 9) Submit script: "cat $script | bsub". +# 10) All files will be placed in "out_dir". # #----------------------------------------------------------------------- @@ -62,11 +64,14 @@ module list # Set grid specs here. #----------------------------------------------------------------------- -export gtype=uniform # 'uniform', 'stretch', 'nest' +export gtype=uniform # 'uniform', 'stretch', 'nest' # 'regional_gfdl', 'regional_esg' if [ $gtype = uniform ]; then export res=96 + export add_lake=false # Add lake frac and depth to orography data. + # Uniform grids only. + export lake_cutoff=0.20 # lake frac less than lake_cutoff is ignored elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid @@ -109,6 +114,10 @@ export home_dir=$LS_SUBCWD/.. export TMPDIR=/gpfs/hps3/stmp/$LOGNAME/fv3_grid.$gtype export out_dir=/gpfs/hps3/stmp/$LOGNAME/my_grids +#----------------------------------------------------------------------- +# Should not need to change anything below here. +#----------------------------------------------------------------------- + export NODES=1 export APRUN="aprun -n 1 -N 1 -j 1 -d 1 -cc depth" export APRUN_SFC="aprun -j 1 -n 24 -N 24" @@ -117,6 +126,7 @@ export OMP_NUM_THREADS=6 export OMP_STACKSIZE=2048m export KMP_AFFINITY=disabled export machine=WCOSS_C +export NCDUMP=/gpfs/hps/usrx/local/prod/NetCDF/4.2/intel/sandybridge/bin/ncdump ulimit -a ulimit -s unlimited diff --git a/driver_scripts/driver_grid.dell.sh b/driver_scripts/driver_grid.dell.sh index a1d891fe7..c6da158fc 100755 --- a/driver_scripts/driver_grid.dell.sh +++ b/driver_scripts/driver_grid.dell.sh @@ -38,21 +38,23 @@ # "regional_gfdl" - stand-alone gfdl regional grid # "regional_esg" - stand-alone extended Schmidt gnomonic # (esg) regional grid -# 3) For "stretch" and "nest" grids, set the stretching factor - +# 3) For "uniform" grids - to include lake fraction and +# depth, set "add_lake" to true, and the "lake_cutoff" value. +# 4) For "stretch" and "nest" grids, set the stretching factor - # "stretch_fac", and center lat/lon of highest resolution # tile - "target_lat" and "target_lon". -# 4) For "nest" grids, set the refinement ratio - "refine_ratio", +# 5) For "nest" grids, set the refinement ratio - "refine_ratio", # the starting/ending i/j index location within the parent # tile - "istart_nest", "jstart_nest", "iend_nest", "jend_nest" -# 5) For "regional_gfdl" grids, set the "halo". Default is three +# 6) For "regional_gfdl" grids, set the "halo". Default is three # rows/columns. -# 6) For "regional_esg" grids, set center lat/lon of grid, +# 7) For "regional_esg" grids, set center lat/lon of grid, # - "target_lat/lon" - the i/j dimensions - "i/jdim", the # x/y grid spacing - "delx/y", and halo. -# 7) Set working directory - TMPDIR - and path to the repository +# 8) Set working directory - TMPDIR - and path to the repository # clone - home_dir. -# 8) Submit script: "cat $script | bsub". -# 9) All files will be placed in "out_dir". +# 9) Submit script: "cat $script | bsub". +# 10) All files will be placed in "out_dir". # #----------------------------------------------------------------------- @@ -65,10 +67,13 @@ module list #----------------------------------------------------------------------- export gtype=uniform # 'uniform', 'stretch', 'nest', - # 'regional_gfdl', 'regional_esg' + # 'regional_gfdl', 'regional_esg' if [ $gtype = uniform ]; then export res=96 + export add_lake=false # Add lake frac and depth to orography data. + # Uniform grids only. + export lake_cutoff=0.20 # lake frac less than lake_cutoff is ignored elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid diff --git a/driver_scripts/driver_grid.hera.sh b/driver_scripts/driver_grid.hera.sh index 50f13fbee..75c986aba 100755 --- a/driver_scripts/driver_grid.hera.sh +++ b/driver_scripts/driver_grid.hera.sh @@ -36,21 +36,23 @@ # "regional_gfdl" - stand-alone gfdl regional grid # "regional_esg" - stand-alone extended Schmidt gnomonic # (esg) regional grid -# 3) For "stretch" and "nest" grids, set the stretching factor - +# 3) For "uniform" grids - to include lake fraction and +# depth, set "add_lake" to true, and the "lake_cutoff" value. +# 4) For "stretch" and "nest" grids, set the stretching factor - # "stretch_fac", and center lat/lon of highest resolution # tile - "target_lat" and "target_lon". -# 4) For "nest" grids, set the refinement ratio - "refine_ratio", +# 5) For "nest" grids, set the refinement ratio - "refine_ratio", # the starting/ending i/j index location within the parent # tile - "istart_nest", "jstart_nest", "iend_nest", "jend_nest" -# 5) For "regional_gfdl" grids, set the "halo". Default is three +# 6) For "regional_gfdl" grids, set the "halo". Default is three # rows/columns. -# 6) For "regional_esg" grids, set center lat/lon of grid, +# 7) For "regional_esg" grids, set center lat/lon of grid, # - "target_lat/lon" - the i/j dimensions - "i/jdim", the # x/y grid spacing - "delx/y", and halo. -# 7) Set working directory - TMPDIR - and path to the repository +# 8) Set working directory - TMPDIR - and path to the repository # clone - home_dir. -# 8) Submit script: "sbatch $script". -# 9) All files will be placed in "out_dir". +# 9) Submit script: "sbatch $script". +# 10) All files will be placed in "out_dir". # #----------------------------------------------------------------------- @@ -69,6 +71,9 @@ export gtype=uniform # 'uniform', 'stretch', 'nest' if [ $gtype = uniform ]; then export res=96 + export add_lake=false # Add lake frac and depth to orography data. + # Uniform grids only. + export lake_cutoff=0.20 # lake frac less than lake_cutoff is ignored elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid diff --git a/driver_scripts/driver_grid.jet.sh b/driver_scripts/driver_grid.jet.sh index 179864abd..650b39820 100755 --- a/driver_scripts/driver_grid.jet.sh +++ b/driver_scripts/driver_grid.jet.sh @@ -37,21 +37,23 @@ # "regional_gfdl" - stand-alone gfdl regional grid # "regional_esg" - stand-alone extended Schmidt gnomonic # (esg) regional grid -# 3) For "stretch" and "nest" grids, set the stretching factor - +# 3) For "uniform" grids - to include lake fraction and +# depth, set "add_lake" to true, and the "lake_cutoff" value. +# 4) For "stretch" and "nest" grids, set the stretching factor - # "stretch_fac", and center lat/lon of highest resolution # tile - "target_lat" and "target_lon". -# 4) For "nest" grids, set the refinement ratio - "refine_ratio", +# 5) For "nest" grids, set the refinement ratio - "refine_ratio", # the starting/ending i/j index location within the parent # tile - "istart_nest", "jstart_nest", "iend_nest", "jend_nest" -# 5) For "regional_gfdl" grids, set the "halo". Default is three +# 6) For "regional_gfdl" grids, set the "halo". Default is three # rows/columns. -# 6) For "regional_esg" grids, set center lat/lon of grid, +# 7) For "regional_esg" grids, set center lat/lon of grid, # - "target_lat/lon" - the i/j dimensions - "i/jdim", the # x/y grid spacing - "delx/y", and halo. -# 7) Set working directory - TMPDIR - and path to the repository +# 8) Set working directory - TMPDIR - and path to the repository # clone - home_dir. -# 8) Submit script: "sbatch $script". -# 9) All files will be placed in "out_dir". +# 9) Submit script: "sbatch $script". +# 10) All files will be placed in "out_dir". # #----------------------------------------------------------------------- @@ -70,6 +72,9 @@ export gtype=uniform # 'uniform', 'stretch', 'nest' if [ $gtype = uniform ]; then export res=96 + export add_lake=false # Add lake frac and depth to orography data. + # Uniform grids only. + export lake_cutoff=0.20 # lake frac less than lake_cutoff is ignored elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid diff --git a/driver_scripts/driver_grid.orion.sh b/driver_scripts/driver_grid.orion.sh index 66a2955d5..208596da3 100755 --- a/driver_scripts/driver_grid.orion.sh +++ b/driver_scripts/driver_grid.orion.sh @@ -36,21 +36,23 @@ # "regional_gfdl" - stand-alone gfdl regional grid # "regional_esg" - stand-alone extended Schmidt # gnomonic (esg) regional grid -# 3) For "stretch" and "nest" grids, set the stretching factor - +# 3) For "uniform" grids - to include lake fraction and +# depth, set "add_lake" to true, and the "lake_cutoff" value. +# 4) For "stretch" and "nest" grids, set the stretching factor - # "stretch_fac", and center lat/lon of highest resolution # tile - "target_lat" and "target_lon". -# 4) For "nest" grids, set the refinement ratio - "refine_ratio", +# 5) For "nest" grids, set the refinement ratio - "refine_ratio", # the starting/ending i/j index location within the parent # tile - "istart_nest", "jstart_nest", "iend_nest", "jend_nest" -# 5) For "regional_gfdl" grids, set the "halo". Default is three +# 6) For "regional_gfdl" grids, set the "halo". Default is three # rows/columns. -# 6) For "regional_esg" grids, set center lat/lon of grid, +# 7) For "regional_esg" grids, set center lat/lon of grid, # - "target_lat/lon" - the i/j dimensions - "i/jdim", the # x/y grid spacing - "delx/y", and halo. -# 7) Set working directory - TMPDIR - and path to the repository +# 8) Set working directory - TMPDIR - and path to the repository # clone - home_dir. -# 8) Submit script: "sbatch $script". -# 9) All files will be placed in "out_dir". +# 9) Submit script: "sbatch $script". +# 10) All files will be placed in "out_dir". # #----------------------------------------------------------------------- @@ -69,6 +71,9 @@ export gtype=uniform # 'uniform', 'stretch', 'nest', if [ $gtype = uniform ]; then export res=96 + export add_lake=false # Add lake frac and depth to orography data. + # Uniform grids only. + export lake_cutoff=0.20 # lake frac less than lake_cutoff is ignored elif [ $gtype = stretch ]; then export res=96 export stretch_fac=1.5 # Stretching factor for the grid diff --git a/sorc/CMakeLists.txt b/sorc/CMakeLists.txt index fbf3ce95c..6daacc548 100644 --- a/sorc/CMakeLists.txt +++ b/sorc/CMakeLists.txt @@ -15,5 +15,7 @@ add_subdirectory(mkgfsnemsioctl.fd) add_subdirectory(fre-nctools.fd) add_subdirectory(grid_tools.fd) add_subdirectory(chgres_cube.fd) -add_subdirectory(orog.fd) +add_subdirectory(orog_mask_tools.fd/orog.fd) +add_subdirectory(orog_mask_tools.fd/lake.fd) +add_subdirectory(orog_mask_tools.fd/inland.fd) add_subdirectory(sfc_climo_gen.fd) diff --git a/sorc/orog_mask_tools.fd/inland.fd/CMakeLists.txt b/sorc/orog_mask_tools.fd/inland.fd/CMakeLists.txt new file mode 100644 index 000000000..e2078e76f --- /dev/null +++ b/sorc/orog_mask_tools.fd/inland.fd/CMakeLists.txt @@ -0,0 +1,19 @@ +set(fortran_src + nb.F90 + inland.F90) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -assume byterecl") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-range-check") +endif() + +set(exe_name inland) + +add_executable(${exe_name} ${fortran_src}) + +target_link_libraries( + ${exe_name} + NetCDF::NetCDF_Fortran) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/orog_mask_tools.fd/inland.fd/inland.F90 b/sorc/orog_mask_tools.fd/inland.fd/inland.F90 new file mode 100644 index 000000000..cdeb5a303 --- /dev/null +++ b/sorc/orog_mask_tools.fd/inland.fd/inland.F90 @@ -0,0 +1,225 @@ +!<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> +! This program creates the inland mask and writes it to the orography data files. +! +! Ning Wang, July 1, 2020, original version. +! +!<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> +PROGRAM inland_mask + USE cs_nb + IMPLICIT NONE + + INTEGER :: tile, i, j + TYPE(nb_gp_idx) :: nbs + + REAL, ALLOCATABLE :: inland(:,:,:) + REAL, ALLOCATABLE :: land_frac(:,:,:) + INTEGER :: i_ctr, j_ctr, tile_beg, tile_end + INTEGER :: cs_res + CHARACTER(len=32) :: arg + INTEGER :: stat + INTEGER :: max_rd + REAL :: cutoff + + LOGICAL, ALLOCATABLE :: done(:,:,:) + +! CALL getarg(0, arg) ! get the program name +! IF (iargc() /= 3) THEN +! PRINT*, 'Usage: ', trim(arg), ' [resolution (48,96, ...)] [non-land cutoff] [max recursive depth]' +! STOP +! ENDIF + + CALL getarg(1, arg) + READ(arg,*,iostat=stat) cs_res + CALL getarg(2, arg) + READ(arg,*,iostat=stat) cutoff + CALL getarg(3, arg) + READ(arg,*,iostat=stat) max_rd + + ALLOCATE(done(cs_res,cs_res,6)) + ALLOCATE(inland(cs_res,cs_res,6)) + ALLOCATE(land_frac(cs_res,cs_res,6)) + + tile_beg = 1; tile_end = 6 + +! init inter-panel neighbor index + CALL idx_init(cs_res) + +! read in orography data + CALL read_orog(cs_res) + +! create a inland mask + CALL mark_global_inland(cs_res) + +! write back to the orography data files + CALL write_inland(cs_res) + +CONTAINS + +SUBROUTINE mark_global_inland(cs_res) + INTEGER, INTENT(IN) :: cs_res + + done = .false. + inland = 1.0 + i_ctr = cs_res/2; j_ctr = cs_res/2 + + CALL mark_global_inland_rec_d(i_ctr, j_ctr, 2, 0) + +END SUBROUTINE mark_global_inland + +RECURSIVE SUBROUTINE mark_global_inland_rec_d(i, j, t, rd) + INTEGER, INTENT(IN) :: i, j, t, rd + + TYPE(nb_gp_idx) :: nbs + INTEGER :: k, nrd + + IF (land_frac(i,j,t) <= 0.15) THEN + nrd = 1 + ELSE + nrd = rd + 1 + ENDIF + + IF (nrd > max_rd) RETURN + + IF (done(i,j,t)) RETURN + IF (land_frac(i,j,t) < cutoff) THEN + done(i,j,t) = .true. + inland(i,j,t) = 0.0 + CALL neighbors(t, i, j, nbs) + ! recursively go through k neighbors + DO k = 1, 4 + CALL mark_global_inland_rec_d(nbs%ijt(1,k),nbs%ijt(2,k),nbs%ijt(3,k),nrd) + ENDDO + ENDIF + +END SUBROUTINE mark_global_inland_rec_d + +RECURSIVE SUBROUTINE mark_global_inland_rec(i, j, t) + INTEGER, INTENT(IN) :: i, j, t + + TYPE(nb_gp_idx) :: nbs + INTEGER :: k + + IF (done(i,j,t)) RETURN + IF (land_frac(i,j,t) < 0.9) THEN + done(i,j,t) = .true. + inland(i,j,t) = 0.0 + CALL neighbors(t, i, j, nbs) + ! recursively go through k neighbors + DO k = 1, 4 + CALL mark_global_inland_rec(nbs%ijt(1,k), nbs%ijt(2,k), nbs%ijt(3,k)) + ENDDO + ENDIF + +END SUBROUTINE mark_global_inland_rec + +SUBROUTINE read_orog(cs_res) + USE netcdf + INTEGER, INTENT(IN) :: cs_res + + INTEGER :: tile_sz, tile_num + INTEGER :: stat, ncid, x_dimid, y_dimid, varid + INTEGER :: land_frac_id, slmsk_id, geolon_id, geolat_id + CHARACTER(len=256) :: filename,string + CHARACTER(len=1) :: ich + CHARACTER(len=4) res_ch + + INTEGER :: i, j + REAL, ALLOCATABLE :: var_tmp(:,:) + + tile_sz = cs_res*cs_res + ALLOCATE(var_tmp(cs_res,cs_res)) + + WRITE(res_ch,'(I4)') cs_res + DO tile_num = tile_beg, tile_end + WRITE(ich, '(I1)') tile_num + filename = "oro.C" // trim(adjustl(res_ch)) // ".tile" // ich // ".nc" + print *,'Read, update, and write ',trim(filename) + stat = nf90_open(filename, NF90_NOWRITE, ncid) + CALL nc_opchk(stat, "nf90_open oro_data.nc") +! original orodata netcdf file uses (y, x) order, so we made change to match it. + stat = nf90_inq_varid(ncid, "land_frac", land_frac_id) + CALL nc_opchk(stat, "nf90_inq_varid: land_frac") + stat = nf90_get_var(ncid, land_frac_id, var_tmp, & + start = (/ 1, 1 /), count = (/ cs_res, cs_res /) ) + CALL nc_opchk(stat, "nf90_get_var: land_frac") + land_frac(:,:,tile_num) = var_tmp(:,:) + stat = nf90_close(ncid) + CALL nc_opchk(stat, "nf90_close oro_data.nc") + ENDDO + + DEALLOCATE(var_tmp) + +END SUBROUTINE read_orog + +SUBROUTINE write_inland(cs_res) + USE netcdf + INTEGER, INTENT(IN) :: cs_res + + CHARACTER(len=256) :: filename + CHARACTER(len=1) :: ich + CHARACTER(len=4) res_ch + + INTEGER :: tile_num + INTEGER :: stat, ncid, x_dimid, y_dimid, inland_id, dimids(2) + REAL, ALLOCATABLE :: var_tmp(:,:) + + ALLOCATE(var_tmp(cs_res,cs_res)) + + WRITE(res_ch,'(I4)') cs_res + DO tile_num = tile_beg, tile_end + WRITE(ich, '(I1)') tile_num + filename = "oro.C" // trim(adjustl(res_ch)) // ".tile" // ich // ".nc" + print *,'write inland to ',trim(filename) + stat = nf90_open(filename, NF90_WRITE, ncid) + CALL nc_opchk(stat, "nf90_open oro_data.nc") + stat = nf90_inq_dimid(ncid, "lon", x_dimid) + CALL nc_opchk(stat, "nf90_inq_dim: x") + stat = nf90_inq_dimid(ncid, "lat", y_dimid) + CALL nc_opchk(stat, "nf90_inq_dim: y") + +! original orodata netcdf file uses (y, x) order, so we made change to match it. + dimids = (/ x_dimid, y_dimid /) + +! define a new variables + stat = nf90_redef(ncid) + CALL nc_opchk(stat, "nf90_redef") + stat = nf90_def_var(ncid,"inland",NF90_FLOAT,dimids,inland_id) + CALL nc_opchk(stat, "nf90_def_var: inland") + stat = nf90_put_att(ncid, inland_id,'coordinates','geolon geolat') + CALL nc_opchk(stat, "nf90_put_att: inland:coordinates") + stat = nf90_put_att(ncid, inland_id,'description', & + 'inland = 1 indicates grid cells away from coast') + CALL nc_opchk(stat, "nf90_put_att: inland:description") + + stat = nf90_enddef(ncid) + CALL nc_opchk(stat, "nf90_enddef") + + var_tmp(:,:) = inland(:,:,tile_num) + stat = nf90_put_var(ncid, inland_id, var_tmp, & + start = (/ 1, 1 /), count = (/ cs_res, cs_res /) ) + CALL nc_opchk(stat, "nf90_put_var: inland") + + stat = nf90_close(ncid) + CALL nc_opchk(stat, "nf90_close oro_data.nc") + ENDDO + DEALLOCATE(var_tmp) + +END SUBROUTINE write_inland + +SUBROUTINE nc_opchk(stat,opname) + USE netcdf + IMPLICIT NONE + INTEGER stat + CHARACTER(len=*) opname + CHARACTER(64) msg + + IF (stat .NE.0) THEN + msg = trim(opname) // ' Error, status code and message:' + PRINT*,trim(msg), stat, nf90_strerror(stat) + STOP + END IF + +END SUBROUTINE nc_opchk + +END PROGRAM inland_mask + diff --git a/sorc/orog_mask_tools.fd/inland.fd/nb.F90 b/sorc/orog_mask_tools.fd/inland.fd/nb.F90 new file mode 100644 index 000000000..32b77abdf --- /dev/null +++ b/sorc/orog_mask_tools.fd/inland.fd/nb.F90 @@ -0,0 +1,335 @@ +!<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> +! This module contains the subroutines that find the adjacent neighbors of a +! given cell, in a cubed sphere grid. Each neighbor is in the form of (i,j,tile). +! +! Ning Wang, July 1, 2020, original version. +! +!<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> + +MODULE cs_nb + IMPLICIT NONE + + TYPE nb_tile_idx + INTEGER :: nb_tile_num + CHARACTER (1) :: nb_tile_bndry + END TYPE nb_tile_idx + + TYPE nb_gp_idx + INTEGER :: gp_type + INTEGER :: ijt(3,8) + END TYPE nb_gp_idx + + TYPE(nb_tile_idx):: nb_tile(4,6) + TYPE(nb_gp_idx):: nb_index + + INTEGER :: cres + + +CONTAINS + +! _______1_______ +! | | 1-upper, 2-bottom, 3-left, 4-right +! | | +! | | +! 3| |4 +! | | +! | | +! |_______________| +! 2 +! Figure 1. Boundary numbers +! + SUBROUTINE idx_init(cres_in) + INTEGER :: cres_in + + nb_tile(1,1)%nb_tile_num = 3; nb_tile(1,1)%nb_tile_bndry ='l' + nb_tile(2,1)%nb_tile_num = 6; nb_tile(2,1)%nb_tile_bndry ='t' + nb_tile(3,1)%nb_tile_num = 5; nb_tile(3,1)%nb_tile_bndry ='t' + nb_tile(4,1)%nb_tile_num = 2; nb_tile(4,1)%nb_tile_bndry ='l' + + nb_tile(1,2)%nb_tile_num = 3; nb_tile(1,2)%nb_tile_bndry ='b' + nb_tile(2,2)%nb_tile_num = 6; nb_tile(2,2)%nb_tile_bndry ='r' + nb_tile(3,2)%nb_tile_num = 1; nb_tile(3,2)%nb_tile_bndry ='r' + nb_tile(4,2)%nb_tile_num = 4; nb_tile(4,2)%nb_tile_bndry ='b' + + nb_tile(1,3)%nb_tile_num = 5; nb_tile(1,3)%nb_tile_bndry ='l' + nb_tile(2,3)%nb_tile_num = 2; nb_tile(2,3)%nb_tile_bndry ='t' + nb_tile(3,3)%nb_tile_num = 1; nb_tile(3,3)%nb_tile_bndry ='t' + nb_tile(4,3)%nb_tile_num = 4; nb_tile(4,3)%nb_tile_bndry ='l' + + nb_tile(1,4)%nb_tile_num = 5; nb_tile(1,4)%nb_tile_bndry ='b' + nb_tile(2,4)%nb_tile_num = 2; nb_tile(2,4)%nb_tile_bndry ='r' + nb_tile(3,4)%nb_tile_num = 3; nb_tile(3,4)%nb_tile_bndry ='r' + nb_tile(4,4)%nb_tile_num = 6; nb_tile(4,4)%nb_tile_bndry ='b' + + nb_tile(1,5)%nb_tile_num = 1; nb_tile(1,5)%nb_tile_bndry ='l' + nb_tile(2,5)%nb_tile_num = 4; nb_tile(2,5)%nb_tile_bndry ='t' + nb_tile(3,5)%nb_tile_num = 3; nb_tile(3,5)%nb_tile_bndry ='t' + nb_tile(4,5)%nb_tile_num = 6; nb_tile(4,5)%nb_tile_bndry ='l' + + nb_tile(1,6)%nb_tile_num = 1; nb_tile(1,6)%nb_tile_bndry ='b' + nb_tile(2,6)%nb_tile_num = 4; nb_tile(2,6)%nb_tile_bndry ='r' + nb_tile(3,6)%nb_tile_num = 5; nb_tile(3,6)%nb_tile_bndry ='r' + nb_tile(4,6)%nb_tile_num = 2; nb_tile(4,6)%nb_tile_bndry ='b' + + cres = cres_in + + END SUBROUTINE idx_init + + INTEGER FUNCTION bndry(i, j) + INTEGER :: i,j + + bndry = 0 ! no boundary + + IF (j == cres) THEN ! upper boundary + bndry = 1 + IF (i == 1) THEN + bndry = 13 + ELSE IF (i == cres) THEN + bndry = 14 + ENDIF + ELSE IF (j == 1) THEN ! bottom boundary + bndry = 2 + IF (i == 1) THEN + bndry = 23 + ELSE IF (i == cres) THEN + bndry = 24 + ENDIF + ELSE IF (i == 1) THEN ! left boundary + bndry = 3 + ELSE IF (i == cres) THEN ! right boundary + bndry = 4 + ENDIF + + END FUNCTION bndry + +! ______________ +! | | | | ________ +! | 5 | 1 | 6 | /\ 1 \ 6 \ +! |____|____|____| / \___\___\ +! | | | | /\2 / c / 3 / +! | 2 | c | 3 | / \/___/___/ +! |____|____|____| \7 / 4 / 8 / +! | | | | \/___/___/ +! | 7 | 4 | 8 | +! |____|____|____| +! +! Figure 2. Eight neighbors of cell 'c' and special cases at upper left +! cornner of the tile +! + SUBROUTINE neighbors(tile, i, j, nb) + INTEGER :: tile, i, j + TYPE(nb_gp_idx) :: nb + + INTEGER :: bd, nb_t_num + + nb%gp_type = bndry(i,j) + IF (nb%gp_type == 0) THEN ! interior (non-boundary) cell + ! top, bottom, left, and right + nb%ijt(1,1) = i; nb%ijt(2,1) = j+1; nb%ijt(3,1) = tile + nb%ijt(1,2) = i-1; nb%ijt(2,2) = j; nb%ijt(3,2) = tile + nb%ijt(1,3) = i+1; nb%ijt(2,3) = j; nb%ijt(3,3) = tile + nb%ijt(1,4) = i; nb%ijt(2,4) = j-1; nb%ijt(3,4) = tile + ! top left, top right, bottom left, and bottom right + nb%ijt(1,5) = i-1; nb%ijt(2,5) = j+1; nb%ijt(3,5) = tile + nb%ijt(1,6) = i+1; nb%ijt(2,6) = j+1; nb%ijt(3,6) = tile + nb%ijt(1,7) = i-1; nb%ijt(2,7) = j-1; nb%ijt(3,7) = tile + nb%ijt(1,8) = i+1; nb%ijt(2,8) = j-1; nb%ijt(3,8) = tile + ELSEIF (nb%gp_type == 1) THEN ! top boundary cell + bd = 1 + nb_t_num = nb_tile(nb%gp_type,tile)%nb_tile_num + nb%ijt(3,1)=nb_t_num; nb%ijt(3,5)=nb_t_num; nb%ijt(3,6)=nb_t_num + IF (nb_tile(bd,tile)%nb_tile_bndry == 'l') THEN + nb%ijt(1,1) = 1; nb%ijt(2,1) = cres+1-i; + nb%ijt(1,5) = 1; nb%ijt(2,5) = cres+1-(i-1); + nb%ijt(1,6) = 1; nb%ijt(2,6) = cres+1-(i+1); + ELSEIF (nb_tile(bd,tile)%nb_tile_bndry == 'b') THEN + nb%ijt(1,1) = i; nb%ijt(2,1) = 1 + nb%ijt(1,5) = i-1; nb%ijt(2,5) = 1 + nb%ijt(1,6) = i+1; nb%ijt(2,6) = 1 + ENDIF + nb%ijt(1,2) = i-1; nb%ijt(2,2) = j; nb%ijt(3,2) = tile + nb%ijt(1,3) = i+1; nb%ijt(2,3) = j; nb%ijt(3,3) = tile + nb%ijt(1,4) = i; nb%ijt(2,4) = j-1; nb%ijt(3,4) = tile + nb%ijt(1,7) = i-1; nb%ijt(2,7) = j-1; nb%ijt(3,7) = tile + nb%ijt(1,8) = i+1; nb%ijt(2,8) = j-1; nb%ijt(3,8) = tile + ELSEIF (nb%gp_type == 2) THEN ! bottom boundary cell + bd = 2 + nb_t_num = nb_tile(nb%gp_type,tile)%nb_tile_num + nb%ijt(3,4)=nb_t_num; nb%ijt(3,7)=nb_t_num; nb%ijt(3,8)=nb_t_num + IF (nb_tile(bd,tile)%nb_tile_bndry == 'r') THEN + nb%ijt(1,4) = cres; nb%ijt(2,4) = cres+1-i; + nb%ijt(1,7) = cres; nb%ijt(2,7) = cres+1-(i-1); + nb%ijt(1,8) = cres; nb%ijt(2,8) = cres+1-(i+1); + ELSEIF (nb_tile(bd,tile)%nb_tile_bndry == 't') THEN + nb%ijt(1,4) = i; nb%ijt(2,4) = cres + nb%ijt(1,7) = i-1; nb%ijt(2,7) = cres + nb%ijt(1,8) = i+1; nb%ijt(2,8) = cres + ENDIF + nb%ijt(1,1) = i; nb%ijt(2,1) = j+1; nb%ijt(3,1) = tile + nb%ijt(1,2) = i-1; nb%ijt(2,2) = j; nb%ijt(3,2) = tile + nb%ijt(1,3) = i+1; nb%ijt(2,3) = j; nb%ijt(3,3) = tile + nb%ijt(1,5) = i-1; nb%ijt(2,5) = j+1; nb%ijt(3,5) = tile + nb%ijt(1,6) = i+1; nb%ijt(2,6) = j+1; nb%ijt(3,6) = tile + ELSEIF (nb%gp_type == 3) THEN ! left boundary cell + bd = 3 + nb_t_num = nb_tile(nb%gp_type,tile)%nb_tile_num + nb%ijt(3,2)=nb_t_num; nb%ijt(3,5)=nb_t_num; nb%ijt(3,7)=nb_t_num + IF (nb_tile(bd,tile)%nb_tile_bndry == 'r') THEN + nb%ijt(1,2) = cres; nb%ijt(2,2) = j; + nb%ijt(1,5) = cres; nb%ijt(2,5) = j+1; + nb%ijt(1,7) = cres; nb%ijt(2,7) = j-1; + ELSEIF (nb_tile(bd,tile)%nb_tile_bndry == 't') THEN + nb%ijt(1,2) = cres+1-j; nb%ijt(2,2) = cres + nb%ijt(1,5) = cres+1-(j+1); nb%ijt(2,5) = cres + nb%ijt(1,7) = cres+1-(j-1); nb%ijt(2,7) = cres + ENDIF + nb%ijt(1,1) = i; nb%ijt(2,1) = j+1; nb%ijt(3,1) = tile + nb%ijt(1,3) = i+1; nb%ijt(2,3) = j; nb%ijt(3,3) = tile + nb%ijt(1,4) = i; nb%ijt(2,4) = j-1; nb%ijt(3,4) = tile + nb%ijt(1,6) = i+1; nb%ijt(2,6) = j+1; nb%ijt(3,6) = tile + nb%ijt(1,8) = i+1; nb%ijt(2,8) = j-1; nb%ijt(3,8) = tile + ELSEIF (nb%gp_type == 4) THEN ! right boundary cell + bd = 4 + nb_t_num = nb_tile(nb%gp_type,tile)%nb_tile_num + nb%ijt(3,3)=nb_t_num; nb%ijt(3,6)=nb_t_num; nb%ijt(3,8)=nb_t_num + IF (nb_tile(bd,tile)%nb_tile_bndry == 'l') THEN + nb%ijt(1,3) = 1; nb%ijt(2,3) = j; + nb%ijt(1,6) = 1; nb%ijt(2,6) = j+1; + nb%ijt(1,8) = 1; nb%ijt(2,8) = j-1; + ELSEIF (nb_tile(bd,tile)%nb_tile_bndry == 'b') THEN + nb%ijt(1,3) = cres+1-j; nb%ijt(2,3) = 1 + nb%ijt(1,6) = cres+1-(j+1); nb%ijt(2,6) = 1 + nb%ijt(1,8) = cres+1-(j-1); nb%ijt(2,8) = 1 + ENDIF + nb%ijt(1,1) = i; nb%ijt(2,1) = j+1; nb%ijt(3,1) = tile + nb%ijt(1,2) = i-1; nb%ijt(2,2) = j; nb%ijt(3,2) = tile + nb%ijt(1,4) = i; nb%ijt(2,4) = j-1; nb%ijt(3,4) = tile + nb%ijt(1,5) = i-1; nb%ijt(2,5) = j+1; nb%ijt(3,5) = tile + nb%ijt(1,7) = i-1; nb%ijt(2,7) = j-1; nb%ijt(3,7) = tile + ELSEIF (nb%gp_type == 13) THEN ! upper left coner + bd = 1 + nb_t_num = nb_tile(bd,tile)%nb_tile_num + nb%ijt(3,1)=nb_t_num; nb%ijt(3,6)=nb_t_num + IF (nb_tile(bd,tile)%nb_tile_bndry == 'l') THEN + nb%ijt(1,1) = 1; nb%ijt(2,1) = cres+1-i + nb%ijt(1,6) = 1; nb%ijt(2,6) = cres+1-(i+1) + ELSEIF (nb_tile(bd,tile)%nb_tile_bndry == 'b') THEN + nb%ijt(1,1) = i; nb%ijt(2,1) = 1 + nb%ijt(1,6) = i+1; nb%ijt(2,6) = 1 + ENDIF + bd = 3 + nb_t_num = nb_tile(bd,tile)%nb_tile_num + nb%ijt(3,2)=nb_t_num; nb%ijt(3,7)=nb_t_num + IF (nb_tile(bd,tile)%nb_tile_bndry == 'r') THEN + nb%ijt(1,2) = cres; nb%ijt(2,2) = j + nb%ijt(1,7) = cres; nb%ijt(2,7) = j-1 + ELSEIF (nb_tile(bd,tile)%nb_tile_bndry == 't') THEN + nb%ijt(1,2) = cres+1-j; nb%ijt(2,2) = cres + nb%ijt(1,7) = cres+1-(j-1); nb%ijt(2,7) = cres + ENDIF + nb%ijt(3,5)=0 + nb%ijt(1,3) = i+1; nb%ijt(2,3) = j; nb%ijt(3,3) = tile + nb%ijt(1,4) = i; nb%ijt(2,4) = j-1; nb%ijt(3,4) = tile + nb%ijt(1,8) = i+1; nb%ijt(2,8) = j-1; nb%ijt(3,8) = tile + ELSEIF (nb%gp_type == 14) THEN ! upper left coner + bd = 1 + nb_t_num = nb_tile(bd,tile)%nb_tile_num + nb%ijt(3,1)=nb_t_num; nb%ijt(3,5)=nb_t_num + IF (nb_tile(bd,tile)%nb_tile_bndry == 'l') THEN + nb%ijt(1,1) = 1; nb%ijt(2,1) = cres+1-i + nb%ijt(1,5) = 1; nb%ijt(2,5) = cres+1-(i-1) + ELSEIF (nb_tile(bd,tile)%nb_tile_bndry == 'b') THEN + nb%ijt(1,1) = i; nb%ijt(2,1) = 1 + nb%ijt(1,5) = i-1; nb%ijt(2,5) = 1 + ENDIF + bd = 4 + nb_t_num = nb_tile(bd,tile)%nb_tile_num + nb%ijt(3,3)=nb_t_num; nb%ijt(3,8)=nb_t_num + IF (nb_tile(bd,tile)%nb_tile_bndry == 'l') THEN + nb%ijt(1,3) = 1; nb%ijt(2,3) = j + nb%ijt(1,8) = 1; nb%ijt(2,8) = j-1 + ELSEIF (nb_tile(bd,tile)%nb_tile_bndry == 'b') THEN + nb%ijt(1,3) = cres+1-j; nb%ijt(2,3) = 1 + nb%ijt(1,8) = cres+1-(j-1); nb%ijt(2,8) = 1 + ENDIF + nb%ijt(3,6)=0 + nb%ijt(1,2) = i-1; nb%ijt(2,2) = j; nb%ijt(3,2) = tile + nb%ijt(1,4) = i; nb%ijt(2,4) = j-1; nb%ijt(3,4) = tile + nb%ijt(1,7) = i-1; nb%ijt(2,7) = j-1; nb%ijt(3,7) = tile + ELSEIF (nb%gp_type == 23) THEN ! upper left coner + bd = 2 + nb_t_num = nb_tile(bd,tile)%nb_tile_num + nb%ijt(3,4)=nb_t_num; nb%ijt(3,8)=nb_t_num + IF (nb_tile(bd,tile)%nb_tile_bndry == 'r') THEN + nb%ijt(1,4) = cres; nb%ijt(2,4) = cres+1-i + nb%ijt(1,8) = cres; nb%ijt(2,8) = cres+1-(i+1) + ELSEIF (nb_tile(bd,tile)%nb_tile_bndry == 't') THEN + nb%ijt(1,4) = i; nb%ijt(2,4) = cres + nb%ijt(1,8) = i+1; nb%ijt(2,8) = cres + ENDIF + bd = 3 + nb_t_num = nb_tile(bd,tile)%nb_tile_num + nb%ijt(3,2)=nb_t_num; nb%ijt(3,5)=nb_t_num + IF (nb_tile(bd,tile)%nb_tile_bndry == 'r') THEN + nb%ijt(1,2) = cres; nb%ijt(2,2) = j + nb%ijt(1,5) = cres; nb%ijt(2,5) = j+1 + ELSEIF (nb_tile(bd,tile)%nb_tile_bndry == 't') THEN + nb%ijt(1,2) = cres+1-j; nb%ijt(2,2) = cres + nb%ijt(1,5) = cres+1-(j+1); nb%ijt(2,5) = cres + ENDIF + nb%ijt(3,7)=0 + nb%ijt(1,1) = i; nb%ijt(2,1) = j+1; nb%ijt(3,1) = tile + nb%ijt(1,3) = i+1; nb%ijt(2,3) = j; nb%ijt(3,3) = tile + nb%ijt(1,6) = i+1; nb%ijt(2,6) = j+1; nb%ijt(3,6) = tile + ELSEIF (nb%gp_type == 24) THEN ! upper left coner + bd = 2 + nb_t_num = nb_tile(bd,tile)%nb_tile_num + nb%ijt(3,4)=nb_t_num; nb%ijt(3,7)=nb_t_num + IF (nb_tile(bd,tile)%nb_tile_bndry == 'r') THEN + nb%ijt(1,4) = cres; nb%ijt(2,4) = cres+1-i + nb%ijt(1,7) = cres; nb%ijt(2,7) = cres+1-(i-1) + ELSEIF (nb_tile(bd,tile)%nb_tile_bndry == 't') THEN + nb%ijt(1,4) = i; nb%ijt(2,4) = cres + nb%ijt(1,7) = i-1; nb%ijt(2,7) = cres + ENDIF + bd = 4 + nb_t_num = nb_tile(bd,tile)%nb_tile_num + nb%ijt(3,3)=nb_t_num; nb%ijt(3,6)=nb_t_num + IF (nb_tile(bd,tile)%nb_tile_bndry == 'l') THEN + nb%ijt(1,3) = 1; nb%ijt(2,3) = j + nb%ijt(1,6) = 1; nb%ijt(2,6) = j+1 + ELSEIF (nb_tile(bd,tile)%nb_tile_bndry == 'b') THEN + nb%ijt(1,3) = cres+1-j; nb%ijt(2,3) = 1 + nb%ijt(1,6) = cres+1-(j+1); nb%ijt(2,6) = 1 + ENDIF + nb%ijt(3,8)=0 + nb%ijt(1,1) = i; nb%ijt(2,1) = j+1; nb%ijt(3,1) = tile + nb%ijt(1,2) = i-1; nb%ijt(2,2) = j; nb%ijt(3,2) = tile + nb%ijt(1,5) = i-1; nb%ijt(2,5) = j+1; nb%ijt(3,5) = tile + + ENDIF + END SUBROUTINE neighbors + +END MODULE cs_nb + +#ifdef TEST_CS_NB +PROGRAM test_nb + USE cs_nb + + INTEGER :: tile, i, j + TYPE(nb_gp_idx) :: nbs + + INTEGER, PARAMETER :: res = 96 + + CALL idx_init(res) +! tile = 1; i = 1; j = 5 +! tile = 1; i = 5; j = 1 +! tile = 1; i = 96; j = 10 + tile = 2; i = 96; j = 96 + CALL neighbors(tile, i, j, nbs) + print*, 'tile = ', tile, ' i = ',i, ' j = ', j + print*, 'nbs%type: ', nbs%gp_type + print*, 'nbs%ijt: ' + print*, nbs%ijt +END PROGRAM test_nb +#endif diff --git a/sorc/orog_mask_tools.fd/lake.fd/CMakeLists.txt b/sorc/orog_mask_tools.fd/lake.fd/CMakeLists.txt new file mode 100644 index 000000000..b33ddfd6d --- /dev/null +++ b/sorc/orog_mask_tools.fd/lake.fd/CMakeLists.txt @@ -0,0 +1,20 @@ +set(fortran_src + enclosure_cnvx.F90 + find_limit.F90 + lakefrac.F90) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -assume byterecl") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-range-check") +endif() + +set(exe_name lakefrac) + +add_executable(${exe_name} ${fortran_src}) + +target_link_libraries( + ${exe_name} + NetCDF::NetCDF_Fortran) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/orog_mask_tools.fd/lake.fd/enclosure_cnvx.F90 b/sorc/orog_mask_tools.fd/lake.fd/enclosure_cnvx.F90 new file mode 100644 index 000000000..35bd766ee --- /dev/null +++ b/sorc/orog_mask_tools.fd/lake.fd/enclosure_cnvx.F90 @@ -0,0 +1,82 @@ +#ifdef INCLUDE_TEST_DRIVER + PROGRAM testenc + IMPLICIT NONE + REAL*8 :: v(2,4) + REAL*8 :: p(2) + + REAL*8 :: d2r + LOGICAL:: enclosure_cnvx, inside + INTEGER :: co_gc + + d2r = acos(-1.0)/180.0D0 + + v(1,1) = 10.0D0*d2r; v(2,1) = 20.0D0*d2r + v(1,2) = 15.0D0*d2r; v(2,2) = 30.0D0*d2r + v(1,3) = 17.7D0*d2r; v(2,3) = 25.0D0*d2r + v(1,4) = 20.0D0*d2r; v(2,4) = 20.0D0*d2r + +! p(1) = 15.0D0*d2r; p(2) = 30.00000001D0*d2r +! p(1) = 20.00000000D0*d2r; p(2) = 20.0D0*d2r +! p(1) = 9.999999999D0*d2r; p(2) = 20.0D0*d2r +! p(1) = 10.00000000*d2r; p(2) = 20.000000001D0*d2r + p(1) = 17.7D0*d2r; p(2) = 25.000000001D0*d2r + + inside = enclosure_cnvx(v,4,p,co_gc) + IF (inside) THEN + PRINT*, 'inside ', co_gc + ELSE + PRINT*, 'outside ', co_gc + ENDIF + + END PROGRAM +#endif + + +LOGICAL FUNCTION enclosure_cnvx(v, n, p, co_gc) +!<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> +! Function enclosure tests whether a given point p(2) is inside a convex spherical polygon +! defined with a sequence of n vertices v(2,n). Both the test point and the polygon are +! apecified in latitude and longitude radians. +! +! N. Wang, Jan 2007 - Initial version +!<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> + IMPLICIT NONE + REAL*8, INTENT(IN) :: v(2,n), p(2) + INTEGER, INTENT(IN) :: n + INTEGER, INTENT(OUT) :: co_gc + + REAL*8 v_xy(2, n) + REAL*8 cp_z(n), cos_d2c, eps + + INTEGER :: i, ip1 + + + eps = 0.000000000000001D0 + co_gc = 0 + DO i = 1, n + cos_d2c = sin(p(1))*sin(v(1,i)) + cos(p(1))*cos(v(1,i))*cos(v(2,i)-p(2)) + v_xy(1,i) = (cos(v(1,i))*sin(v(2,i)-p(2)))/cos_d2c + v_xy(2,i) = (cos(p(1))*sin(v(1,i))-sin(p(1))*cos(v(1,i))*cos(v(2,i)-p(2)))/cos_d2c + + ENDDO + + DO i = 1, n + ip1 = mod(i,n)+1 + cp_z(i) = v_xy(1,i)*v_xy(2,ip1)-v_xy(2,i)*v_xy(1,ip1) + IF (abs(cp_z(i)) < eps) co_gc = i + ENDDO + + DO i = 1, n-1 + ip1 = mod(i,n)+1 + IF (cp_z(i)*cp_z(ip1) .LT. -eps) THEN + enclosure_cnvx = .false. + RETURN + ENDIF + ENDDO + + enclosure_cnvx = .true. + RETURN + +END FUNCTION enclosure_cnvx + +!<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> diff --git a/sorc/orog_mask_tools.fd/lake.fd/find_limit.F90 b/sorc/orog_mask_tools.fd/lake.fd/find_limit.F90 new file mode 100644 index 000000000..cc6964f59 --- /dev/null +++ b/sorc/orog_mask_tools.fd/lake.fd/find_limit.F90 @@ -0,0 +1,100 @@ +!#define DIAG +SUBROUTINE find_limit (p1_in, p2_in, latmin, latmax) + REAL*8, INTENT(IN) :: p1_in(2), p2_in(2) + REAL*8, INTENT(OUT) :: latmin, latmax + + REAL*8 :: p1(2),p2(2), pm(2) + REAL*8 :: r2d = 180.0/acos(-1.0) + + p1 = p1_in/r2d; p2 = p2_in/r2d + latmin = min(p1(1), p2(1)) + latmax = max(p1(1), p2(1)) + + CALL middle(p1, p2, pm) +#ifdef DIAG + PRINT*, 'before loop', p1(1)*r2d,p2(1)*r2d,pm(1)*r2d +#endif + + DO WHILE (abs(p1(1)-p2(1)) > 0.00001 .AND. & + abs(p1(2)-p2(2)) > 0.00001 ) + IF (abs(p1(1)-pm(1)) < abs(p2(1)-pm(1))) THEN + p2 = pm + ELSE + p1 = pm + ENDIF + CALL middle(p1, p2, pm) +#ifdef DIAG + PRINT*, 'in loop', p1(1)*r2d,p2(1)*r2d, pm(1)*r2d +#endif + ENDDO + + latmin = min(latmin, pm(1)) + latmax = max(latmax, pm(1)) + + latmin = latmin *r2d + latmax = latmax *r2d + +END SUBROUTINE find_limit + +!====================================================== +! This subroutine computes the latitude and longitude +! of the middle point between two given ponits. +! +! There are two formulae available to compute it. +! +! One derived from a more general m-sect formula: +! +! xyz = sin((1-f)*theta) / sin(theta) * xyz1 + +! sin(f*theta) /sin(theta) * xyz2 ; +! where theta is the angle of xyz1, and xyz2. +! +! xyz = 0.5 / sqrt[(1+dot(xyz1,xyz2))/2] * (xyz1+xyz2) +! +! and the other one is the normalized middle point of +! the two end points: +! +! xyz = 0.5 * (xyz1+xyz2), xyz = xyz / sqrt(dot(xyz,xyz)) +! +! Author: Ning Wang, March, 2006 +!====================================================== + +SUBROUTINE middle(p1,p2,p) + IMPLICIT NONE + + ! Two given points in lat/lon: + REAL*8, INTENT(IN) :: p1(2),p2(2) + REAL*8, INTENT(OUT) :: p(2) + REAL*8 :: pi + + REAL*8 :: xyz1(3),xyz2(3),xyz(3) + + pi = acos(-1.0) + + ! Convert them into Cardesian coor: + xyz1(1) = cos(p1(1)) * cos(p1(2)) + xyz1(2) = cos(p1(1)) * sin(p1(2)) + xyz1(3) = sin(p1(1)) + + xyz2(1) = cos(p2(1)) * cos(p2(2)) + xyz2(2) = cos(p2(1)) * sin(p2(2)) + xyz2(3) = sin(p2(1)) + + ! middle point: + +! coeff = 0.5 / sqrt((1.0 + dot_product(xyz1,xyz2)) / 2) +! xyz = coeff * (xyz1 + xyz2) + + xyz = 0.5 * (xyz1 + xyz2) + + xyz = xyz / sqrt(dot_product(xyz,xyz)) + + ! Convert the middle point to lat/lon coor: + p(1) = atan2(xyz(3), sqrt(xyz(1) * xyz(1) + xyz(2) * xyz(2))) + p(2) = atan2(xyz(2), xyz(1)) + + IF (p(2) < -pi / 2.0) THEN + p(2) = p(2) + 2 * pi + END IF + +END SUBROUTINE middle + diff --git a/sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 b/sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 new file mode 100644 index 000000000..9673dacfb --- /dev/null +++ b/sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 @@ -0,0 +1,896 @@ +!<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> +! This program computes lake fraction and depth numbers for FV3 cubed sphere +! grid cells, from a high resolution lat/lon data set. +! +! Ning Wang, July 2018: Original version +! +! Shan Sun, Aug. 2018: Added Caspian Sea and Aral Sea to the lake fraction +! and lake depth fields. +! Shan Sun, Dec. 2018: Added round up and round down with respect to a +! numerical minimum value and a cut-off value, for lake +! fraction number. +! Ning Wang, Apr. 2019: Extended the program to process the same lake data +! for FV3 stand-alone regional (SAR) model. +! +!<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> +!#define DIAG_N_VERBOSE +#define ADD_ATT_FOR_NEW_VAR +PROGRAM lake_frac + USE netcdf + IMPLICIT NONE + + CHARACTER(len=256) :: sfcdata_path + INTEGER :: cs_res, ncsmp, ncscp, i + INTEGER :: res_x, res_y + + INTEGER*1, ALLOCATABLE :: lakestatus(:) + INTEGER*2, ALLOCATABLE :: lakedepth(:) + REAL, ALLOCATABLE :: cs_grid(:,:) + REAL, ALLOCATABLE :: cs_lakestatus(:), cs_lakedepth(:) + REAL, ALLOCATABLE :: src_grid_lon(:), src_grid_lat(:) + + INTEGER :: tile_req, tile_beg, tile_end + REAL :: lake_cutoff + + INTEGER, PARAMETER :: nlat = 21600, nlon = 43200 + REAL, PARAMETER :: d2r = acos(-1.0) / 180.0 + REAL, PARAMETER :: r2d = 180.0 /acos(-1.0) + REAL, PARAMETER :: pi = acos(-1.0) + REAL*8, PARAMETER :: gppdeg = 119.99444445 + REAL*8, PARAMETER :: delta = 1.0 / 119.99444445 + + CHARACTER(len=32) :: arg + CHARACTER(len=256) :: lakedata_path + INTEGER :: stat + + CALL getarg(0, arg) ! get the program name + IF (iargc() /= 3 .AND. iargc() /= 4) THEN + PRINT*, 'Usage: ', trim(arg), & + ' [tile_num (0:all tiles, 7:regional)] [resolution (48,96, ...)] [path to lake data file]' + PRINT*, 'Or: ', trim(arg), & + ' [tile_num (0:all tiles, 7:regional)] [resolution (48,96, ...)] [path to lake data file] [lake_cutoff]' + STOP + ENDIF + CALL getarg(1, arg) + READ(arg,*,iostat=stat) tile_req + CALL getarg(2, arg) + READ(arg,*,iostat=stat) cs_res + CALL getarg(3, lakedata_path) + + IF (iargc() == 3) THEN + lake_cutoff = 0.20 + ELSE + CALL getarg(4, arg) + READ(arg,*,iostat=stat) lake_cutoff + ENDIF + + IF (tile_req == 0) THEN + tile_beg = 1; tile_end = 6 + PRINT*, 'Process tile 1 - 6 at resolution C',cs_res + ELSE IF (tile_req /= 7) THEN + tile_beg = tile_req; tile_end = tile_req + PRINT*, 'Process tile',tile_req, 'at resolution C',cs_res + ELSE + tile_beg = 1; tile_end = 1 + PRINT*, 'Process regional tile (tile', tile_req, ') at resolution C',cs_res + ENDIF + +! cs_res = 96 ! tile_beg = 3; tile_end = 3 + + ! read in grid spec data for each tile and concatenate them together + + ncsmp = (2*cs_res+1)*(2*cs_res+1)*6 + IF (tile_req /= 7) THEN + PRINT*, 'Read in cubed sphere grid information ... ',ncsmp,'pairs of lat/lons' + ENDIF + + IF (tile_req /= 7) THEN + ALLOCATE(cs_grid(ncsmp, 2)) + CALL read_cubed_sphere_grid(cs_res, cs_grid) + ELSE + CALL read_cubed_sphere_reg_grid(cs_res, cs_grid, 3, res_x, res_y) + ENDIF + ! compute source grid + ALLOCATE(src_grid_lon(nlon), src_grid_lat(nlat)) + DO i = 1, nlon + src_grid_lon(i) = -180.0 + delta * (i-1) + ENDDO + DO i = 1, nlat + src_grid_lat(i) = 90.0 - delta * (i-1) + ENDDO + + ! read in lake data file +! sfcdata_path = '/scratch1/NCEPDEV/global/glopara/fix/fix_orog/' + lakedata_path = trim(lakedata_path) // "/" + ALLOCATE(lakestatus(nlon*nlat),lakedepth(nlon*nlat)) + PRINT*, 'Read in lake data file ...' + CALL read_lakedata(lakedata_path,lakestatus,lakedepth,nlat,nlon) + + ! calculate fraction numbers for all cs-cells + ncscp = cs_res*cs_res*6 + ALLOCATE(cs_lakestatus(ncscp)) + ALLOCATE(cs_lakedepth(ncscp)) + + PRINT*, 'Calculate lake fraction and average depth for cubed-sphere cells ...' + CALL cal_lake_frac_depth(lakestatus,cs_lakestatus,lakedepth,cs_lakedepth) + + ! write lake status (in terms of fraction) and lake depth(average) + ! to a netcdf file + IF (tile_req /= 7) THEN + PRINT*, 'Write lake fraction/depth on cubed sphere grid cells to netCDF files ...' + CALL write_lakedata_to_orodata(cs_res, cs_lakestatus, cs_lakedepth) + ELSE + PRINT*, 'Write lake fraction/depth on regional FV3 grid cells to a netCDF file ...' + CALL write_reg_lakedata_to_orodata(cs_res, res_x, res_y, cs_lakestatus, cs_lakedepth) + ENDIF + + DEALLOCATE(cs_lakestatus,cs_lakedepth) + DEALLOCATE(cs_grid) + DEALLOCATE(lakestatus,lakedepth) + STOP +CONTAINS + +SUBROUTINE cal_lake_frac_depth(lakestat,cs_lakestat,lakedpth,cs_lakedpth) + INTEGER*1, INTENT(IN) :: lakestat(:) + INTEGER*2, INTENT(IN) :: lakedpth(:) + REAL, INTENT(OUT) :: cs_lakestat(:), cs_lakedpth(:) + + REAL*8 lolf(2), lort(2), uplf(2), uprt(2), sd_ltmn(4), sd_ltmx(4) + REAL*8 :: v(2,4), p(2) + REAL :: latmin1, latmax1 + REAL :: latmin, latmax, lonmin, lonmax, lontmp, lat_sz_max, lon_sz_max + INTEGER :: tile_num, i, j, gp, row, col, cs_grid_idx, cs_data_idx + INTEGER :: sidex_res, sidey_res, sidex_sz, sidey_sz + INTEGER :: stride_lat, stride_lon + INTEGER :: src_grid_lat_beg,src_grid_lat_end,src_grid_lon_beg,src_grid_lon_end + INTEGER :: src_grid_lon_beg1,src_grid_lon_end1,src_grid_lon_beg2,src_grid_lon_end2 + INTEGER :: grid_ct, lake_ct, co_gc, tmp + + REAL*8 :: lake_dpth_sum + LOGICAL :: two_section, enclosure_cnvx + + IF (tile_req /= 7) THEN + sidex_res = cs_res; sidey_res = cs_res + ELSE + sidex_res = res_x; sidey_res = res_y + ENDIF + + sidex_sz = 2*sidex_res+1; sidey_sz = 2*sidey_res+1 + + stride_lat = 1 + + lat_sz_max = 0.0 + lon_sz_max = 0.0 + + cs_lakestat = 0.0 + + DO tile_num = tile_beg, tile_end + row = 2 + sidex_sz*(tile_num-1); col = 2 + DO gp = 1, sidex_res*sidey_res + two_section = .false. + cs_grid_idx = (row-1)*sidex_sz+col + cs_data_idx = (tile_num-1)*sidex_res*sidey_res+gp + IF (abs(cs_grid(cs_grid_idx,1)) > 80.0 ) THEN !ignore lakes in very high latitude + cs_lakestat(cs_data_idx) = 0.0 + cs_lakedpth(cs_data_idx) = 0.0 + ! move to next cs cell + col = col + 2 + IF (col > sidex_sz) THEN + col = 2 + row = row + 2 + ENDIF + CYCLE + ENDIF + ! get the four corners of the cs cell + lolf(1) = cs_grid(cs_grid_idx-sidex_sz-1, 1) + lolf(2) = cs_grid(cs_grid_idx-sidex_sz-1, 2) + IF (lolf(2) > 180.0) lolf(2) = lolf(2) - 360.0 + lort(1) = cs_grid(cs_grid_idx-sidex_sz+1, 1) + lort(2) = cs_grid(cs_grid_idx-sidex_sz+1, 2) + IF (lort(2) > 180.0) lort(2) = lort(2) - 360.0 + uplf(1) = cs_grid(cs_grid_idx+sidex_sz-1,1) + uplf(2) = cs_grid(cs_grid_idx+sidex_sz-1,2) + IF (uplf(2) > 180.0) uplf(2) = uplf(2) - 360.0 + uprt(1) = cs_grid(cs_grid_idx+sidex_sz+1,1) + uprt(2) = cs_grid(cs_grid_idx+sidex_sz+1,2) + + v(1,1) = lolf(1); v(2,1) = lolf(2) + v(1,2) = lort(1); v(2,2) = lort(2) + v(1,3) = uprt(1); v(2,3) = uprt(2) + v(1,4) = uplf(1); v(2,4) = uplf(2) + v(:,:) = v(:,:) * d2r + + IF (uprt(2) > 180.0) uprt(2) = uprt(2) - 360.0 + ! gather the candidate indices in lakestat +#ifdef LIMIT_CAL + CALL find_limit (lolf, lort, sd_ltmn(1), sd_ltmx(1)) + CALL find_limit (lort, uprt, sd_ltmn(2), sd_ltmx(2)) + CALL find_limit (uprt, uplf, sd_ltmn(3), sd_ltmx(3)) + CALL find_limit (uplf, lolf, sd_ltmn(4), sd_ltmx(4)) + latmin = min(sd_ltmn(1),min(sd_ltmn(2),min(sd_ltmn(3),sd_ltmn(4)))) + latmax = max(sd_ltmx(1),max(sd_ltmx(2),max(sd_ltmx(3),sd_ltmx(4)))) +#endif + latmin = min(lolf(1),min(lort(1),min(uplf(1),uprt(1)))) + latmax = max(lolf(1),max(lort(1),max(uplf(1),uprt(1)))) + lonmin = min(lolf(2),min(lort(2),min(uplf(2),uprt(2)))) + lonmax = max(lolf(2),max(lort(2),max(uplf(2),uprt(2)))) +! lat_sz_max = max(lat_sz_max, (latmax-latmin)) +! lon_sz_max = max(lon_sz_max, (lonmax-lonmin)) + + src_grid_lat_beg = nint((90.0-latmax)*gppdeg+0.5) + src_grid_lat_end = nint((90.0-latmin)*gppdeg+0.5) + src_grid_lon_beg = nint((180.0+lonmin)*gppdeg+0.5) + src_grid_lon_end = nint((180.0+lonmax)*gppdeg+0.5) + + IF (src_grid_lat_beg > src_grid_lat_end) THEN + print*,'switch!!!' + tmp = src_grid_lat_beg + src_grid_lat_beg = src_grid_lat_end + src_grid_lat_end = tmp + ENDIF + IF (src_grid_lon_beg > src_grid_lon_end) THEN + print*,'switch!!!' + tmp = src_grid_lon_beg + src_grid_lon_beg = src_grid_lon_end + src_grid_lon_end = tmp + ENDIF + IF ((src_grid_lon_end - src_grid_lon_beg) > nlon*0.75) THEN + two_section = .true. + src_grid_lon_beg1 = src_grid_lon_end + src_grid_lon_end1 = nlon + src_grid_lon_beg2 = 1 + src_grid_lon_end2 = src_grid_lon_beg + ENDIF + +#ifdef DIAG_N_VERBOSE + PRINT*, 'cell centre lat/lon =', & + gp, cs_res*cs_res, cs_grid(cs_grid_idx,1),cs_grid(cs_grid_idx,2) + PRINT*, 'lat index range and stride', & + src_grid_lat_beg,src_grid_lat_end,stride_lat + PRINT*, 'lat range ', & + src_grid_lat(src_grid_lat_beg),src_grid_lat(src_grid_lat_end) +#endif + lake_ct = 0; grid_ct = 0 + lake_dpth_sum = 0.0 + DO j = src_grid_lat_beg, src_grid_lat_end, stride_lat + stride_lon = int(1.0/cos(src_grid_lat(j)*d2r)*REAL(stride_lat)) +#ifdef DIAG_N_VERBOSE + IF (j == src_grid_lat_beg) THEN + PRINT*, 'lon index range and stride', & + src_grid_lon_beg,src_grid_lon_end,stride_lon + PRINT*, 'lon range ', & + src_grid_lon(src_grid_lon_beg),src_grid_lon(src_grid_lon_end) + IF (two_section == .true.) THEN + PRINT*, 'section1 index lon range and stride', & + src_grid_lon_beg1,src_grid_lon_end1,stride_lon + PRINT*, 'section1 lon range ', & + src_grid_lon(src_grid_lon_beg1),src_grid_lon(src_grid_lon_end1) + PRINT*, 'section2 index lon range and stride', & + src_grid_lon_beg2,src_grid_lon_end2,stride_lon + PRINT*, 'section2 lon range ', & + src_grid_lon(src_grid_lon_beg2),src_grid_lon(src_grid_lon_end2) + ENDIF + ENDIF +#endif + IF (two_section == .false.) THEN + DO i = src_grid_lon_beg, src_grid_lon_end, stride_lon + p(1) = src_grid_lat(j); p(2) = src_grid_lon(i) + p(:) = p(:)*d2r + IF(enclosure_cnvx(v, 4, p, co_gc) == .true.) THEN + grid_ct = grid_ct+1 + IF (lakestat((j-1)*nlon+i) /= 0) THEN + lake_ct = lake_ct+1 + IF (lakedpth((j-1)*nlon+i) < 0) THEN + IF (lakestat((j-1)*nlon+i) == 4) THEN + lake_dpth_sum = lake_dpth_sum+30.0 + ELSE + lake_dpth_sum = lake_dpth_sum+100.0 + ENDIF + ELSE + lake_dpth_sum = lake_dpth_sum+REAL(lakedpth((j-1)*nlon+i)) + ENDIF + ENDIF + ENDIF + ENDDO + ELSE + DO i = src_grid_lon_beg1, src_grid_lon_end1, stride_lon + p(1) = src_grid_lat(j); p(2) = src_grid_lon(i) + p(:) = p(:)*d2r + IF(enclosure_cnvx(v, 4, p, co_gc) == .true.) THEN + grid_ct = grid_ct+1 + IF (lakestat((j-1)*nlon+i) /= 0) THEN + lake_ct = lake_ct+1 + IF (lakedpth((j-1)*nlon+i) < 0) THEN + IF (lakestat((j-1)*nlon+i) == 4) THEN + lake_dpth_sum = lake_dpth_sum+30.0 + ELSE + lake_dpth_sum = lake_dpth_sum+100.0 + ENDIF + ELSE + lake_dpth_sum = lake_dpth_sum+REAL(lakedpth((j-1)*nlon+i)) + ENDIF + ENDIF + ENDIF + ENDDO + DO i = src_grid_lon_beg2, src_grid_lon_end2, stride_lon + p(1) = src_grid_lat(j); p(2) = src_grid_lon(i) + p(:) = p(:)*d2r + IF(enclosure_cnvx(v, 4, p, co_gc) == .true.) THEN + grid_ct = grid_ct+1 + IF (lakestat((j-1)*nlon+i) /= 0) THEN + lake_ct = lake_ct+1 + IF (lakedpth((j-1)*nlon+i) < 0) THEN + IF (lakestat((j-1)*nlon+i) == 4) THEN + lake_dpth_sum = lake_dpth_sum+30.0 + ELSE + lake_dpth_sum = lake_dpth_sum+100.0 + ENDIF + ELSE + lake_dpth_sum = lake_dpth_sum+REAL(lakedpth((j-1)*nlon+i)) + ENDIF + ENDIF + ENDIF + ENDDO + ENDIF + ENDDO + cs_lakestat(cs_data_idx)=REAL(lake_ct)/REAL(grid_ct) + IF (lake_ct /= 0) THEN + cs_lakedpth(cs_data_idx)=lake_dpth_sum/REAL(lake_ct)/10.0 !convert to meter + ELSE + cs_lakedpth(cs_data_idx)=0.0 + ENDIF +#ifdef DIAG_N_VERBOSE + PRINT*, 'tile_num, row, col:', tile_num, row, col + PRINT*, 'grid_ct, lake_ct = ', grid_ct, lake_ct + PRINT*, 'lake_frac= ', cs_lakestat(cs_data_idx) + PRINT*, 'lake_depth (avg) = ', cs_lakedpth(cs_data_idx) +#endif + + ! move to the next control volume + col = col + 2 + IF (col > sidex_sz) THEN + col = 2 + row = row + 2 + ENDIF + ENDDO + PRINT "('*'$)" ! progress '*' + ENDDO + PRINT*, '' + +END SUBROUTINE cal_lake_frac_depth + + +SUBROUTINE read_cubed_sphere_grid(res, grid) + INTEGER, INTENT(IN) :: res + REAL, INTENT(OUT) :: grid(:,:) + + REAL*8, ALLOCATABLE :: lat(:), lon(:) + INTEGER :: side_sz, tile_sz, ncid, varid + INTEGER :: i, tile_beg, tile_end, stat + CHARACTER(len=256) :: gridfile_path,gridfile + CHARACTER(len=1) ich + CHARACTER(len=4) res_ch + + side_sz = 2*res+1 + tile_sz = side_sz*side_sz + ALLOCATE(lat(tile_sz), lon(tile_sz)) + + IF (tile_req == 0) THEN + tile_beg = 1; tile_end = 6 + ELSE + tile_beg = tile_req; tile_end = tile_req + ENDIF + WRITE(res_ch,'(I4)') res +! gridfile_path = "/scratch1/NCEPDEV/global/glopara/fix/fix_fv3/C"//trim(adjustl(res_ch))//"/" + gridfile_path = "./" + DO i = tile_beg, tile_end + WRITE(ich, '(I1)') i + gridfile = trim(gridfile_path)//"C"//trim(adjustl(res_ch))//"_grid.tile"//ich//".nc" + + PRINT*, 'Open cubed sphere grid spec file ', trim(gridfile) + + stat = nf90_open(trim(gridfile), NF90_NOWRITE, ncid) + CALL nc_opchk(stat,'nf90_open') + + stat = nf90_inq_varid(ncid,'x',varid) + CALL nc_opchk(stat,'nf90_inq_lon') + stat = nf90_get_var(ncid,varid,lon,start=(/1,1/),count=(/side_sz,side_sz/)) + CALL nc_opchk(stat,'nf90_get_var_lon') + stat = nf90_inq_varid(ncid,'y',varid) + CALL nc_opchk(stat,'nf90_inq_lat') + stat = nf90_get_var(ncid,varid,lat,start=(/1,1/),count=(/side_sz,side_sz/)) + CALL nc_opchk(stat,'nf90_get_var_lat') + stat = nf90_close(ncid) + CALL nc_opchk(stat,'nf90_close') + + tile_beg = (i-1)*tile_sz+1 + tile_end = i*tile_sz + grid(tile_beg:tile_end,1) = lat(1:tile_sz) + grid(tile_beg:tile_end,2) = lon(1:tile_sz) + END DO + DEALLOCATE(lat,lon) + +END SUBROUTINE read_cubed_sphere_grid + +SUBROUTINE read_cubed_sphere_reg_grid(res, grid, halo_depth, res_x, res_y) + INTEGER, INTENT(IN) :: res, halo_depth + INTEGER, INTENT(OUT) :: res_x, res_y + REAL, ALLOCATABLE, INTENT(OUT) :: grid(:,:) + + REAL*8, ALLOCATABLE :: lat(:), lon(:) + INTEGER :: sidex_sz, sidey_sz, tile_sz, ncid, varid, dimid + INTEGER :: x_start, y_start + INTEGER :: nxp, nyp, stat + CHARACTER(len=256) :: gridfile_path,gridfile + CHARACTER(len=1) ich + CHARACTER(len=4) res_ch + CHARACTER(len=8) dimname + + + WRITE(res_ch,'(I4)') res +! gridfile_path = '/scratch4/BMC/fim/fv3data/fix/reg/' + gridfile_path = './' + gridfile = trim(gridfile_path)//"C"//trim(adjustl(res_ch))//"_grid.tile7.nc" + + PRINT*, 'Open cubed sphere grid spec file ', trim(gridfile) + + stat = nf90_open(trim(gridfile), NF90_NOWRITE, ncid) + CALL nc_opchk(stat,'nf90_open') + + stat = nf90_inq_dimid(ncid,'nxp',dimid) + CALL nc_opchk(stat,'nf90_inq_dimid: nxp') + stat = nf90_inquire_dimension(ncid,dimid,dimname,len=nxp) + CALL nc_opchk(stat,'nf90_inquire_dimension: nxp') + + stat = nf90_inq_dimid(ncid,'nyp',dimid) + CALL nc_opchk(stat,'nf90_inq_dimid: nyp') + stat = nf90_inquire_dimension(ncid,dimid,dimname,len=nyp) + CALL nc_opchk(stat,'nf90_inquire_dimension: nyp') + +! sidex_sz = nxp-2*halo_depth +! sidey_sz = nyp-2*halo_depth + sidex_sz = nxp + sidey_sz = nyp + tile_sz = sidex_sz*sidey_sz + ALLOCATE(lat(tile_sz), lon(tile_sz)) + +! x_start = halo_depth+1; y_start = halo_depth+1 + x_start = 1; y_start = 1 + stat = nf90_inq_varid(ncid,'x',varid) + CALL nc_opchk(stat,'nf90_inq_lon') + stat = nf90_get_var(ncid,varid,lon,start=(/x_start,y_start/),count=(/sidex_sz,sidey_sz/)) + CALL nc_opchk(stat,'nf90_get_var_lon') + stat = nf90_inq_varid(ncid,'y',varid) + CALL nc_opchk(stat,'nf90_inq_lat') + stat = nf90_get_var(ncid,varid,lat,start=(/x_start,y_start/),count=(/sidex_sz,sidey_sz/)) + CALL nc_opchk(stat,'nf90_get_var_lat') + stat = nf90_close(ncid) + CALL nc_opchk(stat,'nf90_close') + + ALLOCATE(grid(tile_sz,2)) + grid(1:tile_sz,1) = lat(1:tile_sz) + grid(1:tile_sz,2) = lon(1:tile_sz) + + res_x = sidex_sz/2; res_y = sidey_sz/2 + DEALLOCATE(lat,lon) + +END SUBROUTINE read_cubed_sphere_reg_grid + +SUBROUTINE read_lakedata(lakedata_path,lake_stat,lake_dpth,nlat,nlon) + CHARACTER(len=256), INTENT(IN) :: lakedata_path + INTEGER*1, INTENT(OUT) :: lake_stat(:) + INTEGER*2, INTENT(OUT) :: lake_dpth(:) + INTEGER, INTENT(IN) :: nlat, nlon + + CHARACTER(len=256) lakefile + INTEGER :: data_sz, i + + data_sz = nlon*nlat + + ! read in 30 arc seconds lake data + lakefile = trim(lakedata_path) // "GlobalLakeStatus.dat" + OPEN(10, file=lakefile, form='unformatted', access='direct', recl=data_sz*1) + READ(10,rec=1) lake_stat + CLOSE(10) + + lakefile = trim(lakedata_path) // "GlobalLakeDepth.dat" + OPEN(10, file=lakefile, form='unformatted', access='direct', recl=data_sz*2) + READ(10,rec=1) lake_dpth + CLOSE(10) + +END SUBROUTINE read_lakedata + + +SUBROUTINE write_lakedata_to_orodata(cs_res, cs_lakestat, cs_lakedpth) + USE netcdf + INTEGER, INTENT(IN) :: cs_res + REAL, INTENT(IN) :: cs_lakestat(:) + REAL, INTENT(IN) :: cs_lakedpth(:) + + INTEGER :: tile_sz, tile_num + INTEGER :: stat, ncid, x_dimid, y_dimid, varid, dimids(2) + INTEGER :: lake_frac_id, lake_depth_id + INTEGER :: land_frac_id, slmsk_id, inland_id, geolon_id, geolat_id + CHARACTER(len=256) :: filename,string + CHARACTER(len=1) :: ich + CHARACTER(len=4) res_ch + REAL :: lake_frac(cs_res*cs_res),lake_depth(cs_res*cs_res) + REAL :: geolon(cs_res*cs_res),geolat(cs_res*cs_res) + REAL :: land_frac(cs_res*cs_res),slmsk(cs_res*cs_res),inland(cs_res*cs_res) + real, parameter :: epsil=1.e-6 ! numerical min for lake_frac/land_frac + real :: land_cutoff=1.e-4 ! land_frac=0 if it is < land_cutoff + + INTEGER :: i, j + +! include "netcdf.inc" + tile_sz = cs_res*cs_res + + WRITE(res_ch,'(I4)') cs_res + DO tile_num = tile_beg, tile_end + WRITE(ich, '(I1)') tile_num +! filename = "C" // trim(adjustl(res_ch)) // "_oro_data.tile" // ich // ".nc" +! filename = "oro_data.tile" // ich // ".nc" + filename = "oro.C" // trim(adjustl(res_ch)) // ".tile" // ich // ".nc" + print *,'Read, update, and write ',trim(filename) + stat = nf90_open(filename, NF90_WRITE, ncid) + CALL nc_opchk(stat, "nf90_open oro_data.nc") + stat = nf90_inq_dimid(ncid, "lon", x_dimid) + CALL nc_opchk(stat, "nf90_inq_dim: x") + stat = nf90_inq_dimid(ncid, "lat", y_dimid) + CALL nc_opchk(stat, "nf90_inq_dim: y") +! dimids = (/ y_dimid, x_dimid /) +! original orodata netcdf file uses (y, x) order, so we made change to match it. + dimids = (/ x_dimid, y_dimid /) + stat = nf90_inq_varid(ncid, "land_frac", land_frac_id) + CALL nc_opchk(stat, "nf90_inq_varid: land_frac") + stat = nf90_inq_varid(ncid, "slmsk", slmsk_id) + CALL nc_opchk(stat, "nf90_inq_varid: slmsk") +! define 2 new variables + stat = nf90_redef(ncid) + CALL nc_opchk(stat, "nf90_redef") + stat = nf90_def_var(ncid,"lake_frac",NF90_FLOAT,dimids,lake_frac_id) + CALL nc_opchk(stat, "nf90_def_var: lake_frac") +#ifdef ADD_ATT_FOR_NEW_VAR + stat = nf90_put_att(ncid, lake_frac_id,'coordinates','geolon geolat') + CALL nc_opchk(stat, "nf90_put_att: lake_frac:coordinates") + stat = nf90_put_att(ncid, lake_frac_id,'long_name','lake fraction') + CALL nc_opchk(stat, "nf90_put_att: lake_frac:long_name") + stat = nf90_put_att(ncid, lake_frac_id,'unit','fraction') + CALL nc_opchk(stat, "nf90_put_att: lake_frac:unit") + write(string,'(a,f5.2)') 'based on GLDBv2 (Choulga et al. 2014); missing lakes & + added based on land_frac in this dataset; lake_frac cutoff is',lake_cutoff + stat = nf90_put_att(ncid, lake_frac_id,'description',trim(string)) + CALL nc_opchk(stat, "nf90_put_att: lake_frac:description") +#endif + stat = nf90_def_var(ncid,"lake_depth",NF90_FLOAT,dimids,lake_depth_id) + CALL nc_opchk(stat, "nf90_def_var: lake_depth") +#ifdef ADD_ATT_FOR_NEW_VAR + stat = nf90_put_att(ncid, lake_depth_id,'coordinates','geolon geolat') + CALL nc_opchk(stat, "nf90_put_att: lake_depth:coordinates") + stat = nf90_put_att(ncid, lake_depth_id,'long_name','lake depth') + CALL nc_opchk(stat, "nf90_put_att: lake_depth:long_name") + stat = nf90_put_att(ncid, lake_depth_id,'unit','meter') + CALL nc_opchk(stat, "nf90_put_att: lake_depth:long_name") + stat = nf90_put_att(ncid, lake_depth_id,'description', & + 'based on GLDBv2 (Choulga et al. 2014); missing depth set to 10m & + (except to 211m in Caspian Sea); spurious large pos. depths are left unchanged.') + CALL nc_opchk(stat, "nf90_put_att: lake_depth:description") +#endif + + write(string,'(a,es8.1)') 'land_frac and lake_frac are adjusted such that their sum is 1 at points where inland=1; land_frac cutoff is',land_cutoff + stat = nf90_put_att(ncid, land_frac_id,'description',trim(string)) + CALL nc_opchk(stat, "nf90_put_att: land_frac:description") + + write(string,'(a)') 'slmsk = nint(land_frac)' + stat = nf90_put_att(ncid, slmsk_id,'description',trim(string)) + CALL nc_opchk(stat, "nf90_put_att: slmsk:description") + + stat = nf90_enddef(ncid) + CALL nc_opchk(stat, "nf90_enddef") + +! read in geolon and geolat and 2 variables from orog data file + stat = nf90_inq_varid(ncid, "geolon", geolon_id) + CALL nc_opchk(stat, "nf90_inq_varid: geolon") + stat = nf90_inq_varid(ncid, "geolat", geolat_id) + CALL nc_opchk(stat, "nf90_inq_varid: geolat") + stat = nf90_inq_varid(ncid, "land_frac", land_frac_id) + CALL nc_opchk(stat, "nf90_inq_varid: land_frac") + stat = nf90_inq_varid(ncid, "slmsk", slmsk_id) + CALL nc_opchk(stat, "nf90_inq_varid: slmsk") + stat = nf90_inq_varid(ncid, "inland", inland_id) + CALL nc_opchk(stat, "nf90_inq_varid: inland") + stat = nf90_get_var(ncid, geolon_id, geolon, & + start = (/ 1, 1 /), count = (/ cs_res, cs_res /) ) + CALL nc_opchk(stat, "nf90_get_var: geolon") + stat = nf90_get_var(ncid, geolat_id, geolat, & + start = (/ 1, 1 /), count = (/ cs_res, cs_res /) ) + CALL nc_opchk(stat, "nf90_get_var: geolat") + stat = nf90_get_var(ncid, land_frac_id, land_frac, & + start = (/ 1, 1 /), count = (/ cs_res, cs_res /) ) + CALL nc_opchk(stat, "nf90_get_var: land_frac") + stat = nf90_get_var(ncid, slmsk_id, slmsk, & + start = (/ 1, 1 /), count = (/ cs_res, cs_res /) ) + CALL nc_opchk(stat, "nf90_get_var: slmsk") + stat = nf90_get_var(ncid, inland_id, inland, & + start = (/ 1, 1 /), count = (/ cs_res, cs_res /) ) + CALL nc_opchk(stat, "nf90_get_var: inland") + + lake_frac (:) = cs_lakestat ((tile_num-1)*tile_sz+1:tile_num*tile_sz) + lake_depth(:) = cs_lakedepth((tile_num-1)*tile_sz+1:tile_num*tile_sz) + +! add Caspian Sea and Aral Sea to lake_frac and lake_depth + IF (tile_num == 2 .or. tile_num == 3) THEN + DO i = 1, tile_sz + IF (land_frac(i) < 0.9 .AND. lake_frac(i) < 0.1) THEN + IF (geolat(i) > 35.0 .AND. geolat(i) <= 50.0 .AND. & + geolon(i) > 45.0 .AND. geolon(i) <= 55.0) THEN + lake_frac(i) = 1.-land_frac(i) + lake_depth(i) = 211.0 + ENDIF + IF (geolat(i) > 35.0 .AND. geolat(i) <= 50.0 .AND. & + geolon(i) > 57.0 .AND. geolon(i) <= 63.0) THEN + lake_frac(i) = 1.-land_frac(i) + lake_depth(i) = 10.0 + ENDIF + ENDIF + ENDDO + ENDIF + +! adjust land_frac and lake_frac, and make sure land_frac+lake_frac=1 at inland points + DO i = 1, tile_sz + if (lake_frac(i) >= lake_cutoff) then ! non-zero lake_frac dominates over land_frac + land_frac(i) = max(0., min(1., 1.-lake_frac(i))) + elseif (inland(i) == 1.) then ! land_frac dominates over lake_frac at inland points + lake_frac(i) = max(0., min(1., 1.-land_frac(i))) + end if + +! epsil is "numerical" nonzero min for lake_frac/land_frac +! lake_cutoff/land_cutoff is practical min for lake_frac/land_frac + if (min(lake_cutoff,land_cutoff) < epsil) then + print *,'lake_cutoff/land_cutoff cannot be smaller than epsil, reset...' + lake_cutoff=max(epsil,lake_cutoff) + land_cutoff=max(epsil,land_cutoff) + end if + + if (lake_frac(i)< lake_cutoff) lake_frac(i)=0. + if (lake_frac(i)>1.-lake_cutoff) lake_frac(i)=1. + if (inland(i) == 1.) land_frac(i) = 1.-lake_frac(i) + if (land_frac(i)< land_cutoff) land_frac(i)=0. + if (land_frac(i)>1.-land_cutoff) land_frac(i)=1. + + if (lake_frac(i) < lake_cutoff) then + lake_depth(i)=0. + elseif (lake_frac(i) >= lake_cutoff .and. lake_depth(i)==0.) then + lake_depth(i)=10. + end if + slmsk(i) = nint(land_frac(i)) + ENDDO +! write 2 new variables + stat = nf90_put_var(ncid, lake_frac_id, lake_frac, & + start = (/ 1, 1 /), count = (/ cs_res, cs_res /) ) + CALL nc_opchk(stat, "nf90_put_var: lake_frac") + + stat = nf90_put_var(ncid, lake_depth_id, lake_depth, & + start = (/ 1, 1 /), count = (/ cs_res, cs_res /) ) + CALL nc_opchk(stat, "nf90_put_var: lake_depth") + +! write back 2 modified variables: land_frac and slmsk + stat = nf90_put_var(ncid, land_frac_id, land_frac, & + start = (/ 1, 1 /), count = (/ cs_res, cs_res /) ) + CALL nc_opchk(stat, "nf90_put_var: land_frac") + + stat = nf90_put_var(ncid, slmsk_id, slmsk, & + start = (/ 1, 1 /), count = (/ cs_res, cs_res /) ) + CALL nc_opchk(stat, "nf90_put_var: slmsk") + + stat = nf90_close(ncid) + CALL nc_opchk(stat, "nf90_close") + ENDDO + +END SUBROUTINE write_lakedata_to_orodata + +SUBROUTINE write_reg_lakedata_to_orodata(cs_res, tile_x_dim, tile_y_dim, cs_lakestat, cs_lakedpth) + USE netcdf + INTEGER, INTENT(IN) :: cs_res, tile_x_dim, tile_y_dim + REAL, INTENT(IN) :: cs_lakestat(:) + REAL, INTENT(IN) :: cs_lakedpth(:) + + INTEGER :: tile_sz, tile_num + INTEGER :: stat, ncid, x_dimid, y_dimid, varid, dimids(2) + INTEGER :: lake_frac_id, lake_depth_id + INTEGER :: land_frac_id, slmsk_id, geolon_id, geolat_id + CHARACTER(len=256) :: filename,string + CHARACTER(len=1) :: ich + CHARACTER(len=4) res_ch + + REAL, ALLOCATABLE :: lake_frac(:), lake_depth(:), geolon(:), geolat(:) + REAL, ALLOCATABLE :: land_frac(:), slmsk(:) + + real, parameter :: epsil=1.e-6 ! numerical min for lake_frac/land_frac + real :: land_cutoff=1.e-6 ! land_frac=0 if it is < land_cutoff + + INTEGER :: i, j, var_id + +! include "netcdf.inc" + tile_sz = tile_x_dim*tile_y_dim + + ALLOCATE(lake_frac(tile_sz), lake_depth(tile_sz)) + ALLOCATE(geolon(tile_sz), geolat(tile_sz)) + ALLOCATE(land_frac(tile_sz), slmsk(tile_sz)) + + WRITE(res_ch,'(I4)') cs_res + tile_num = 7 + WRITE(ich, '(I1)') tile_num +! filename = "C" // trim(adjustl(res_ch)) // "_oro_data.tile" // ich // ".halo4.nc" + filename = "oro.C" // trim(adjustl(res_ch)) // ".tile" // ich // ".nc" + PRINT*, 'Open and write regional orography data netCDF file ', trim(filename) + stat = nf90_open(filename, NF90_WRITE, ncid) + CALL nc_opchk(stat, "nf90_open oro_data.nc") + stat = nf90_inq_dimid(ncid, "lon", x_dimid) + CALL nc_opchk(stat, "nf90_inq_dim: x") + stat = nf90_inq_dimid(ncid, "lat", y_dimid) + CALL nc_opchk(stat, "nf90_inq_dim: y") + dimids = (/ x_dimid, y_dimid /) + + stat = nf90_inq_varid(ncid, "land_frac", land_frac_id) + CALL nc_opchk(stat, "nf90_inq_varid: land_frac") + stat = nf90_inq_varid(ncid, "slmsk", slmsk_id) + CALL nc_opchk(stat, "nf90_inq_varid: slmsk") + +! define 2 new variables, lake_frac and lake_depth + stat = nf90_redef(ncid) + CALL nc_opchk(stat, "nf90_redef") + + IF (nf90_inq_varid(ncid, "lake_frac",lake_frac_id) /= 0) THEN + stat = nf90_def_var(ncid,"lake_frac",NF90_FLOAT,dimids,lake_frac_id) + CALL nc_opchk(stat, "nf90_def_var: lake_frac") +#ifdef ADD_ATT_FOR_NEW_VAR + stat = nf90_put_att(ncid, lake_frac_id,'coordinates','geolon geolat') + CALL nc_opchk(stat, "nf90_put_att: lake_frac:coordinates") + stat = nf90_put_att(ncid, lake_frac_id,'long_name','lake fraction') + CALL nc_opchk(stat, "nf90_put_att: lake_frac:long_name") + stat = nf90_put_att(ncid, lake_frac_id,'unit','fraction') + CALL nc_opchk(stat, "nf90_put_att: lake_frac:unit") + stat = nf90_put_att(ncid, lake_frac_id,'description', & + 'based on GLDBv2 (Choulga et al. 2014); missing lakes & + added based on land_frac in this dataset.') + CALL nc_opchk(stat, "nf90_put_att: lake_frac:description") +#endif + ENDIF + IF (nf90_inq_varid(ncid, "lake_depth",lake_depth_id) /= 0) THEN + stat = nf90_def_var(ncid,"lake_depth",NF90_FLOAT,dimids,lake_depth_id) + CALL nc_opchk(stat, "nf90_def_var: lake_depth") +#ifdef ADD_ATT_FOR_NEW_VAR + stat = nf90_put_att(ncid, lake_depth_id,'coordinates','geolon geolat') + CALL nc_opchk(stat, "nf90_put_att: lake_depth:coordinates") + stat = nf90_put_att(ncid, lake_depth_id,'long_name','lake depth') + CALL nc_opchk(stat, "nf90_put_att: lake_depth:long_name") + stat = nf90_put_att(ncid, lake_depth_id,'unit','meter') + CALL nc_opchk(stat, "nf90_put_att: lake_depth:long_name") + stat = nf90_put_att(ncid, lake_depth_id,'description', & + 'based on GLDBv2 (Choulga et al. 2014); missing depth set to 10m & + (except to 211m in Caspian Sea); spurious large pos. depths are left unchanged.') + CALL nc_opchk(stat, "nf90_put_att: lake_depth:description") +#endif + ENDIF + write(string,'(a,es8.1)') 'land_frac is adjusted to 1-lake_frac where lake_frac>0 but left unchanged where lake_frac=0. This could lead to land_frac+lake_frac<1 at some inland points; land_frac cutoff is',land_cutoff + stat = nf90_put_att(ncid, land_frac_id,'description',trim(string)) + CALL nc_opchk(stat, "nf90_put_att: land_frac:description") + + write(string,'(a)') 'slmsk = nint(land_frac)' + stat = nf90_put_att(ncid, slmsk_id,'description',trim(string)) + CALL nc_opchk(stat, "nf90_put_att: slmsk:description") + + stat = nf90_enddef(ncid) + CALL nc_opchk(stat, "nf90_enddef") + +! read in geolon and geolat and 2 variables from orog data file + stat = nf90_inq_varid(ncid, "geolon", geolon_id) + CALL nc_opchk(stat, "nf90_inq_varid: geolon") + stat = nf90_inq_varid(ncid, "geolat", geolat_id) + CALL nc_opchk(stat, "nf90_inq_varid: geolat") + stat = nf90_inq_varid(ncid, "land_frac", land_frac_id) + CALL nc_opchk(stat, "nf90_inq_varid: land_frac") + stat = nf90_inq_varid(ncid, "slmsk", slmsk_id) + CALL nc_opchk(stat, "nf90_inq_varid: slmsk") + + stat = nf90_get_var(ncid, geolon_id, geolon, & + start = (/ 1, 1 /), count = (/ tile_x_dim, tile_y_dim /) ) + CALL nc_opchk(stat, "nf90_get_var: geolon") + stat = nf90_get_var(ncid, geolat_id, geolat, & + start = (/ 1, 1 /), count = (/ tile_x_dim, tile_y_dim /) ) + CALL nc_opchk(stat, "nf90_get_var: geolat") + stat = nf90_get_var(ncid, land_frac_id, land_frac, & + start = (/ 1, 1 /), count = (/ tile_x_dim, tile_y_dim /) ) + CALL nc_opchk(stat, "nf90_get_var: land_frac") + stat = nf90_get_var(ncid, slmsk_id, slmsk, & + start = (/ 1, 1 /), count = (/ tile_x_dim, tile_y_dim /) ) + CALL nc_opchk(stat, "nf90_get_var: slmsk") + + tile_num = 1 + lake_frac(:) = cs_lakestat((tile_num-1)*tile_sz+1:tile_num*tile_sz) + lake_depth(:) = cs_lakedepth((tile_num-1)*tile_sz+1:tile_num*tile_sz) + +! add Caspian Sea and Aral Sea to lake_frac and lake_depth + IF (tile_num == 2 .or. tile_num == 3) THEN + DO i = 1, tile_sz + IF (land_frac(i) < 0.9 .AND. lake_frac(i) < 0.1) THEN + IF (geolat(i) > 35.0 .AND. geolat(i) <= 50.0 .AND. & + geolon(i) > 45.0 .AND. geolon(i) <= 55.0) THEN + lake_frac(i) = 1.-land_frac(i) + lake_depth(i) = 211.0 + ENDIF + IF (geolat(i) > 35.0 .AND. geolat(i) <= 50.0 .AND. & + geolon(i) > 57.0 .AND. geolon(i) <= 63.0) THEN + lake_frac(i) = 1.-land_frac(i) + lake_depth(i) = 10.0 + ENDIF + ENDIF + ENDDO + ENDIF + + DO i = 1, tile_sz +! epsil is "numerical" nonzero min for lake_frac/land_frac +! lake_cutoff/land_cutoff is practical min for lake_frac/land_frac + if (min(lake_cutoff,land_cutoff) < epsil) then + print *,'lake_cutoff/land_cutoff cannot be smaller than epsil, reset...' + lake_cutoff=max(epsil,lake_cutoff) + land_cutoff=max(epsil,land_cutoff) + end if + + if (lake_frac(i)< lake_cutoff) lake_frac(i)=0. + if (lake_frac(i)>1.-lake_cutoff) lake_frac(i)=1. + if (land_frac(i)< land_cutoff) land_frac(i)=0. + if (land_frac(i)>1.-land_cutoff) land_frac(i)=1. + + if (lake_frac(i) >= lake_cutoff) then ! non-zero lake_frac dominates over land_frac + land_frac(i) = max(0., min(1., 1.-lake_frac(i))) + end if + + if (lake_frac(i) < lake_cutoff) then + lake_depth(i)=0. + elseif (lake_frac(i) >= lake_cutoff .and. lake_depth(i)==0.) then + lake_depth(i)=10. + end if + slmsk(i) = nint(land_frac(i)) + ENDDO + +! write 2 new variables + stat = nf90_put_var(ncid, lake_frac_id, lake_frac, & + start = (/ 1, 1 /), count = (/ tile_x_dim, tile_y_dim /) ) + CALL nc_opchk(stat, "nf90_put_var: lake_frac") + + stat = nf90_put_var(ncid, lake_depth_id, lake_depth, & + start = (/ 1, 1 /), count = (/ tile_x_dim, tile_y_dim /) ) + CALL nc_opchk(stat, "nf90_put_var: lake_depth") + +! write back 2 modified variables: land_frac and slmsk + stat = nf90_put_var(ncid, land_frac_id, land_frac, & + start = (/ 1, 1 /), count = (/ tile_x_dim, tile_y_dim /) ) + CALL nc_opchk(stat, "nf90_put_var: land_frac") + + stat = nf90_put_var(ncid, slmsk_id, slmsk, & + start = (/ 1, 1 /), count = (/ tile_x_dim, tile_y_dim /) ) + CALL nc_opchk(stat, "nf90_put_var: slmsk") + + stat = nf90_close(ncid) + CALL nc_opchk(stat, "nf90_close") + +END SUBROUTINE write_reg_lakedata_to_orodata + +SUBROUTINE nc_opchk(stat,opname) + USE netcdf + IMPLICIT NONE + INTEGER stat + CHARACTER(len=*) opname + CHARACTER(64) msg + + IF (stat .NE.0) THEN + msg = trim(opname) // ' Error, status code and message:' + PRINT*,trim(msg), stat, nf90_strerror(stat) + STOP + END IF + +END SUBROUTINE nc_opchk + +END PROGRAM lake_frac diff --git a/sorc/orog.fd/.gitignore b/sorc/orog_mask_tools.fd/orog.fd/.gitignore similarity index 100% rename from sorc/orog.fd/.gitignore rename to sorc/orog_mask_tools.fd/orog.fd/.gitignore diff --git a/sorc/orog.fd/CMakeLists.txt b/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt similarity index 100% rename from sorc/orog.fd/CMakeLists.txt rename to sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt diff --git a/sorc/orog.fd/README b/sorc/orog_mask_tools.fd/orog.fd/README similarity index 100% rename from sorc/orog.fd/README rename to sorc/orog_mask_tools.fd/orog.fd/README diff --git a/sorc/orog.fd/README_OC b/sorc/orog_mask_tools.fd/orog.fd/README_OC similarity index 100% rename from sorc/orog.fd/README_OC rename to sorc/orog_mask_tools.fd/orog.fd/README_OC diff --git a/sorc/orog.fd/machine.h b/sorc/orog_mask_tools.fd/orog.fd/machine.h similarity index 100% rename from sorc/orog.fd/machine.h rename to sorc/orog_mask_tools.fd/orog.fd/machine.h diff --git a/sorc/orog.fd/mtnlm7_oclsm.f b/sorc/orog_mask_tools.fd/orog.fd/mtnlm7_oclsm.f similarity index 100% rename from sorc/orog.fd/mtnlm7_oclsm.f rename to sorc/orog_mask_tools.fd/orog.fd/mtnlm7_oclsm.f diff --git a/sorc/orog.fd/netcdf_io.F90 b/sorc/orog_mask_tools.fd/orog.fd/netcdf_io.F90 similarity index 100% rename from sorc/orog.fd/netcdf_io.F90 rename to sorc/orog_mask_tools.fd/orog.fd/netcdf_io.F90 diff --git a/sorc/orog.fd/resevod.h b/sorc/orog_mask_tools.fd/orog.fd/resevod.h similarity index 100% rename from sorc/orog.fd/resevod.h rename to sorc/orog_mask_tools.fd/orog.fd/resevod.h diff --git a/sorc/sfc_climo_gen.fd/model_grid.F90 b/sorc/sfc_climo_gen.fd/model_grid.F90 index b123b6bfa..bd0c0b5f0 100644 --- a/sorc/sfc_climo_gen.fd/model_grid.F90 +++ b/sorc/sfc_climo_gen.fd/model_grid.F90 @@ -334,7 +334,7 @@ subroutine get_model_info(orog_file, mask, lat2d, lon2d, idim, jdim) real(esmf_kind_r4), intent(out) :: lat2d(idim,jdim) real(esmf_kind_r4), intent(out) :: lon2d(idim,jdim) - integer :: error, lat, lon + integer :: error, lat, lon, i, j integer :: ncid, id_dim, id_var real(kind=4), allocatable :: dummy(:,:) @@ -365,12 +365,37 @@ subroutine get_model_info(orog_file, mask, lat2d, lon2d, idim, jdim) allocate(dummy(idim,jdim)) - print*,"- READ LAND MASK" - error=nf90_inq_varid(ncid, 'slmsk', id_var) - call netcdf_err(error, "READING SLMSK ID") - error=nf90_get_var(ncid, id_var, dummy) - call netcdf_err(error, "READING SLMSK") - mask = nint(dummy) +!----------------------------------------------------------------------- +! If the lake maker was used, there will be a 'lake_frac' record. +! In that case, land/non-land is determined by 'land_frac'. +! +! If the lake maker was not used, use 'slmsk', which is defined +! as the nint(land_frac). +!----------------------------------------------------------------------- + + error=nf90_inq_varid(ncid, 'lake_frac', id_var) + if (error /= 0) then + print*,"- READ LAND MASK (SLMSK)" + error=nf90_inq_varid(ncid, 'slmsk', id_var) + call netcdf_err(error, "READING SLMSK ID") + error=nf90_get_var(ncid, id_var, dummy) + call netcdf_err(error, "READING SLMSK") + mask = nint(dummy) + else + print*,"- READ LAND FRACTION" + error=nf90_inq_varid(ncid, 'land_frac', id_var) + call netcdf_err(error, "READING LAND_FRAC ID") + error=nf90_get_var(ncid, id_var, dummy) + call netcdf_err(error, "READING LAND_FRAC") + mask = 0 + do j = 1, lat + do i = 1, lon + if (dummy(i,j) > 0.0) then + mask(i,j) = 1 + endif + enddo + enddo + endif print*,"- READ LATITUDE" error=nf90_inq_varid(ncid, 'geolat', id_var) diff --git a/ush/fv3gfs_driver_grid.sh b/ush/fv3gfs_driver_grid.sh index dc37d28ff..202a8e6a6 100755 --- a/ush/fv3gfs_driver_grid.sh +++ b/ush/fv3gfs_driver_grid.sh @@ -42,8 +42,12 @@ export machine=${machine:?} #---------------------------------------------------------------------------------- export res=${res:-96} # resolution of tile: 48, 96, 128, 192, 384, 768, 1152, 3072 -export gtype=${gtype:-uniform} # grid type: uniform, stretch, nest, regional_gfdl - # or regional_esg +export gtype=${gtype:-uniform} # grid type: uniform, stretch, nest, regional_gfdl, + # or regional_esg + +export add_lake=${add_lake:-false} # add lake fraction and depth. uniform only. +export lake_cutoff=${lake_cutoff:-0.20} # lake fractions less than lake_cutoff + # are ignored. if [ $gtype = uniform ]; then echo "Creating global uniform grid" @@ -88,6 +92,15 @@ else exit 9 fi +if [ $add_lake = true ]; then + if [ $gtype != uniform ]; then + set +x + echo "Adding lake data to orography data is only available" + echo "for uniform grids." + exit 1 + fi +fi + export TMPDIR=${TMPDIR:?} export out_dir=${out_dir:?} @@ -194,6 +207,14 @@ if [ $gtype = uniform ] || [ $gtype = stretch ] || [ $gtype = nest ]; then done fi + if [ $add_lake = true ]; then + $script_dir/fv3gfs_make_lake.sh + err=$? + if [ $err != 0 ]; then + exit $err + fi + fi + set +x echo "End uniform orography generation at `date`" set -x diff --git a/ush/fv3gfs_make_lake.sh b/ush/fv3gfs_make_lake.sh new file mode 100755 index 000000000..ad0d81f14 --- /dev/null +++ b/ush/fv3gfs_make_lake.sh @@ -0,0 +1,99 @@ +#!/bin/ksh + +echo +echo "CREATE AND ADD INLAND, LAKE_STATUS, AND LAKE_DEPTH TO THE OROGRAPHY FILES" +echo + +set -ax + +outdir=$orog_dir +indir=$topo + +if [ $gtype != uniform ]; then + echo "lake_frac has not been implemented for FV3 stand-alone Regional (SAR) model" + exit 1 +fi + +exe_add_lake=$exec_dir/lakefrac +if [ ! -s $exe_add_lake ]; then + echo "executable to add lake does not exist" + exit 1 +fi + +exe_inland=$exec_dir/inland +if [ ! -s $exe_inland ]; then + echo "executable to create inland mask does not exist" + exit 1 +fi + +workdir=$TMPDIR/C${res}/orog/tiles +if [ ! -s $workdir ]; then mkdir -p $workdir ;fi + +# Make lake data - +# Create and add inland, lake_status, and lake_depth to the orography files + +echo "workdir = $workdir" +echo "outdir = $outdir" +echo "indir = $indir" + +cd $workdir + +# link all required files to the current work directory + +tile_beg=1 +tile_end=6 +tile=$tile_beg +while [ $tile -le $tile_end ]; do + outfile=oro.C${res}.tile${tile}.nc + ln -s $outdir/$outfile . + outgrid="C${res}_grid.tile${tile}.nc" + ln -s $grid_dir/$outgrid . + tile=$(( $tile + 1 )) +done + +# create inland mask and save it to the orography files + +cutoff=0.99 +rd=7 +$APRUN $exe_inland $res $cutoff $rd +err=$? +if [ $err != 0 ]; then + set +x + echo ERROR CREATING INLAND MASK + exit $err +fi + +# create lake data for FV3 grid and save it to the orography files + +if [ $machine = WCOSS_C ]; then + touch ./lake.txt + tile=$tile_beg + while [ $tile -le $tile_end ]; do + echo "$exe_add_lake ${tile} ${res} ${indir} ${lake_cutoff}" >> ./lake.txt + tile=$(( $tile + 1 )) + done + aprun -j 1 -n 6 -N 6 -d 1 -cc depth cfp ./lake.txt + err=$? + if [ $err != 0 ]; then + set +x + echo ERROR CREATING LAKE FRACTION + exit $err + fi + rm ./lake.txt +else + tile=$tile_beg + while [ $tile -le $tile_end ]; do + outfile=oro.C${res}.tile${tile}.nc + $APRUN $exe_add_lake ${tile} ${res} ${indir} ${lake_cutoff} + err=$? + if [ $err != 0 ]; then + set +x + echo ERROR CREATING LAKE FRACTION FOR TILE $tile + exit $err + fi + echo "lake fraction is added to $outfile" + tile=$(( $tile + 1 )) + done +fi + +exit 0 From 8404a4d07998ef92a58a55b0ab3408c158975477 Mon Sep 17 00:00:00 2001 From: Rahul Mahajan Date: Mon, 14 Sep 2020 16:29:22 -0400 Subject: [PATCH 030/192] Update to use project configs from NCEPLIBS NCEPLIBS was updated to provide a project-config file with its CMake build. Update the UFS_UTILS build to use the imported targets from these NCEPLIBS. --- .gitignore | 11 +++ .gitmodules | 2 +- CMakeLists.txt | 90 +++++-------------- CMakeModules | 1 + build_all.sh | 18 ++-- cmake | 1 - modulefiles/build.hera | 33 +++---- modulefiles/build.jet | 46 +++++----- modulefiles/build.orion | 29 +++--- modulefiles/build.wcoss_cray | 32 ++++--- modulefiles/build.wcoss_dell_p3 | 31 ++++--- sorc/CMakeLists.txt | 4 +- sorc/chgres_cube.fd/CMakeLists.txt | 17 ++-- sorc/emcsfc_ice_blend.fd/CMakeLists.txt | 9 +- sorc/emcsfc_snow2mdl.fd/CMakeLists.txt | 17 ++-- sorc/global_chgres.fd/CMakeLists.txt | 30 ++++--- sorc/global_cycle.fd/CMakeLists.txt | 18 ++-- .../filter_topo.fd/CMakeLists.txt | 2 +- .../global_equiv_resol.f90 | 4 +- sorc/mkgfsnemsioctl.fd/CMakeLists.txt | 4 +- sorc/nemsio_chgdate.fd/CMakeLists.txt | 5 +- sorc/nemsio_get.fd/CMakeLists.txt | 6 +- sorc/nemsio_read.fd/CMakeLists.txt | 4 +- sorc/nst_tf_chg.fd/CMakeLists.txt | 6 +- sorc/orog_mask_tools.fd/CMakeLists.txt | 3 + .../inland.fd/CMakeLists.txt | 4 +- .../orog_mask_tools.fd/lake.fd/CMakeLists.txt | 6 +- .../orog_mask_tools.fd/orog.fd/CMakeLists.txt | 10 +-- sorc/orog_mask_tools.fd/orog.fd/README | 0 sorc/orog_mask_tools.fd/orog.fd/README_OC | 0 sorc/orog_mask_tools.fd/orog.fd/machine.h | 0 .../orog_mask_tools.fd/orog.fd/mtnlm7_oclsm.f | 0 sorc/orog_mask_tools.fd/orog.fd/netcdf_io.F90 | 0 sorc/orog_mask_tools.fd/orog.fd/resevod.h | 0 sorc/sfc_climo_gen.fd/CMakeLists.txt | 2 +- 35 files changed, 211 insertions(+), 234 deletions(-) create mode 100644 .gitignore create mode 160000 CMakeModules delete mode 160000 cmake create mode 100644 sorc/orog_mask_tools.fd/CMakeLists.txt mode change 100755 => 100644 sorc/orog_mask_tools.fd/orog.fd/README mode change 100755 => 100644 sorc/orog_mask_tools.fd/orog.fd/README_OC mode change 100755 => 100644 sorc/orog_mask_tools.fd/orog.fd/machine.h mode change 100755 => 100644 sorc/orog_mask_tools.fd/orog.fd/mtnlm7_oclsm.f mode change 100755 => 100644 sorc/orog_mask_tools.fd/orog.fd/netcdf_io.F90 mode change 100755 => 100644 sorc/orog_mask_tools.fd/orog.fd/resevod.h diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..53eb8fe30 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +build/ +install/ +exec/ + +*.[ao] +*.mod +*.so +*.exe +*.x + +*.swp diff --git a/.gitmodules b/.gitmodules index 5efb05cac..e17e00eca 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "cmake"] - path = cmake + path = CMakeModules url = https://github.com/NOAA-EMC/CMakeModules branch = develop diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ae7980d4..2c7357146 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ project( ufs_util VERSION ${pVersion} LANGUAGES C Fortran) -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/Modules") if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") message(STATUS "Setting build type to 'Release' as none was specified.") @@ -17,96 +17,52 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") "MinSizeRel" "RelWithDebInfo") endif() -if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU|Clang|AppleClang)$") - message(WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}") +if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Intel|GNU|Clang|AppleClang)$") + message(WARNING "Compiler not officially supported: ${CMAKE_C_COMPILER_ID}") endif() -if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Intel|GNU)$") - message(WARNING "Compiler not officially supported: ${CMAKE_C_COMPILER_ID}") +if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU)$") + message(WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}") endif() if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") - set(CMAKE_Fortran_FLAGS "-g -traceback") + 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") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") - set(CMAKE_Fortran_FLAGS "-g -fbacktrace") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -fbacktrace") set(CMAKE_Fortran_FLAGS_RELEASE "-O3") set(CMAKE_Fortran_FLAGS_DEBUG "-O0 -ggdb -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check") endif() if(CMAKE_C_COMPILER_ID MATCHES "^(Intel)$") - set(CMAKE_C_FLAGS "-g -traceback") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -traceback") set(CMAKE_C_FLAGS_RELEASE "-O2") set(CMAKE_C_FLAGS_DEBUG "-O0") -elseif(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") - set(CMAKE_C_FLAGS " ") - set(CMAKE_C_FLAGS_RELEASE " ") - set(CMAKE_C_FLAGS_DEBUG " ") endif() -find_package(PNG REQUIRED) -find_package(ZLIB REQUIRED) -find_package(Jasper REQUIRED) find_package(NetCDF REQUIRED C Fortran) -find_package(MPI REQUIRED ) +find_package(MPI REQUIRED) find_package(ESMF MODULE REQUIRED) -find_package(WGRIB2 REQUIRED) option(OPENMP "use OpenMP threading" ON) if(OPENMP) find_package(OpenMP REQUIRED COMPONENTS Fortran) endif() -set(CMAKE_FIND_PACKAGE_PREFER_CONFIG true) - -if(NOT TARGET gfsio_4) - find_package(gfsio REQUIRED) -endif() - -if(NOT TARGET sfcio_4) - find_package(sfcio REQUIRED) -endif() - -if(NOT TARGET w3nco_d) - find_package(w3nco REQUIRED) -endif() - -if(NOT TARGET landsfcutil_d) - find_package(landsfcutil REQUIRED) -endif() - -if(NOT TARGET bacio_4) - find_package(bacio REQUIRED) -endif() - -if(NOT TARGET nemsio) - find_package(nemsio REQUIRED) -endif() - -if(NOT TARGET nemsiogfs) - find_package(nemsiogfs REQUIRED) -endif() - -if(NOT TARGET sigio_4) - find_package(sigio REQUIRED) -endif() - -if(NOT TARGET sp_d) - find_package(sp REQUIRED) -endif() - -if(NOT TARGET ip_d) - find_package(ip REQUIRED) -endif() - -if(NOT TARGET w3emc_d) - find_package(w3emc REQUIRED) -endif() - -if(NOT TARGET g2_d) - find_package(g2 REQUIRED) -endif() +find_package(gfsio REQUIRED) +find_package(sfcio REQUIRED) +find_package(w3nco REQUIRED) +find_package(landsfcutil REQUIRED) +find_package(bacio REQUIRED) +find_package(nemsio REQUIRED) +find_package(nemsiogfs REQUIRED) +find_package(sigio REQUIRED) +find_package(sp REQUIRED) +find_package(ip REQUIRED) +find_package(w3emc REQUIRED) +find_package(g2 REQUIRED) +find_package(wgrib2 REQUIRED) # EMC requires executables in ./exec set(exec_dir bin) diff --git a/CMakeModules b/CMakeModules new file mode 160000 index 000000000..3eaddb8c9 --- /dev/null +++ b/CMakeModules @@ -0,0 +1 @@ +Subproject commit 3eaddb8c9d5cfc07c2b2388e70b0f19326c1cfc0 diff --git a/build_all.sh b/build_all.sh index 854538b76..64d159c1d 100755 --- a/build_all.sh +++ b/build_all.sh @@ -3,16 +3,20 @@ set -eux target=${target:-"NULL"} -if [[ $target == "linux.gnu" || $target == "linux.intel" ]]; then +if [[ "$target" == "linux.gnu" || "$target" == "linux.intel" ]]; then unset -f module else + set +x source ./sorc/machine-setup.sh > /dev/null 2>&1 + set -x fi export MOD_PATH +set +x source ./modulefiles/build.$target > /dev/null 2>&1 +module list +set -x -# # --- Build all programs. # @@ -20,12 +24,14 @@ rm -fr ./build mkdir ./build cd ./build -if [[ $target == "wcoss_cray" ]]; then - cmake .. -DCMAKE_INSTALL_PREFIX=../ -DEMC_EXEC_DIR=ON -else - cmake .. -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_C_COMPILER=icc -DCMAKE_INSTALL_PREFIX=../ -DEMC_EXEC_DIR=ON +CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=../ -DEMC_EXEC_DIR=ON" + +if [[ "$target" != "wcoss_cray" ]]; then + CMAKE_FLAGS+=" -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_C_COMPILER=icc" fi +cmake .. ${CMAKE_FLAGS} + make -j 8 VERBOSE=1 make install diff --git a/cmake b/cmake deleted file mode 160000 index ff93c2d2c..000000000 --- a/cmake +++ /dev/null @@ -1 +0,0 @@ -Subproject commit ff93c2d2ca7df9e8ba6372b70f5d58110c9210f1 diff --git a/modulefiles/build.hera b/modulefiles/build.hera index d7068c38d..cbae95e56 100644 --- a/modulefiles/build.hera +++ b/modulefiles/build.hera @@ -7,22 +7,23 @@ module load cmake/3.16.1 module load intel/18.0.5.274 module load impi/2018.0.4 -module use -a /scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles -module load prod_util/1.1.0 -module load w3nco/2.0.6 -module load w3emc/2.3.0 -module load nemsio/2.2.3 -module load bacio/2.0.2 -module load sp/2.0.2 -module load ip/3.0.1 -module load sfcio/1.1.0 -module load sigio/2.1.0 -module load gfsio/1.1.0 -module load nemsiogfs/2.2.0 -module load landsfcutil/2.1.0 -module load g2/2.5.0 +module use /scratch2/NCEPDEV/nwprod/NCEPLIBS/cmake/install/NCEPLIBS-v1.2.0/modules +module load bacio/2.4.1 +module load g2/3.4.1 +module load ip/3.3.3 +module load nemsio/2.5.2 +module load sp/2.3.3 +module load w3emc/2.7.3 +module load w3nco/2.4.1 +module load gfsio/1.4.1 +module load sfcio/1.4.1 +module load sigio/2.3.2 +module load nemsiogfs/2.5.3 +module load landsfcutil/2.4.1 +module load wgrib2/2.0.8 + +module use /scratch1/NCEPDEV/nems/emc.nemspara/soft/modulefiles +module load hdf5_parallel/1.10.6 module load netcdf_parallel/4.7.4 module load esmf/8.0.0_ParallelNetCDF - -export WGRIB2_ROOT="/scratch1/NCEPDEV/da/George.Gayno/noscrub/wgrib2" diff --git a/modulefiles/build.jet b/modulefiles/build.jet index 5b552697c..b81a52cd0 100644 --- a/modulefiles/build.jet +++ b/modulefiles/build.jet @@ -1,30 +1,34 @@ #%Module##################################################### ## Build and run module for Jet ############################################################# - -module use /lfs4/HFIP/hfv3gfs/nwprod/NCEPLIBS/modulefiles module load cmake/3.16.1 module load intel/18.0.5.274 module load impi/2018.4.274 module load szip/2.1 -module load hdf5/1.10.4 -module load netcdf/4.6.1 -export NETCDF="/apps/netcdf/4.6.1/intel/18.0.5.274" -module load w3nco/v2.0.6 -module load w3emc/v2.2.0 -module load sp/v2.0.2 -module load ip/v3.0.0 -module load bacio/v2.0.2 -module load sigio/v2.1.0 -module load sfcio/v1.0.0 -module load nemsio/v2.2.3 -module load nemsiogfs/v2.0.1 -module load gfsio/v1.1.0 -module load landsfcutil/v2.1.0 -module load g2/v3.1.0 +module load hdf5/1.10.5 +module load netcdf/4.7.0 + +export CC=icc +export FC=ifort +export CXX=icpc + +export ESMFMKFILE=/lfs4/HFIP/hfv3gfs/software/NCEPLIBS-ufs-v2.0.0beta01/intel-18.0.5.274/impi-2018.4.274/lib64/esmf.mk +export Jasper_ROOT=/lfs4/HFIP/hfv3gfs/software/NCEPLIBS-ufs-v2.0.0beta01/intel-18.0.5.274/impi-2018.4.274 + +module use /lfs4/HFIP/hfv3gfs/software/NCEPLIBS-ufs-v2.0.0beta01/intel-18.0.5.274/impi-2018.4.274/modules +module load w3nco/2.4.1 +module load w3emc/2.7.3 +module load sp/2.3.3 +module load ip/3.3.3 +module load bacio/2.4.1 +module load sigio/2.3.2 +module load sfcio/1.4.1 +module load nemsio/2.5.2 +module load nemsiogfs/2.5.3 +module load gfsio/1.4.1 +module load landsfcutil/2.4.1 +module load g2/3.4.1 +module load wgrib2/2.0.8 + -# Use DTCs version of esmf v8. POC Dom H. -module use -a /lfs4/HFIP/hfv3gfs/software/modulefiles/intel-18.0.5.274/impi-2018.4.274 -module load esmf/8.0.0 -export WGRIB2_ROOT="/lfs4/HFIP/hwrfv3/Jili.Dong/wgrib2-2.0.8/grib2/lib" diff --git a/modulefiles/build.orion b/modulefiles/build.orion index 145ec66c8..5c623989a 100644 --- a/modulefiles/build.orion +++ b/modulefiles/build.orion @@ -6,23 +6,24 @@ module load cmake/3.15.4 module load intel/2020 module load impi/2020 -module use -a /apps/contrib/NCEPLIBS/orion/modulefiles -module load w3nco/2.1.0 -module load nemsio/2.3.0 -module load bacio/2.2.0 -module load sfcio/1.2.0 -module load sigio/2.2.0 -module load gfsio/1.2.0 -module load w3emc/2.4.0 -module load ip/3.1.0 -module load nemsiogfs/2.3.0 -module load landsfcutil/2.2.0 -module load g2/3.1.1 -module load sp/2.0.3 +module use /apps/contrib/NCEPLIBS/orion/cmake/install/NCEPLIBS-v1.2.0/modules +module load bacio/2.4.1 +module load g2/3.4.1 +module load ip/3.3.3 +module load nemsio/2.5.2 +module load sp/2.3.3 +module load w3emc/2.7.3 +module load w3nco/2.4.1 +module load gfsio/1.4.1 +module load sfcio/1.4.1 +module load sigio/2.3.2 +module load nemsiogfs/2.5.3 +module load landsfcutil/2.4.1 +module load wgrib2/2.0.8 + export Jasper_ROOT="/apps/jasper-1.900.1" module use -a /apps/contrib/NCEPLIBS/lib/modulefiles module load netcdfp/4.7.4.release module load esmflocal/8_0_0.release -export WGRIB2_ROOT="/work/noaa/da/ggayno/save/wgrib2" diff --git a/modulefiles/build.wcoss_cray b/modulefiles/build.wcoss_cray index 14506ef13..b6ce5aa57 100644 --- a/modulefiles/build.wcoss_cray +++ b/modulefiles/build.wcoss_cray @@ -9,32 +9,36 @@ module load cfp-intel-sandybridge/1.1.0 module load cmake/3.16.2 module load PrgEnv-intel/5.2.56 module rm intel -module load intel/16.3.210 +module load intel/18.1.163 module load cray-mpich/7.2.0 module load craype-haswell module load alps/5.2.4-2.0502.9822.32.1.ari module load cray-netcdf/4.3.3.1 module load cray-hdf5/1.8.14 -module load w3nco-intel/2.0.6 -module load nemsio-intel/2.2.3 -module load bacio-intel/2.0.2 -module load sp-intel/2.0.2 -module load ip-intel/3.0.0 -module load sigio-intel/2.1.0 -module load sfcio-intel/1.0.0 -module load landsfcutil-intel/2.1.0 -module load gfsio-intel/1.1.0 -module load w3emc-intel/2.2.0 -module load nemsiogfs-intel/2.0.1 -module load g2-intel/2.5.0 + +module use /usrx/local/nceplibs/NCEPLIBS/cmake/install/NCEPLIBS-v1.2.0/modules +module load bacio/2.4.1 +module load g2/3.4.1 +module load ip/3.3.3 +module load nemsio/2.5.2 +module load sp/2.3.3 +module load w3emc/2.7.3 +module load w3nco/2.4.1 +module load gfsio/1.4.1 +module load sfcio/1.4.1 +module load sigio/2.3.2 +module load nemsiogfs/2.5.3 +module load landsfcutil/2.4.1 +module load wgrib2/2.0.8 + export ZLIB_ROOT=/usrx/local/prod/zlib/1.2.7/intel/haswell export PNG_ROOT=/usrx/local/prod//png/1.2.49/intel/haswell export Jasper_ROOT=/usrx/local/prod/jasper/1.900.1/intel/haswell module use /gpfs/hps3/emc/nems/noscrub/emc.nemspara/soft/modulefiles module load esmf/8.0.0 +export ESMFMKFILE=/gpfs/hps3/emc/nems/noscrub/emc.nemspara/soft/esmf/8.0.0/lib/esmf.mk export NETCDF=/opt/cray/netcdf/4.3.3.1/INTEL/14.0 module rm gcc module load gcc/6.3.0 -export WGRIB2_ROOT=/gpfs/hps3/emc/global/noscrub/George.Gayno/wgrib2 diff --git a/modulefiles/build.wcoss_dell_p3 b/modulefiles/build.wcoss_dell_p3 index 338663c9b..ae9d55e2c 100644 --- a/modulefiles/build.wcoss_dell_p3 +++ b/modulefiles/build.wcoss_dell_p3 @@ -7,18 +7,8 @@ module load HPSS/5.0.2.5 module load cmake/3.16.2 module load ips/18.0.1.163 module load impi/18.0.1 -module load w3nco/2.0.6 -module load w3emc/2.3.0 -module load sp/2.0.2 -module load nemsio/2.2.3 -module load bacio/2.0.2 -module load ip/3.0.1 -module load sfcio/1.0.0 -module load sigio/2.1.0 -module load gfsio/1.1.0 -module load landsfcutil/2.1.0 -module load nemsiogfs/2.0.1 -module load g2/3.1.0 + + module load jasper/1.900.29 export Jasper_ROOT="/usrx/local/prod/packages/gnu/4.8.5/jasper/1.900.29" @@ -28,7 +18,20 @@ module load netcdf_parallel/4.7.4 module use /gpfs/dell2/emc/modeling/noscrub/emc.nemspara/soft/modulefiles module load esmf/8.0.0_ParallelNetCDF -export WGRIB2_ROOT=/gpfs/dell2/emc/modeling/noscrub/George.Gayno/wgrib2 - module use /usrx/local/dev/modulefiles module load prod_util/1.1.3 + +module use /usrx/local/nceplibs/dev/NCEPLIBS/cmake/install/NCEPLIBS-v1.2.0/modules +module load bacio/2.4.1 +module load g2/3.4.1 +module load ip/3.3.3 +module load nemsio/2.5.2 +module load sp/2.3.3 +module load w3emc/2.7.3 +module load w3nco/2.4.1 +module load gfsio/1.4.1 +module load sfcio/1.4.1 +module load sigio/2.3.2 +module load nemsiogfs/2.5.3 +module load landsfcutil/2.4.1 +module load wgrib2/2.0.8 diff --git a/sorc/CMakeLists.txt b/sorc/CMakeLists.txt index 6daacc548..2cbca0d16 100644 --- a/sorc/CMakeLists.txt +++ b/sorc/CMakeLists.txt @@ -15,7 +15,5 @@ add_subdirectory(mkgfsnemsioctl.fd) add_subdirectory(fre-nctools.fd) add_subdirectory(grid_tools.fd) add_subdirectory(chgres_cube.fd) -add_subdirectory(orog_mask_tools.fd/orog.fd) -add_subdirectory(orog_mask_tools.fd/lake.fd) -add_subdirectory(orog_mask_tools.fd/inland.fd) +add_subdirectory(orog_mask_tools.fd) add_subdirectory(sfc_climo_gen.fd) diff --git a/sorc/chgres_cube.fd/CMakeLists.txt b/sorc/chgres_cube.fd/CMakeLists.txt index 3c5f6f6cc..dd7dc4a6c 100644 --- a/sorc/chgres_cube.fd/CMakeLists.txt +++ b/sorc/chgres_cube.fd/CMakeLists.txt @@ -14,7 +14,7 @@ set(fortran_src if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian -assume byterecl") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-0 -fdefault-real-8 -fconvert=big-endian") endif() @@ -22,14 +22,15 @@ set(exe_name chgres_cube) add_executable(${exe_name} ${fortran_src}) target_link_libraries( ${exe_name} - nemsio - sfcio_4 - sigio_4 - bacio_4 - sp_d - w3nco_d + nemsio::nemsio + sfcio::sfcio + sigio::sigio + bacio::bacio_4 + sp::sp_d + w3nco::w3nco_d esmf - wgrib2 + wgrib2::wgrib2_lib + wgrib2::wgrib2_api MPI::MPI_Fortran NetCDF::NetCDF_Fortran) if(OpenMP_Fortran_FOUND) diff --git a/sorc/emcsfc_ice_blend.fd/CMakeLists.txt b/sorc/emcsfc_ice_blend.fd/CMakeLists.txt index ecfe7af75..e50646381 100644 --- a/sorc/emcsfc_ice_blend.fd/CMakeLists.txt +++ b/sorc/emcsfc_ice_blend.fd/CMakeLists.txt @@ -5,11 +5,8 @@ set(exe_name emcsfc_ice_blend) add_executable(${exe_name} ${fortran_src}) target_link_libraries( ${exe_name} - bacio_4 - g2_4 - w3nco_4 - ${JASPER_LIBRARIES} - PNG::PNG - ZLIB::ZLIB) + bacio::bacio_4 + g2::g2_4 + w3nco::w3nco_4) install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt b/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt index 8a4561a1a..e884e1d7a 100644 --- a/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt +++ b/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt @@ -8,7 +8,7 @@ set(fortran_src if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -FR -convert big_endian -assume byterecl") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-form -fdefault-real-8 -fconvert=big-endian") endif() @@ -16,15 +16,12 @@ set(exe_name emcsfc_snow2mdl) add_executable(${exe_name} ${fortran_src}) target_link_libraries( ${exe_name} - g2_d - ip_d - sp_d - landsfcutil_d - bacio_4 - w3nco_d - ${JASPER_LIBRARIES} - PNG::PNG - ZLIB::ZLIB) + g2::g2_d + ip::ip_d + sp::sp_d + landsfcutil::landsfcutil_d + bacio::bacio_4 + w3nco::w3nco_d) if(OpenMP_Fortran_FOUND) target_link_libraries(${exe_name} OpenMP::OpenMP_Fortran) endif() diff --git a/sorc/global_chgres.fd/CMakeLists.txt b/sorc/global_chgres.fd/CMakeLists.txt index a3298825e..dc62c1a7d 100644 --- a/sorc/global_chgres.fd/CMakeLists.txt +++ b/sorc/global_chgres.fd/CMakeLists.txt @@ -14,7 +14,7 @@ set(fortran_src if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fconvert=big-endian") endif() @@ -22,18 +22,20 @@ set(exe_name global_chgres) add_executable(${exe_name} ${fortran_src}) target_link_libraries( ${exe_name} - gfsio_4 - nemsiogfs - nemsio - sigio_4 - sfcio_4 - landsfcutil_d - ip_d - sp_d - w3emc_d - w3nco_d - bacio_4 - NetCDF::NetCDF_Fortran - OpenMP::OpenMP_Fortran) + gfsio::gfsio + nemsiogfs::nemsiogfs + nemsio::nemsio + sigio::sigio + sfcio::sfcio + landsfcutil::landsfcutil_d + ip::ip_d + sp::sp_d + w3emc::w3emc_d + w3nco::w3nco_d + bacio::bacio_4 + NetCDF::NetCDF_Fortran) +if(OpenMP_Fortran_FOUND) + target_link_libraries(${exe_name} OpenMP::OpenMP_Fortran) +endif() install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/global_cycle.fd/CMakeLists.txt b/sorc/global_cycle.fd/CMakeLists.txt index 94d44e144..d962bf79e 100644 --- a/sorc/global_cycle.fd/CMakeLists.txt +++ b/sorc/global_cycle.fd/CMakeLists.txt @@ -1,5 +1,5 @@ set(fortran_src - cycle.f90 + cycle.f90 machine.f90 num_parthds.f90 sfcsub.F @@ -7,7 +7,7 @@ set(fortran_src if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fconvert=big-endian") endif() @@ -15,12 +15,14 @@ set(exe_name global_cycle) add_executable(${exe_name} ${fortran_src}) target_link_libraries( ${exe_name} - w3nco_d - bacio_4 - ip_d - sp_d + w3nco::w3nco_d + bacio::bacio_4 + ip::ip_d + sp::sp_d MPI::MPI_Fortran - NetCDF::NetCDF_Fortran - OpenMP::OpenMP_Fortran) + NetCDF::NetCDF_Fortran) +if(OpenMP_Fortran_FOUND) + target_link_libraries(${exe_name} OpenMP::OpenMP_Fortran) +endif() install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/grid_tools.fd/filter_topo.fd/CMakeLists.txt b/sorc/grid_tools.fd/filter_topo.fd/CMakeLists.txt index bd56685b1..b854a11b8 100644 --- a/sorc/grid_tools.fd/filter_topo.fd/CMakeLists.txt +++ b/sorc/grid_tools.fd/filter_topo.fd/CMakeLists.txt @@ -3,7 +3,7 @@ set(fortran_src if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -assume byterecl -real_size 64 -fno-alias -stack_temps -safe_cray_ptr -ftz") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-0 -fdefault-real-8") endif() diff --git a/sorc/grid_tools.fd/global_equiv_resol.fd/global_equiv_resol.f90 b/sorc/grid_tools.fd/global_equiv_resol.fd/global_equiv_resol.f90 index 7bd9c813f..9d40db90e 100644 --- a/sorc/grid_tools.fd/global_equiv_resol.fd/global_equiv_resol.f90 +++ b/sorc/grid_tools.fd/global_equiv_resol.fd/global_equiv_resol.f90 @@ -131,7 +131,7 @@ program global_equiv_resol WRITE(*,530) " min_cell_size = ", min_cell_size WRITE(*,530) " max_cell_size = ", max_cell_size WRITE(*,530) " avg_cell_size = ", avg_cell_size -530 FORMAT(A, G) +530 FORMAT(A, G10.4) ! !======================================================================= ! @@ -147,7 +147,7 @@ program global_equiv_resol WRITE(*,500) WRITE(*,500) "Equivalent global uniform cubed-sphere resolution is:" - WRITE(*,530) " RES_equiv = ", RES_equiv + WRITE(*,*) " RES_equiv = ", RES_equiv ! !======================================================================= ! diff --git a/sorc/mkgfsnemsioctl.fd/CMakeLists.txt b/sorc/mkgfsnemsioctl.fd/CMakeLists.txt index 7002cf37f..ced548712 100644 --- a/sorc/mkgfsnemsioctl.fd/CMakeLists.txt +++ b/sorc/mkgfsnemsioctl.fd/CMakeLists.txt @@ -5,8 +5,6 @@ set(exe_name mkgfsnemsioctl) add_executable(${exe_name} ${fortran_src}) target_link_libraries( ${exe_name} - nemsio - bacio_4 - w3nco_d) + nemsio::nemsio bacio::bacio_4 w3nco::w3nco_d) install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/nemsio_chgdate.fd/CMakeLists.txt b/sorc/nemsio_chgdate.fd/CMakeLists.txt index bb04b6c8d..d70d62aea 100644 --- a/sorc/nemsio_chgdate.fd/CMakeLists.txt +++ b/sorc/nemsio_chgdate.fd/CMakeLists.txt @@ -3,7 +3,7 @@ set(fortran_src if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -convert big_endian") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fconvert=big-endian") endif() @@ -11,7 +11,6 @@ set(exe_name nemsio_chgdate) add_executable(${exe_name} ${fortran_src}) target_link_libraries( ${exe_name} - nemsio - bacio_4) + nemsio::nemsio bacio::bacio_4 w3nco::w3nco_d) install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/nemsio_get.fd/CMakeLists.txt b/sorc/nemsio_get.fd/CMakeLists.txt index 435602ef8..108c31476 100644 --- a/sorc/nemsio_get.fd/CMakeLists.txt +++ b/sorc/nemsio_get.fd/CMakeLists.txt @@ -3,7 +3,7 @@ set(fortran_src if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -convert big_endian") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fconvert=big-endian") endif() @@ -11,8 +11,6 @@ set(exe_name nemsio_get) add_executable(${exe_name} ${fortran_src}) target_link_libraries( ${exe_name} - nemsio - bacio_4 - w3nco_d) + nemsio::nemsio bacio::bacio_4 w3nco::w3nco_d) install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/nemsio_read.fd/CMakeLists.txt b/sorc/nemsio_read.fd/CMakeLists.txt index 9e192044d..ac116193b 100644 --- a/sorc/nemsio_read.fd/CMakeLists.txt +++ b/sorc/nemsio_read.fd/CMakeLists.txt @@ -5,8 +5,6 @@ set(exe_name nemsio_read) add_executable(${exe_name} ${fortran_src}) target_link_libraries( ${exe_name} - nemsio - bacio_4 - w3nco_d) + nemsio::nemsio bacio::bacio_4 w3nco::w3nco_d) install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/nst_tf_chg.fd/CMakeLists.txt b/sorc/nst_tf_chg.fd/CMakeLists.txt index 43cd32228..8a6ad20fb 100644 --- a/sorc/nst_tf_chg.fd/CMakeLists.txt +++ b/sorc/nst_tf_chg.fd/CMakeLists.txt @@ -8,7 +8,7 @@ set(fortran_src if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8") endif() @@ -16,9 +16,7 @@ set(exe_name nst_tf_chg) add_executable(${exe_name} ${fortran_src}) target_link_libraries( ${exe_name} - nemsio - w3nco_d - bacio_4 + nemsio::nemsio bacio::bacio_4 w3nco::w3nco_d NetCDF::NetCDF_Fortran) install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/orog_mask_tools.fd/CMakeLists.txt b/sorc/orog_mask_tools.fd/CMakeLists.txt new file mode 100644 index 000000000..551d728c5 --- /dev/null +++ b/sorc/orog_mask_tools.fd/CMakeLists.txt @@ -0,0 +1,3 @@ +add_subdirectory(orog.fd) +add_subdirectory(lake.fd) +add_subdirectory(inland.fd) diff --git a/sorc/orog_mask_tools.fd/inland.fd/CMakeLists.txt b/sorc/orog_mask_tools.fd/inland.fd/CMakeLists.txt index e2078e76f..e88bc2030 100644 --- a/sorc/orog_mask_tools.fd/inland.fd/CMakeLists.txt +++ b/sorc/orog_mask_tools.fd/inland.fd/CMakeLists.txt @@ -1,10 +1,10 @@ set(fortran_src - nb.F90 + nb.F90 inland.F90) if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -assume byterecl") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-range-check") endif() diff --git a/sorc/orog_mask_tools.fd/lake.fd/CMakeLists.txt b/sorc/orog_mask_tools.fd/lake.fd/CMakeLists.txt index b33ddfd6d..5e071590d 100644 --- a/sorc/orog_mask_tools.fd/lake.fd/CMakeLists.txt +++ b/sorc/orog_mask_tools.fd/lake.fd/CMakeLists.txt @@ -1,11 +1,11 @@ set(fortran_src - enclosure_cnvx.F90 - find_limit.F90 + enclosure_cnvx.F90 + find_limit.F90 lakefrac.F90) if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -assume byterecl") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fno-range-check") endif() diff --git a/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt b/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt index 28a57938a..2ef189199 100644 --- a/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt +++ b/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt @@ -4,7 +4,7 @@ set(fortran_src if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian -assume byterecl") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fconvert=big-endian -fno-range-check") endif() @@ -12,10 +12,10 @@ set(exe_name orog) add_executable(${exe_name} ${fortran_src}) target_link_libraries( ${exe_name} - bacio_4 - w3nco_d - ip_d - sp_d + bacio::bacio_4 + w3nco::w3nco_d + ip::ip_d + sp::sp_d NetCDF::NetCDF_Fortran) if(OpenMP_Fortran_FOUND) target_link_libraries(${exe_name} OpenMP::OpenMP_Fortran) diff --git a/sorc/orog_mask_tools.fd/orog.fd/README b/sorc/orog_mask_tools.fd/orog.fd/README old mode 100755 new mode 100644 diff --git a/sorc/orog_mask_tools.fd/orog.fd/README_OC b/sorc/orog_mask_tools.fd/orog.fd/README_OC old mode 100755 new mode 100644 diff --git a/sorc/orog_mask_tools.fd/orog.fd/machine.h b/sorc/orog_mask_tools.fd/orog.fd/machine.h old mode 100755 new mode 100644 diff --git a/sorc/orog_mask_tools.fd/orog.fd/mtnlm7_oclsm.f b/sorc/orog_mask_tools.fd/orog.fd/mtnlm7_oclsm.f old mode 100755 new mode 100644 diff --git a/sorc/orog_mask_tools.fd/orog.fd/netcdf_io.F90 b/sorc/orog_mask_tools.fd/orog.fd/netcdf_io.F90 old mode 100755 new mode 100644 diff --git a/sorc/orog_mask_tools.fd/orog.fd/resevod.h b/sorc/orog_mask_tools.fd/orog.fd/resevod.h old mode 100755 new mode 100644 diff --git a/sorc/sfc_climo_gen.fd/CMakeLists.txt b/sorc/sfc_climo_gen.fd/CMakeLists.txt index b57f47fa9..1af894b82 100644 --- a/sorc/sfc_climo_gen.fd/CMakeLists.txt +++ b/sorc/sfc_climo_gen.fd/CMakeLists.txt @@ -10,7 +10,7 @@ set(fortran_src if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian") -elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-0 -fdefault-real-8 -fconvert=big-endian") endif() From d29cc355cfb09c8473d329cf799d7a4d63e726b2 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Tue, 15 Sep 2020 13:14:13 -0400 Subject: [PATCH 031/192] Updates for the Gnu compiler Some updates for the Gnu compiler. Fix argument mismatches in calls to mpi_abort. Fix syntax errors in ./lake.fd/lakefrac.F90. Add compiler flags for Gnu versions >10. See issues #140 #147. --- sorc/chgres_cube.fd/utils.f90 | 9 ++++-- sorc/fre-nctools.fd/shared_lib/mpp_domain.c | 2 +- sorc/global_chgres.fd/CMakeLists.txt | 3 ++ sorc/global_cycle.fd/CMakeLists.txt | 3 ++ sorc/global_cycle.fd/cycle.f90 | 4 +-- sorc/global_cycle.fd/read_write_data.f90 | 28 ++++++++++--------- sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 | 15 ++++++---- .../orog_mask_tools.fd/orog.fd/CMakeLists.txt | 3 ++ sorc/sfc_climo_gen.fd/interp.F90 | 4 +-- sorc/sfc_climo_gen.fd/model_grid.F90 | 6 ++-- sorc/sfc_climo_gen.fd/output.f90 | 4 +-- sorc/sfc_climo_gen.fd/utils.f90 | 9 ++++-- 12 files changed, 58 insertions(+), 32 deletions(-) diff --git a/sorc/chgres_cube.fd/utils.f90 b/sorc/chgres_cube.fd/utils.f90 index ddda0bb90..3a547eede 100644 --- a/sorc/chgres_cube.fd/utils.f90 +++ b/sorc/chgres_cube.fd/utils.f90 @@ -2,13 +2,17 @@ subroutine error_handler(string, rc) implicit none + include 'mpif.h' + character(len=*), intent(in) :: string integer, intent(in) :: rc + integer :: ierr + print*,"- FATAL ERROR: ", string print*,"- IOSTAT IS: ", rc - call mpi_abort + call mpi_abort(mpi_comm_world, 999, ierr) end subroutine error_handler @@ -20,6 +24,7 @@ subroutine netcdf_err( err, string ) integer, intent(in) :: err character(len=*), intent(in) :: string character(len=256) :: errmsg + integer :: iret include "mpif.h" @@ -28,7 +33,7 @@ subroutine netcdf_err( err, string ) print*,'' print*,'FATAL ERROR: ', trim(string), ': ', trim(errmsg) print*,'STOP.' - call mpi_abort(mpi_comm_world, 999) + call mpi_abort(mpi_comm_world, 999, iret) return end subroutine netcdf_err diff --git a/sorc/fre-nctools.fd/shared_lib/mpp_domain.c b/sorc/fre-nctools.fd/shared_lib/mpp_domain.c index 3c8b6b1cb..ea51d5ec1 100644 --- a/sorc/fre-nctools.fd/shared_lib/mpp_domain.c +++ b/sorc/fre-nctools.fd/shared_lib/mpp_domain.c @@ -13,7 +13,7 @@ /*********************************************************** global variables ***********************************************************/ -int pe, npes, root_pe; +static int pe, npes, root_pe; #define MAX_BUFFER_SIZE 10000000 double rBuffer[MAX_BUFFER_SIZE]; double sBuffer[MAX_BUFFER_SIZE]; diff --git a/sorc/global_chgres.fd/CMakeLists.txt b/sorc/global_chgres.fd/CMakeLists.txt index dc62c1a7d..4c2133a35 100644 --- a/sorc/global_chgres.fd/CMakeLists.txt +++ b/sorc/global_chgres.fd/CMakeLists.txt @@ -16,6 +16,9 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian") elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fconvert=big-endian") + if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10) + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch") + endif() endif() set(exe_name global_chgres) diff --git a/sorc/global_cycle.fd/CMakeLists.txt b/sorc/global_cycle.fd/CMakeLists.txt index d962bf79e..1b8e13973 100644 --- a/sorc/global_cycle.fd/CMakeLists.txt +++ b/sorc/global_cycle.fd/CMakeLists.txt @@ -9,6 +9,9 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian") elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fconvert=big-endian") + if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10) + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch") + endif() endif() set(exe_name global_cycle) diff --git a/sorc/global_cycle.fd/cycle.f90 b/sorc/global_cycle.fd/cycle.f90 index 5aa800f9b..290ab531f 100644 --- a/sorc/global_cycle.fd/cycle.f90 +++ b/sorc/global_cycle.fd/cycle.f90 @@ -563,7 +563,7 @@ SUBROUTINE ADJUST_NSST(RLA,RLO,SLMSK_TILE,SLMSK_FG_TILE,SKINT_TILE,& INTEGER :: ISTART, IEND, JSTART, JEND INTEGER :: MASK_TILE, MASK_FG_TILE INTEGER :: ITILE, JTILE - INTEGER :: MAX_SEARCH, J + INTEGER :: MAX_SEARCH, J, IERR INTEGER :: IGAUSP1, JGAUSP1 integer :: nintp,nsearched,nice,nland integer :: nfill,nfill_tice,nfill_clm @@ -617,7 +617,7 @@ SUBROUTINE ADJUST_NSST(RLA,RLO,SLMSK_TILE,SLMSK_FG_TILE,SKINT_TILE,& IF (NRET /= (IDIM_GAUS*JDIM_GAUS)) THEN PRINT*,'FATAL ERROR: PROBLEM IN GDSWZD. STOP.' - CALL MPI_ABORT(MPI_COMM_WORLD, 12) + CALL MPI_ABORT(MPI_COMM_WORLD, 12, IERR) ENDIF DEALLOCATE (XPTS, YPTS) diff --git a/sorc/global_cycle.fd/read_write_data.f90 b/sorc/global_cycle.fd/read_write_data.f90 index 4bbac032b..371a42668 100644 --- a/sorc/global_cycle.fd/read_write_data.f90 +++ b/sorc/global_cycle.fd/read_write_data.f90 @@ -901,7 +901,7 @@ SUBROUTINE READ_LAT_LON_OROG(RLA,RLO,OROG,OROG_UF,& IF ((NX/2) /= IDIM .OR. (NY/2) /= JDIM) THEN PRINT*,'FATAL ERROR: DIMENSIONS IN FILE: ',(NX/2),(NY/2) PRINT*,'DO NOT MATCH GRID DIMENSIONS: ',IDIM,JDIM - CALL MPI_ABORT(MPI_COMM_WORLD, 130) + CALL MPI_ABORT(MPI_COMM_WORLD, 130, ERROR) ENDIF ALLOCATE(GEOLON(NX+1,NY+1)) @@ -992,13 +992,14 @@ SUBROUTINE NETCDF_ERR( ERR, STRING ) INTEGER, INTENT(IN) :: ERR CHARACTER(LEN=*), INTENT(IN) :: STRING CHARACTER(LEN=80) :: ERRMSG + INTEGER :: IRET IF( ERR == NF90_NOERR )RETURN ERRMSG = NF90_STRERROR(ERR) PRINT*,'' PRINT*,'FATAL ERROR: ', TRIM(STRING), ': ', TRIM(ERRMSG) PRINT*,'STOP.' - CALL MPI_ABORT(MPI_COMM_WORLD, 999) + CALL MPI_ABORT(MPI_COMM_WORLD, 999, IRET) RETURN END SUBROUTINE NETCDF_ERR @@ -1123,7 +1124,7 @@ SUBROUTINE READ_DATA(TSFFCS,SMCFCS,SNOFCS,STCFCS, & INTEGER :: ERROR, NCID, MYRANK INTEGER :: IDIM, JDIM, ID_DIM - INTEGER :: ID_VAR + INTEGER :: ID_VAR, IERR REAL(KIND=8), ALLOCATABLE :: DUMMY(:,:), DUMMY3D(:,:,:) @@ -1151,7 +1152,7 @@ SUBROUTINE READ_DATA(TSFFCS,SMCFCS,SNOFCS,STCFCS, & IF ((IDIM*JDIM) /= LENSFC) THEN PRINT*,'FATAL ERROR: DIMENSIONS WRONG.' - CALL MPI_ABORT(MPI_COMM_WORLD, 88) + CALL MPI_ABORT(MPI_COMM_WORLD, 88, IERR) ENDIF ALLOCATE(DUMMY(IDIM,JDIM)) @@ -1560,7 +1561,7 @@ subroutine read_tf_clim_grb(file_sst,sst,rlats_sst,rlons_sst,mlat_sst,mlon_sst,m integer :: nlat_sst,nlon_sst integer :: iret,ni,nj - integer :: mscan,kb1 + integer :: mscan,kb1,ierr integer :: jincdir,i,iincdir,kb2,kb3,kf,kg,k,j,jf integer, dimension(22):: jgds,kgds integer, dimension(25):: jpds,kpds @@ -1575,7 +1576,7 @@ subroutine read_tf_clim_grb(file_sst,sst,rlats_sst,rlons_sst,mlat_sst,mlon_sst,m call baopenr(lu_sst,trim(file_sst),iret) if (iret /= 0 ) then write(6,*)'read_tf_clm_grb: ***error*** opening sst file' - CALL MPI_ABORT(MPI_COMM_WORLD, 111) + CALL MPI_ABORT(MPI_COMM_WORLD, 111, ierr) endif ! define sst variables for read @@ -1603,14 +1604,14 @@ subroutine read_tf_clim_grb(file_sst,sst,rlats_sst,rlons_sst,mlat_sst,mlon_sst,m if (iret /= 0) then write(6,*)'read_tf_clm_grb: ***error*** reading sst analysis data record' deallocate(lb,f) - CALL MPI_ABORT(MPI_COMM_WORLD, 111) + CALL MPI_ABORT(MPI_COMM_WORLD, 111, ierr) endif if ( (nlat_sst /= mlat_sst) .or. (nlon_sst /= mlon_sst) ) then write(6,*)'read_rtg_org: inconsistent dimensions. mlat_sst,mlon_sst=',& mlat_sst,mlon_sst,' -versus- nlat_sst,nlon_sst=',nlat_sst,nlon_sst deallocate(lb,f) - CALL MPI_ABORT(MPI_COMM_WORLD, 111) + CALL MPI_ABORT(MPI_COMM_WORLD, 111, ierr) endif ! @@ -1665,7 +1666,7 @@ subroutine read_tf_clim_grb(file_sst,sst,rlats_sst,rlons_sst,mlat_sst,mlon_sst,m call baclose(lu_sst,iret) if (iret /= 0 ) then write(6,*)'read_tf_clm_grb: ***error*** close sst file' - CALL MPI_ABORT(MPI_COMM_WORLD, 121) + CALL MPI_ABORT(MPI_COMM_WORLD, 121, ierr) endif end subroutine read_tf_clim_grb @@ -1703,7 +1704,7 @@ subroutine get_tf_clm_dim(file_sst,mlat_sst,mlon_sst) integer :: iret integer :: mscan,kb1 - integer :: kf,kg,k,j + integer :: kf,kg,k,j,ierr integer, dimension(22):: jgds,kgds integer, dimension(25):: jpds,kpds @@ -1713,7 +1714,7 @@ subroutine get_tf_clm_dim(file_sst,mlat_sst,mlon_sst) call baopenr(lu_sst,trim(file_sst),iret) if (iret /= 0 ) then write(6,*)'get_tf_clm_dim: ***error*** opening sst file' - CALL MPI_ABORT(MPI_COMM_WORLD, 111) + CALL MPI_ABORT(MPI_COMM_WORLD, 111, ierr) endif ! define sst variables for read @@ -1733,7 +1734,7 @@ subroutine get_tf_clm_dim(file_sst,mlat_sst,mlon_sst) call baclose(lu_sst,iret) if (iret /= 0 ) then write(6,*)'get_tf_clm_dim: ***error*** close sst file' - CALL MPI_ABORT(MPI_COMM_WORLD, 121) + CALL MPI_ABORT(MPI_COMM_WORLD, 121, ierr) endif end subroutine get_tf_clm_dim @@ -1848,10 +1849,11 @@ subroutine nc_check(status) include "mpif.h" integer, intent ( in) :: status + integer :: ierr if(status /= nf90_noerr) then print *, trim(nf90_strerror(status)) - CALL MPI_ABORT(MPI_COMM_WORLD, 122) + CALL MPI_ABORT(MPI_COMM_WORLD, 122, ierr) end if end subroutine nc_check diff --git a/sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 b/sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 index 9673dacfb..2c243078b 100644 --- a/sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 +++ b/sorc/orog_mask_tools.fd/lake.fd/lakefrac.F90 @@ -272,11 +272,11 @@ SUBROUTINE cal_lake_frac_depth(lakestat,cs_lakestat,lakedpth,cs_lakedpth) ENDIF ENDIF #endif - IF (two_section == .false.) THEN + IF (two_section .EQV. .false.) THEN DO i = src_grid_lon_beg, src_grid_lon_end, stride_lon p(1) = src_grid_lat(j); p(2) = src_grid_lon(i) p(:) = p(:)*d2r - IF(enclosure_cnvx(v, 4, p, co_gc) == .true.) THEN + IF(enclosure_cnvx(v, 4, p, co_gc) .EQV. .true.) THEN grid_ct = grid_ct+1 IF (lakestat((j-1)*nlon+i) /= 0) THEN lake_ct = lake_ct+1 @@ -296,7 +296,7 @@ SUBROUTINE cal_lake_frac_depth(lakestat,cs_lakestat,lakedpth,cs_lakedpth) DO i = src_grid_lon_beg1, src_grid_lon_end1, stride_lon p(1) = src_grid_lat(j); p(2) = src_grid_lon(i) p(:) = p(:)*d2r - IF(enclosure_cnvx(v, 4, p, co_gc) == .true.) THEN + IF(enclosure_cnvx(v, 4, p, co_gc) .EQV. .true.) THEN grid_ct = grid_ct+1 IF (lakestat((j-1)*nlon+i) /= 0) THEN lake_ct = lake_ct+1 @@ -315,7 +315,7 @@ SUBROUTINE cal_lake_frac_depth(lakestat,cs_lakestat,lakedpth,cs_lakedpth) DO i = src_grid_lon_beg2, src_grid_lon_end2, stride_lon p(1) = src_grid_lat(j); p(2) = src_grid_lon(i) p(:) = p(:)*d2r - IF(enclosure_cnvx(v, 4, p, co_gc) == .true.) THEN + IF(enclosure_cnvx(v, 4, p, co_gc) .EQV. .true.) THEN grid_ct = grid_ct+1 IF (lakestat((j-1)*nlon+i) /= 0) THEN lake_ct = lake_ct+1 @@ -577,7 +577,8 @@ SUBROUTINE write_lakedata_to_orodata(cs_res, cs_lakestat, cs_lakedpth) CALL nc_opchk(stat, "nf90_put_att: lake_depth:description") #endif - write(string,'(a,es8.1)') 'land_frac and lake_frac are adjusted such that their sum is 1 at points where inland=1; land_frac cutoff is',land_cutoff + write(string,'(a,es8.1)') 'land_frac and lake_frac are adjusted such that their sum '// & + 'is 1 at points where inland=1; land_frac cutoff is',land_cutoff stat = nf90_put_att(ncid, land_frac_id,'description',trim(string)) CALL nc_opchk(stat, "nf90_put_att: land_frac:description") @@ -773,7 +774,9 @@ SUBROUTINE write_reg_lakedata_to_orodata(cs_res, tile_x_dim, tile_y_dim, cs_lake CALL nc_opchk(stat, "nf90_put_att: lake_depth:description") #endif ENDIF - write(string,'(a,es8.1)') 'land_frac is adjusted to 1-lake_frac where lake_frac>0 but left unchanged where lake_frac=0. This could lead to land_frac+lake_frac<1 at some inland points; land_frac cutoff is',land_cutoff + write(string,'(a,es8.1)') 'land_frac is adjusted to 1-lake_frac where lake_frac>0 but lefti '// & + 'unchanged where lake_frac=0. This could lead to land_frac+lake_frac<1 '// & + 'at some inland points; land_frac cutoff is',land_cutoff stat = nf90_put_att(ncid, land_frac_id,'description',trim(string)) CALL nc_opchk(stat, "nf90_put_att: land_frac:description") diff --git a/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt b/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt index 2ef189199..5e38c7a35 100644 --- a/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt +++ b/sorc/orog_mask_tools.fd/orog.fd/CMakeLists.txt @@ -6,6 +6,9 @@ if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian -assume byterecl") elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8 -fconvert=big-endian -fno-range-check") + if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10) + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-argument-mismatch -fallow-invalid-boz") + endif() endif() set(exe_name orog) diff --git a/sorc/sfc_climo_gen.fd/interp.F90 b/sorc/sfc_climo_gen.fd/interp.F90 index 67a8cc079..1e6141708 100644 --- a/sorc/sfc_climo_gen.fd/interp.F90 +++ b/sorc/sfc_climo_gen.fd/interp.F90 @@ -308,7 +308,7 @@ subroutine adjust_for_landice(field, vegt, idim, jdim, field_ch) integer, parameter :: landice=15 - integer :: i, j + integer :: i, j, ierr real :: landice_value @@ -364,7 +364,7 @@ subroutine adjust_for_landice(field, vegt, idim, jdim, field_ch) enddo case default print*,'- FATAL ERROR IN ROUTINE ADJUST_FOR_LANDICE. UNIDENTIFIED FIELD : ', field_ch - call mpi_abort(mpi_comm_world, 57) + call mpi_abort(mpi_comm_world, 57, ierr) end select end subroutine adjust_for_landice diff --git a/sorc/sfc_climo_gen.fd/model_grid.F90 b/sorc/sfc_climo_gen.fd/model_grid.F90 index bd0c0b5f0..056a57130 100644 --- a/sorc/sfc_climo_gen.fd/model_grid.F90 +++ b/sorc/sfc_climo_gen.fd/model_grid.F90 @@ -88,12 +88,14 @@ subroutine define_model_grid(localpet, npets) implicit none + include 'mpif.h' + integer, intent(in) :: localpet, npets character(len=500) :: the_file integer :: error, id_dim, id_tiles, ncid - integer :: id_grid_tiles + integer :: id_grid_tiles, ierr integer :: extra, rc, tile integer, allocatable :: decomptile(:,:) @@ -132,7 +134,7 @@ subroutine define_model_grid(localpet, npets) if (mod(npets,num_tiles) /= 0) then print*,'- FATAL ERROR: MUST RUN THIS PROGRAM WITH A TASK COUNT THAT' print*,'- IS A MULTIPLE OF THE NUMBER OF TILES.' - call mpi_abort + call mpi_abort(mpi_comm_world, 44, ierr) endif !----------------------------------------------------------------------- diff --git a/sorc/sfc_climo_gen.fd/output.f90 b/sorc/sfc_climo_gen.fd/output.f90 index b38aa8bea..87016e4af 100644 --- a/sorc/sfc_climo_gen.fd/output.f90 +++ b/sorc/sfc_climo_gen.fd/output.f90 @@ -50,7 +50,7 @@ subroutine output(data_one_tile, lat_one_tile, lon_one_tile, i_mdl, j_mdl, & integer :: initialsiz, fsize, error, j integer :: dim_x, dim_y, id_data - integer :: dim_time, id_times + integer :: dim_time, id_times, ierr integer :: header_buffer_val = 16384 integer :: i_out, j_out, id_lat, id_lon integer :: i_start, i_end, j_start, j_end @@ -86,7 +86,7 @@ subroutine output(data_one_tile, lat_one_tile, lon_one_tile, i_mdl, j_mdl, & out_file_with_halo = "./vegetation_type." // grid_tiles(tile) // ".halo.nc" case default print*,'- FATAL ERROR IN ROUTINE OUTPUT. UNIDENTIFIED FIELD : ', field_names(field_idx) - call mpi_abort(mpi_comm_world, 67) + call mpi_abort(mpi_comm_world, 67, ierr) end select !---------------------------------------------------------------------- diff --git a/sorc/sfc_climo_gen.fd/utils.f90 b/sorc/sfc_climo_gen.fd/utils.f90 index 373ae736c..0941737d1 100644 --- a/sorc/sfc_climo_gen.fd/utils.f90 +++ b/sorc/sfc_climo_gen.fd/utils.f90 @@ -15,6 +15,7 @@ subroutine netcdf_err( err, string ) integer, intent(in) :: err character(len=*), intent(in) :: string character(len=256) :: errmsg + integer :: ierr include "mpif.h" @@ -23,7 +24,7 @@ subroutine netcdf_err( err, string ) print*,'' print*,'FATAL ERROR: ', trim(string), ': ', trim(errmsg) print*,'STOP.' - call mpi_abort(mpi_comm_world, 999) + call mpi_abort(mpi_comm_world, 999, ierr) return end subroutine netcdf_err @@ -36,9 +37,13 @@ subroutine error_handler(string, rc) integer, optional, intent(in) :: rc + integer :: ierr + + include "mpif.h" + print*,"- FATAL ERROR: ", string if (present(rc)) print*,"- IOSTAT IS: ", rc - call mpi_abort + call mpi_abort(mpi_comm_world, 999, ierr) end subroutine error_handler From 03265576ebe018c79043c51b5c6cf527861b2bce Mon Sep 17 00:00:00 2001 From: Kyle Gerheiser <3209794+kgerheiser@users.noreply.github.com> Date: Fri, 18 Sep 2020 08:28:52 -0400 Subject: [PATCH 032/192] Update NetCDF and HDF5 modules on Hera NCEPLIBS was built on Hera with a different NetCDF and it wasn't updated in the build module. Users could not run the wgrib2 executable with this NetCDF loaded. --- modulefiles/build.hera | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modulefiles/build.hera b/modulefiles/build.hera index cbae95e56..80be679f4 100644 --- a/modulefiles/build.hera +++ b/modulefiles/build.hera @@ -24,6 +24,6 @@ module load landsfcutil/2.4.1 module load wgrib2/2.0.8 module use /scratch1/NCEPDEV/nems/emc.nemspara/soft/modulefiles -module load hdf5_parallel/1.10.6 -module load netcdf_parallel/4.7.4 +module load hdf5_parallel/1.10.6.release +module load netcdf_parallel/4.7.4.release module load esmf/8.0.0_ParallelNetCDF From e3f82aaff71f2e30ac2d3bce84aac43671c5fc1d Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Fri, 18 Sep 2020 09:56:42 -0400 Subject: [PATCH 033/192] Convert all scripts to bash Convert all scripts to bash, which is standard on most machines. See issue #144 for more details. --- driver_scripts/driver_grid.cray.sh | 6 +- driver_scripts/driver_grid.dell.sh | 6 +- driver_scripts/driver_grid.hera.sh | 6 +- driver_scripts/driver_grid.jet.sh | 6 +- driver_scripts/driver_grid.orion.sh | 6 +- reg_tests/chgres_cube/driver.hera.sh | 2 +- reg_tests/chgres_cube/driver.jet.sh | 2 +- reg_tests/chgres_cube/driver.orion.sh | 2 +- reg_tests/grid_gen/c96.uniform.sh | 2 +- reg_tests/grid_gen/driver.hera.sh | 2 +- reg_tests/grid_gen/driver.jet.sh | 2 +- reg_tests/grid_gen/driver.orion.sh | 2 +- reg_tests/grid_gen/gfdl.regional.sh | 2 +- scripts/exemcsfc_global_sfc_prep.sh.ecf | 2 +- ush/chgres_cube.sh | 2 +- ush/emcsfc_ice_blend.sh | 2 +- ush/emcsfc_snow.sh | 15 +-- ush/fv3gfs_driver_grid.sh | 50 ++++---- ush/fv3gfs_filter_topo.sh | 16 +-- ush/fv3gfs_make_grid.sh | 4 +- ush/fv3gfs_make_lake.sh | 6 +- ush/fv3gfs_make_orog.sh | 161 ++++++++++++------------ ush/global_cycle.sh | 14 +-- ush/global_cycle_driver.sh | 4 +- ush/sfc_climo_gen.sh | 13 +- 25 files changed, 163 insertions(+), 172 deletions(-) diff --git a/driver_scripts/driver_grid.cray.sh b/driver_scripts/driver_grid.cray.sh index 28e68c4c7..f2faa4a78 100755 --- a/driver_scripts/driver_grid.cray.sh +++ b/driver_scripts/driver_grid.cray.sh @@ -49,7 +49,7 @@ # 7) For "regional_esg" grids, set center lat/lon of grid, # - "target_lat/lon" - the i/j dimensions - "i/jdim", the # x/y grid spacing - "delx/y", and halo. -# 8) Set working directory - TMPDIR - and path to the repository +# 8) Set working directory - TEMP_DIR - and path to the repository # clone - home_dir. # 9) Submit script: "cat $script | bsub". # 10) All files will be placed in "out_dir". @@ -106,12 +106,12 @@ fi #----------------------------------------------------------------------- # Check paths. # home_dir - location of repository. -# TMPDIR - working directory. +# TEMP_DIR - working directory. # out_dir - where files will be placed upon completion. #----------------------------------------------------------------------- export home_dir=$LS_SUBCWD/.. -export TMPDIR=/gpfs/hps3/stmp/$LOGNAME/fv3_grid.$gtype +export TEMP_DIR=/gpfs/hps3/stmp/$LOGNAME/fv3_grid.$gtype export out_dir=/gpfs/hps3/stmp/$LOGNAME/my_grids #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.dell.sh b/driver_scripts/driver_grid.dell.sh index c6da158fc..d2d6d08d0 100755 --- a/driver_scripts/driver_grid.dell.sh +++ b/driver_scripts/driver_grid.dell.sh @@ -51,7 +51,7 @@ # 7) For "regional_esg" grids, set center lat/lon of grid, # - "target_lat/lon" - the i/j dimensions - "i/jdim", the # x/y grid spacing - "delx/y", and halo. -# 8) Set working directory - TMPDIR - and path to the repository +# 8) Set working directory - TEMP_DIR - and path to the repository # clone - home_dir. # 9) Submit script: "cat $script | bsub". # 10) All files will be placed in "out_dir". @@ -108,12 +108,12 @@ fi #----------------------------------------------------------------------- # Check paths. # home_dir - location of repository. -# TMPDIR - working directory. +# TEMP_DIR - working directory. # out_dir - where files will be placed upon completion. #----------------------------------------------------------------------- export home_dir=$LS_SUBCWD/.. -export TMPDIR=/gpfs/dell1/stmp/$LOGNAME/fv3_grid.$gtype +export TEMP_DIR=/gpfs/dell1/stmp/$LOGNAME/fv3_grid.$gtype export out_dir=/gpfs/dell1/stmp/$LOGNAME/my_grids #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.hera.sh b/driver_scripts/driver_grid.hera.sh index 75c986aba..e00c7de1e 100755 --- a/driver_scripts/driver_grid.hera.sh +++ b/driver_scripts/driver_grid.hera.sh @@ -49,7 +49,7 @@ # 7) For "regional_esg" grids, set center lat/lon of grid, # - "target_lat/lon" - the i/j dimensions - "i/jdim", the # x/y grid spacing - "delx/y", and halo. -# 8) Set working directory - TMPDIR - and path to the repository +# 8) Set working directory - TEMP_DIR - and path to the repository # clone - home_dir. # 9) Submit script: "sbatch $script". # 10) All files will be placed in "out_dir". @@ -108,12 +108,12 @@ fi #----------------------------------------------------------------------- # Check paths. # home_dir - location of repository. -# TMPDIR - working directory. +# TEMP_DIR - working directory. # out_dir - where files will be placed upon completion. #----------------------------------------------------------------------- export home_dir=$SLURM_SUBMIT_DIR/.. -export TMPDIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/fv3_grid.$gtype +export TEMP_DIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/fv3_grid.$gtype export out_dir=/scratch2/NCEPDEV/stmp1/$LOGNAME/my_grids #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.jet.sh b/driver_scripts/driver_grid.jet.sh index 650b39820..2df3f01a5 100755 --- a/driver_scripts/driver_grid.jet.sh +++ b/driver_scripts/driver_grid.jet.sh @@ -50,7 +50,7 @@ # 7) For "regional_esg" grids, set center lat/lon of grid, # - "target_lat/lon" - the i/j dimensions - "i/jdim", the # x/y grid spacing - "delx/y", and halo. -# 8) Set working directory - TMPDIR - and path to the repository +# 8) Set working directory - TEMP_DIR - and path to the repository # clone - home_dir. # 9) Submit script: "sbatch $script". # 10) All files will be placed in "out_dir". @@ -109,12 +109,12 @@ fi #----------------------------------------------------------------------- # Check paths. # home_dir - location of repository. -# TMPDIR - working directory. +# TEMP_DIR - working directory. # out_dir - where files will be placed upon completion. #----------------------------------------------------------------------- export home_dir=$SLURM_SUBMIT_DIR/.. -export TMPDIR=/lfs4/HFIP/emcda/$LOGNAME/stmp/fv3_grid.$gtype +export TEMP_DIR=/lfs4/HFIP/emcda/$LOGNAME/stmp/fv3_grid.$gtype export out_dir=/lfs4/HFIP/emcda/$LOGNAME/stmp/my_grids #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.orion.sh b/driver_scripts/driver_grid.orion.sh index 208596da3..9eebd32a7 100755 --- a/driver_scripts/driver_grid.orion.sh +++ b/driver_scripts/driver_grid.orion.sh @@ -49,7 +49,7 @@ # 7) For "regional_esg" grids, set center lat/lon of grid, # - "target_lat/lon" - the i/j dimensions - "i/jdim", the # x/y grid spacing - "delx/y", and halo. -# 8) Set working directory - TMPDIR - and path to the repository +# 8) Set working directory - TEMP_DIR - and path to the repository # clone - home_dir. # 9) Submit script: "sbatch $script". # 10) All files will be placed in "out_dir". @@ -108,12 +108,12 @@ fi #----------------------------------------------------------------------- # Check paths. # home_dir - location of repository. -# TMPDIR - working directory. +# TEMP_DIR - working directory. # out_dir - where files will be placed upon completion. #----------------------------------------------------------------------- export home_dir=$SLURM_SUBMIT_DIR/.. -export TMPDIR=/work/noaa/stmp/$LOGNAME/fv3_grid.$gtype +export TEMP_DIR=/work/noaa/stmp/$LOGNAME/fv3_grid.$gtype export out_dir=/work/noaa/stmp/$LOGNAME/my_grids #----------------------------------------------------------------------- diff --git a/reg_tests/chgres_cube/driver.hera.sh b/reg_tests/chgres_cube/driver.hera.sh index fa09e7999..c61b72c87 100755 --- a/reg_tests/chgres_cube/driver.hera.sh +++ b/reg_tests/chgres_cube/driver.hera.sh @@ -123,7 +123,7 @@ TEST8=$(sbatch --parsable --ntasks-per-node=6 --nodes=1 -t 0:05:00 -A $PROJECT_C sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ --open-mode=append -q $QUEUE -d afterok:$TEST8 << EOF -#!/bin/sh +#!/bin/bash grep -a '<<<' $LOG_FILE > $SUM_FILE EOF diff --git a/reg_tests/chgres_cube/driver.jet.sh b/reg_tests/chgres_cube/driver.jet.sh index b17353920..a9ee38707 100755 --- a/reg_tests/chgres_cube/driver.jet.sh +++ b/reg_tests/chgres_cube/driver.jet.sh @@ -123,7 +123,7 @@ TEST8=$(sbatch --parsable --partition=xjet --nodes=1 --ntasks-per-node=6 -t 0:05 sbatch --partition=xjet --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ --open-mode=append -q $QUEUE -d afterok:$TEST8 << EOF -#!/bin/sh +#!/bin/bash grep -a '<<<' $LOG_FILE > $SUM_FILE EOF diff --git a/reg_tests/chgres_cube/driver.orion.sh b/reg_tests/chgres_cube/driver.orion.sh index 3026082e1..479eedb96 100755 --- a/reg_tests/chgres_cube/driver.orion.sh +++ b/reg_tests/chgres_cube/driver.orion.sh @@ -126,7 +126,7 @@ TEST8=$(sbatch --parsable --ntasks-per-node=6 --nodes=2 -t 0:10:00 -A $PROJECT_C sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J chgres_summary -o $LOG_FILE -e $LOG_FILE \ --open-mode=append -q $QUEUE -d afterok:$TEST8 << EOF -#!/bin/sh +#!/bin/bash grep -a '<<<' $LOG_FILE > $SUM_FILE EOF diff --git a/reg_tests/grid_gen/c96.uniform.sh b/reg_tests/grid_gen/c96.uniform.sh index 73da0389d..346c95dbf 100755 --- a/reg_tests/grid_gen/c96.uniform.sh +++ b/reg_tests/grid_gen/c96.uniform.sh @@ -8,7 +8,7 @@ set -x -export TMPDIR=${WORK_DIR}/c96.uniform.work +export TEMP_DIR=${WORK_DIR}/c96.uniform.work export out_dir=${WORK_DIR}/c96.uniform export res=96 diff --git a/reg_tests/grid_gen/driver.hera.sh b/reg_tests/grid_gen/driver.hera.sh index ad19573fd..f2a8536cf 100755 --- a/reg_tests/grid_gen/driver.hera.sh +++ b/reg_tests/grid_gen/driver.hera.sh @@ -71,6 +71,6 @@ TEST2=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_ sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J grid_summary -o $LOG_FILE -e $LOG_FILE \ --open-mode=append -q $QUEUE -d afterok:$TEST2 << EOF -#!/bin/sh +#!/bin/bash grep -a '<<<' $LOG_FILE > $SUM_FILE EOF diff --git a/reg_tests/grid_gen/driver.jet.sh b/reg_tests/grid_gen/driver.jet.sh index a340582b2..5c1facea3 100755 --- a/reg_tests/grid_gen/driver.jet.sh +++ b/reg_tests/grid_gen/driver.jet.sh @@ -71,6 +71,6 @@ TEST2=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_ sbatch --partition=xjet --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J grid_summary -o $LOG_FILE -e $LOG_FILE \ --open-mode=append -q $QUEUE -d afterok:$TEST2 << EOF -#!/bin/sh +#!/bin/bash grep -a '<<<' $LOG_FILE > $SUM_FILE EOF diff --git a/reg_tests/grid_gen/driver.orion.sh b/reg_tests/grid_gen/driver.orion.sh index 2ae73ff2d..12e56d21b 100755 --- a/reg_tests/grid_gen/driver.orion.sh +++ b/reg_tests/grid_gen/driver.orion.sh @@ -67,6 +67,6 @@ TEST2=$(sbatch --parsable --ntasks-per-node=24 --nodes=1 -t 0:10:00 -A $PROJECT_ sbatch --nodes=1 -t 0:01:00 -A $PROJECT_CODE -J grid_summary -o $LOG_FILE -e $LOG_FILE \ --open-mode=append -q $QUEUE -d afterok:$TEST2 << EOF -#!/bin/sh +#!/bin/bash grep -a '<<<' $LOG_FILE > $SUM_FILE EOF diff --git a/reg_tests/grid_gen/gfdl.regional.sh b/reg_tests/grid_gen/gfdl.regional.sh index 05eb31e6c..00d5c9a82 100755 --- a/reg_tests/grid_gen/gfdl.regional.sh +++ b/reg_tests/grid_gen/gfdl.regional.sh @@ -8,7 +8,7 @@ set -x -export TMPDIR=${WORK_DIR}/gfdl.regional.work +export TEMP_DIR=${WORK_DIR}/gfdl.regional.work export out_dir=${WORK_DIR}/gfdl.regional export res=96 # global resolution in which grid is embedded. diff --git a/scripts/exemcsfc_global_sfc_prep.sh.ecf b/scripts/exemcsfc_global_sfc_prep.sh.ecf index 87593e0dd..04fc0f429 100755 --- a/scripts/exemcsfc_global_sfc_prep.sh.ecf +++ b/scripts/exemcsfc_global_sfc_prep.sh.ecf @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash #### UNIX Script Documentation Block ################################### # . . diff --git a/ush/chgres_cube.sh b/ush/chgres_cube.sh index fd036e5c8..66261fa89 100755 --- a/ush/chgres_cube.sh +++ b/ush/chgres_cube.sh @@ -8,7 +8,7 @@ # See comments for variable definitions and setup information. #---------------------------------------------------------------------------- -set -x +set -eux #---------------------------------------------------------------------------- # Resolution of target grid. diff --git a/ush/emcsfc_ice_blend.sh b/ush/emcsfc_ice_blend.sh index 35f15d61f..9bceee83e 100755 --- a/ush/emcsfc_ice_blend.sh +++ b/ush/emcsfc_ice_blend.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash #### UNIX Script Documentation Block ################################### # . . diff --git a/ush/emcsfc_snow.sh b/ush/emcsfc_snow.sh index b738ba49e..7c4c6c429 100755 --- a/ush/emcsfc_snow.sh +++ b/ush/emcsfc_snow.sh @@ -1,4 +1,4 @@ -#!/bin/ksh +#!/bin/bash #### UNIX Script Documentation Block ################################### # . . @@ -56,6 +56,8 @@ fi # are only used in ncep ops when the "prod_util" module is loaded. #----------------------------------------------------------------------- +jlogfile=${jlogfile:-"jlogfile"} + use_prod_util=`echo $UTILROOT` if ((${#use_prod_util} != 0)); then use_prod_util="true" @@ -160,18 +162,19 @@ $WGRIB2 -Sec0 ${IMS_FILE} 2>&1 | grep "grib1 message" status=$? if (( status == 0 )); then # grib 1 file tempdate=$($WGRIB -v $IMS_FILE | head -1) - typeset -L10 IMSDATE10 - IMSDATE10=${tempdate#*D=} + IMSDATE=${tempdate#*D=} else # grib 2 file tempdate=$($WGRIB2 -t $IMS_FILE | head -1) - typeset -L10 IMSDATE10 - IMSDATE10=${tempdate#*d=} + IMSDATE=${tempdate#*d=} fi +IMSDATE10=$(echo $IMSDATE|cut -c1-10) IMSYEAR=$(echo $IMSDATE10 | cut -c1-4) IMSMONTH=$(echo $IMSDATE10 | cut -c5-6) IMSDAY=$(echo $IMSDATE10 | cut -c7-8) IMSHOUR=0 # emc convention is to use 00Z. +pgmout=${pgmout:-OUTPUT} + if test "$use_prod_util" = "true" ; then . prep_step fi @@ -214,8 +217,6 @@ cat > ./fort.41 << ! / ! -pgmout=${pgmout:-OUTPUT} - eval $SNOW2MDLEXEC >> $pgmout 2> errfile rc2=$? diff --git a/ush/fv3gfs_driver_grid.sh b/ush/fv3gfs_driver_grid.sh index 202a8e6a6..c522516eb 100755 --- a/ush/fv3gfs_driver_grid.sh +++ b/ush/fv3gfs_driver_grid.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # #----------------------------------------------------------------------- # Driver script to create a cubic-sphere based model grid. @@ -33,7 +33,7 @@ # ./driver_scripts. #----------------------------------------------------------------------- -set -ax +set -eux export machine=${machine:?} @@ -101,19 +101,19 @@ if [ $add_lake = true ]; then fi fi -export TMPDIR=${TMPDIR:?} +export TEMP_DIR=${TEMP_DIR:?} export out_dir=${out_dir:?} export home_dir=${home_dir:-"$PWD/../"} export script_dir=$home_dir/ush -export exec_dir=$home_dir/exec +export exec_dir=${exec_dir:-"$home_dir/exec"} export topo=$home_dir/fix/fix_orog export NCDUMP=${NCDUMP:-ncdump} -rm -fr $TMPDIR -mkdir -p $TMPDIR -cd $TMPDIR ||exit 8 +rm -fr $TEMP_DIR +mkdir -p $TEMP_DIR +cd $TEMP_DIR ||exit 8 #---------------------------------------------------------------------------------- #---------------------------------------------------------------------------------- @@ -142,18 +142,18 @@ if [ $gtype = uniform ] || [ $gtype = stretch ] || [ $gtype = nest ]; then name=C${res}r${rn}n${refine_ratio}_${title} fi - grid_dir=$TMPDIR/$name/grid - orog_dir=$TMPDIR/$name/orog + export grid_dir=$TEMP_DIR/$name/grid + export orog_dir=$TEMP_DIR/$name/orog out_dir=$out_dir/C${res} mkdir -p $out_dir if [ $gtype = nest ]; then filter_dir=$orog_dir # nested grid topography will be filtered online else - filter_dir=$TMPDIR/$name/filter_topo + filter_dir=$TEMP_DIR/$name/filter_topo fi - rm -rf $TMPDIR/$name + rm -rf $TEMP_DIR/$name mkdir -p $grid_dir $orog_dir $filter_dir set +x @@ -178,18 +178,18 @@ if [ $gtype = uniform ] || [ $gtype = stretch ] || [ $gtype = nest ]; then #---------------------------------------------------------------------------------- if [ $machine = WCOSS_C ]; then - touch $TMPDIR/orog.file1 + touch $TEMP_DIR/orog.file1 tile=1 while [ $tile -le $ntiles ]; do - echo "$script_dir/fv3gfs_make_orog.sh $res $tile $grid_dir $orog_dir $script_dir $topo $TMPDIR " >>$TMPDIR/orog.file1 + echo "$script_dir/fv3gfs_make_orog.sh $res $tile $grid_dir $orog_dir $script_dir $topo " >>$TEMP_DIR/orog.file1 tile=$(( $tile + 1 )) done - aprun -j 1 -n 4 -N 4 -d 6 -cc depth cfp $TMPDIR/orog.file1 + aprun -j 1 -n 4 -N 4 -d 6 -cc depth cfp $TEMP_DIR/orog.file1 err=$? if [ $err != 0 ]; then exit $err fi - rm $TMPDIR/orog.file1 + rm $TEMP_DIR/orog.file1 else tile=1 while [ $tile -le $ntiles ]; do @@ -198,7 +198,7 @@ if [ $gtype = uniform ] || [ $gtype = stretch ] || [ $gtype = nest ]; then echo "............ Execute fv3gfs_make_orog.sh for tile $tile .................." echo set -x - $script_dir/fv3gfs_make_orog.sh $res $tile $grid_dir $orog_dir $script_dir $topo $TMPDIR + $script_dir/fv3gfs_make_orog.sh $res $tile $grid_dir $orog_dir $script_dir $topo err=$? if [ $err != 0 ]; then exit $err @@ -267,10 +267,10 @@ elif [ $gtype = regional_gfdl ] || [ $gtype = regional_esg ]; then halop1=$(( halo + 1 )) tile=7 name=regional - grid_dir=$TMPDIR/${name}/grid - orog_dir=$TMPDIR/${name}/orog - filter_dir=$orog_dir # nested grid topography will be filtered online - rm -rf $TMPDIR/$name + export grid_dir=$TEMP_DIR/${name}/grid + export orog_dir=$TEMP_DIR/${name}/orog + filter_dir=$TEMP_DIR/$name/filter_topo + rm -rf $TEMP_DIR/$name mkdir -p $grid_dir $orog_dir $filter_dir #---------------------------------------------------------------------------------- @@ -364,17 +364,17 @@ elif [ $gtype = regional_gfdl ] || [ $gtype = regional_esg ]; then echo "Begin orography generation at `date`" if [ $machine = WCOSS_C ]; then - echo "$script_dir/fv3gfs_make_orog.sh $res $tile $grid_dir $orog_dir $script_dir $topo $TMPDIR " >>$TMPDIR/orog.file1 - aprun -j 1 -n 4 -N 4 -d 6 -cc depth cfp $TMPDIR/orog.file1 + echo "$script_dir/fv3gfs_make_orog.sh $res $tile $grid_dir $orog_dir $script_dir $topo " >>$TEMP_DIR/orog.file1 + aprun -j 1 -n 4 -N 4 -d 6 -cc depth cfp $TEMP_DIR/orog.file1 err=$? - rm $TMPDIR/orog.file1 + rm $TEMP_DIR/orog.file1 else set +x echo echo "............ Execute fv3gfs_make_orog.sh for tile $tile .................." echo set -x - $script_dir/fv3gfs_make_orog.sh $res $tile $grid_dir $orog_dir $script_dir $topo $TMPDIR + $script_dir/fv3gfs_make_orog.sh $res $tile $grid_dir $orog_dir $script_dir $topo err=$? if [ $err != 0 ]; then exit $err @@ -464,7 +464,7 @@ fi #------------------------------------------------------------------------------------ #------------------------------------------------------------------------------------ -export WORK_DIR=$TMPDIR/sfcfields +export WORK_DIR=$TEMP_DIR/sfcfields export SAVE_DIR=$out_dir/fix_sfc export BASE_DIR=$home_dir export FIX_FV3=$out_dir diff --git a/ush/fv3gfs_filter_topo.sh b/ush/fv3gfs_filter_topo.sh index 4f0b2e8e6..06f537701 100755 --- a/ush/fv3gfs_filter_topo.sh +++ b/ush/fv3gfs_filter_topo.sh @@ -1,5 +1,5 @@ -#!/bin/ksh -set -ax +#!/bin/bash +set -eux #----------------------------------------------------------------------------------------- # @@ -26,10 +26,10 @@ else stretch=1.0 fi -export res=$1 -export griddir=$2 -export orodir=$3 -export outdir=$4 +res=$1 +griddir=$2 +orodir=$3 +outdir=$4 executable=$exec_dir/filter_topo if [ ! -s $executable ]; then @@ -41,8 +41,8 @@ if [ ! -s $executable ]; then exit 1 fi -export mosaic_grid=C${res}_mosaic.nc -export topo_file=oro.C${res} +mosaic_grid=C${res}_mosaic.nc +topo_file=oro.C${res} if [ ! -s $outdir ]; then mkdir -p $outdir ;fi cd $outdir ||exit 8 diff --git a/ush/fv3gfs_make_grid.sh b/ush/fv3gfs_make_grid.sh index 7a7cff105..4510c0500 100755 --- a/ush/fv3gfs_make_grid.sh +++ b/ush/fv3gfs_make_grid.sh @@ -1,6 +1,6 @@ -#!/bin/ksh +#!/bin/bash -set -ax +set -eux #----------------------------------------------------------------------------------------- # diff --git a/ush/fv3gfs_make_lake.sh b/ush/fv3gfs_make_lake.sh index ad0d81f14..69013168f 100755 --- a/ush/fv3gfs_make_lake.sh +++ b/ush/fv3gfs_make_lake.sh @@ -1,10 +1,10 @@ -#!/bin/ksh +#!/bin/bash echo echo "CREATE AND ADD INLAND, LAKE_STATUS, AND LAKE_DEPTH TO THE OROGRAPHY FILES" echo -set -ax +set -eux outdir=$orog_dir indir=$topo @@ -26,7 +26,7 @@ if [ ! -s $exe_inland ]; then exit 1 fi -workdir=$TMPDIR/C${res}/orog/tiles +workdir=$TEMP_DIR/C${res}/orog/tiles if [ ! -s $workdir ]; then mkdir -p $workdir ;fi # Make lake data - diff --git a/ush/fv3gfs_make_orog.sh b/ush/fv3gfs_make_orog.sh index 532c6407f..5b2bae4fa 100755 --- a/ush/fv3gfs_make_orog.sh +++ b/ush/fv3gfs_make_orog.sh @@ -1,56 +1,54 @@ #!/bin/bash -set -ax + +set -eux nargv=$# -export inorogexist=0 +inorogexist=0 -if [ $nargv -eq 6 ]; then # lat-lon grid - export lonb=$1 - export latb=$2 - export outdir=$3 - export script_dir=$4 - export is_latlon=1 - export orogfile="none" - export hist_dir=$5 - export TMPDIR=$6 - export workdir=$TMPDIR/latlon/orog/latlon_${lonb}x${latb} -elif [ $nargv -eq 7 ]; then # cubed-sphere grid - export res=$1 - export lonb=$1 - export latb=$1 - export tile=$2 - export griddir=$3 - export outdir=$4 - export script_dir=$5 - export is_latlon=0 - export orogfile="none" - export hist_dir=$6 - export TMPDIR=$7 - export workdir=$TMPDIR/C${res}/orog/tile$tile +if [ $nargv -eq 5 ]; then # lat-lon grid + lonb=$1 + latb=$2 + outdir=$3 + script_dir=$4 + is_latlon=1 + orogfile="none" + hist_dir=$5 + workdir=$TEMP_DIR/latlon/orog/latlon_${lonb}x${latb} +elif [ $nargv -eq 6 ]; then # cubed-sphere grid + res=$1 + lonb=$1 + latb=$1 + tile=$2 + griddir=$3 + outdir=$4 + script_dir=$5 + is_latlon=0 + orogfile="none" + hist_dir=$6 + workdir=$TEMP_DIR/C${res}/orog/tile$tile elif [ $nargv -eq 8 ]; then # input your own orography files - export res=$1 - export lonb=$1 - export latb=$1 - export tile=$2 - export griddir=$3 - export outdir=$4 - export is_latlon=0 - export inputorog=$5 - export script_dir=$6 - export orogfile=$inputorog:t - export inorogexist=1 - export hist_dir=$7 - export TMPDIR=$8 - export workdir=$TMPDIR/C${res}/orog/tile$tile + res=$1 + lonb=$1 + latb=$1 + tile=$2 + griddir=$3 + outdir=$4 + is_latlon=0 + inputorog=$5 + script_dir=$6 + orogfile=$inputorog:t + inorogexist=1 + hist_dir=$7 + workdir=$TEMP_DIR/C${res}/orog/tile$tile else - echo "number of arguments must be 5 or 6 for cubic sphere grid and 4 for lat-lon grid" - echo "Usage for cubic sphere grid: $0 resolution tile grid_dir out_dir script_dir hist_dir TMPDIR" + echo "Number of arguments must be 6 for cubic sphere grid" + echo "Usage for cubic sphere grid: $0 resolution tile griddir outdir script_dir hist_dir" exit 1 fi -export indir=$hist_dir -export executable=$exec_dir/orog +indir=$hist_dir +executable=$exec_dir/orog if [ ! -s $executable ]; then echo "executable does not exist" exit 1 @@ -61,18 +59,18 @@ if [ ! -s $outdir ]; then mkdir -p $outdir ;fi #jcap is for Gaussian grid #jcap=`expr $latb - 2 ` -export jcap=0 -export NF1=0 -export NF2=0 -export mtnres=1 -export efac=0 -export blat=0 -export NR=0 +jcap=0 +NF1=0 +NF2=0 +mtnres=1 +efac=0 +blat=0 +NR=0 if [ $is_latlon -eq 1 ]; then - export OUTGRID="none" + OUTGRID="none" else - export OUTGRID="C${res}_grid.tile${tile}.nc" + OUTGRID="C${res}_grid.tile${tile}.nc" fi # Make Orograraphy @@ -82,47 +80,42 @@ echo "outdir = $outdir" echo "indir = $indir" cd $workdir -# export MTN_SLM=${indir}/TOP8M_slm.80I1.asc -# cp ${indir}/a_ocean_mask${lonb}x${latb}.txt fort.25 -# cp /home/z1l/GFS_tools/orog/a_ocean_mask${lonb}x${latb}.txt fort.25 -# cp $MTN_SLM fort.14 - cp ${indir}/thirty.second.antarctic.new.bin fort.15 - cp ${indir}/landcover30.fixed . +cp ${indir}/thirty.second.antarctic.new.bin fort.15 +cp ${indir}/landcover30.fixed . # uncomment next line to use the old gtopo30 data. # cp ${indir}/gtopo30_gg.fine.nh fort.235 # use gmted2020 data. - cp ${indir}/gmted2010.30sec.int fort.235 - if [ $inorogexist -eq 1 ]; then - cp $inputorog . - fi +cp ${indir}/gmted2010.30sec.int fort.235 +if [ $inorogexist -eq 1 ]; then + cp $inputorog . +fi - if [ $is_latlon -eq 0 ]; then - cp ${griddir}/$OUTGRID . - fi - cp $executable . +if [ $is_latlon -eq 0 ]; then + cp ${griddir}/$OUTGRID . +fi +cp $executable . - echo $mtnres $lonb $latb $jcap $NR $NF1 $NF2 $efac $blat > INPS - echo $OUTGRID >> INPS - echo $orogfile >> INPS - cat INPS - time $executable < INPS +echo $mtnres $lonb $latb $jcap $NR $NF1 $NF2 $efac $blat > INPS +echo $OUTGRID >> INPS +echo $orogfile >> INPS +cat INPS +time $executable < INPS - if [ $? -ne 0 ]; then - echo "ERROR in running $executable " - exit 1 +if [ $? -ne 0 ]; then + echo "ERROR in running $executable " + exit 1 +else + if [ $is_latlon -eq 1 ]; then + outfile=oro.${lonb}x${latb}.nc else - if [ $is_latlon -eq 1 ]; then - export outfile=oro.${lonb}x${latb}.nc - else - export outfile=oro.C${res}.tile${tile}.nc - fi - - mv ./out.oro.nc $outdir/$outfile - echo "file $outdir/$outfile is created" - echo "Successfully running $executable " - exit 0 + outfile=oro.C${res}.tile${tile}.nc fi + mv ./out.oro.nc $outdir/$outfile + echo "file $outdir/$outfile is created" + echo "Successfully running $executable " + exit 0 +fi exit diff --git a/ush/global_cycle.sh b/ush/global_cycle.sh index 477253681..b44d548a2 100755 --- a/ush/global_cycle.sh +++ b/ush/global_cycle.sh @@ -1,4 +1,4 @@ -#!/bin/ksh +#!/bin/bash ################################################################################ #### UNIX Script Documentation Block # . . @@ -242,9 +242,9 @@ COMIN=${COMIN:-$(pwd)} COMOUT=${COMOUT:-$(pwd)} # Filenames. -XC=${XC} -PREINP=${PREINP} -SUFINP=${SUFINP} +XC=${XC:-" "} +PREINP=${PREINP:-" "} +SUFINP=${SUFINP:-" "} CYCLEXEC=${CYCLEXEC:-$EXECgfs/global_cycle$XC} CDATE=${CDATE:?} @@ -295,10 +295,10 @@ GSI_FILE=${GSI_FILE:-"NULL"} FNTSFA=${FNTSFA:-${COMIN}/${PREINP}sstgrb${SUFINP}} FNACNA=${FNACNA:-${COMIN}/${PREINP}engicegrb${SUFINP}} FNSNOA=${FNSNOA:-${COMIN}/${PREINP}snogrb${SUFINP}} -export INISCRIPT=${INISCRIPT} +export INISCRIPT=${INISCRIPT:-" "} export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} -export LOGSCRIPT=${LOGSCRIPT} -export ENDSCRIPT=${ENDSCRIPT} +export LOGSCRIPT=${LOGSCRIPT:-" "} +export ENDSCRIPT=${ENDSCRIPT:-" "} # Other variables. export PGMOUT=${PGMOUT:-${pgmout:-'&1'}} export PGMERR=${PGMERR:-${pgmerr:-'&2'}} diff --git a/ush/global_cycle_driver.sh b/ush/global_cycle_driver.sh index 7a8c2a8ce..ce5997cb1 100755 --- a/ush/global_cycle_driver.sh +++ b/ush/global_cycle_driver.sh @@ -1,6 +1,6 @@ -#!/bin/sh +#!/bin/bash -set -ax +set -eux #------------------------------------------------------------------------------------------------- # Update surface fields in FV3 restart files on the cubed-sphere grid diff --git a/ush/sfc_climo_gen.sh b/ush/sfc_climo_gen.sh index c51aa1135..a68e99118 100755 --- a/ush/sfc_climo_gen.sh +++ b/ush/sfc_climo_gen.sh @@ -1,4 +1,4 @@ -#!/bin/ksh +#!/bin/bash #------------------------------------------------------------------------- # Run sfc_climo_gen program to create surface fixed fields, @@ -12,7 +12,7 @@ # # BASE_DIR Location of your repository. # input_sfc_climo_dir Location of raw input surface climo data -# EXEC_DIR Location of program executable +# exec_dir Location of program executable # FIX_DIR Location of 'grid' and 'orog' files # GRIDTYPE Flag to invoke logic for global nests # and regional grids. Valid values are @@ -25,16 +25,13 @@ # WORK_DIR Temporary working directory #------------------------------------------------------------------------- -set -x - -ulimit -s unlimited -ulimit -a +set -eux res=${res:-96} WORK_DIR=${WORK_DIR:-/scratch3/NCEPDEV/stmp1/$LOGNAME/sfc_climo_gen.C${res}} SAVE_DIR=${SAVE_DIR:-$WORK_DIR} BASE_DIR=${BASE_DIR:?} -EXEC_DIR=${EXEC_DIR:-$BASE_DIR/exec} +exec_dir=${exec_dir:-$BASE_DIR/exec} GRIDTYPE=${GRIDTYPE:-NULL} FIX_FV3=${FIX_FV3:-/scratch4/NCEPDEV/global/save/glopara/git/fv3gfs/fix/fix_fv3_gmted2010/C${res}} input_sfc_climo_dir=${input_sfc_climo_dir:?} @@ -80,7 +77,7 @@ vegetation_greenness_method="bilinear" EOF APRUN_SFC=${APRUN_SFC:-"aprun -j 1 -n 6 -N 6"} -$APRUN_SFC $EXEC_DIR/sfc_climo_gen +$APRUN_SFC $exec_dir/sfc_climo_gen rc=$? From 230b35c8e4886ec1d578d2eb08830a509b7d4478 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Fri, 18 Sep 2020 10:53:42 -0400 Subject: [PATCH 034/192] Add Mark Iredell's vertical coordinate generator Add Mark's program, a 'readme' and some sample scripts to run it. For details see issue #136. --- sorc/CMakeLists.txt | 1 + sorc/vcoord_gen.fd/CMakeLists.txt | 15 ++ sorc/vcoord_gen.fd/driver.f90 | 13 + sorc/vcoord_gen.fd/matrix_utils.f90 | 158 ++++++++++++ sorc/vcoord_gen.fd/vcoord_gen.f90 | 377 ++++++++++++++++++++++++++++ util/vcoord_gen/readme.md | 71 ++++++ util/vcoord_gen/run.cray.sh | 51 ++++ util/vcoord_gen/run.sh | 40 +++ 8 files changed, 726 insertions(+) create mode 100644 sorc/vcoord_gen.fd/CMakeLists.txt create mode 100644 sorc/vcoord_gen.fd/driver.f90 create mode 100644 sorc/vcoord_gen.fd/matrix_utils.f90 create mode 100644 sorc/vcoord_gen.fd/vcoord_gen.f90 create mode 100644 util/vcoord_gen/readme.md create mode 100755 util/vcoord_gen/run.cray.sh create mode 100755 util/vcoord_gen/run.sh diff --git a/sorc/CMakeLists.txt b/sorc/CMakeLists.txt index 2cbca0d16..92838fa68 100644 --- a/sorc/CMakeLists.txt +++ b/sorc/CMakeLists.txt @@ -17,3 +17,4 @@ add_subdirectory(grid_tools.fd) add_subdirectory(chgres_cube.fd) add_subdirectory(orog_mask_tools.fd) add_subdirectory(sfc_climo_gen.fd) +add_subdirectory(vcoord_gen.fd) diff --git a/sorc/vcoord_gen.fd/CMakeLists.txt b/sorc/vcoord_gen.fd/CMakeLists.txt new file mode 100644 index 000000000..7c55675a0 --- /dev/null +++ b/sorc/vcoord_gen.fd/CMakeLists.txt @@ -0,0 +1,15 @@ +set(fortran_src + driver.f90 + matrix_utils.f90 + vcoord_gen.f90) + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-real-8") +endif() + +set(exe_name vcoord_gen) +add_executable(${exe_name} ${fortran_src}) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/vcoord_gen.fd/driver.f90 b/sorc/vcoord_gen.fd/driver.f90 new file mode 100644 index 000000000..39e9c0703 --- /dev/null +++ b/sorc/vcoord_gen.fd/driver.f90 @@ -0,0 +1,13 @@ +program driver + implicit none + integer levs,lupp,k + real pbot,psig,ppre,pupp,ptop,dpbot,dpsig,dppre,dpupp,dptop,pmin + real,allocatable:: ak(:),bk(:) + write(0,*) 'Enter levs,lupp,pbot,psig,ppre,pupp,ptop,dpbot,dpsig,dppre,dpupp,dptop' + read *,levs,lupp,pbot,psig,ppre,pupp,ptop,dpbot,dpsig,dppre,dpupp,dptop + allocate(ak(0:levs),bk(0:levs)) + call vcoord_gen(levs,lupp,pbot,psig,ppre,pupp,ptop,dpbot,dpsig,dppre,dpupp,dptop,pmin,ak,bk) + write(0,*) 'pmin=',pmin + print '(2i6)',2,levs + print '(f12.3,f12.8)',(ak(k),bk(k),k=0,levs) +end program diff --git a/sorc/vcoord_gen.fd/matrix_utils.f90 b/sorc/vcoord_gen.fd/matrix_utils.f90 new file mode 100644 index 000000000..003c9bbbf --- /dev/null +++ b/sorc/vcoord_gen.fd/matrix_utils.f90 @@ -0,0 +1,158 @@ +!------------------------------------------------------------------------------- +!$$$ Subprogram documentation block +! +! Subprogram: ludcmp lower and upper triangular decomposition +! Prgmmr: Iredell Org: W/NP23 Date: 2008-08-01 +! +! Abstract: This subprogram decomposes a matrix into a product of +! lower and upper triangular matrices. +! +! Program history log: +! 2008-08-01 Mark Iredell +! +! Usage: call ludcmp(a,n,np,indx,d) +! Input argument list: +! a real(np,np) matrix (will be overwritten) +! n integer order of matrix +! np integer dimension of matrix +! +! Output argument list: +! a real(np,np) LU-decomposed matrix +! (U is upper part of A, including diagonal; +! L is lower part of A, with 1 as diagonal; +! L*U equals original A after permuting) +! indx integer(n) pivot indices +! (original A rows are permuted in order i with indx(i)) +! d real determinant permutation (1 or -1, or 0 if singular) +! (determinant is output diagonal product times d) +! +! Attributes: +! Language: Fortran 90 +! +!$$$ +subroutine ludcmp(a,n,np,indx,d) + implicit none + integer,intent(in):: n,np + real,intent(inout):: a(np,np) + integer,intent(out):: indx(n) + real,intent(out):: d + integer i,j,k,imax + real aamax,sum,dum + real vv(n) +! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + d=1 + do i=1,n + aamax=0 + do j=1,n + if(abs(a(i,j))>aamax) aamax=abs(a(i,j)) + enddo + if(aamax==0) then + d=0 + return + endif + vv(i)=1/aamax + enddo + do j=1,n + do i=1,j-1 + sum=a(i,j) + do k=1,i-1 + sum=sum-a(i,k)*a(k,j) + enddo + a(i,j)=sum + enddo + aamax=0. + do i=j,n + sum=a(i,j) + do k=1,j-1 + sum=sum-a(i,k)*a(k,j) + enddo + a(i,j)=sum + dum=vv(i)*abs(sum) + if(dum>=aamax) then + imax=i + aamax=dum + endif + enddo + if (j/=imax)then + do k=1,n + dum=a(imax,k) + a(imax,k)=a(j,k) + a(j,k)=dum + enddo + d=-d + vv(imax)=vv(j) + endif + indx(j)=imax + if(a(j,j)==0) then + d=0 + return + endif + if(j/=n)then + dum=1/a(j,j) + do i=j+1,n + a(i,j)=a(i,j)*dum + enddo + endif + enddo +end subroutine +!------------------------------------------------------------------------------- +!$$$ Subprogram documentation block +! +! Subprogram: lubksb lower and upper triangular back substitution +! Prgmmr: Iredell Org: W/NP23 Date: 2008-08-01 +! +! Abstract: This subprogram back substitutes to solve decomposed +! lower and upper triangular matrices as outputted by ludcmp. +! +! Program history log: +! 2008-08-01 Mark Iredell +! +! Usage: call lubksb(a,n,np,indx,b) +! Input argument list: +! a real(np,np) LU-decomposed matrix +! (from ludcmp) +! n integer order of matrix +! np integer dimension of matrix +! indx integer(n) pivot indices +! (from ludcmp) +! b real(n) rhs vector of linear problem (will be overwritten) +! +! Output argument list: +! b real(n) solution of linear problem +! (original A times output B equals original B) +! +! Attributes: +! Language: Fortran 90 +! +!$$$ +subroutine lubksb(a,n,np,indx,b) + implicit none + integer,intent(in):: n,np + real,intent(in):: a(np,np) + integer,intent(in):: indx(n) + real,intent(inout):: b(n) + integer i,j,ii,ll + real sum +! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + ii=0 + do i=1,n + ll=indx(i) + sum=b(ll) + b(ll)=b(i) + if (ii/=0)then + do j=ii,i-1 + sum=sum-a(i,j)*b(j) + enddo + elseif(sum/=0) then + ii=i + endif + b(i)=sum + enddo + do i=n,1,-1 + sum=b(i) + do j=i+1,n + sum=sum-a(i,j)*b(j) + enddo + b(i)=sum/a(i,i) + enddo +end subroutine diff --git a/sorc/vcoord_gen.fd/vcoord_gen.f90 b/sorc/vcoord_gen.fd/vcoord_gen.f90 new file mode 100644 index 000000000..0a2aa2471 --- /dev/null +++ b/sorc/vcoord_gen.fd/vcoord_gen.f90 @@ -0,0 +1,377 @@ +!$$$ Subprogram documentation block +! +! Subprogram: vcoord_gen Generates hybrid coordinate interface profiles +! Prgmmr: Iredell Org: W/NP23 Date: 2008-08-01 +! +! Abstract: This subprogram generates hybrid coordinate interface profiles +! from a few given parameters. The hybrid coordinate is intended to start +! out at the bottom in pure sigma and end up at the top in pure pressure, +! with a smooth transition in between. The pressure thickness is close to +! quadratic in pressure, with maximum thicknesses in the middle of the domain. +! The coordinate pressure will have continuous second derivatives in level. +! +! The hybrid coordinate is returned in terms of vectors AK and BK, where +! the interface pressure is defined as A+B*ps where ps is surface pressure +! Thus A=0 in regions of pure sigma and B=0 in regions of pure sigma. +! At the bottom, A(0)=0 and B(0)=1 so that surface pressure is the bottom +! boundary condition, while at the top, A(levs)=ptop and B(levs)=0 so that +! the constant top pressure (which can be zero) is the top boundary condition. +! +! The procedure for the calculation is described in the remarks section below. +! +! Program history log: +! 2008-08-01 Mark Iredell +! +! Usage: call vcoord_gen(levs,lupp,pbot,psig,ppre,pupp,ptop,& +! dpbot,dpsig,dppre,dpupp,dptop,pmin,ak,bk) +! Input argument list: +! levs integer number of levels +! lupp integer number of levels below pupp +! pbot real nominal surface pressure (Pa) +! psig real nominal pressure where coordinate changes +! from pure sigma (Pa) +! ppre real nominal pressure where coordinate changes +! to pure pressure (Pa) +! pupp real nominal pressure where coordinate changes +! to upper atmospheric profile (Pa) +! ptop real pressure at top (Pa) +! dpbot real coordinate thickness at bottom (Pa) +! dpsig real thickness of zone within which coordinate changes +! to pure sigma (Pa) +! dppre real thickness of zone within which coordinate changes +! to pure pressure (Pa) +! dpupp real coordinate thickness at pupp (Pa) +! dptop real coordinate thickness at top (Pa) +! Output argument list: +! pmin real minimum surface pressure (Pa) +! ak real(0:levs) a coordinate values, bottom to top (Pa) +! bk real(0:levs) b coordinate values, bottom to top () +! +! Subprograms called: +! ludcmp lower and upper triangular decomposition +! lubksb lower and upper triangular back substitution +! +! Attributes: +! Language: Fortran 90 +! +! Remarks: +! Example: Create the operational GFS 64-level hybrid coordinate. +! real(8) pmin,ak(0:64),bk(0:64) +! call vcoord_gen(64,64,100000.,99400.,7000.,0.,0.,500.,1200.,18000.,60.,60.,& +! pmin,ak,bk) +! print '(2i6)',2,64 +! print '(f12.3,f12.8)',(ak(k),bk(k),k=0,64) +! end +! +! Graphical description of parameters and zones: +! ptop --- ----- ---------------------- +! ... dptop +! --- zone U (upper atmos) +! ... +! pupp --- ----- ---------------------- +! ... dpupp +! --- ----- +! ... zone P (pure pressure) +! --- +! ... +! ppre --- ----- ---------------------- +! ... +! --- dppre zone T1 (transition 1) +! ... +! --- ----- ---------------------- +! ... +! --- +! ... zone T2 (transition 2) +! --- +! ... +! --- ----- ---------------------- +! ... +! --- dpsig zone T3 (transition 3) +! ... +! psig --- ----- ---------------------- +! ... +! --- ----- zone S (pure sigma) +! ... dpbot +! pbot --- ----- ---------------------- +! +! Detailed procedure description: +! STEP 1. +! The pressure profile is computed with respect to the given reference +! surface pressure pbot. For this surface pressure, the 'sigma' thicknesses +! dsig are assumed to be proportional to a quadratic polynomial in sigma sig +! with zero intercepts sig1 and sig2 somewhere below and above the model +! domain, respectively. That is, +! dsig ~ (sig2-sig)*(sig-sig1)*dk +! Integrating this differential equation gives +! sig = (sig1*exp(c1*k+c2)+sig2)/(exp(c1*k+c2)+1) +! The required boundary conditions sig(0)=1 and sig(levs)=0 +! fix the proportionality and integration constants c1 and c2. +! The two crossing parameters (sig1 and sig2) are determined +! by two input sigma thickness conditions dsig/dk at the bottom and top +! which are respectively given as dpbot/(pbot-pupp) and dpupp/(pbot-pupp). +! The crossing parameters are computed using Newton-Raphson iteration. +! This procedure fixes the pressure profile for surface pressure pbot. +! STEP 2. +! The pressure profile is computed with respect to a minimum surface pressure. +! This minimum surface pressure pmin is yet to be determined. +! Divide the profile into zones: +! zone U (pure pressure) from pupp to ptop +! zone P (pure pressure) from pupp to ppre +! zone T1 (transition 1) from ppre to ppre+dppre +! zone T2 (transition 2) from ppre+dppre to psig-dpsig +! zone T3 (transition 3) from psig-dpsig to psig +! zone S (pure "sigma") from psig to pmin +! (here sigma=p/ps so that d(ln(p))/dk is horizontally uniform) +! The pressure profile in the pure pressure zone P is set from step 1. +! The pressure thicknesses in zone T1 is set to be quadratic in level k. +! The pressure thicknesses in zone T2 is set to be linear in level k. +! The pressure thicknesses in zone T3 is set to be quadratic in level k. +! The pressure profile in the pure sigma zone S is also set from step 1. +! Thus there are nine unknowns: +! the 3 polynomial coefficients in zone T1 +! the 2 polynomial coefficients in zone T2 +! the 3 polynomial coefficients in zone T3 +! and the 1 minimum surface pressure. +! The nine conditions to determine these unknowns are: +! the thickness and its derivative match at zone P and T1 boundary +! the thickness and its derivative match at zone T1 and T2 boundary +! the thickness and its derivative match at zone T2 and T3 boundary +! the thickness and its derivative match at zone T3 and S boundary +! the sum of the thicknesses of zones T1, T2, T3, and S is pmin-ppre +! The unknowns are computed using standard linear decomposition. +! This procedure fixes the pressure profile for surface pressure pmin. +! STEP 3. +! (Step 3 skipped if lupp=levs, in which case pupp=ptop and dpupp=dptop.) +! The pressure in zone U is assumed to be the exponential of a cubic +! polynomial in level k. The function must match the pressure at pupp, +! as well as the thickness and its derivative there, and the pressure +! at ptop+dptop at the second to top level. The latter 3 conditions +! are determined by using standard linear decomposition. +! STEP 4. +! For an arbitrary surface pressure, the pressure profile is an linear +! combination of the pressure profiles for surface pressures pbot and pmin +! p(psfc)=p(pbot)*(psfc-pmin)/(pbot-pmin)+p(pmin)*(pbot-psfc)/(pbot-pmin) +! from which the hybrid coordinate profiles ak and bk are found such that +! p(psfc)=ak+bk*psfc +! +!$$$ +subroutine vcoord_gen(levs,lupp,pbot,psig,ppre,pupp,ptop,& + dpbot,dpsig,dppre,dpupp,dptop,pmin,ak,bk) + implicit none + integer,intent(in):: levs,lupp + real,intent(in):: pbot,psig,ppre,pupp,ptop + real,intent(in):: dpbot,dpsig,dppre,dpupp,dptop + real,intent(out):: pmin,ak(0:levs),bk(0:levs) + integer,parameter:: lo=100,li=10 ! outer and inner N-R iterations + real pdif ! thickness from pbot to pupp + real delb ! delta sig at bot + real delt ! delta sig at top + real sig1 ! crossing parameter 1 + real sig2 ! crossing parameter 2 + real c1 ! proportionality constant + real c2 ! integration constant + real sig ! sig variable + real dsig ! delta sig variable + real delbio0 ! initial guess at delta sig at bot + real deltio0 ! initial guess at delta sig at top + real delbio ! guess at delta sig at bot + real deltio ! guess at delta sig at top + real c1sig1 ! d(c1)/d(sig1) + real c1sig2 ! d(c1)/d(sig2) + real p(2) ! rhs in N-R iteration + real fjac(2,2) ! lhs in N-R iteration + integer indx(2) ! permutations in N-R iteration + real ppred ! pressure at T1-T2 boundary + real spre ! sig at P-T1 boundary + real spred ! sig at T1-T2 boundary + real rkpre ! level at P-T1 boundary + real rkpred ! level at T1-T2 boundary + real pkpre ! dp/dk at P-T1 boundary + real pkkpre ! d2p/dk2 at P-T1 boundary + real psigd ! pressure at T2-T3 boundary + real ssig ! sig at T3-S boundary + real ssigd ! sig at T2-T3 boundary + real rksig ! level at T3-S boundary + real rksigd ! level at T2-T3 boundary + real pksig ! dp/dk at T3-S boundary + real pkksig ! d2p/dk2 at T3-S boundary + real p2sig ! pressure at T3-S boundary for pmin surface pressure + real p2sigd ! pressure at T2-T3 boundary for pmin surface pressure + real p2pred ! pressure at T1-T2 boundary for pmin surface pressure + real x2(9) ! rhs in linear solver + real a2(9,9) ! lhs in linear solver + integer indx2(9) ! permutations in linear solver + real pkupp ! dp/dk at U-P boundary + real pkkupp ! d2p/dk2 at U-P boundary + real x3(3) ! rhs in linear solver + real a3(3,3) ! lhs in linear solver + integer indx3(3) ! permutations in linear solver + real p1 ! pressure variable for pbot surface pressure + real p2 ! pressure variable for pmin surface pressure + real d ! determinant permutation + integer io,ii,k +! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +! STEP 1. + pdif=pbot-pupp + delb=dpbot/pdif + delt=dpupp/pdif + sig1=1+delb + sig2=-delt + c1=log(-sig2*(1-sig1)/sig1/(sig2-1))/lupp + c2=log((sig2-1)/(1-sig1)) + sig=1 + dsig=(sig2-sig)*(sig-sig1)*c1/(sig1-sig2) + delbio0=-dsig + sig=0 + dsig=(sig2-sig)*(sig-sig1)*c1/(sig1-sig2) + deltio0=-dsig +! Newton-Raphson iterations + do io=1,lo + delbio=delbio0+(delb-delbio0)*io/lo + deltio=deltio0+(delt-deltio0)*io/lo + do ii=1,li + c1sig1=-1/(sig1*(1-sig1)*lupp) + c1sig2=-1/(sig2*(sig2-1)*lupp) + sig=1 + dsig=(sig2-sig)*(sig-sig1)*c1/(sig1-sig2) + p(1)=-delbio-dsig + fjac(1,1)=((-c1*(sig+sig2)+(sig-sig1)*c1sig1*(sig1+sig2)) & + *(sig2-sig)/(sig1+sig2)**2) + fjac(1,2)=((c1*(sig+sig1)+(sig2-sig)*c1sig2*(sig1+sig2)) & + *(sig-sig1)/(sig1+sig2)**2) + sig=0 + dsig=(sig2-sig)*(sig-sig1)*c1/(sig1-sig2) + p(2)=-deltio-dsig + fjac(2,1)=((-c1*(sig+sig2)+(sig-sig1)*c1sig1*(sig1+sig2)) & + *(sig2-sig)/(sig1+sig2)**2) + fjac(2,2)=((c1*(sig+sig1)+(sig2-sig)*c1sig2*(sig1+sig2)) & + *(sig-sig1)/(sig1+sig2)**2) + call ludcmp(fjac,2,2,indx,d) + call lubksb(fjac,2,2,indx,p) + sig1=sig1+p(1) + sig2=sig2+p(2) + c1=log(-sig2*(1-sig1)/sig1/(sig2-1))/lupp + c2=log((sig2-1)/(1-sig1)) + enddo + enddo +! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +! STEP 2. +! Compute minimum surface pressure + ppred=ppre+dppre + spre=(ppre-pupp)/pdif + spred=(ppred-pupp)/pdif + rkpre=(log((spre-sig2)/(sig1-spre))-c2)/c1 + rkpred=(log((spred-sig2)/(sig1-spred))-c2)/c1 + pkpre=pdif*c1*(sig2-spre)*(spre-sig1)/(sig1-sig2) + pkkpre=pkpre*c1*(sig2+sig1-2*spre)/(sig1-sig2) + psigd=psig-dpsig + ssig=(psig-pupp)/pdif + ssigd=(psigd-pupp)/pdif + rksig=(log((ssig-sig2)/(sig1-ssig))-c2)/c1 + rksigd=(log((ssigd-sig2)/(sig1-ssigd))-c2)/c1 + pksig=pdif*c1*(sig2-ssig)*(ssig-sig1)/(sig1-sig2) + pkksig=pksig*c1*(sig2+sig1-2*ssig)/(sig1-sig2) + x2=0 + a2=0 + x2(1)=pkpre + a2(1,1)=1 + a2(1,2)=rkpre + a2(1,3)=rkpre**2 + x2(2)=pkkpre + a2(2,2)=1 + a2(2,3)=2*rkpre + a2(3,1)=1 + a2(3,2)=rkpred + a2(3,3)=rkpred**2 + a2(3,4)=-1 + a2(3,5)=-rkpred + a2(4,2)=1 + a2(4,3)=2*rkpred + a2(4,5)=-1 + a2(5,4)=-1 + a2(5,5)=-rksigd + a2(5,6)=1 + a2(5,7)=rksigd + a2(5,8)=rksigd**2 + a2(6,5)=-1 + a2(6,7)=1 + a2(6,8)=2*rksigd + a2(7,6)=1 + a2(7,7)=rksig + a2(7,8)=rksig**2 + a2(7,9)=-pksig/pbot + a2(8,7)=1 + a2(8,8)=2*rksig + a2(8,9)=-pkksig/pbot + x2(9)=ppre + a2(9,1)=(rkpre-rkpred) + a2(9,2)=(rkpre**2-rkpred**2)/2 + a2(9,3)=(rkpre**3-rkpred**3)/3 + a2(9,4)=(rkpred-rksigd) + a2(9,5)=(rkpred**2-rksigd**2)/2 + a2(9,6)=(rksigd-rksig) + a2(9,7)=(rksigd**2-rksig**2)/2 + a2(9,8)=(rksigd**3-rksig**3)/3 + a2(9,9)=psig/pbot + call ludcmp(a2,9,9,indx2,d) + call lubksb(a2,9,9,indx2,x2) + pmin=x2(9) + p2sig=psig/pbot*pmin + p2sigd=p2sig & + +x2(6)*(rksigd-rksig) & + +x2(7)*(rksigd**2-rksig**2)/2 & + +x2(8)*(rksigd**3-rksig**3)/3 + p2pred=p2sigd & + +x2(4)*(rkpred-rksigd) & + +x2(5)*(rkpred**2-rksigd**2)/2 +! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +! STEP 3. + if(lupp.lt.levs) then + pkupp=pdif*c1*(sig2-0)*(0-sig1)/(sig1-sig2) + pkkupp=pkupp*c1*(sig2+sig1-2*0)/(sig1-sig2) + x3=0 + a3=0 + x3(1)=pkupp + a3(1,1)=pupp + x3(2)=pkkupp*pupp-pkupp**2 + a3(2,2)=pupp**2 + x3(3)=log((ptop+dptop)/pupp) + a3(3,1)=levs-1-lupp + a3(3,2)=(levs-1-lupp)**2/2 + a3(3,3)=(levs-1-lupp)**3/3 + call ludcmp(a3,3,3,indx3,d) + call lubksb(a3,3,3,indx3,x3) + endif +! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +! STEP 4. +! Compute hybrid interface values + ak(0)=0 + bk(0)=1 + do k=1,levs-1 + if(k.ge.lupp) then + p1=pupp*exp(x3(1)*(k-lupp)+x3(2)*(k-lupp)**2/2+x3(3)*(k-lupp)**3/3) + else + p1=(sig1*exp(c1*k+c2)+sig2)/(exp(c1*k+c2)+1)*pdif+pupp + endif + if(k.ge.rkpre) then + p2=p1 + elseif(k.ge.rkpred) then + p2=p2pred+x2(1)*(k-rkpred) & + +x2(2)*(k**2-rkpred**2)/2 & + +x2(3)*(k**3-rkpred**3)/3 + elseif(k.ge.rksigd) then + p2=p2sigd+x2(4)*(k-rksigd) & + +x2(5)*(k**2-rksigd**2)/2 + elseif(k.ge.rksig) then + p2=p2sig+x2(6)*(k-rksig) & + +x2(7)*(k**2-rksig**2)/2 & + +x2(8)*(k**3-rksig**3)/3 + else + p2=p1/pbot*pmin + endif + ak(k)=(p2*pbot-p1*pmin)/(pbot-pmin) + bk(k)=(p1-p2)/(pbot-pmin) + enddo + ak(levs)=ptop + bk(levs)=0 +end subroutine diff --git a/util/vcoord_gen/readme.md b/util/vcoord_gen/readme.md new file mode 100644 index 000000000..e6943a53a --- /dev/null +++ b/util/vcoord_gen/readme.md @@ -0,0 +1,71 @@ + + This program generates hybrid coordinate interface profiles + from a few given parameters. The hybrid coordinate is intended to start + out at the bottom in pure sigma and end up at the top in pure pressure, + with a smooth transition in between. The pressure thickness is close to + quadratic in pressure, with maximum thicknesses in the middle of the domain. + The coordinate pressure will have continuous second derivatives in level. + + The hybrid coordinate is returned in terms of vectors AK and BK, where + the interface pressure is defined as A+B*ps where ps is surface pressure + Thus A=0 in regions of pure sigma and B=0 in regions of pure sigma. + At the bottom, A(0)=0 and B(0)=1 so that surface pressure is the bottom + boundary condition, while at the top, A(levs)=ptop and B(levs)=0 so that + the constant top pressure (which can be zero) is the top boundary condition. + + Input argument list: + levs integer number of levels + lupp integer number of levels below pupp + pbot real nominal surface pressure (Pa) + psig real nominal pressure where coordinate changes + from pure sigma (Pa) + ppre real nominal pressure where coordinate changes + to pure pressure (Pa) + pupp real nominal pressure where coordinate changes + to upper atmospheric profile (Pa) + ptop real pressure at top (Pa) + dpbot real coordinate thickness at bottom (Pa) + dpsig real thickness of zone within which coordinate changes + to pure sigma (Pa) + dppre real thickness of zone within which coordinate changes + to pure pressure (Pa) + dpupp real coordinate thickness at pupp (Pa) + dptop real coordinate thickness at top (Pa) + + Outputs a text file containing the 'ak' and 'bk' values - + bottom to top. The conversion to pressure is: + + pressure = ak + (bk * pbot) + + Graphical description of parameters and zones: + ptop --- ----- ---------------------- + ... dptop + --- zone U (upper atmos) + ... + pupp --- ----- ---------------------- + ... dpupp + --- ----- + ... zone P (pure pressure) + --- + ... + ppre --- ----- ---------------------- + ... + --- dppre zone T1 (transition 1) + ... + --- ----- ---------------------- + ... + --- + ... zone T2 (transition 2) + --- + ... + --- ----- ---------------------- + ... + --- dpsig zone T3 (transition 3) + ... + psig --- ----- ---------------------- + ... + --- ----- zone S (pure sigma) + ... dpbot + pbot --- ----- ---------------------- + + For details on the procedure, see the program prolog. diff --git a/util/vcoord_gen/run.cray.sh b/util/vcoord_gen/run.cray.sh new file mode 100755 index 000000000..b6f9c7e13 --- /dev/null +++ b/util/vcoord_gen/run.cray.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +#BSUB -W 0:01 +#BSUB -o log +#BSUB -e log +#BSUB -J vcoord +#BSUB -q debug +#BSUB -R "rusage[mem=100]" +#BSUB -P GFS-DEV + +#------------------------------------------------------------------------------- +# +# Generate a hybrid coordinate interface profile on WCOSS-Cray. +# +# Build the repository using the ./build_all.sh script before running. +# +# Output 'ak' and 'bk' values are placed in $outfile. +# +#------------------------------------------------------------------------------- + +set -x + +source ../../sorc/machine-setup.sh > /dev/null 2>&1 +source ../../modulefiles/build.$target +module list + +outfile="./global_hyblev.txt" + +levs=128 # integer number of levels +lupp=88 # integer number of levels below pupp +pbot=100000.0 # real nominal surface pressure (Pa) +psig=99500.0 # real nominal pressure where coordinate changes + # from pure sigma (Pa) +ppre=7000.0 # real nominal pressure where coordinate changes + # to pure pressure (Pa) +pupp=7000.0 # real nominal pressure where coordinate changes + # to upper atmospheric profile (Pa) +ptop=0.0 # real pressure at top (Pa) +dpbot=240.0 # real coordinate thickness at bottom (Pa) +dpsig=1200.0 # real thickness of zone within which coordinate changes + # to pure sigma (Pa) +dppre=18000.0 # real thickness of zone within which coordinate changes + # to pure pressure (Pa) +dpupp=550.0 # real coordinate thickness at pupp (Pa) +dptop=1.0 # real coordinate thickness at top (Pa) + +rm -f $outfile + +echo $levs $lupp $pbot $psig $ppre $pupp $ptop $dpbot $dpsig $dppre $dpupp $dptop | $PWD/../../exec/vcoord_gen > $outfile + +exit diff --git a/util/vcoord_gen/run.sh b/util/vcoord_gen/run.sh new file mode 100755 index 000000000..b0d5c3aff --- /dev/null +++ b/util/vcoord_gen/run.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +#------------------------------------------------------------------------------- +# +# Generate a hybrid coordinate interface profile. On WCOSS-Cray, use +# 'run.cray.sh'. +# +# Build the repository using the ./build_all.sh script before running. +# +# Output 'ak' and 'bk' values are placed in $outfile. +# +#------------------------------------------------------------------------------- + +set -x + +outfile="./global_hyblev.txt" + +levs=128 # integer number of levels +lupp=88 # integer number of levels below pupp +pbot=100000.0 # real nominal surface pressure (Pa) +psig=99500.0 # real nominal pressure where coordinate changes + # from pure sigma (Pa) +ppre=7000.0 # real nominal pressure where coordinate changes + # to pure pressure (Pa) +pupp=7000.0 # real nominal pressure where coordinate changes + # to upper atmospheric profile (Pa) +ptop=0.0 # real pressure at top (Pa) +dpbot=240.0 # real coordinate thickness at bottom (Pa) +dpsig=1200.0 # real thickness of zone within which coordinate changes + # to pure sigma (Pa) +dppre=18000.0 # real thickness of zone within which coordinate changes + # to pure pressure (Pa) +dpupp=550.0 # real coordinate thickness at pupp (Pa) +dptop=1.0 # real coordinate thickness at top (Pa) + +rm -f $outfile + +echo $levs $lupp $pbot $psig $ppre $pupp $ptop $dpbot $dpsig $dppre $dpupp $dptop | ../../exec/vcoord_gen > $outfile + +exit From dbcad06d54c339d0d1667360a9ca48753dd7a645 Mon Sep 17 00:00:00 2001 From: gsketefian <31046882+gsketefian@users.noreply.github.com> Date: Fri, 25 Sep 2020 15:33:54 -0600 Subject: [PATCH 035/192] Update make_solo_mosaic to handle longer file names Increase the length of the string "mosaic_name" in make_solo_mosaic.c from 128 to 255 characters. This is needed for the regional workflow where "mosaic_name" includes the absolute path and can exceed 128 characters. In that case, make_solo_mosaic fails without a clear error message. --- sorc/fre-nctools.fd/tools/make_solo_mosaic/make_solo_mosaic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorc/fre-nctools.fd/tools/make_solo_mosaic/make_solo_mosaic.c b/sorc/fre-nctools.fd/tools/make_solo_mosaic/make_solo_mosaic.c index 82f7ee78f..f78ec54a5 100644 --- a/sorc/fre-nctools.fd/tools/make_solo_mosaic/make_solo_mosaic.c +++ b/sorc/fre-nctools.fd/tools/make_solo_mosaic/make_solo_mosaic.c @@ -78,7 +78,7 @@ main (int argc, char *argv[]) int contact_tile1_jstart[MAXCONTACT], contact_tile1_jend[MAXCONTACT]; int contact_tile2_istart[MAXCONTACT], contact_tile2_iend[MAXCONTACT]; int contact_tile2_jstart[MAXCONTACT], contact_tile2_jend[MAXCONTACT]; - char mosaic_name[128] = "solo_mosaic"; + char mosaic_name[STRING] = "solo_mosaic"; char grid_descriptor[128] = ""; int c, i, n, m, l, errflg; From 8bef319960e7169c8a948a9ea1990af78df3df86 Mon Sep 17 00:00:00 2001 From: David Wright Date: Tue, 29 Sep 2020 10:54:19 -0400 Subject: [PATCH 036/192] Use FVCOM lake surface conditions New program fvcom_to_FV3 takes lake surface data generated by FVCOM and replaces the corresponding variables in the surface file created by chgres_cube. Input data to fvcom_to_FV3 needs to be in netcdf format and already horizontally interpolated to the model grid. Some QC is done within the code to create a minimum lake ice value of 15%. The code is strongly based upon work done by Eric James (GSL) and Ming Hu (GSL) to get FVCOM surface conditions into HRRRv4. PR #158. --- sorc/CMakeLists.txt | 1 + sorc/fvcom_tools.fd/CMakeLists.txt | 22 + sorc/fvcom_tools.fd/kinds.f90 | 48 + sorc/fvcom_tools.fd/module_ncio.f90 | 2360 +++++++++++++++++++++++ sorc/fvcom_tools.fd/module_nwp.f90 | 280 +++ sorc/fvcom_tools.fd/module_nwp_base.f90 | 126 ++ sorc/fvcom_tools.fd/process_FVCOM.f90 | 217 +++ sorc/fvcom_tools.fd/readme.md | 39 + 8 files changed, 3093 insertions(+) create mode 100644 sorc/fvcom_tools.fd/CMakeLists.txt create mode 100644 sorc/fvcom_tools.fd/kinds.f90 create mode 100644 sorc/fvcom_tools.fd/module_ncio.f90 create mode 100644 sorc/fvcom_tools.fd/module_nwp.f90 create mode 100644 sorc/fvcom_tools.fd/module_nwp_base.f90 create mode 100755 sorc/fvcom_tools.fd/process_FVCOM.f90 create mode 100644 sorc/fvcom_tools.fd/readme.md diff --git a/sorc/CMakeLists.txt b/sorc/CMakeLists.txt index 92838fa68..0bc698c8d 100644 --- a/sorc/CMakeLists.txt +++ b/sorc/CMakeLists.txt @@ -18,3 +18,4 @@ add_subdirectory(chgres_cube.fd) add_subdirectory(orog_mask_tools.fd) add_subdirectory(sfc_climo_gen.fd) add_subdirectory(vcoord_gen.fd) +add_subdirectory(fvcom_tools.fd) diff --git a/sorc/fvcom_tools.fd/CMakeLists.txt b/sorc/fvcom_tools.fd/CMakeLists.txt new file mode 100644 index 000000000..7f0bec898 --- /dev/null +++ b/sorc/fvcom_tools.fd/CMakeLists.txt @@ -0,0 +1,22 @@ +set(fortran_src + kinds.f90 + module_ncio.f90 + module_nwp_base.f90 + module_nwp.f90 + process_FVCOM.f90) + + +if(CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -r8 -convert big_endian") +elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-0 -fdefault-real-8 -fconvert=big-endian") +endif() + +set(exe_name fvcom_to_FV3) +add_executable(${exe_name} ${fortran_src}) +target_link_libraries( + ${exe_name} + MPI::MPI_Fortran + NetCDF::NetCDF_Fortran) + +install(TARGETS ${exe_name} RUNTIME DESTINATION ${exec_dir}) diff --git a/sorc/fvcom_tools.fd/kinds.f90 b/sorc/fvcom_tools.fd/kinds.f90 new file mode 100644 index 000000000..d10a7d797 --- /dev/null +++ b/sorc/fvcom_tools.fd/kinds.f90 @@ -0,0 +1,48 @@ +module kinds +!$$$ module documentation block +! . . . . +! module: kinds +! abstract: Module to hold specification kinds for variable declaration. +! This module is based on (copied from) Paul vanDelst's +! type_kinds module found in the community radiative transfer +! model +! +! module history log: +! +! Subroutines Included: +! +! Functions Included: +! +! remarks: +! The numerical data types defined in this module are: +! r_single - specification kind for single precision (4-byte) real variable +! i_kind - generic specification kind for default integer +! r_kind - generic specification kind for default floating point +! +! +! attributes: +! language: f90 +! +!$$$ end documentation block + implicit none + private +! +! for name string + integer, parameter, public :: len_sta_name = 8 + +! Integer type definitions below + +! Integer types + integer, parameter, public :: i_kind = 4 + integer, parameter, public :: i_short = 2 + integer, parameter, public :: i_byte = 1 +! Real types + integer, parameter, public :: r_single = 4 ! single precision + integer, parameter, public :: r_kind = 8 + +! + real(r_single),parameter,public :: rmissing=-99999.0 + real(i_kind),parameter,public :: imissing=-99999 + real(r_kind),parameter,public :: drmissing=-99999.0 + +end module kinds diff --git a/sorc/fvcom_tools.fd/module_ncio.f90 b/sorc/fvcom_tools.fd/module_ncio.f90 new file mode 100644 index 000000000..5f118ad93 --- /dev/null +++ b/sorc/fvcom_tools.fd/module_ncio.f90 @@ -0,0 +1,2360 @@ +module module_ncio +! +! module: functions to read and write netcdf files +! +! Ming Hu +! +! program history log: +! 2017-11-01 Hu initial build +! +! Subroutines Included: +! + + use netcdf + implicit none + + public :: ncio +! set default to private + private +! + type :: ncio + character(len=256) :: filename + integer :: ncid, status + integer :: debug_level + + integer :: nDims + integer :: ends(4) + integer :: xtype + character(len=40) :: dimname(4) + contains + procedure :: open => open_nc + procedure :: close => close_nc + +! read in dimension from the nc file + procedure :: get_dim => get_dim_nc + +! read in attribute from the nc file + generic :: get_att => get_att_nc_int,get_att_nc_real,get_att_nc_string + procedure :: get_att_nc_int + procedure :: get_att_nc_real + procedure :: get_att_nc_string + +! read in a 1d, 2d, 3d, or 4d field from the nc file + generic :: get_var => get_var_nc_double_1d, get_var_nc_double_2d, & + get_var_nc_double_3d, & + get_var_nc_real_1d,get_var_nc_real_2d, & + get_var_nc_real_3d, & + get_var_nc_short_1d,get_var_nc_short_2d, & + get_var_nc_int_1d,get_var_nc_int_2d, & + get_var_nc_int_3d, & + get_var_nc_char_1d,get_var_nc_char_2d, & + get_var_nc_char_3d + procedure :: get_var_nc_short + procedure :: get_var_nc_short_1d + procedure :: get_var_nc_short_2d + procedure :: get_var_nc_int + procedure :: get_var_nc_int_1d + procedure :: get_var_nc_int_2d + procedure :: get_var_nc_int_3d + procedure :: get_var_nc_real + procedure :: get_var_nc_real_1d + procedure :: get_var_nc_real_2d + procedure :: get_var_nc_real_3d + procedure :: get_var_nc_double + procedure :: get_var_nc_double_1d + procedure :: get_var_nc_double_2d + procedure :: get_var_nc_double_3d + procedure :: get_var_nc_char + procedure :: get_var_nc_char_1d + procedure :: get_var_nc_char_2d + procedure :: get_var_nc_char_3d + +! replace 1d, 2d, 3d, or 4d field from the nc file + generic :: replace_var => replace_var_nc_double_1d, replace_var_nc_double_2d, & + replace_var_nc_double_3d, & + replace_var_nc_real_1d,replace_var_nc_real_2d, & + replace_var_nc_real_3d, & + replace_var_nc_int_1d,replace_var_nc_int_2d, & + replace_var_nc_int_3d, & + replace_var_nc_char_1d,replace_var_nc_char_2d, & + replace_var_nc_char_3d + procedure :: replace_var_nc_int + procedure :: replace_var_nc_int_1d + procedure :: replace_var_nc_int_2d + procedure :: replace_var_nc_int_3d + procedure :: replace_var_nc_real + procedure :: replace_var_nc_real_1d + procedure :: replace_var_nc_real_2d + procedure :: replace_var_nc_real_3d + procedure :: replace_var_nc_double + procedure :: replace_var_nc_double_1d + procedure :: replace_var_nc_double_2d + procedure :: replace_var_nc_double_3d + procedure :: replace_var_nc_char + procedure :: replace_var_nc_char_1d + procedure :: replace_var_nc_char_2d + procedure :: replace_var_nc_char_3d + + procedure :: handle_err + + procedure :: convert_theta2t_2dgrid +!Add a new 3d variable to output file (David.M.Wright) + procedure :: add_new_var => add_new_var_3d + end type ncio + +contains + +subroutine open_nc(this,filename,action,debug_level) +! +! open a netcdf file, set initial debug level +! +! prgmmr: Ming Hu org: GSD date: 2017-11-01 +! +! abstract: +! + + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: filename + character(len=1),intent(in) :: action + integer,intent(in),optional :: debug_level + + integer :: ncid, status + + this%debug_level=20 + if(present(debug_level)) this%debug_level=debug_level + + this%filename=trim(filename) +! open existing netCDF dataset + if(action=="r" .or. action=="R") then + status = nf90_open(path = trim(filename), mode = nf90_nowrite, ncid = ncid) + elseif(action=="w" .or. action=="W") then + status = nf90_open(path = trim(filename), mode = nf90_write, ncid = ncid) + else + write(*,*) 'unknow action :', action + stop 123 + endif + if (status /= nf90_noerr) call this%handle_err(status) + this%ncid=ncid + + if(this%debug_level>0) then + write(*,*) '>>> open file: ',trim(this%filename) + endif + +end subroutine open_nc + +subroutine close_nc(this) +! +! initial netcdf file +! +! prgmmr: Ming Hu org: GSD/AMB date: 2017-04-10 +! +! abstract: +! + + implicit none +! + class(ncio) :: this + + integer :: ncid, status + + ncid=this%ncid +! +! close netCDF dataset + status = nf90_close(ncid) + if (status /= nf90_noerr) call this%handle_err(status) + +end subroutine close_nc + +subroutine get_att_nc_real(this,attname,rval) +! +! get attribute in wrf netcdf file +! +! prgmmr: Ming Hu org: GSD/AMB date: 2017-10-04 +! +! abstract: +! + + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: attname + real, intent(out) :: rval + + integer :: ncid, status + +! open existing netCDF dataset + ncid=this%ncid + +! get date from exisiting NC file + status = nf90_get_att(ncid, NF90_GLOBAL, trim(attname), rval) + if (status /= nf90_noerr) call this%handle_err(status) +! +end subroutine get_att_nc_real + +subroutine get_att_nc_int(this,attname,ival) +! +! get attribute in wrf netcdf file +! +! prgmmr: Ming Hu org: GSD/AMB date: 2017-10-04 +! +! abstract: +! + + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: attname + integer, intent(out) :: ival + + integer :: ncid, status + +! open existing netCDF dataset + ncid=this%ncid + +! get date from exisiting NC file + status = nf90_get_att(ncid, NF90_GLOBAL, trim(attname), ival) + if (status /= nf90_noerr) call this%handle_err(status) +! +end subroutine get_att_nc_int + +subroutine get_att_nc_string(this,attname,string) +! +! get attribute in wrf netcdf file +! +! prgmmr: Ming Hu org: GSD/AMB date: 2017-10-04 +! +! abstract: +! + + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: attname + character(len=*), intent(out) :: string + + integer :: ncid, status + +! open existing netCDF dataset + ncid=this%ncid + +! get date from exisiting NC file + status = nf90_get_att(ncid, NF90_GLOBAL, trim(attname), string) + if (status /= nf90_noerr) call this%handle_err(status) +! +end subroutine get_att_nc_string + + +subroutine get_dim_nc(this,dimname,dimvalue) +! +! get dimensions in netcdf file +! +! prgmmr: Ming Hu org: GSD/AMB date: 2017-11-01 +! +! abstract: +! + + implicit none +! + class(ncio) :: this + character(len=*), intent(in) :: dimname + integer,intent(out) :: dimvalue + + integer :: ncid, status + integer :: DimId + +! open existing netCDF dataset + ncid=this%ncid + +! get dimension from exisiting NC file + status = nf90_inq_dimid(ncid,trim(dimname), DimId) + if (status /= nf90_noerr) call this%handle_err(status) + status = nf90_Inquire_Dimension(ncid, DimId, len = dimvalue) + if (status /= nf90_noerr) call this%handle_err(status) +! +end subroutine get_dim_nc + +!==========================begin replace_var ========================== +subroutine replace_var_nc_char_1d(this,varname,nd1,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1 ! size of array dval + character, intent(in) :: field(nd1) ! values of the field read in + integer :: ilength +! + character*40,parameter :: thissubname='replace_var_nc_char_1d' +! + integer :: i +! +! + ilength=nd1 +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) (field(i),i=1,min(nd1,10)) + endif + + call this%replace_var_nc_char(varname,ilength,field) +! +end subroutine replace_var_nc_char_1d + +subroutine replace_var_nc_char_2d(this,varname,nd1,nd2,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2 ! size of array dval + character, intent(in) :: field(nd1,nd2) ! values of the field read in + integer :: ilength +! + character,allocatable :: temp(:) +! + character*40,parameter :: thissubname='replace_var_nc_char_2d' +! + integer :: i,j,k + integer :: istart,iend +! +! + ilength=nd1*nd2 + allocate(temp(ilength)) + + do j=1,nd2 + istart=(j-1)*nd1+1 + iend=(j-1)*nd1+nd1 + temp(istart:iend)=field(:,j) + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) field(1,1) + endif +! + call this%replace_var_nc_char(varname,ilength,temp) + + deallocate(temp) +! +end subroutine replace_var_nc_char_2d + +subroutine replace_var_nc_char_3d(this,varname,nd1,nd2,nd3,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2,nd3 ! size of array dval + character, intent(in) :: field(nd1,nd2,nd3) ! values of the field read in + integer :: ilength +! + character,allocatable :: temp(:) +! + character*40,parameter :: thissubname='replace_var_nc_char_3d' +! + integer :: i,j,k + integer :: length2d + integer :: istart,iend +! +! + length2d=nd1*nd2 + ilength=length2d*nd3 + allocate(temp(ilength)) + + do k=1,nd3 + do j=1,nd2 + istart=(k-1)*length2d+(j-1)*nd1+1 + iend =(k-1)*length2d+(j-1)*nd1+nd1 + temp(istart:iend)=field(:,j,k) + enddo + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) field(1,1,1) + endif + + call this%replace_var_nc_char(varname,ilength,temp) + + deallocate(temp) +! +end subroutine replace_var_nc_char_3d +! +subroutine replace_var_nc_char(this,varname,ilength,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: ilength ! size of array dval + character, intent(in) :: field(ilength) ! values of the field read in +! + integer :: ncid +! + integer :: status + integer :: varid + integer :: ends(4),start(4) + + integer :: length4d,length3d,length2d + integer :: nDims,ndim + integer :: dimids(4) + integer :: xtype + character*40 :: dimname + + character*40,parameter :: thissubname='replace_var_nc_char' +! + integer :: i,k +! +! + ncid=this%ncid + +! get variable IDs + status = nf90_inq_varid(ncid, trim(varname), VarId) + if(status /= nf90_NoErr) call this%handle_err(status) + +! get dimensions + ends=1 + start=1 + this%ends=1 + + this%dimname=" " +! get variable type + status = nf90_inquire_variable(ncid, VarId, xtype = xtype) + if(status /= nf90_NoErr) call this%handle_err(status) + if(xtype==NF90_CHAR) then + this%xtype=xtype + else + write(*,*) trim(thissubname),' ERROR: wrong data type, expect ',NF90_INT,' but read in ',xtype + stop 123 + endif + +! get dimension size + status = nf90_inquire_variable(ncid, VarId, ndims = nDims) + if(status /= nf90_NoErr) call this%handle_err(status) + this%ndims=nDims +! + status = nf90_inquire_variable(ncid, VarId, dimids = dimids(1:nDims)) + if(status /= nf90_NoErr) call this%handle_err(status) + do i=1,nDims + dimname=" " + status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim) + if (status /= nf90_noerr) call this%handle_err(status) + ends(i)=ndim + this%ends(i)=ends(i) + this%dimname(i)=trim(dimname) + if(this%ends(i) < 1) then + write(*,*) trim(thissubname),' Error, ends dimension should larger than 0 :', ends(i) + stop 1234 + endif + enddo + length2d=ends(1)*ends(2) + length3d=length2d*ends(3) + length4d=length3d*ends(4) + if(ilength .ne. length4d) then + write(*,*) trim(thissubname),'ERROR: ',ilength,' should equal to ',length4d + stop 123 + endif +! + if(nDims <=4 ) then + status = nf90_put_var(ncid, VarId, field, & + start = start(1:4) , & + count = ends(1:4)) + if(status /= nf90_NoErr) call this%handle_err(status) + else + write(*,*) trim(thissubname),'Error: too many dimensions:',nDims + stop 1234 + endif +! + if(this%debug_level>0) then + write(*,'(a,a)') '>>>replace variable: ',trim(varname) + endif + if(this%debug_level>10) then + write(*,'(8x,a,I10)') 'data type : ',this%xtype + write(*,'(8x,a,I10)') 'dimension size: ',this%nDims + do i=1,this%nDims + write(*,'(8x,a,I5,I10,2x,a)') 'rank, ends, name=',i,this%ends(i),trim(this%dimname(i)) + enddo + endif +! +end subroutine replace_var_nc_char +!--- replace_var_nc_char + +!---- replace real +subroutine replace_var_nc_real_1d(this,varname,nd1,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1 ! size of array dval + real(4), intent(in) :: field(nd1) ! values of the field read in + integer :: ilength +! + character*40,parameter :: thissubname='replace_var_nc_real_1d' +! + integer :: i +! +! + ilength=nd1 +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) (field(i),i=1,min(nd1,10)) + endif +! + call this%replace_var_nc_real(varname,ilength,field) +! +end subroutine replace_var_nc_real_1d + +subroutine replace_var_nc_real_2d(this,varname,nd1,nd2,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2 ! size of array dval + real(4), intent(in) :: field(nd1,nd2) ! values of the field read in + integer :: ilength +! + real(4),allocatable :: temp(:) +! + character*40,parameter :: thissubname='replace_var_nc_real_2d' +! + integer :: i,j,k + integer :: istart,iend +! +! + ilength=nd1*nd2 + allocate(temp(ilength)) + + do j=1,nd2 + istart=(j-1)*nd1+1 + iend=(j-1)*nd1+nd1 + temp(istart:iend)=field(:,j) + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) 'max,min:',maxval(field(:,:)),minval(field(:,:)) + endif + + call this%replace_var_nc_real(varname,ilength,temp) + + deallocate(temp) +! +end subroutine replace_var_nc_real_2d + +subroutine replace_var_nc_real_3d(this,varname,nd1,nd2,nd3,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2,nd3 ! size of array dval + real(4), intent(in) :: field(nd1,nd2,nd3) ! values of the field read in + integer :: ilength +! + real(4),allocatable :: temp(:) +! + character*40,parameter :: thissubname='replace_var_nc_real_3d' +! + integer :: i,j,k + integer :: length2d + integer :: istart,iend +! +! + length2d=nd1*nd2 + ilength=length2d*nd3 + allocate(temp(ilength)) + + do k=1,nd3 + do j=1,nd2 + istart=(k-1)*length2d+(j-1)*nd1+1 + iend =(k-1)*length2d+(j-1)*nd1+nd1 + temp(istart:iend)=field(:,j,k) + enddo + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + do k=1,nd3 + write(*,*) 'k,max,min:',k,maxval(field(:,:,k)),minval(field(:,:,k)) + enddo + endif + + call this%replace_var_nc_real(varname,ilength,temp) + + deallocate(temp) +! +end subroutine replace_var_nc_real_3d + +subroutine replace_var_nc_real(this,varname,ilength,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: ilength ! size of array dval + real(4), intent(in) :: field(ilength) ! values of the field read in +! + integer :: ncid +! + integer :: status + integer :: varid + integer :: ends(4),start(4) + + integer :: length4d,length3d,length2d + integer :: nDims,ndim + integer :: dimids(4) + integer :: xtype + character*40 :: dimname + + character*40,parameter :: thissubname='replace_var_nc_real' +! + integer :: i,k +! +! + ncid=this%ncid + +! get variable IDs + status = nf90_inq_varid(ncid, trim(varname), VarId) + if(status /= nf90_NoErr) call this%handle_err(status) + +! get dimensions + ends=1 + start=1 + this%ends=1 + + this%dimname=" " +! get variable type + status = nf90_inquire_variable(ncid, VarId, xtype = xtype) + if(status /= nf90_NoErr) call this%handle_err(status) + if(xtype==NF90_FLOAT) then + this%xtype=xtype + else + write(*,*) trim(thissubname),' ERROR: wrong data type, expect ',NF90_INT,' but read in ',xtype + stop 123 + endif + +! get dimension size + status = nf90_inquire_variable(ncid, VarId, ndims = nDims) + if(status /= nf90_NoErr) call this%handle_err(status) + this%ndims=nDims +! + status = nf90_inquire_variable(ncid, VarId, dimids = dimids(1:nDims)) + if(status /= nf90_NoErr) call this%handle_err(status) + do i=1,nDims + dimname=" " + status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim) + if (status /= nf90_noerr) call this%handle_err(status) + ends(i)=ndim + this%ends(i)=ends(i) + this%dimname(i)=trim(dimname) + if(this%ends(i) < 1) then + write(*,*) trim(thissubname),' Error, ends dimension should larger than 0 :', ends(i) + stop 1234 + endif + enddo + length2d=ends(1)*ends(2) + length3d=length2d*ends(3) + length4d=length3d*ends(4) + if(ilength .ne. length4d) then + write(*,*) trim(thissubname),'ERROR: ',ilength,' should equal to ',length4d + stop 123 + endif +! + if(nDims <=4 ) then + status = nf90_put_var(ncid, VarId, field, & + start = start(1:4) , & + count = ends(1:4)) + if(status /= nf90_NoErr) call this%handle_err(status) + else + write(*,*) trim(thissubname),'Error: too many dimensions:',nDims + stop 1234 + endif +! + if(this%debug_level>0) then + write(*,'(a,a)') '>>>replace variable: ',trim(varname) + endif + if(this%debug_level>10) then + write(*,'(8x,a,I10)') 'data type : ',this%xtype + write(*,'(8x,a,I10)') 'dimension size: ',this%nDims + do i=1,this%nDims + write(*,'(8x,a,I5,I10,2x,a)') 'rank, ends, name=',i,this%ends(i),trim(this%dimname(i)) + enddo + endif +! +end subroutine replace_var_nc_real + +!---- repalce double +subroutine replace_var_nc_double_1d(this,varname,nd1,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1 ! size of array dval + real(8), intent(in) :: field(nd1) ! values of the field read in + integer :: ilength +! + character*40,parameter :: thissubname='replace_var_nc_double_1d' +! + integer :: i +! +! + ilength=nd1 +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) (field(i),i=1,min(nd1,10)) + endif +! + call this%replace_var_nc_double(varname,ilength,field) +! +end subroutine replace_var_nc_double_1d + +subroutine replace_var_nc_double_2d(this,varname,nd1,nd2,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2 ! size of array dval + real(8), intent(in) :: field(nd1,nd2) ! values of the field read in + integer :: ilength +! + real(8),allocatable :: temp(:) +! + character*40,parameter :: thissubname='replace_var_nc_double_2d' +! + integer :: i,j,k + integer :: istart,iend +! +! + ilength=nd1*nd2 + allocate(temp(ilength)) + + do j=1,nd2 + istart=(j-1)*nd1+1 + iend=(j-1)*nd1+nd1 + temp(istart:iend)=field(:,j) + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) 'max,min:',maxval(field(:,:)),minval(field(:,:)) + endif + + call this%replace_var_nc_double(varname,ilength,temp) + + deallocate(temp) +! +end subroutine replace_var_nc_double_2d + +subroutine replace_var_nc_double_3d(this,varname,nd1,nd2,nd3,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2,nd3 ! size of array dval + real(8), intent(in) :: field(nd1,nd2,nd3) ! values of the field read in + integer :: ilength +! + real(8),allocatable :: temp(:) +! + character*40,parameter :: thissubname='replace_var_nc_double_3d' +! + integer :: i,j,k + integer :: length2d + integer :: istart,iend +! +! + length2d=nd1*nd2 + ilength=length2d*nd3 + allocate(temp(ilength)) + + do k=1,nd3 + do j=1,nd2 + istart=(k-1)*length2d+(j-1)*nd1+1 + iend =(k-1)*length2d+(j-1)*nd1+nd1 + temp(istart:iend)=field(:,j,k) + enddo + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + do k=1,nd3 + write(*,*) 'k,max,min:',k,maxval(field(:,:,k)),minval(field(:,:,k)) + enddo + endif + + call this%replace_var_nc_double(varname,ilength,temp) + + deallocate(temp) +! +end subroutine replace_var_nc_double_3d +! + +subroutine replace_var_nc_double(this,varname,ilength,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: ilength ! size of array dval + real(8), intent(in) :: field(ilength) ! values of the field read in +! + integer :: ncid +! + integer :: status + integer :: varid + integer :: ends(4),start(4) + + integer :: length4d,length3d,length2d + integer :: nDims,ndim + integer :: dimids(4) + integer :: xtype + character*40 :: dimname + + character*40,parameter :: thissubname='replace_var_nc_double' +! + integer :: i,k +! +! + ncid=this%ncid + +! get variable IDs + status = nf90_inq_varid(ncid, trim(varname), VarId) + if(status /= nf90_NoErr) call this%handle_err(status) + +! get dimensions + ends=1 + start=1 + this%ends=1 + + this%dimname=" " +! get variable type + status = nf90_inquire_variable(ncid, VarId, xtype = xtype) + if(status /= nf90_NoErr) call this%handle_err(status) + if(xtype==NF90_DOUBLE) then + this%xtype=xtype + else + write(*,*) trim(thissubname),' ERROR: wrong data type, expect ',NF90_INT,' but read in ',xtype + stop 123 + endif + +! get dimension size + status = nf90_inquire_variable(ncid, VarId, ndims = nDims) + if(status /= nf90_NoErr) call this%handle_err(status) + this%ndims=nDims +! + status = nf90_inquire_variable(ncid, VarId, dimids = dimids(1:nDims)) + if(status /= nf90_NoErr) call this%handle_err(status) + do i=1,nDims + dimname=" " + status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim) + if (status /= nf90_noerr) call this%handle_err(status) + ends(i)=ndim + this%ends(i)=ends(i) + this%dimname(i)=trim(dimname) + if(this%ends(i) < 1) then + write(*,*) trim(thissubname),' Error, ends dimension should larger than 0 :', ends(i) + stop 1234 + endif + enddo + length2d=ends(1)*ends(2) + length3d=length2d*ends(3) + length4d=length3d*ends(4) + if(ilength .ne. length4d) then + write(*,*) trim(thissubname),'ERROR: ',ilength,' should equal to ',length4d + stop 123 + endif +! + if(nDims <=4 ) then + status = nf90_put_var(ncid, VarId, field, & + start = start(1:4) , & + count = ends(1:4)) + if(status /= nf90_NoErr) call this%handle_err(status) + else + write(*,*) trim(thissubname),'Error: too many dimensions:',nDims + stop 1234 + endif +! + if(this%debug_level>0) then + write(*,'(a,a)') '>>>replace variable: ',trim(varname) + endif + if(this%debug_level>10) then + write(*,'(8x,a,I10)') 'data type : ',this%xtype + write(*,'(8x,a,I10)') 'dimension size: ',this%nDims + do i=1,this%nDims + write(*,'(8x,a,I5,I10,2x,a)') 'rank, ends, name=',i,this%ends(i),trim(this%dimname(i)) + enddo + endif +! +end subroutine replace_var_nc_double +! +!---- replace int +subroutine replace_var_nc_int_1d(this,varname,nd1,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1 ! size of array dval + integer, intent(in) :: field(nd1) ! values of the field read in + integer :: ilength +! + character*40,parameter :: thissubname='get_var_nc_int_1d' +! + integer :: i +! +! + ilength=nd1 +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) (field(i),i=1,min(nd1,10)) + endif + + call this%replace_var_nc_int(varname,ilength,field) +! +end subroutine replace_var_nc_int_1d + +subroutine replace_var_nc_int_2d(this,varname,nd1,nd2,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2 ! size of array dval + integer, intent(in) :: field(nd1,nd2) ! values of the field read in + integer :: ilength +! + integer,allocatable :: temp(:) +! + character*40,parameter :: thissubname='replace_var_nc_int_2d' +! + integer :: i,j,k + integer :: istart,iend +! +! + ilength=nd1*nd2 + allocate(temp(ilength)) + + do j=1,nd2 + istart=(j-1)*nd1+1 + iend=(j-1)*nd1+nd1 + temp(istart:iend)=field(:,j) + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) 'max,min:',maxval(field(:,:)),minval(field(:,:)) + endif + + call this%replace_var_nc_int(varname,ilength,temp) + + deallocate(temp) +! +end subroutine replace_var_nc_int_2d + +subroutine replace_var_nc_int_3d(this,varname,nd1,nd2,nd3,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2,nd3 ! size of array dval + integer, intent(in) :: field(nd1,nd2,nd3) ! values of the field read in + integer :: ilength +! + integer,allocatable :: temp(:) +! + character*40,parameter :: thissubname='replace_var_nc_int_3d' +! + integer :: i,j,k + integer :: length2d + integer :: istart,iend +! +! + length2d=nd1*nd2 + ilength=length2d*nd3 + allocate(temp(ilength)) + + do k=1,nd3 + do j=1,nd2 + istart=(k-1)*length2d+(j-1)*nd1+1 + iend =(k-1)*length2d+(j-1)*nd1+nd1 + temp(istart:iend)=field(:,j,k) + enddo + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + do k=1,nd3 + write(*,*) 'k,max,min:',k,maxval(field(:,:,k)),minval(field(:,:,k)) + enddo + endif + + call this%replace_var_nc_int(varname,ilength,temp) + + deallocate(temp) +! +end subroutine replace_var_nc_int_3d +! +subroutine replace_var_nc_int(this,varname,ilength,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: ilength ! size of array dval + integer, intent(in) :: field(ilength) ! values of the field read in +! + integer :: ncid +! + integer :: status + integer :: varid + integer :: ends(4),start(4) + + integer :: length4d,length3d,length2d + integer :: nDims,ndim + integer :: dimids(4) + integer :: xtype + character*40 :: dimname + + character*40,parameter :: thissubname='replace_var_nc_int' +! + integer :: i,k +! +! + ncid=this%ncid + +! get variable IDs + status = nf90_inq_varid(ncid, trim(varname), VarId) + if(status /= nf90_NoErr) call this%handle_err(status) + +! get dimensions + ends=1 + start=1 + this%ends=1 + + this%dimname=" " +! get variable type + status = nf90_inquire_variable(ncid, VarId, xtype = xtype) + if(status /= nf90_NoErr) call this%handle_err(status) + if(xtype==NF90_INT) then + this%xtype=xtype + else + write(*,*) trim(thissubname),' ERROR: wrong data type, expect ',NF90_INT,' but read in ',xtype + stop 123 + endif + +! get dimension size + status = nf90_inquire_variable(ncid, VarId, ndims = nDims) + if(status /= nf90_NoErr) call this%handle_err(status) + this%ndims=nDims +! + status = nf90_inquire_variable(ncid, VarId, dimids = dimids(1:nDims)) + if(status /= nf90_NoErr) call this%handle_err(status) + do i=1,nDims + dimname=" " + status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim) + if (status /= nf90_noerr) call this%handle_err(status) + ends(i)=ndim + this%ends(i)=ends(i) + this%dimname(i)=trim(dimname) + if(this%ends(i) < 1) then + write(*,*) trim(thissubname),' Error, ends dimension should larger than 0 :', ends(i) + stop 1234 + endif + enddo + length2d=ends(1)*ends(2) + length3d=length2d*ends(3) + length4d=length3d*ends(4) + if(ilength .ne. length4d) then + write(*,*) trim(thissubname),'ERROR: ',ilength,' should equal to ',length4d + stop 123 + endif +! + if(nDims <=4 ) then + status = nf90_put_var(ncid, VarId, field, & + start = start(1:4) , & + count = ends(1:4)) + if(status /= nf90_NoErr) call this%handle_err(status) + else + write(*,*) trim(thissubname),'Error: too many dimensions:',nDims + stop 1234 + endif +! + if(this%debug_level>0) then + write(*,'(a,a)') '>>>replace variable: ',trim(varname) + endif + if(this%debug_level>10) then + write(*,'(8x,a,I10)') 'data type : ',this%xtype + write(*,'(8x,a,I10)') 'dimension size: ',this%nDims + do i=1,this%nDims + write(*,'(8x,a,I5,I10,2x,a)') 'rank, ends, name=',i,this%ends(i),trim(this%dimname(i)) + enddo + endif +! +end subroutine replace_var_nc_int +! +!==========================end of replace_var ========================== + +!==========================begin get_var ========================== +subroutine get_var_nc_double_1d(this,varname,nd1,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1 ! size of array dval + real(8), intent(out) :: field(nd1) ! values of the field read in + integer :: ilength +! + character*40,parameter :: thissubname='get_var_nc_double_1d' +! + integer :: i +! +! + ilength=nd1 + call this%get_var_nc_double(varname,ilength,field) +! + if(nd1==this%ends(1)) then + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) (field(i),i=1,min(nd1,10)) + endif + else + write(*,*) trim(thissubname),' ERROR: dimension does not match.' + endif +! +end subroutine get_var_nc_double_1d + +subroutine get_var_nc_double_2d(this,varname,nd1,nd2,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2 ! size of array dval + real(8), intent(out) :: field(nd1,nd2) ! values of the field read in + integer :: ilength +! + real(8),allocatable :: temp(:) +! + character*40,parameter :: thissubname='get_var_nc_double_2d' +! + integer :: i,j,k + integer :: istart,iend +! +! + ilength=nd1*nd2 + allocate(temp(ilength)) + + call this%get_var_nc_double(varname,ilength,temp) + + if(nd1==this%ends(1) .and. nd2==this%ends(2)) then + do j=1,nd2 + istart=(j-1)*nd1+1 + iend=(j-1)*nd1+nd1 + field(:,j)=temp(istart:iend) + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) 'max,min:',maxval(field(:,:)),minval(field(:,:)) + endif + else + write(*,*) trim(thissubname),' ERROR: dimension does not match.' + write(*,*) nd1,this%ends(1),nd2,this%ends(2) + endif + deallocate(temp) +! +end subroutine get_var_nc_double_2d + +subroutine get_var_nc_double_3d(this,varname,nd1,nd2,nd3,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2,nd3 ! size of array dval + real(8), intent(out) :: field(nd1,nd2,nd3) ! values of the field read in + integer :: ilength +! + real(8),allocatable :: temp(:) +! + character*40,parameter :: thissubname='get_var_nc_double_3d' +! + integer :: i,j,k + integer :: length2d + integer :: istart,iend +! +! + length2d=nd1*nd2 + ilength=length2d*nd3 + allocate(temp(ilength)) + + call this%get_var_nc_double(varname,ilength,temp) + + if(nd1==this%ends(1) .and. nd2==this%ends(2) .and. nd3==this%ends(3)) then + do k=1,nd3 + do j=1,nd2 + istart=(k-1)*length2d+(j-1)*nd1+1 + iend =(k-1)*length2d+(j-1)*nd1+nd1 + field(:,j,k)=temp(istart:iend) + enddo + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + do k=1,nd3 + write(*,*) 'k,max,min:',k,maxval(field(:,:,k)),minval(field(:,:,k)) + enddo + endif + else + write(*,*) trim(thissubname),' ERROR: dimension does not match.' + write(*,*) nd1,this%ends(1),nd2,this%ends(2),nd3,this%ends(3) + endif + deallocate(temp) +! +end subroutine get_var_nc_double_3d +! +subroutine get_var_nc_double(this,varname,ilength,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: ilength ! size of array dval + real(8), intent(out) :: field(ilength) ! values of the field read in +! + integer :: ncid +! + integer :: status + integer :: varid + integer :: ends(4),start(4) + + integer :: length4d,length3d,length2d + integer :: nDims,ndim + integer :: dimids(4) + integer :: xtype + character*40 :: dimname + + character*40,parameter :: thissubname='get_var_nc_double' +! + integer :: i,k +! +! + ncid=this%ncid + +! get variable IDs + status = nf90_inq_varid(ncid, trim(varname), VarId) + if(status /= nf90_NoErr) call this%handle_err(status) + +! get dimensions + ends=1 + start=1 + this%ends=1 + + this%dimname=" " +! get variable type + status = nf90_inquire_variable(ncid, VarId, xtype = xtype) + if(status /= nf90_NoErr) call this%handle_err(status) + if(xtype==NF90_DOUBLE) then + this%xtype=xtype + else + write(*,*) trim(thissubname),' ERROR: wrong data type, expect ',NF90_DOUBLE,' but read in ',xtype + stop 123 + endif + +! get dimension size + status = nf90_inquire_variable(ncid, VarId, ndims = nDims) + if(status /= nf90_NoErr) call this%handle_err(status) + this%ndims=nDims +! + status = nf90_inquire_variable(ncid, VarId, dimids = dimids(1:nDims)) + if(status /= nf90_NoErr) call this%handle_err(status) + do i=1,nDims + dimname=" " + status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim) + if (status /= nf90_noerr) call this%handle_err(status) + ends(i)=ndim + this%ends(i)=ends(i) + this%dimname(i)=trim(dimname) + if(this%ends(i) < 1) then + write(*,*) trim(thissubname),' Error, ends dimension should larger than 0 :', ends(i) + stop 1234 + endif + enddo + length2d=ends(1)*ends(2) + length3d=length2d*ends(3) + length4d=length3d*ends(4) + if(ilength .ne. length4d) then + write(*,*) trim(thissubname),'ERROR: ',ilength,' should equal to ',length4d + stop 123 + endif +! + if(nDims <=4 ) then + status = nf90_get_var(ncid, VarId, field, & + start = start(1:4) , & + count = ends(1:4)) + if(status /= nf90_NoErr) call this%handle_err(status) + else + write(*,*) trim(thissubname),'Error: too many dimensions:',nDims + stop 1234 + endif +! + if(this%debug_level>0) then + write(*,'(a,a)') '>>>read in variable: ',trim(varname) + endif + if(this%debug_level>10) then + write(*,'(a,I10)') ' data type : ',this%xtype + write(*,'(a,I10)')' dimension size: ',this%nDims + do i=1,this%nDims + write(*,'(a,I5,I10,2x,a)') ' rank, ends, name=',i,this%ends(i),trim(this%dimname(i)) + enddo + endif +! +end subroutine get_var_nc_double + +subroutine get_var_nc_real_1d(this,varname,nd1,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1 ! size of array dval + real(4), intent(out) :: field(nd1) ! values of the field read in + integer :: ilength +! + character*40,parameter :: thissubname='get_var_nc_real_1d' +! + integer :: i +! +! + ilength=nd1 + call this%get_var_nc_real(varname,ilength,field) +! + if(nd1==this%ends(1)) then + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) (field(i),i=1,min(nd1,10)) + endif + else + write(*,*) trim(thissubname),' ERROR: dimension does not match.' + endif +! +end subroutine get_var_nc_real_1d + +subroutine get_var_nc_real_2d(this,varname,nd1,nd2,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2 ! size of array dval + real(4), intent(out) :: field(nd1,nd2) ! values of the field read in + integer :: ilength +! + real(4),allocatable :: temp(:) +! + character*40,parameter :: thissubname='get_var_nc_real_2d' +! + integer :: i,j,k + integer :: istart,iend +! +! + ilength=nd1*nd2 + allocate(temp(ilength)) + + call this%get_var_nc_real(varname,ilength,temp) + + if(nd1==this%ends(1) .and. nd2==this%ends(2)) then + do j=1,nd2 + istart=(j-1)*nd1+1 + iend=(j-1)*nd1+nd1 + field(:,j)=temp(istart:iend) + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) 'max,min:',maxval(field(:,:)),minval(field(:,:)) + endif + else + write(*,*) trim(thissubname),' ERROR: dimension does not match.' + write(*,*) nd1,this%ends(1),nd2,this%ends(2) + endif + deallocate(temp) +! +end subroutine get_var_nc_real_2d + +subroutine get_var_nc_real_3d(this,varname,nd1,nd2,nd3,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2,nd3 ! size of array dval + real(4), intent(out) :: field(nd1,nd2,nd3) ! values of the field read in + integer :: ilength +! + real(4),allocatable :: temp(:) +! + character*40,parameter :: thissubname='get_var_nc_real_3d' +! + integer :: i,j,k + integer :: length2d + integer :: istart,iend +! +! + length2d=nd1*nd2 + ilength=length2d*nd3 + allocate(temp(ilength)) + + call this%get_var_nc_real(varname,ilength,temp) + + if(nd1==this%ends(1) .and. nd2==this%ends(2) .and. nd3==this%ends(3)) then + do k=1,nd3 + do j=1,nd2 + istart=(k-1)*length2d+(j-1)*nd1+1 + iend =(k-1)*length2d+(j-1)*nd1+nd1 + field(:,j,k)=temp(istart:iend) + enddo + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + do k=1,nd3 + write(*,*) 'k,max,min:',k,maxval(field(:,:,k)),minval(field(:,:,k)) + enddo + endif + else + write(*,*) trim(thissubname),' ERROR: dimension does not match.' + write(*,*) nd1,this%ends(1),nd2,this%ends(2),nd3,this%ends(3) + endif + deallocate(temp) +! +end subroutine get_var_nc_real_3d +! +subroutine get_var_nc_real(this,varname,ilength,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: ilength ! size of array dval + real(4), intent(out) :: field(ilength) ! values of the field read in +! + integer :: ncid +! + integer :: status + integer :: varid + integer :: ends(4),start(4) + + integer :: length4d,length3d,length2d + integer :: nDims,ndim + integer :: dimids(4) + integer :: xtype + character*40 :: dimname + + character*40,parameter :: thissubname='get_var_nc_real' +! + integer :: i,k +! +! + ncid=this%ncid + +! get variable IDs + status = nf90_inq_varid(ncid, trim(varname), VarId) + if(status /= nf90_NoErr) call this%handle_err(status) + +! get dimensions + ends=1 + start=1 + this%ends=1 + + this%dimname=" " +! get variable type + status = nf90_inquire_variable(ncid, VarId, xtype = xtype) + if(status /= nf90_NoErr) call this%handle_err(status) + if(xtype==NF90_FLOAT) then + this%xtype=xtype + else + write(*,*) trim(thissubname),' ERROR: wrong data type, expect ',NF90_FLOAT,' but read in ',xtype + stop 123 + endif + +! get dimension size + status = nf90_inquire_variable(ncid, VarId, ndims = nDims) + if(status /= nf90_NoErr) call this%handle_err(status) + this%ndims=nDims +! + status = nf90_inquire_variable(ncid, VarId, dimids = dimids(1:nDims)) + if(status /= nf90_NoErr) call this%handle_err(status) + do i=1,nDims + dimname=" " + status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim) + if (status /= nf90_noerr) call this%handle_err(status) + ends(i)=ndim + this%ends(i)=ends(i) + this%dimname(i)=trim(dimname) + if(this%ends(i) < 1) then + write(*,*) trim(thissubname),' Error, ends dimension should larger than 0 :', ends(i) + stop 1234 + endif + enddo + length2d=ends(1)*ends(2) + length3d=length2d*ends(3) + length4d=length3d*ends(4) + if(ilength .ne. length4d) then + write(*,*) trim(thissubname),'ERROR: ',ilength,' should equal to ',length4d + stop 123 + endif +! + if(nDims <=4 ) then + status = nf90_get_var(ncid, VarId, field, & + start = start(1:4) , & + count = ends(1:4)) + if(status /= nf90_NoErr) call this%handle_err(status) + else + write(*,*) trim(thissubname),'Error: too many dimensions:',nDims + stop 1234 + endif +! + if(this%debug_level>0) then + write(*,'(a,a)') '>>>read in variable: ',trim(varname) + endif + if(this%debug_level>10) then + write(*,'(8x,a,I10)') 'data type : ',this%xtype + write(*,'(8x,a,I10)') 'dimension size: ',this%nDims + do i=1,this%nDims + write(*,'(8x,a,I5,I10,2x,a)') 'rank, ends, name=',i,this%ends(i),trim(this%dimname(i)) + enddo + endif +! +end subroutine get_var_nc_real + +subroutine get_var_nc_int_1d(this,varname,nd1,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1 ! size of array dval + integer, intent(out) :: field(nd1) ! values of the field read in + integer :: ilength +! + character*40,parameter :: thissubname='get_var_nc_int_1d' +! + integer :: i +! +! + ilength=nd1 + call this%get_var_nc_int(varname,ilength,field) +! + if(nd1==this%ends(1)) then + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) (field(i),i=1,min(nd1,10)) + endif + else + write(*,*) trim(thissubname),' ERROR: dimension does not match.' + endif +! +end subroutine get_var_nc_int_1d + +subroutine get_var_nc_int_2d(this,varname,nd1,nd2,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2 ! size of array dval + integer, intent(out) :: field(nd1,nd2) ! values of the field read in + integer :: ilength +! + integer,allocatable :: temp(:) +! + character*40,parameter :: thissubname='get_var_nc_int_2d' +! + integer :: i,j,k + integer :: istart,iend +! +! + ilength=nd1*nd2 + allocate(temp(ilength)) + + call this%get_var_nc_int(varname,ilength,temp) + + if(nd1==this%ends(1) .and. nd2==this%ends(2)) then + do j=1,nd2 + istart=(j-1)*nd1+1 + iend=(j-1)*nd1+nd1 + field(:,j)=temp(istart:iend) + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) 'max,min:',maxval(field(:,:)),minval(field(:,:)) + endif + else + write(*,*) trim(thissubname),' ERROR: dimension does not match.' + write(*,*) nd1,this%ends(1),nd2,this%ends(2) + endif + deallocate(temp) +! +end subroutine get_var_nc_int_2d + +subroutine get_var_nc_int_3d(this,varname,nd1,nd2,nd3,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2,nd3 ! size of array dval + integer, intent(out) :: field(nd1,nd2,nd3) ! values of the field read in + integer :: ilength +! + integer,allocatable :: temp(:) +! + character*40,parameter :: thissubname='get_var_nc_int_3d' +! + integer :: i,j,k + integer :: length2d + integer :: istart,iend +! +! + length2d=nd1*nd2 + ilength=length2d*nd3 + allocate(temp(ilength)) + + call this%get_var_nc_int(varname,ilength,temp) + + if(nd1==this%ends(1) .and. nd2==this%ends(2) .and. nd3==this%ends(3)) then + do k=1,nd3 + do j=1,nd2 + istart=(k-1)*length2d+(j-1)*nd1+1 + iend =(k-1)*length2d+(j-1)*nd1+nd1 + field(:,j,k)=temp(istart:iend) + enddo + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + do k=1,nd3 + write(*,*) 'k,max,min:',k,maxval(field(:,:,k)),minval(field(:,:,k)) + enddo + endif + else + write(*,*) trim(thissubname),' ERROR: dimension does not match.' + write(*,*) nd1,this%ends(1),nd2,this%ends(2),nd3,this%ends(3) + endif + deallocate(temp) +! +end subroutine get_var_nc_int_3d +! +subroutine get_var_nc_int(this,varname,ilength,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: ilength ! size of array dval + integer, intent(out) :: field(ilength) ! values of the field read in +! + integer :: ncid +! + integer :: status + integer :: varid + integer :: ends(4),start(4) + + integer :: length4d,length3d,length2d + integer :: nDims,ndim + integer :: dimids(4) + integer :: xtype + character*40 :: dimname + + character*40,parameter :: thissubname='get_var_nc_int' +! + integer :: i,k +! +! + ncid=this%ncid + +! get variable IDs + status = nf90_inq_varid(ncid, trim(varname), VarId) + if(status /= nf90_NoErr) call this%handle_err(status) + +! get dimensions + ends=1 + start=1 + this%ends=1 + + this%dimname=" " +! get variable type + status = nf90_inquire_variable(ncid, VarId, xtype = xtype) + if(status /= nf90_NoErr) call this%handle_err(status) + if(xtype==NF90_INT) then + this%xtype=xtype + else + write(*,*) trim(thissubname),' ERROR: wrong data type, expect ',NF90_INT,' but read in ',xtype + stop 123 + endif + +! get dimension size + status = nf90_inquire_variable(ncid, VarId, ndims = nDims) + if(status /= nf90_NoErr) call this%handle_err(status) + this%ndims=nDims +! + status = nf90_inquire_variable(ncid, VarId, dimids = dimids(1:nDims)) + if(status /= nf90_NoErr) call this%handle_err(status) + do i=1,nDims + dimname=" " + status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim) + if (status /= nf90_noerr) call this%handle_err(status) + ends(i)=ndim + this%ends(i)=ends(i) + this%dimname(i)=trim(dimname) + if(this%ends(i) < 1) then + write(*,*) trim(thissubname),' Error, ends dimension should larger than 0 :', ends(i) + stop 1234 + endif + enddo + length2d=ends(1)*ends(2) + length3d=length2d*ends(3) + length4d=length3d*ends(4) + if(ilength .ne. length4d) then + write(*,*) trim(thissubname),'ERROR: ',ilength,' should equal to ',length4d + stop 123 + endif +! + if(nDims <=4 ) then + status = nf90_get_var(ncid, VarId, field, & + start = start(1:4) , & + count = ends(1:4)) + if(status /= nf90_NoErr) call this%handle_err(status) + else + write(*,*) trim(thissubname),'Error: too many dimensions:',nDims + stop 1234 + endif +! + if(this%debug_level>0) then + write(*,'(a,a)') '>>>read in variable: ',trim(varname) + endif + if(this%debug_level>10) then + write(*,'(8x,a,I10)') 'data type : ',this%xtype + write(*,'(8x,a,I10)') 'dimension size: ',this%nDims + do i=1,this%nDims + write(*,'(8x,a,I5,I10,2x,a)') 'rank, ends, name=',i,this%ends(i),trim(this%dimname(i)) + enddo + endif +! +end subroutine get_var_nc_int +! +subroutine get_var_nc_short_1d(this,varname,nd1,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1 ! size of array dval + integer(2), intent(out) :: field(nd1) ! values of the field read in + integer :: ilength +! + character*40,parameter :: thissubname='get_var_nc_short_1d' +! + integer :: i +! +! + ilength=nd1 + call this%get_var_nc_short(varname,ilength,field) +! + if(nd1==this%ends(1)) then + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) (field(i),i=1,min(nd1,10)) + endif + else + write(*,*) trim(thissubname),' ERROR: dimension does not match.' + endif +! +end subroutine get_var_nc_short_1d +! +subroutine get_var_nc_short_2d(this,varname,nd1,nd2,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2 ! size of array dval + integer(2), intent(out) :: field(nd1,nd2) ! values of the field read in + integer :: ilength +! + integer(2),allocatable :: temp(:) +! + character*40,parameter :: thissubname='get_var_nc_short_2d' +! + integer :: i,j,k + integer :: istart,iend +! +! + ilength=nd1*nd2 + allocate(temp(ilength)) + + call this%get_var_nc_short(varname,ilength,temp) + + if(nd1==this%ends(1) .and. nd2==this%ends(2)) then + do j=1,nd2 + istart=(j-1)*nd1+1 + iend=(j-1)*nd1+nd1 + field(:,j)=temp(istart:iend) + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) 'max,min:',maxval(field(:,:)),minval(field(:,:)) + endif + else + write(*,*) trim(thissubname),' ERROR: dimension does not match.' + write(*,*) nd1,this%ends(1),nd2,this%ends(2) + endif + deallocate(temp) +! +end subroutine get_var_nc_short_2d +! +subroutine get_var_nc_short(this,varname,ilength,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: ilength ! size of array dval + integer(2), intent(out) :: field(ilength) ! values of the field read in +! + integer :: ncid +! + integer :: status + integer :: varid + integer :: ends(4),start(4) + + integer :: length4d,length3d,length2d + integer :: nDims,ndim + integer :: dimids(4) + integer :: xtype + character*40 :: dimname + + character*40,parameter :: thissubname='get_var_nc_short' +! + integer :: i,k +! +! + ncid=this%ncid + +! get variable IDs + status = nf90_inq_varid(ncid, trim(varname), VarId) + if(status /= nf90_NoErr) call this%handle_err(status) + +! get dimensions + ends=1 + start=1 + this%ends=1 + + this%dimname=" " +! get variable type + status = nf90_inquire_variable(ncid, VarId, xtype = xtype) + if(status /= nf90_NoErr) call this%handle_err(status) + if(xtype==NF90_SHORT) then + this%xtype=xtype + else + write(*,*) trim(thissubname),' ERROR: wrong data type, expect ',NF90_SHORT,' but read in ',xtype + stop 123 + endif + +! get dimension size + status = nf90_inquire_variable(ncid, VarId, ndims = nDims) + if(status /= nf90_NoErr) call this%handle_err(status) + this%ndims=nDims +! + status = nf90_inquire_variable(ncid, VarId, dimids = dimids(1:nDims)) + if(status /= nf90_NoErr) call this%handle_err(status) + do i=1,nDims + dimname=" " + status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim) + if (status /= nf90_noerr) call this%handle_err(status) + ends(i)=ndim + this%ends(i)=ends(i) + this%dimname(i)=trim(dimname) + if(this%ends(i) < 1) then + write(*,*) trim(thissubname),' Error, ends dimension should larger than 0 :', ends(i) + stop 1234 + endif + enddo + length2d=ends(1)*ends(2) + length3d=length2d*ends(3) + length4d=length3d*ends(4) + if(ilength .ne. length4d) then + write(*,*) trim(thissubname),'ERROR: ',ilength,' should equal to ',length4d + stop 123 + endif +! + if(nDims <=4 ) then + status = nf90_get_var(ncid, VarId, field, & + start = start(1:4) , & + count = ends(1:4)) + if(status /= nf90_NoErr) call this%handle_err(status) + else + write(*,*) trim(thissubname),'Error: too many dimensions:',nDims + stop 1234 + endif +! + if(this%debug_level>0) then + write(*,'(a,a)') '>>>read in variable: ',trim(varname) + endif + if(this%debug_level>10) then + write(*,'(8x,a,I10)') 'data type : ',this%xtype + write(*,'(8x,a,I10)') 'dimension size: ',this%nDims + do i=1,this%nDims + write(*,'(8x,a,I5,I10,2x,a)') 'rank, ends, name=',i,this%ends(i),trim(this%dimname(i)) + enddo + endif +! +end subroutine get_var_nc_short + +subroutine get_var_nc_char_1d(this,varname,nd1,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1 ! size of array dval + character, intent(out) :: field(nd1) ! values of the field read in + integer :: ilength +! + character*40,parameter :: thissubname='get_var_nc_char_1d' +! + integer :: i +! +! + ilength=nd1 + call this%get_var_nc_char(varname,ilength,field) +! + if(nd1==this%ends(1)) then + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) (field(i),i=1,min(nd1,10)) + endif + else + write(*,*) trim(thissubname),' ERROR: dimension does not match.' + endif +! +end subroutine get_var_nc_char_1d + +subroutine get_var_nc_char_2d(this,varname,nd1,nd2,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2 ! size of array dval + character, intent(out) :: field(nd1,nd2) ! values of the field read in + integer :: ilength +! + character,allocatable :: temp(:) +! + character*40,parameter :: thissubname='get_var_nc_char_2d' +! + integer :: i,j,k + integer :: istart,iend +! +! + ilength=nd1*nd2 + allocate(temp(ilength)) + + call this%get_var_nc_char(varname,ilength,temp) + + if(nd1==this%ends(1) .and. nd2==this%ends(2)) then + do j=1,nd2 + istart=(j-1)*nd1+1 + iend=(j-1)*nd1+nd1 + field(:,j)=temp(istart:iend) + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) field(1,1) + endif + else + write(*,*) trim(thissubname),' ERROR: dimension does not match.' + write(*,*) nd1,this%ends(1),nd2,this%ends(2) + endif + deallocate(temp) +! +end subroutine get_var_nc_char_2d + +subroutine get_var_nc_char_3d(this,varname,nd1,nd2,nd3,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: nd1,nd2,nd3 ! size of array dval + character, intent(out) :: field(nd1,nd2,nd3) ! values of the field read in + integer :: ilength +! + character,allocatable :: temp(:) +! + character*40,parameter :: thissubname='get_var_nc_char_3d' +! + integer :: i,j,k + integer :: length2d + integer :: istart,iend +! +! + length2d=nd1*nd2 + ilength=length2d*nd3 + allocate(temp(ilength)) + + call this%get_var_nc_char(varname,ilength,temp) + + if(nd1==this%ends(1) .and. nd2==this%ends(2) .and. nd3==this%ends(3)) then + do k=1,nd3 + do j=1,nd2 + istart=(k-1)*length2d+(j-1)*nd1+1 + iend =(k-1)*length2d+(j-1)*nd1+nd1 + field(:,j,k)=temp(istart:iend) + enddo + enddo +! + if(this%debug_level>100) then + write(*,*) trim(thissubname),' show samples:' + write(*,*) field(1,1,1) + endif + else + write(*,*) trim(thissubname),' ERROR: dimension does not match.' + write(*,*) nd1,this%ends(1),nd2,this%ends(2),nd3,this%ends(3) + endif + deallocate(temp) +! +end subroutine get_var_nc_char_3d +! +subroutine get_var_nc_char(this,varname,ilength,field) +! +! read in one field +! + use netcdf +! + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname ! name of the field to read + integer, intent(in) :: ilength ! size of array dval + character, intent(out) :: field(ilength) ! values of the field read in +! + integer :: ncid +! + integer :: status + integer :: varid + integer :: ends(4),start(4) + + integer :: length4d,length3d,length2d + integer :: nDims,ndim + integer :: dimids(4) + integer :: xtype + character*40 :: dimname + + character*40,parameter :: thissubname='get_var_nc_char' +! + integer :: i,k +! +! + ncid=this%ncid + +! get variable IDs + status = nf90_inq_varid(ncid, trim(varname), VarId) + if(status /= nf90_NoErr) call this%handle_err(status) + +! get dimensions + ends=1 + start=1 + this%ends=1 + + this%dimname=" " +! get variable type + status = nf90_inquire_variable(ncid, VarId, xtype = xtype) + if(status /= nf90_NoErr) call this%handle_err(status) + if(xtype==NF90_CHAR) then + this%xtype=xtype + else + write(*,*) trim(thissubname),' ERROR: wrong data type, expect ',NF90_CHAR,' but read in ',xtype + stop 123 + endif + +! get dimension size + status = nf90_inquire_variable(ncid, VarId, ndims = nDims) + if(status /= nf90_NoErr) call this%handle_err(status) + this%ndims=nDims +! + status = nf90_inquire_variable(ncid, VarId, dimids = dimids(1:nDims)) + if(status /= nf90_NoErr) call this%handle_err(status) + do i=1,nDims + dimname=" " + status = nf90_inquire_dimension(ncid, dimids(i), dimname, len = ndim) + if (status /= nf90_noerr) call this%handle_err(status) + ends(i)=ndim + this%ends(i)=ends(i) + this%dimname(i)=trim(dimname) + if(this%ends(i) < 1) then + write(*,*) trim(thissubname),' Error, ends dimension should larger than 0 :', ends(i) + stop 1234 + endif + enddo + length2d=ends(1)*ends(2) + length3d=length2d*ends(3) + length4d=length3d*ends(4) + if(ilength .ne. length4d) then + write(*,*) trim(thissubname),'ERROR: ',ilength,' should equal to ',length4d + stop 123 + endif +! + if(nDims <=4 ) then + status = nf90_get_var(ncid, VarId, field, & + start = start(1:4) , & + count = ends(1:4)) + if(status /= nf90_NoErr) call this%handle_err(status) + else + write(*,*) trim(thissubname),'Error: too many dimensions:',nDims + stop 1234 + endif +! + if(this%debug_level>0) then + write(*,'(a,a)') '>>>read in variable: ',trim(varname) + endif + if(this%debug_level>10) then + write(*,'(8x,a,I10)') 'data type : ',this%xtype + write(*,'(8x,a,I10)') 'dimension size: ',this%nDims + do i=1,this%nDims + write(*,'(8x,a,I5,I10,2x,a)') 'rank, ends, name=',i,this%ends(i),trim(this%dimname(i)) + enddo + endif +! +end subroutine get_var_nc_char +!==========================end of get_var ========================== + +subroutine handle_err(this,status) + use netcdf + implicit none + class(ncio) :: this +! + integer, intent ( in) :: status + if(status /= nf90_noerr) then + print *, trim(nf90_strerror(status)) + stop "Stopped" + end if +end subroutine handle_err + +subroutine convert_theta2t_2dgrid(this,nx,ny,ps,t2) +! convertt theta T to T + implicit none + class(ncio) :: this + + integer :: nx,ny + real, intent(in ) :: ps(nx,ny) + real, intent(inout) :: t2(nx,ny) + + integer :: i,j + real(8) :: rd,cp,rd_over_cp + + + rd = 2.8705e+2_8 + cp = 1.0046e+3_8 ! specific heat of air @pressure (J/kg/K) + rd_over_cp = rd/cp + + do j=1,ny + do i=1,nx + t2(i,j)=t2(i,j)*(ps(i,j)/1000.0)**rd_over_cp - 273.15 + enddo + enddo + +end subroutine convert_theta2t_2dgrid + +subroutine add_new_var_3d(this,varname,dname1,dname2,dname3,lname,units) +! +! prgmmr: David.M.Wright org: UM/GLERL date: 2020-09-01 +! +! abstract: Add a new variable to sfc_data.nc with dimensions +! (Time, yaxis_1, xaxis_1) +! +! Input: varname = Name of variable to be created in netcdf file +! dname1,dname2,dname3 = 1st,2nd, and 3rd dimension names +! lname = long name output for netcdf variable +! units = units to use in netcdf variable +! + use netcdf + implicit none +! + class(ncio) :: this + character(len=*),intent(in) :: varname,dname1,dname2,dname3 & + ,lname,units + integer :: status, ncid, dim1id, dim2id, dim3id, varid + + status = nf90_inq_dimid(this%ncid, dname1, dim1id) + if (status /= nf90_noerr) call this%handle_err(status) + status = nf90_inq_dimid(this%ncid, dname2, dim2id) + if (status /= nf90_noerr) call this%handle_err(status) + status = nf90_inq_dimid(this%ncid, dname3, dim3id) + if (status /= nf90_noerr) call this%handle_err(status) + + status = nf90_def_var(this%ncid, varname, nf90_double, & + (/ dim1id, dim2id, dim3id /), varid) + if (status /= nf90_noerr) call this%handle_err(status) + + status = nf90_put_att(this%ncid, varid, 'long_name', lname) + if (status /= nf90_noerr) call this%handle_err(status) + status = nf90_put_att(this%ncid, varid, 'units', units) + if (status /= nf90_noerr) call this%handle_err(status) + +end subroutine add_new_var_3d + +end module module_ncio diff --git a/sorc/fvcom_tools.fd/module_nwp.f90 b/sorc/fvcom_tools.fd/module_nwp.f90 new file mode 100644 index 000000000..40965cdcf --- /dev/null +++ b/sorc/fvcom_tools.fd/module_nwp.f90 @@ -0,0 +1,280 @@ +! module_nwp.f90 +! David Wright +! University of Michigan and GLERL +! 17 Aug 2020 +! +! This module defines FV3LAM and FVCOM forecast data structure and the method to +! read and write observations from and to those data structures. It is used by +! ingest_FVCOM.f90. +! +! This script is strongly based upon Eric James' (ESRL/GSL) work with HRRR/WRF +! to get FVCOM data into the model. + +module module_nwp + + use kinds, only: r_kind, r_single, i_short, rmissing + use module_nwp_base, only: nwpbase +! use module_map_utils, only: map_util + use module_ncio, only: ncio + + implicit none + + public :: fcst_nwp + public :: nwp_type + + private + type :: nwp_type + character(len=6) :: datatype + integer :: numvar, xlat, xlon, xtime + integer :: i_mask, i_sst, i_ice, i_sfcT, i_iceT + character(len=20), allocatable :: varnames(:) + character(len=20), allocatable :: latname + character(len=20), allocatable :: lonname + character(len=20), allocatable :: dimnameEW + character(len=20), allocatable :: dimnameNS + character(len=20), allocatable :: dimnameTIME + + real(r_kind), allocatable :: nwp_mask(:,:,:) + real(r_kind), allocatable :: nwp_sst(:,:,:) + real(r_kind), allocatable :: nwp_ice(:,:,:) + real(r_kind), allocatable :: nwp_sfcT(:,:,:) + real(r_kind), allocatable :: nwp_iceT(:,:,:) + end type nwp_type + + type, extends(nwp_type) :: fcst_nwp + type(nwpbase), pointer :: head => NULL() + type(nwpbase), pointer :: tail => NULL() + contains + procedure :: initial => initial_nwp + procedure :: list_initial => list_initial_nwp + procedure :: read_n => read_nwp + procedure :: finish => finish_nwp + end type fcst_nwp + + type(ncio) :: ncdata +! type(map_util) :: map + + contains + + subroutine initial_nwp(this,itype) + +! This subroutine defines the number of variables and their names for +! each NWP data type. The indices of the variables are +! also defined for later reference. + + class(fcst_nwp) :: this + + character(len=6), intent(in) :: itype + +! FVCOM grid + if (itype==' FVCOM') then + this%datatype = itype + this%numvar = 4 + + this%i_mask = 1 + this%i_sst = 2 + this%i_ice = 3 + this%i_iceT = 4 + this%i_sfcT = 0 + + allocate(this%varnames(this%numvar)) + this%varnames(1) = 'glmask' + this%varnames(2) = 'tsfc' + this%varnames(3) = 'aice' + this%varnames(4) = 'tisfc' + + allocate(this%latname) + allocate(this%lonname) + this%latname = 'lat' + this%lonname = 'lon' + + allocate(this%dimnameEW) + allocate(this%dimnameNS) + allocate(this%dimnameTIME) + this%dimnameEW = 'lon' + this%dimnameNS = 'lat' + this%dimnameTIME = 'Time' + +! FV3LAM grid + + else if (trim(itype)=='FV3LAM') then + this%datatype = itype + this%numvar = 4 + + this%i_mask = 1 + this%i_sst = 2 + this%i_ice = 3 + this%i_iceT = 4 + this%i_sfcT = 0 + + allocate(this%varnames(this%numvar)) + this%varnames(1) = 'slmsk' + this%varnames(2) = 'tsea' + this%varnames(3) = 'fice' + this%varnames(4) = 'tisfc' + + allocate(this%latname) + allocate(this%lonname) + this%latname = 'yaxis_1' + this%lonname = 'xaxis_1' + + allocate(this%dimnameEW) + allocate(this%dimnameNS) + allocate(this%dimnameTIME) + this%dimnameEW = 'xaxis_1' + this%dimnameNS = 'yaxis_1' + this%dimnameTIME = 'Time' + +! If the data type does not match one of the known types, exit. + + else + write(*,*) 'Unknown data type:', itype + stop 1234 + end if + + this%head => NULL() + this%tail => NULL() + + write(*,*) 'Finished initial_nwp' + write(*,*) ' ' + + end subroutine initial_nwp + + subroutine list_initial_nwp(this) + +! This subroutine lists the setup for NWP data that was done by +! the initial_nwp subroutine. + + class(fcst_nwp) :: this + + integer :: k + + write(*,*) 'List initial setup for ', this%datatype + write(*,*) 'number of variables ', this%numvar + write(*,*) 'variable index: mask, sst, ice, sfcT' + write(*,'(15x,10I3)') this%i_mask, this%i_sst, this%i_ice, & + & this%i_sfcT + write(*,*) 'variable name:' + do k=1,this%numvar + write(*,*) k,trim(this%varnames(k)) + enddo + + write(*,*) 'Finished list_initial_nwp' + write(*,*) ' ' + + end subroutine list_initial_nwp + + subroutine read_nwp(this,filename,itype,numlon,numlat,numtimes,time_to_get,mask,sst,ice,sfcT,iceT) + +! This subroutine initializes arrays to receive the NWP data, +! and opens the file and gets the data. + + class(fcst_nwp) :: this + + character(len=5), intent(in) :: itype + character(len=*), intent(in) :: filename + + integer, intent(in) :: time_to_get + integer, intent(inout) :: numlon, numlat, numtimes +! real(r_single), intent(inout) :: mask(:,:), sst(:,:), ice(:,:), sfcT(:,:) + real(r_kind), intent(inout) :: mask(:,:),sst(:,:),ice(:,:),sfcT(:,:) & + ,iceT(:,:) + +! Open the file using module_ncio.f90 code, and find the number of +! lat/lon points + + call ncdata%open(trim(filename),'r',200) + call ncdata%get_dim(this%dimnameEW,this%xlon) + call ncdata%get_dim(this%dimnameNS,this%xlat) + call ncdata%get_dim(this%dimnameTIME,this%xtime) + + write(*,*) 'number of longitudes for file ', filename, this%xlon + numlon = this%xlon + write(*,*) 'number of latitudes for file ', filename, this%xlat + numlat = this%xlat + write(*,*) 'number of times for file ', filename, this%xtime + numtimes = this%xtime + +! Allocate all the arrays to receive data + + allocate(this%nwp_mask(this%xlon,this%xlat,this%xtime)) + allocate(this%nwp_sst(this%xlon,this%xlat,this%xtime)) + allocate(this%nwp_ice(this%xlon,this%xlat,this%xtime)) + allocate(this%nwp_sfcT(this%xlon,this%xlat,this%xtime)) + allocate(this%nwp_iceT(this%xlon,this%xlat,this%xtime)) + +! Get variables from the data file, but only if the variable is +! defined for that data type. + + if (this%i_mask .gt. 0) then + call ncdata%get_var(this%varnames(this%i_mask),this%xlon, & + this%xlat,this%xtime,this%nwp_mask) + mask = this%nwp_mask(:,:,1) + end if + if (this%i_sst .gt. 0) then + call ncdata%get_var(this%varnames(this%i_sst),this%xlon, & + this%xlat,this%xtime,this%nwp_sst) + sst = this%nwp_sst(:,:,time_to_get) + end if + if (this%i_ice .gt. 0) then + call ncdata%get_var(this%varnames(this%i_ice),this%xlon, & + this%xlat,this%xtime,this%nwp_ice) + ice = this%nwp_ice(:,:,time_to_get) + end if + if (this%i_sfcT .gt. 0) then + call ncdata%get_var(this%varnames(this%i_sfcT),this%xlon, & + this%xlat,this%xtime,this%nwp_sfcT) + sfcT = this%nwp_sfcT(:,:,time_to_get) + end if + if (this%i_iceT .gt. 0) then + call ncdata%get_var(this%varnames(this%i_iceT),this%xlon, & + this%xlat,this%xtime,this%nwp_iceT) + iceT = this%nwp_iceT(:,:,time_to_get) + end if + +! Close the netCDF file. + + call ncdata%close + + write(*,*) 'Finished read_nwp' + write(*,*) ' ' + + end subroutine read_nwp + + subroutine finish_nwp(this) + + class(fcst_nwp) :: this + + type(nwpbase), pointer :: thisobs,thisobsnext + + deallocate(this%varnames) + deallocate(this%latname) + deallocate(this%lonname) + deallocate(this%dimnameEW) + deallocate(this%dimnameNS) + deallocate(this%dimnameTIME) + deallocate(this%nwp_mask) + deallocate(this%nwp_sst) + deallocate(this%nwp_ice) + deallocate(this%nwp_sfcT) + deallocate(this%nwp_iceT) + + thisobs => this%head + if(.NOT.associated(thisobs)) then + write(*,*) 'No memory to release' + return + endif + do while(associated(thisobs)) +! write(*,*) 'destroy ==',thisobs%name + + thisobsnext => thisobs%next + call thisobs%destroy() + thisobs => thisobsnext + enddo + + write(*,*) 'Finished finish_nwp' + write(*,*) ' ' + + end subroutine finish_nwp + +end module module_nwp diff --git a/sorc/fvcom_tools.fd/module_nwp_base.f90 b/sorc/fvcom_tools.fd/module_nwp_base.f90 new file mode 100644 index 000000000..d32e841e4 --- /dev/null +++ b/sorc/fvcom_tools.fd/module_nwp_base.f90 @@ -0,0 +1,126 @@ +! module_nwp_base.f90 +! David Wright +! University of Michigan and GLERL +! 17 Aug 2020 +! +! This module defines nwp observation data structure and the method to +! read and write observations from and to those data structures. It is used by +! ingest_FVCOM.f90. +! +! This script is strongly based upon Eric James' (ESRL/GSL) work with HRRR/WRF. +! + +module module_nwp_base + + use kinds, only: r_kind, r_single, rmissing + + implicit none + + public :: nwpbase + public :: nwplocation + + private + +! Define a nwp observation type. + + type nwplocation + real(r_single) :: lon ! stroke longitude + real(r_single) :: lat ! stroke latitiude + end type nwplocation + +! Define a nwp observation type to contain actual data. + + type, extends(nwplocation) :: nwpbase +! HOW DOES THIS POINTER THING WORK? + type(nwpbase), pointer :: next => NULL() + real(r_single) :: time ! observation time + integer :: numvar ! number of variables in this obs type +! real(r_single), allocatable :: obs(:) ! observation value (# numvar) + real(r_kind), allocatable :: obs(:) + logical :: ifquality ! do these obs include quality info? +! GLM has flash_quality_flag + integer, allocatable :: quality(:) ! if so, quality flags + contains + procedure :: list => list_obsbase + procedure :: alloc => alloc_obsbase + procedure :: destroy => destroy_obsbase + end type nwpbase + + contains + + subroutine list_obsbase(this) + +! This subroutine lists the contents of a base nwp observation + + class(nwpbase) :: this + + integer :: i, numvar + +! Write out the lon, lat, and time of the ob + + write(*,'(a,3f10.3)') 'LIGHTNING OB: longitude, latitude, time =', & + this%lon, this%lat, this%time + +! Loop through all variables and print out obs and quality + + numvar = this%numvar + if (numvar >= 1) then +! MULTI-DIMENSIONAL EXAMPLE IN module_obs_base.f90 + write(*,'(a4,10F12.2)') 'obs=', (this%obs(i),i=1,numvar) + if(this%ifquality) & + write(*,'(a4,10I12)') 'qul=', (this%quality(i),i=1,numvar) + else + write(*,*) 'No obs for this location' + endif + + end subroutine list_obsbase + + subroutine alloc_obsbase(this,numvar,ifquality) + +! This subroutine allocates memory for base nwp observation variables +! Input variables: +! numvar : number of variables in this ob type +! itquality: does this observation include quality information? + + class(nwpbase) :: this + + integer, intent(in) :: numvar + + logical, intent(in), optional :: ifquality + + if (numvar >= 1) then + this%numvar = numvar + + if(allocated(this%obs)) deallocate(this%obs) + allocate(this%obs(numvar)) + + this%ifquality=.false. + if(present(ifquality)) this%ifquality = ifquality + if(this%ifquality) allocate(this%quality(numvar)) + + else + write(*,*) 'alloc_obsbase Error: dimension must be larger than 0:', numvar + stop 1234 + endif + + end subroutine alloc_obsbase + + subroutine destroy_obsbase(this) + +! This subroutine releases memory associated with nwp observations + + class(nwpbase) :: this + + this%numvar = 0 + this%time = 0 + + if(allocated(this%obs)) deallocate(this%obs) + + this%ifquality=.false. + if(allocated(this%quality)) deallocate(this%quality) + + this%next => NULL() + + end subroutine destroy_obsbase + +end module module_nwp_base diff --git a/sorc/fvcom_tools.fd/process_FVCOM.f90 b/sorc/fvcom_tools.fd/process_FVCOM.f90 new file mode 100755 index 000000000..da3be6f9b --- /dev/null +++ b/sorc/fvcom_tools.fd/process_FVCOM.f90 @@ -0,0 +1,217 @@ +! process_FVCOM.f90 +! David Wright +! University of Michigan and GLERL +! 17 Aug 2020 +! +! This is the code to put lake surface temperature and aerial ice +! concentration from GLERL-provided FVCOM forecast files (which have +! already been mapped to the FV3-LAM grid) into sfc_data.nc. +! +! This script will take two variables from the command line: +! 1. Name of FV3 sfc data file (e.g. sfc_data.tile7.halo0.nc) +! 2. Name of FVCOM data file (e.g. fvcom.nc) +! +! To run the script, use the following example, modifying file +! names as needed: +! ./fvcom_to_FV3 sfc_data.tile7.halo0.nc fvcom.nc +! +! Code is strongly based upon Eric James' (ESRL/GSL) work +! to update HRRR/WRF Great Lakes' temperature data with FVCOM. +! Code also relies heavily on Ming Hu's ncio module. + +program process_FVCOM + + use mpi + use kinds, only: r_kind, i_kind, r_single + use module_ncio, only: ncio + use module_nwp, only: fcst_nwp + + implicit none + +! MPI variables + integer :: npe, mype, mypeLocal,ierror +! + +! New object-oriented declarations + + type(ncio) :: geo + type(fcst_nwp) :: fcst + +! Grid variables + + character*180 :: geofile + character*2 :: workPath + character*1 :: char1 + + integer :: MAP_PROJ, NLON, NLAT + integer :: fv3lon, fv3lat, fv3times + integer :: lbclon, lbclat, lbctimes + integer :: i, j, t1, t2 + integer :: num_args, ix + + real :: rad2deg = 180.0/3.1415926 + real :: userDX, userDY, CEN_LAT, CEN_LON + real :: userTRUELAT1, userTRUELAT2, MOAD_CEN_LAT, STAND_LON + real :: truelat1, truelat2, stdlon, lat1, lon1, r_earth + real :: knowni, knownj, dx + real :: one, pi, deg2rad + + character(len=180) :: fv3file + character(len=180) :: fvcomfile + character(len=180), dimension(:), allocatable :: args + + real(r_kind), allocatable :: fv3ice(:,:), fv3sst(:,:) + real(r_kind), allocatable :: fv3sfcT(:,:), fv3mask(:,:) + real(r_kind), allocatable :: fv3iceT(:,:) + real(r_kind), allocatable :: lbcice(:,:), lbcsst(:,:) + real(r_kind), allocatable :: lbcsfcT(:,:), lbcmask(:,:) + real(r_kind), allocatable :: lbciceT(:,:) + +! Declare namelists +! SETUP (general control namelist) : + + integer :: update_type + +! namelist/setup/update_type, t2 + +! MPI setup + call MPI_INIT(ierror) + call MPI_COMM_SIZE(mpi_comm_world,npe,ierror) + call MPI_COMM_RANK(mpi_comm_world,mype,ierror) +! +! NCEP LSF has to use all cores allocated to run this application +! but this if check can make sure only one core run through the real code. +! +if(mype==0) then + +! Get file names from command line arguements + num_args = command_argument_count() + allocate(args(num_args)) + + do ix = 1, num_args + call get_command_argument(ix,args(ix)) + end do + + fv3file=trim(args(1)) + write(*,*) trim(fv3file) + fvcomfile=trim(args(2)) + write(*,*) trim(fvcomfile) + + t2 = 1 +! Obtain grid parameters + + workPath='./' + write(geofile,'(a,a)') trim(workPath), trim(fv3file) + write(*,*) 'sfc data file', trim(geofile) + call geo%open(trim(geofile),'r',200) + call geo%get_dim("xaxis_1",NLON) + call geo%get_dim("yaxis_1",NLAT) + write(*,*) 'NLON,NLAT:', NLON, NLAT + call geo%close + + write(*,*) 'Finished reading sfc_data grid information.' + write(*,*) ' ' + +! Allocate variables for I/O + + allocate(fv3ice(nlon,nlat)) + allocate(fv3sfcT(nlon,nlat)) + allocate(fv3sst(nlon,nlat)) + allocate(fv3mask(nlon,nlat)) + allocate(fv3iceT(nlon,nlat)) + + allocate(lbcice(nlon,nlat)) + allocate(lbcsfcT(nlon,nlat)) + allocate(lbcsst(nlon,nlat)) + allocate(lbcmask(nlon,nlat)) + allocate(lbciceT(nlon,nlat)) + +! Read fv3 sfc_data.nc before update + +! fv3file='sfc_data.nc' + t1=1 + + call fcst%initial('FV3LAM') + call fcst%list_initial + call fcst%read_n(trim(fv3file),'FV3LAM',fv3lon,fv3lat,fv3times,t1,fv3mask,fv3sst,fv3ice,fv3sfcT,fv3iceT) + call fcst%finish + + + write(*,*) 'fv3times: ', fv3times + write(*,*) 'time to use: ', t1 + +! Read FVCOM input datasets + +! fvcomfile='fvcom.nc' +! Space infront of ' FVCOM' below is important!! + call fcst%initial(' FVCOM') + call fcst%list_initial + call fcst%read_n(trim(fvcomfile),' FVCOM',lbclon,lbclat,lbctimes,t2,lbcmask,lbcsst,lbcice,lbcsfcT,lbciceT) + call fcst%finish + +! Check that the dimensions match + + if (lbclon .ne. nlon .or. lbclat .ne. nlat) then + write(*,*) 'ERROR: FVCOM/FV3 dimensions do not match:' + write(*,*) 'lbclon: ', lbclon + write(*,*) 'nlon: ', nlon + write(*,*) 'lbclat: ', lbclat + write(*,*) 'nlat: ', nlat + stop 135 + endif + + write(*,*) 'lbctimes: ', lbctimes + write(*,*) 'time to use: ', t2 + +! Update with FVCOM fields and process +! ice cover data. Ice fraction is set +! to a minimum of 15% due to FV3-LAM +! raising any value below 15% to 15%. + + do j=1,nlat + do i=1,nlon + if (lbcmask(i,j) > 0. .and. lbcsst(i,j) .ge. -90.0) then + !If ice fraction below 15%, set to 0 + if (lbcice(i,j) < 0.15) then + lbcice(i,j) = 0.0 + endif + fv3ice(i,j) = lbcice(i,j) + !If ice in FVCOM, but not in FV3-LAM, change to ice + if (lbcice(i,j) > 0. .and. fv3mask(i,j) == 0.) then + fv3mask(i,j) = 2. + endif + !If ice in FV3-LAM and not FVCOM, remove it from FV3-LAM + if (fv3mask(i,j) == 2. .and. lbcice(i,j) == 0.) then + fv3mask(i,j) = 0. + endif + fv3sst(i,j) = lbcsst(i,j) + 273.15 + fv3sfcT(i,j) = lbcsst(i,j) + 273.15 + fv3iceT(i,j) = lbcsst(i,j) + 273.15 + !If ice exists in FVCOM, change ice surface temp + if (lbcice(i,j) > 0.) then + fv3iceT(i,j) = lbciceT(i,j) + 273.15 + end if + endif + enddo + enddo + +! Write out sfc file again + + call geo%open(trim(fv3file),'w',300) + call geo%replace_var("tsea",NLON,NLAT,fv3sst) + call geo%replace_var("fice",NLON,NLAT,fv3ice) + call geo%replace_var("slmsk",NLON,NLAT,fv3mask) + call geo%replace_var("tisfc",NLON,NLAT,fv3iceT) +! Add_New_Var takes names of (Variable,Dim1,Dim2,Dim3,Long_Name,Units) + call geo%add_new_var('glmsk','xaxis_1','yaxis_1','Time','glmsk','none') + call geo%replace_var('glmsk',NLON,NLAT,lbcmask) + call geo%close + + write(6,*) "=== LOWBC UPDATE SUCCESS ===" + +endif ! mype==0 + +call MPI_FINALIZE(ierror) + + +end program process_FVCOM diff --git a/sorc/fvcom_tools.fd/readme.md b/sorc/fvcom_tools.fd/readme.md new file mode 100644 index 000000000..252c7ddf0 --- /dev/null +++ b/sorc/fvcom_tools.fd/readme.md @@ -0,0 +1,39 @@ +**fvcom_to_FV3.exe** + +**Introduction:** + This code replaces lake surface and lake ice temperature along + with aerial ice concentration generated from Great Lakes + Operational Forecast System (GLOFS), an FVCOM-based model, into + sfc_data.nc. + **NOTE** that the variables in the input files must reside on + the same grid. This means data from FVCOM must be horizontally + interpolated to the FV3 grid. This routine will also force a + minimum ice concentration of 15%. If ice concentration is less + than 15% in FVCOM, it will be set to 0% to avoid FV3 from + changing values less than 15% to 15% and generating unrealistic + lake ice temperatures. + +**Library Dependencies:** + Installation depends on the netCDF library and cmake. + +**Running:** + This routine will take two variables from the command line: + 1. Name of FV3 sfc data file (e.g. sfc_data.tile7.halo0.nc) + which is generated from chgres_cube.exe. + 2. Name of FVCOM data file in netcdf format (e.g. fvcom.nc) + + To run the script, use the following example, modifying file + names as needed: + ./fvcom_to_FV3 sfc_data.tile7.halo0.nc fvcom.nc + Output will be to the sfc data file and include lake surface + and lake ice temperature, and lake ice concentration from FVCOM. + + +This routine is *strongly* based upon Eric James' (ESRL/GSL) work + to update HRRR/WRF Great Lakes' temperature data with FVCOM. + It also relies heavily on Ming Hu's (ESRL/GSL) ncio module. + +**For more information, please contact:** + David Wright + University of Michigan and GLERL + dmwright@umich.edu From 745fdbdee648ef8426bd069638db374f0affb1f9 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Thu, 1 Oct 2020 09:03:52 -0400 Subject: [PATCH 037/192] CHGRES_CUBE GRIB2 Bug Fix Update chgres_cube to create the wgrib2 inventory file on one mpi task, instead of all tasks. When using all tasks, random failures can occur if one task is still writing the file while another is trying to read it. All programs: replace instances of 'include mpif.h' with 'use mpi'. For details, see #157. --- sorc/chgres_cube.fd/atmosphere.F90 | 8 +++---- sorc/chgres_cube.fd/chgres.F90 | 3 +-- sorc/chgres_cube.fd/input_data.F90 | 8 +++---- sorc/chgres_cube.fd/model_grid.F90 | 15 +++++++++---- sorc/chgres_cube.fd/search_util.f90 | 3 +-- sorc/chgres_cube.fd/surface.F90 | 3 +-- sorc/chgres_cube.fd/utils.f90 | 7 +++--- sorc/global_cycle.fd/cycle.f90 | 8 +++---- sorc/global_cycle.fd/read_write_data.f90 | 27 ++++++++++++------------ sorc/sfc_climo_gen.fd/interp.F90 | 6 ++---- sorc/sfc_climo_gen.fd/model_grid.F90 | 3 +-- sorc/sfc_climo_gen.fd/output.f90 | 3 +-- sorc/sfc_climo_gen.fd/program_setup.f90 | 4 ++-- sorc/sfc_climo_gen.fd/search.f90 | 3 +-- sorc/sfc_climo_gen.fd/source_grid.F90 | 3 +-- sorc/sfc_climo_gen.fd/utils.f90 | 7 +++--- 16 files changed, 53 insertions(+), 58 deletions(-) diff --git a/sorc/chgres_cube.fd/atmosphere.F90 b/sorc/chgres_cube.fd/atmosphere.F90 index 03e7e6869..a76ea36b7 100644 --- a/sorc/chgres_cube.fd/atmosphere.F90 +++ b/sorc/chgres_cube.fd/atmosphere.F90 @@ -144,9 +144,9 @@ module atmosphere subroutine atmosphere_driver(localpet) - implicit none + use mpi - include 'mpif.h' + implicit none integer, intent(in) :: localpet @@ -1407,9 +1407,9 @@ SUBROUTINE VINTG ! LANGUAGE: FORTRAN ! ! - IMPLICIT NONE + use mpi - include 'mpif.h' + IMPLICIT NONE REAL(ESMF_KIND_R8), PARAMETER :: DLTDZ=-6.5E-3*287.05/9.80665 REAL(ESMF_KIND_R8), PARAMETER :: DLPVDRT=-2.5E6/461.50 diff --git a/sorc/chgres_cube.fd/chgres.F90 b/sorc/chgres_cube.fd/chgres.F90 index 0d3fcecbd..20d6b94cc 100644 --- a/sorc/chgres_cube.fd/chgres.F90 +++ b/sorc/chgres_cube.fd/chgres.F90 @@ -9,6 +9,7 @@ program chgres ! !------------------------------------------------------------------------- + use mpi use esmf use atmosphere, only : atmosphere_driver @@ -34,8 +35,6 @@ program chgres ! Initialize mpi and esmf environment. !------------------------------------------------------------------------- - include 'mpif.h' - call mpi_init(ierr) print*,"- INITIALIZE ESMF" diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index 6f324d1c3..f5847fe6d 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -1728,9 +1728,9 @@ end subroutine read_input_atm_restart_file subroutine read_input_atm_gaussian_netcdf_file(localpet) - implicit none + use mpi - include 'mpif.h' + implicit none integer, intent(in) :: localpet @@ -2111,9 +2111,9 @@ end subroutine read_input_atm_gaussian_netcdf_file subroutine read_input_atm_tiled_history_file(localpet) - implicit none + use mpi - include 'mpif.h' + implicit none integer, intent(in) :: localpet diff --git a/sorc/chgres_cube.fd/model_grid.F90 b/sorc/chgres_cube.fd/model_grid.F90 index 9beb96c3b..84e84a7a3 100644 --- a/sorc/chgres_cube.fd/model_grid.F90 +++ b/sorc/chgres_cube.fd/model_grid.F90 @@ -602,6 +602,8 @@ end subroutine define_input_grid_mosaic subroutine define_input_grid_gfs_grib2(localpet, npets) + use mpi + use wgrib2api use program_setup, only : data_dir_input_grid, & @@ -613,7 +615,7 @@ subroutine define_input_grid_gfs_grib2(localpet, npets) character(len=250) :: the_file - integer :: i, j, rc, clb(2), cub(2) + integer :: i, j, rc, clb(2), cub(2), ierr real(esmf_kind_r8), allocatable :: latitude(:,:) real(esmf_kind_r8), allocatable :: longitude(:,:) @@ -631,10 +633,15 @@ subroutine define_input_grid_gfs_grib2(localpet, npets) num_tiles_input_grid = 1 the_file = trim(data_dir_input_grid) // "/" // grib2_file_input_grid - print*,'- OPEN AND INVENTORY GRIB2 FILE: ',trim(the_file) - rc=grb2_mk_inv(the_file,inv_file) - if (rc /=0) call error_handler("OPENING GRIB2 FILE",rc) + if(localpet == 0) then + print*,'- OPEN AND INVENTORY GRIB2 FILE: ',trim(the_file) + rc=grb2_mk_inv(the_file,inv_file) + if (rc /=0) call error_handler("OPENING GRIB2 FILE",rc) + endif +! Wait for localpet 0 to create inventory. + call mpi_barrier(mpi_comm_world, ierr) + rc = grb2_inq(the_file,inv_file,':PRES:',':surface:',nx=i_input, ny=j_input, & lat=lat4, lon=lon4) if (rc /= 1) call error_handler("READING GRIB2 FILE", rc) diff --git a/sorc/chgres_cube.fd/search_util.f90 b/sorc/chgres_cube.fd/search_util.f90 index 0810b0b9b..58bb3cf37 100644 --- a/sorc/chgres_cube.fd/search_util.f90 +++ b/sorc/chgres_cube.fd/search_util.f90 @@ -34,12 +34,11 @@ subroutine search (field, mask, idim, jdim, tile, field_num, latitude) ! future upgrade. !----------------------------------------------------------------------- + use mpi use esmf implicit none - include 'mpif.h' - integer, intent(in) :: idim, jdim, tile, field_num integer(esmf_kind_i8), intent(in) :: mask(idim,jdim) diff --git a/sorc/chgres_cube.fd/surface.F90 b/sorc/chgres_cube.fd/surface.F90 index 6baa2f9bf..ce1b64198 100644 --- a/sorc/chgres_cube.fd/surface.F90 +++ b/sorc/chgres_cube.fd/surface.F90 @@ -242,6 +242,7 @@ end subroutine surface_driver subroutine interp(localpet) + use mpi use esmf use input_data, only : canopy_mc_input_grid, & @@ -301,8 +302,6 @@ subroutine interp(localpet) implicit none - include 'mpif.h' - integer, intent(in) :: localpet integer :: l(1), u(1) diff --git a/sorc/chgres_cube.fd/utils.f90 b/sorc/chgres_cube.fd/utils.f90 index 3a547eede..337083fd3 100644 --- a/sorc/chgres_cube.fd/utils.f90 +++ b/sorc/chgres_cube.fd/utils.f90 @@ -1,8 +1,8 @@ subroutine error_handler(string, rc) - implicit none + use mpi - include 'mpif.h' + implicit none character(len=*), intent(in) :: string @@ -18,6 +18,7 @@ end subroutine error_handler subroutine netcdf_err( err, string ) + use mpi use netcdf implicit none @@ -26,8 +27,6 @@ subroutine netcdf_err( err, string ) character(len=256) :: errmsg integer :: iret - include "mpif.h" - if( err.EQ.NF90_NOERR )return errmsg = NF90_STRERROR(err) print*,'' diff --git a/sorc/global_cycle.fd/cycle.f90 b/sorc/global_cycle.fd/cycle.f90 index 290ab531f..034183336 100644 --- a/sorc/global_cycle.fd/cycle.f90 +++ b/sorc/global_cycle.fd/cycle.f90 @@ -88,10 +88,10 @@ PROGRAM SFC_DRV ! Added mpi directives. !---------------------------------------------------------------------- + use mpi + IMPLICIT NONE ! - include 'mpif.h' - CHARACTER(LEN=3) :: DONST INTEGER :: IDIM, JDIM, LSOIL, LUGB, IY, IM, ID, IH, IALB INTEGER :: ISOT, IVEGSRC, LENSFC, ZSEA1_MM, ZSEA2_MM, IERR @@ -542,9 +542,9 @@ SUBROUTINE ADJUST_NSST(RLA,RLO,SLMSK_TILE,SLMSK_FG_TILE,SKINT_TILE,& SLMSK_GAUS, DTREF_GAUS, & NSST_DATA - IMPLICIT NONE + USE MPI - include 'mpif.h' + IMPLICIT NONE INTEGER, INTENT(IN) :: LENSFC, LSOIL, IDIM, JDIM, MON, DAY diff --git a/sorc/global_cycle.fd/read_write_data.f90 b/sorc/global_cycle.fd/read_write_data.f90 index 371a42668..5ae7bbeae 100644 --- a/sorc/global_cycle.fd/read_write_data.f90 +++ b/sorc/global_cycle.fd/read_write_data.f90 @@ -63,6 +63,8 @@ subroutine write_data(slifcs,tsffcs,snofcs,tg3fcs,zorfcs, & ! let the model compute it. !------------------------------------------------------------------ + use mpi + implicit none integer, intent(in) :: idim, jdim, lensfc, lsoil @@ -118,8 +120,6 @@ subroutine write_data(slifcs,tsffcs,snofcs,tg3fcs,zorfcs, & real(kind=4), allocatable :: lsoil_data(:), x_data(:), y_data(:) real(kind=8), allocatable :: dum2d(:,:), dum3d(:,:,:) - include "mpif.h" - call mpi_comm_rank(mpi_comm_world, myrank, error) write(rankch, '(i3.3)') (myrank+1) @@ -853,9 +853,9 @@ SUBROUTINE READ_LAT_LON_OROG(RLA,RLO,OROG,OROG_UF,& ! THE "GRID" FILE. !-------------------------------------------------------------- - IMPLICIT NONE + USE MPI - include "mpif.h" + IMPLICIT NONE INTEGER, INTENT(IN) :: IDIM, JDIM, IJDIM @@ -985,9 +985,9 @@ SUBROUTINE NETCDF_ERR( ERR, STRING ) ! AND STOP PROCESSING. !-------------------------------------------------------------- - IMPLICIT NONE + USE MPI - include 'mpif.h' + IMPLICIT NONE INTEGER, INTENT(IN) :: ERR CHARACTER(LEN=*), INTENT(IN) :: STRING @@ -1089,9 +1089,9 @@ SUBROUTINE READ_DATA(TSFFCS,SMCFCS,SNOFCS,STCFCS, & ! SELECTED) FOR A SINGLE CUBED-SPHERE TILE. !----------------------------------------------------------------- - IMPLICIT NONE + USE MPI - include "mpif.h" + IMPLICIT NONE INTEGER, INTENT(IN) :: LSOIL, LENSFC @@ -1541,9 +1541,9 @@ subroutine read_tf_clim_grb(file_sst,sst,rlats_sst,rlons_sst,mlat_sst,mlon_sst,m ! language: f90 ! !$$$ - implicit none + use mpi - include "mpif.h" + implicit none ! declare passed variables and arrays character(*) , intent(in ) :: file_sst @@ -1691,9 +1691,9 @@ subroutine get_tf_clm_dim(file_sst,mlat_sst,mlon_sst) ! machine: ibm rs/6000 sp ! !$$$ - implicit none + use mpi - include "mpif.h" + implicit none ! declare passed variables and arrays character(*) , intent(in ) :: file_sst @@ -1844,10 +1844,9 @@ end subroutine get_dim_nc subroutine nc_check(status) + use mpi use netcdf - include "mpif.h" - integer, intent ( in) :: status integer :: ierr diff --git a/sorc/sfc_climo_gen.fd/interp.F90 b/sorc/sfc_climo_gen.fd/interp.F90 index 1e6141708..41b59f916 100644 --- a/sorc/sfc_climo_gen.fd/interp.F90 +++ b/sorc/sfc_climo_gen.fd/interp.F90 @@ -23,11 +23,10 @@ subroutine interp(localpet, method, input_file) use model_grid use source_grid use utils + use mpi implicit none - include 'mpif.h' - character(len=*), intent(in) :: input_file integer :: rc, localpet @@ -294,11 +293,10 @@ subroutine adjust_for_landice(field, vegt, idim, jdim, field_ch) !----------------------------------------------------------------------- use esmf + use mpi implicit none - include 'mpif.h' - character(len=*), intent(in) :: field_ch integer, intent(in) :: idim, jdim diff --git a/sorc/sfc_climo_gen.fd/model_grid.F90 b/sorc/sfc_climo_gen.fd/model_grid.F90 index 056a57130..d86241556 100644 --- a/sorc/sfc_climo_gen.fd/model_grid.F90 +++ b/sorc/sfc_climo_gen.fd/model_grid.F90 @@ -85,11 +85,10 @@ subroutine define_model_grid(localpet, npets) use netcdf use program_setup use utils + use mpi implicit none - include 'mpif.h' - integer, intent(in) :: localpet, npets character(len=500) :: the_file diff --git a/sorc/sfc_climo_gen.fd/output.f90 b/sorc/sfc_climo_gen.fd/output.f90 index 87016e4af..6055404d5 100644 --- a/sorc/sfc_climo_gen.fd/output.f90 +++ b/sorc/sfc_climo_gen.fd/output.f90 @@ -26,6 +26,7 @@ subroutine output(data_one_tile, lat_one_tile, lon_one_tile, i_mdl, j_mdl, & ! time Time period to be output. !-------------------------------------------------------------------------- + use mpi use esmf use netcdf use utils @@ -36,8 +37,6 @@ subroutine output(data_one_tile, lat_one_tile, lon_one_tile, i_mdl, j_mdl, & implicit none - include 'mpif.h' - integer, intent(in) :: i_mdl, j_mdl, tile integer, intent(in) :: record, time, field_idx diff --git a/sorc/sfc_climo_gen.fd/program_setup.f90 b/sorc/sfc_climo_gen.fd/program_setup.f90 index 05e466485..1cb59e6eb 100644 --- a/sorc/sfc_climo_gen.fd/program_setup.f90 +++ b/sorc/sfc_climo_gen.fd/program_setup.f90 @@ -102,9 +102,9 @@ subroutine read_setup_namelist(localpet) ! localpet mpi task number !----------------------------------------------------------------------- - implicit none + use mpi - include 'mpif.h' + implicit none integer, intent(in) :: localpet diff --git a/sorc/sfc_climo_gen.fd/search.f90 b/sorc/sfc_climo_gen.fd/search.f90 index e7446b096..f62cecc17 100644 --- a/sorc/sfc_climo_gen.fd/search.f90 +++ b/sorc/sfc_climo_gen.fd/search.f90 @@ -28,12 +28,11 @@ subroutine search (field, mask, idim, jdim, tile, field_name) ! field field after missing values are replaced !----------------------------------------------------------------------- + use mpi use esmf implicit none - include 'mpif.h' - character(len=*) :: field_name integer, intent(in) :: idim, jdim, tile diff --git a/sorc/sfc_climo_gen.fd/source_grid.F90 b/sorc/sfc_climo_gen.fd/source_grid.F90 index d73e850a1..ccca00b10 100644 --- a/sorc/sfc_climo_gen.fd/source_grid.F90 +++ b/sorc/sfc_climo_gen.fd/source_grid.F90 @@ -79,12 +79,11 @@ subroutine define_source_grid(localpet, npets, input_file) ! !----------------------------------------------------------------------- + use mpi use netcdf implicit none - include 'mpif.h' - character(len=*), intent(in) :: input_file integer, intent(in) :: localpet, npets diff --git a/sorc/sfc_climo_gen.fd/utils.f90 b/sorc/sfc_climo_gen.fd/utils.f90 index 0941737d1..fe18a17dc 100644 --- a/sorc/sfc_climo_gen.fd/utils.f90 +++ b/sorc/sfc_climo_gen.fd/utils.f90 @@ -9,6 +9,7 @@ module utils subroutine netcdf_err( err, string ) + use mpi use netcdf implicit none @@ -17,8 +18,6 @@ subroutine netcdf_err( err, string ) character(len=256) :: errmsg integer :: ierr - include "mpif.h" - if( err.EQ.NF90_NOERR )return errmsg = NF90_STRERROR(err) print*,'' @@ -31,6 +30,8 @@ end subroutine netcdf_err subroutine error_handler(string, rc) + use mpi + implicit none character(len=*), intent(in) :: string @@ -39,8 +40,6 @@ subroutine error_handler(string, rc) integer :: ierr - include "mpif.h" - print*,"- FATAL ERROR: ", string if (present(rc)) print*,"- IOSTAT IS: ", rc call mpi_abort(mpi_comm_world, 999, ierr) From 61c25ed93ae7ac6d3e02ad3c3cfb815f82e77b52 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Thu, 1 Oct 2020 12:31:43 -0400 Subject: [PATCH 038/192] Update GDAS initialization utility for ATMOS subdirectory Update GDAS initialization utility for new 'atmos' subfolder. Add load of NDATE utility to ./gdas_init/driver.hera.sh. It was inadvertently removed during a previous merge. Issue #159. --- util/gdas_init/driver.hera.sh | 4 ++++ util/gdas_init/run_pre-v14.chgres.sh | 4 ++-- util/gdas_init/run_v14.chgres.sh | 4 ++-- util/gdas_init/run_v15.chgres.sh | 4 ++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/util/gdas_init/driver.hera.sh b/util/gdas_init/driver.hera.sh index 02a703e7d..3fee1147e 100755 --- a/util/gdas_init/driver.hera.sh +++ b/util/gdas_init/driver.hera.sh @@ -11,6 +11,10 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 source ../../modulefiles/build.$target +# Needed for NDATE utility +module use -a /scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles +module load prod_util/1.1.0 + PROJECT_CODE=fv3-cpu QUEUE=batch diff --git a/util/gdas_init/run_pre-v14.chgres.sh b/util/gdas_init/run_pre-v14.chgres.sh index 92cfe80b3..42946b220 100755 --- a/util/gdas_init/run_pre-v14.chgres.sh +++ b/util/gdas_init/run_pre-v14.chgres.sh @@ -27,14 +27,14 @@ if [ ${MEMBER} == 'hires' ]; then CTAR=${CRES_HIRES} INPUT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy}${mm}${dd}/${hh}" RADSTAT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy}${mm}${dd}/${hh}" - OUTDIR=$OUTDIR/gdas.${yy}${mm}${dd}/${hh} + OUTDIR=$OUTDIR/gdas.${yy}${mm}${dd}/${hh}/atmos ATMFILE="gdas1.t${hh}z.sanl" SFCFILE="gdas1.t${hh}z.sfcanl" else CTAR=${CRES_ENKF} INPUT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}" RADSTAT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}" - OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER} + OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/atmos/mem${MEMBER} ATMFILE="siganl_${yy}${mm}${dd}${hh}_mem${MEMBER}" SFCFILE="sfcanl_${yy}${mm}${dd}${hh}_mem${MEMBER}" fi diff --git a/util/gdas_init/run_v14.chgres.sh b/util/gdas_init/run_v14.chgres.sh index c60c4b3d5..af35acf61 100755 --- a/util/gdas_init/run_v14.chgres.sh +++ b/util/gdas_init/run_v14.chgres.sh @@ -26,7 +26,7 @@ if [ ${MEMBER} == 'hires' ]; then CTAR=${CRES_HIRES} INPUT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy}${mm}${dd}/${hh}" RADSTAT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy}${mm}${dd}/${hh}" - OUTDIR=$OUTDIR/gdas.${yy}${mm}${dd}/${hh} + OUTDIR=$OUTDIR/gdas.${yy}${mm}${dd}/${hh}/atmos ATMFILE="gdas.t${hh}z.atmanl.nemsio" SFCFILE="gdas.t${hh}z.sfcanl.nemsio" NSTFILE="gdas.t${hh}z.nstanl.nemsio" @@ -34,7 +34,7 @@ else CTAR=${CRES_ENKF} INPUT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}" RADSTAT_DATA_DIR="${EXTRACT_DIR}/enkf.${yy}${mm}${dd}/${hh}/mem${MEMBER}" - OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER} + OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/atmos/mem${MEMBER} ATMFILE="gdas.t${hh}z.ratmanl.mem${MEMBER}.nemsio" SFCFILE="gdas.t${hh}z.sfcanl.mem${MEMBER}.nemsio" NSTFILE="gdas.t${hh}z.nstanl.mem${MEMBER}.nemsio" diff --git a/util/gdas_init/run_v15.chgres.sh b/util/gdas_init/run_v15.chgres.sh index c26d92e6c..fce1569c9 100755 --- a/util/gdas_init/run_v15.chgres.sh +++ b/util/gdas_init/run_v15.chgres.sh @@ -27,13 +27,13 @@ if [ ${MEMBER} == 'hires' ]; then CTAR=${CRES_HIRES} INPUT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy_d}${mm_d}${dd_d}/${hh_d}/RESTART" RADSTAT_DATA_DIR="${EXTRACT_DIR}/gdas.${yy}${mm}${dd}/${hh}" - OUTDIR=$OUTDIR/gdas.${yy}${mm}${dd}/${hh} + OUTDIR=$OUTDIR/gdas.${yy}${mm}${dd}/${hh}/atmos else CINP=C384 CTAR=${CRES_ENKF} INPUT_DATA_DIR="${EXTRACT_DIR}/enkfgdas.${yy_d}${mm_d}${dd_d}/${hh_d}/mem${MEMBER}/RESTART" RADSTAT_DATA_DIR="${EXTRACT_DIR}/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER}" - OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/mem${MEMBER} + OUTDIR=$OUTDIR/enkfgdas.${yy}${mm}${dd}/${hh}/atmos/mem${MEMBER} fi rm -fr $WORKDIR From b69f9d13f6469160f90be9d350fb60d29b3464d9 Mon Sep 17 00:00:00 2001 From: David Wright Date: Wed, 7 Oct 2020 13:48:01 -0400 Subject: [PATCH 039/192] Bug Fix for FVCOM Processing to Allow Adding NetCDF Variables on Hera Small bug fix to ./sorc/fvcom_tools.fd that allows for the addition of new variables on Hera. --- sorc/fvcom_tools.fd/module_ncio.f90 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sorc/fvcom_tools.fd/module_ncio.f90 b/sorc/fvcom_tools.fd/module_ncio.f90 index 5f118ad93..9b80d791f 100644 --- a/sorc/fvcom_tools.fd/module_ncio.f90 +++ b/sorc/fvcom_tools.fd/module_ncio.f90 @@ -2339,6 +2339,9 @@ subroutine add_new_var_3d(this,varname,dname1,dname2,dname3,lname,units) ,lname,units integer :: status, ncid, dim1id, dim2id, dim3id, varid + status = nf90_redef(this%ncid) !Enter Define Mode + if (status /= nf90_noerr) call this%handle_err(status) + status = nf90_inq_dimid(this%ncid, dname1, dim1id) if (status /= nf90_noerr) call this%handle_err(status) status = nf90_inq_dimid(this%ncid, dname2, dim2id) @@ -2355,6 +2358,10 @@ subroutine add_new_var_3d(this,varname,dname1,dname2,dname3,lname,units) status = nf90_put_att(this%ncid, varid, 'units', units) if (status /= nf90_noerr) call this%handle_err(status) + status = nf90_enddef(this%ncid) !Exit Define Mode and + ! return to Data Mode + if (status /= nf90_noerr) call this%handle_err(status) + end subroutine add_new_var_3d end module module_ncio From 457156451f438326e174fdb0c53e595c406820c4 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Wed, 14 Oct 2020 09:39:27 -0400 Subject: [PATCH 040/192] GFS v16 NCO standards updates Updates so GFS v16 will conform with the latest NCO standards: Remove '.ecf' extension from the 'emcsfc_global_sfc_prep.sh' script. Update 'link_fixdirs.sh' to open permissions on fixed directories before removing them. For details, see issue #138. --- fix/link_fixdirs.sh | 6 +++++- ...c_global_sfc_prep.sh.ecf => exemcsfc_global_sfc_prep.sh} | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) rename scripts/{exemcsfc_global_sfc_prep.sh.ecf => exemcsfc_global_sfc_prep.sh} (98%) diff --git a/fix/link_fixdirs.sh b/fix/link_fixdirs.sh index 2f7017a7f..dc762fe2a 100755 --- a/fix/link_fixdirs.sh +++ b/fix/link_fixdirs.sh @@ -46,8 +46,12 @@ elif [ $machine = "jet" ]; then elif [ $machine = "orion" ]; then FIX_DIR="/work/noaa/global/glopara/fix" fi + for dir in fix_am fix_fv3 fix_orog fix_fv3_gmted2010 fix_sfc_climo; do - [[ -d $dir ]] && rm -rf $dir + if [ -d $dir ]; then + [[ $RUN_ENVIR = nco ]] && chmod -R 755 $dir + rm -rf $dir + fi $LINK $FIX_DIR/$dir . done diff --git a/scripts/exemcsfc_global_sfc_prep.sh.ecf b/scripts/exemcsfc_global_sfc_prep.sh similarity index 98% rename from scripts/exemcsfc_global_sfc_prep.sh.ecf rename to scripts/exemcsfc_global_sfc_prep.sh index 04fc0f429..7662402a9 100755 --- a/scripts/exemcsfc_global_sfc_prep.sh.ecf +++ b/scripts/exemcsfc_global_sfc_prep.sh @@ -2,7 +2,7 @@ #### UNIX Script Documentation Block ################################### # . . -# Script name: exemcsfc_global_sfc_prep.sh.ecf +# Script name: exemcsfc_global_sfc_prep.sh # RFC Contact: George Gayno # Abstract: This script calls two utility scripts to prepare a global # blended ice analysis and global snow analyses for use by GFS/GDAS. @@ -16,6 +16,8 @@ # 12/2014 Gayno Set file defaults to grib 2 versions # when available. # 08/2015 Gayno Update to current NCO standards +# 08/2020 Gayno Rename without the '.ecf' extention per +# latest NCO standards. # # Usage: # Parameters: < no arguments > From f8dc806e710bbe380d6894f1412eeddaa28c8548 Mon Sep 17 00:00:00 2001 From: JeffBeck-NOAA <55201531+JeffBeck-NOAA@users.noreply.github.com> Date: Thu, 15 Oct 2020 09:31:11 -0600 Subject: [PATCH 041/192] Update chgres_cube to ingest HRRR, RAP, and NAM grib2 files Update chgres_cube to ingest HRRR, RAP and NAM grib2 files. Add UFS_UTILS build modules for machines Cheyenne, Stampede2, and Odin. In the build script and all utility/regression test scripts, do a 'module load' of the machine-specific build modules instead of sourcing them. This is more portable. --- build_all.sh | 20 +- driver_scripts/driver_grid.cray.sh | 3 +- driver_scripts/driver_grid.dell.sh | 3 +- driver_scripts/driver_grid.hera.sh | 3 +- driver_scripts/driver_grid.jet.sh | 3 +- driver_scripts/driver_grid.orion.sh | 3 +- modulefiles/build.cheyenne | 30 + modulefiles/build.jet | 13 +- modulefiles/build.odin | 41 + modulefiles/build.orion | 4 +- modulefiles/build.stampede | 41 + modulefiles/build.wcoss_cray | 13 +- modulefiles/build.wcoss_dell_p3 | 3 +- parm/varmap_tables/GSDphys_var_map.txt | 27 + reg_tests/chgres_cube/c96.regional.sh | 3 + reg_tests/chgres_cube/driver.cray.sh | 3 +- reg_tests/chgres_cube/driver.dell.sh | 4 +- reg_tests/chgres_cube/driver.hera.sh | 4 +- reg_tests/chgres_cube/driver.jet.sh | 4 +- reg_tests/chgres_cube/driver.orion.sh | 3 +- reg_tests/global_cycle/driver.cray.sh | 3 +- reg_tests/global_cycle/driver.dell.sh | 4 +- reg_tests/global_cycle/driver.hera.sh | 4 +- reg_tests/global_cycle/driver.jet.sh | 4 +- reg_tests/global_cycle/driver.orion.sh | 4 +- reg_tests/grid_gen/driver.cray.sh | 3 +- reg_tests/grid_gen/driver.dell.sh | 4 +- reg_tests/grid_gen/driver.hera.sh | 4 +- reg_tests/grid_gen/driver.jet.sh | 4 +- reg_tests/grid_gen/driver.orion.sh | 4 +- reg_tests/ice_blend/driver.cray.sh | 3 +- reg_tests/ice_blend/driver.dell.sh | 4 +- reg_tests/ice_blend/driver.hera.sh | 4 +- reg_tests/ice_blend/driver.jet.sh | 4 +- reg_tests/ice_blend/driver.orion.sh | 4 +- reg_tests/snow2mdl/driver.cray.sh | 3 +- reg_tests/snow2mdl/driver.dell.sh | 4 +- reg_tests/snow2mdl/driver.hera.sh | 4 +- reg_tests/snow2mdl/driver.jet.sh | 4 +- reg_tests/snow2mdl/driver.orion.sh | 4 +- sorc/chgres_cube.fd/atmosphere.F90 | 30 +- sorc/chgres_cube.fd/grib2_util.F90 | 21 + sorc/chgres_cube.fd/input_data.F90 | 973 +++++++++++++++++---- sorc/chgres_cube.fd/model_grid.F90 | 407 ++++++++- sorc/chgres_cube.fd/program_setup.f90 | 145 +++- sorc/chgres_cube.fd/search_util.f90 | 50 +- sorc/chgres_cube.fd/surface.F90 | 1088 +++++++++++++++++++++++- sorc/chgres_cube.fd/write_data.F90 | 49 +- sorc/emcsfc_snow2mdl.fd/.gitignore | 3 - sorc/global_chgres.fd/.gitignore | 1 - sorc/machine-setup.sh | 9 +- sorc/nst_tf_chg.fd/.gitignore | 3 - sorc/sfc_climo_gen.fd/.gitignore | 3 - util/gdas_init/driver.cray.sh | 3 +- util/gdas_init/driver.dell.sh | 4 +- util/gdas_init/driver.hera.sh | 4 +- util/vcoord_gen/run.cray.sh | 3 +- 57 files changed, 2791 insertions(+), 309 deletions(-) create mode 100644 modulefiles/build.cheyenne create mode 100644 modulefiles/build.odin create mode 100644 modulefiles/build.stampede create mode 100644 parm/varmap_tables/GSDphys_var_map.txt delete mode 100644 sorc/emcsfc_snow2mdl.fd/.gitignore delete mode 100644 sorc/global_chgres.fd/.gitignore delete mode 100644 sorc/nst_tf_chg.fd/.gitignore delete mode 100644 sorc/sfc_climo_gen.fd/.gitignore diff --git a/build_all.sh b/build_all.sh index 64d159c1d..273b40f1e 100755 --- a/build_all.sh +++ b/build_all.sh @@ -3,20 +3,22 @@ set -eux target=${target:-"NULL"} -if [[ "$target" == "linux.gnu" || "$target" == "linux.intel" ]]; then +export MOD_PATH + +if [[ "$target" == "linux.*" || "$target" == "macosx.*" ]]; then unset -f module + set +x + source ./modulefiles/build.$target > /dev/null 2>&1 + set -x else set +x - source ./sorc/machine-setup.sh > /dev/null 2>&1 + source ./sorc/machine-setup.sh + module use ./modulefiles + module load build.$target > /dev/null 2>&1 + module list set -x fi -export MOD_PATH -set +x -source ./modulefiles/build.$target > /dev/null 2>&1 -module list -set -x - # --- Build all programs. # @@ -26,7 +28,7 @@ cd ./build CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=../ -DEMC_EXEC_DIR=ON" -if [[ "$target" != "wcoss_cray" ]]; then +if [[ "$target" != "wcoss_cray" && "$target" != "odin" ]]; then CMAKE_FLAGS+=" -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_C_COMPILER=icc" fi diff --git a/driver_scripts/driver_grid.cray.sh b/driver_scripts/driver_grid.cray.sh index f2faa4a78..1aa1088bb 100755 --- a/driver_scripts/driver_grid.cray.sh +++ b/driver_scripts/driver_grid.cray.sh @@ -57,7 +57,8 @@ #----------------------------------------------------------------------- source ../sorc/machine-setup.sh > /dev/null 2>&1 -source ../modulefiles/build.$target +module use ../modulefiles +module load build.$target module list #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.dell.sh b/driver_scripts/driver_grid.dell.sh index d2d6d08d0..760c44151 100755 --- a/driver_scripts/driver_grid.dell.sh +++ b/driver_scripts/driver_grid.dell.sh @@ -59,7 +59,8 @@ #----------------------------------------------------------------------- source ../sorc/machine-setup.sh > /dev/null 2>&1 -source ../modulefiles/build.$target +module use ../modulefiles +module load build.$target module list #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.hera.sh b/driver_scripts/driver_grid.hera.sh index e00c7de1e..6fbe90c37 100755 --- a/driver_scripts/driver_grid.hera.sh +++ b/driver_scripts/driver_grid.hera.sh @@ -59,7 +59,8 @@ set -x source ../sorc/machine-setup.sh > /dev/null 2>&1 -source ../modulefiles/build.$target +module use ../modulefiles +module load build.$target module list #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.jet.sh b/driver_scripts/driver_grid.jet.sh index 2df3f01a5..88e7e7cda 100755 --- a/driver_scripts/driver_grid.jet.sh +++ b/driver_scripts/driver_grid.jet.sh @@ -60,7 +60,8 @@ set -x source ../sorc/machine-setup.sh > /dev/null 2>&1 -source ../modulefiles/build.$target +module use ../modulefiles +module load build.$target module list #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.orion.sh b/driver_scripts/driver_grid.orion.sh index 9eebd32a7..97dce226c 100755 --- a/driver_scripts/driver_grid.orion.sh +++ b/driver_scripts/driver_grid.orion.sh @@ -59,7 +59,8 @@ set -x source ../sorc/machine-setup.sh > /dev/null 2>&1 -source ../modulefiles/build.$target +module use ../modulefiles +module load build.$target module list #----------------------------------------------------------------------- diff --git a/modulefiles/build.cheyenne b/modulefiles/build.cheyenne new file mode 100644 index 000000000..474981369 --- /dev/null +++ b/modulefiles/build.cheyenne @@ -0,0 +1,30 @@ +#%Module##################################################### +## Build and run module for Cheyenne +############################################################# + +module purge +module load ncarenv/1.3 +module load intel/19.1.1 +module load mpt/2.19 +module load ncarcompilers/0.5.0 +module load cmake/3.16.4 + +module use -a /glade/p/ral/jntp/GMTB/tools/NCEPLIBS-ufs-v2.0.0/intel-19.1.1/mpt-2.19/modules + +module load bacio/2.4.1 +module load g2/3.4.1 +module load ip/3.3.3 +module load nemsio/2.5.2 +module load sp/2.3.3 +module load w3emc/2.7.3 +module load w3nco/2.4.1 +module load sigio/2.3.2 + +module load sfcio/1.4.1 +module load gfsio/1.4.1 +module load nemsiogfs/2.5.3 +module load landsfcutil/2.4.1 +module load wgrib2/2.0.8 +module load netcdf/4.7.4 + +setenv ESMFMKFILE /glade/p/ral/jntp/GMTB/tools/NCEPLIBS-ufs-v2.0.0/intel-19.1.1/mpt-2.19/lib64/esmf.mk diff --git a/modulefiles/build.jet b/modulefiles/build.jet index b81a52cd0..e0156505f 100644 --- a/modulefiles/build.jet +++ b/modulefiles/build.jet @@ -8,12 +8,12 @@ module load szip/2.1 module load hdf5/1.10.5 module load netcdf/4.7.0 -export CC=icc -export FC=ifort -export CXX=icpc +setenv CC icc +setenv FC ifort +setenv CXX icpc -export ESMFMKFILE=/lfs4/HFIP/hfv3gfs/software/NCEPLIBS-ufs-v2.0.0beta01/intel-18.0.5.274/impi-2018.4.274/lib64/esmf.mk -export Jasper_ROOT=/lfs4/HFIP/hfv3gfs/software/NCEPLIBS-ufs-v2.0.0beta01/intel-18.0.5.274/impi-2018.4.274 +setenv ESMFMKFILE /lfs4/HFIP/hfv3gfs/software/NCEPLIBS-ufs-v2.0.0beta01/intel-18.0.5.274/impi-2018.4.274/lib64/esmf.mk +setenv Jasper_ROOT /lfs4/HFIP/hfv3gfs/software/NCEPLIBS-ufs-v2.0.0beta01/intel-18.0.5.274/impi-2018.4.274 module use /lfs4/HFIP/hfv3gfs/software/NCEPLIBS-ufs-v2.0.0beta01/intel-18.0.5.274/impi-2018.4.274/modules module load w3nco/2.4.1 @@ -29,6 +29,3 @@ module load gfsio/1.4.1 module load landsfcutil/2.4.1 module load g2/3.4.1 module load wgrib2/2.0.8 - - - diff --git a/modulefiles/build.odin b/modulefiles/build.odin new file mode 100644 index 000000000..5be328674 --- /dev/null +++ b/modulefiles/build.odin @@ -0,0 +1,41 @@ +#%Module##################################################### +## Build and run module for Odin +############################################################# + +module load craype/2.6.2 +module load craype-ivybridge +module load PrgEnv-intel +module swap intel/19.0.5.281 +module load cray-mpich/7.7.10 +module load cray-libsci +module load cray-netcdf-hdf5parallel +module load cray-parallel-netcdf +module load cray-hdf5-parallel + +setenv NETCDF /opt/cray/pe/netcdf-hdf5parallel/4.6.3.2/INTEL/19.0 + +#module use -a /oldscratch/ywang/external/modulefiles +#module use /oldscratch/ywang/external/NCEPLIBS_SRW/modules +module use /oldscratch/ywang/external/NCEPLIBS_SRWv2.0/modules +module load w3nco +module load w3emc +module load sp +module load ip +module load bacio +module load sigio +module load sfcio +module load nemsio +module load nemsiogfs +module load gfsio +module load landsfcutil +module load g2 +module load wgrib2 + +#module load esmf/8.0.0 +#setenv ESMFMKFILE /oldscratch/ywang/external/NCEPLIBS_SRW/lib64/esmf.mk +setenv ESMFMKFILE /oldscratch/ywang/external/NCEPLIBS_SRWv2.0/lib64/esmf.mk + +setenv CMAKE_Fortran_COMPILER ftn +setenv CMAKE_C_COMPILER cc + +#setenv WGRIB2_ROOT /oldscratch/ywang/external/NCEPLIBS_SRWv2.0/wgrib2-2.0.8 diff --git a/modulefiles/build.orion b/modulefiles/build.orion index 5c623989a..c2c30d6f7 100644 --- a/modulefiles/build.orion +++ b/modulefiles/build.orion @@ -1,4 +1,4 @@ -############################################################# +#%Module##################################################### ## Build module for Orion ############################################################# @@ -21,7 +21,7 @@ module load nemsiogfs/2.5.3 module load landsfcutil/2.4.1 module load wgrib2/2.0.8 -export Jasper_ROOT="/apps/jasper-1.900.1" +setenv Jasper_ROOT /apps/jasper-1.900.1 module use -a /apps/contrib/NCEPLIBS/lib/modulefiles module load netcdfp/4.7.4.release diff --git a/modulefiles/build.stampede b/modulefiles/build.stampede new file mode 100644 index 000000000..a26bfae82 --- /dev/null +++ b/modulefiles/build.stampede @@ -0,0 +1,41 @@ +#%Module##################################################### +## Build and run module for Stampede +############################################################# + +module purge + +module load libfabric/1.7.0 +module load git/2.24.1 +module load autotools/1.1 +module load xalt/2.8 +module load TACC + +module load python3/3.7.0 +module load intel/18.0.2 +module load cmake/3.16.1 +module load impi/18.0.2 +module load pnetcdf/1.11.0 +module load netcdf/4.6.2 +module li + +setenv NETCDF /opt/apps/intel18/netcdf/4.6.2/x86_64 + +#module use /work/00315/tg455890/stampede2/regional_fv3/ufs_testing/INSTALL/modules +module use /work/00315/tg455890/stampede2/regional_fv3/NCEPLIBS_SRWv2.0/modules +module load esmf/8.0.0 + +module load w3nco +module load w3emc +module load sp +module load ip +module load bacio +module load sigio +module load sfcio +module load nemsio +module load nemsiogfs +module load gfsio +module load landsfcutil +module load g2 +module load wgrib2 + +#setenv ESMFMKFILE /work/00315/tg455890/stampede2/regional_fv3/NCEPLIBS_SRWv2.0/lib64/esmf.mk diff --git a/modulefiles/build.wcoss_cray b/modulefiles/build.wcoss_cray index b6ce5aa57..c54daea65 100644 --- a/modulefiles/build.wcoss_cray +++ b/modulefiles/build.wcoss_cray @@ -31,14 +31,13 @@ module load nemsiogfs/2.5.3 module load landsfcutil/2.4.1 module load wgrib2/2.0.8 -export ZLIB_ROOT=/usrx/local/prod/zlib/1.2.7/intel/haswell -export PNG_ROOT=/usrx/local/prod//png/1.2.49/intel/haswell -export Jasper_ROOT=/usrx/local/prod/jasper/1.900.1/intel/haswell +setenv ZLIB_ROOT /usrx/local/prod/zlib/1.2.7/intel/haswell +setenv PNG_ROOT /usrx/local/prod/png/1.2.49/intel/haswell +setenv Jasper_ROOT /usrx/local/prod/jasper/1.900.1/intel/haswell module use /gpfs/hps3/emc/nems/noscrub/emc.nemspara/soft/modulefiles -module load esmf/8.0.0 -export ESMFMKFILE=/gpfs/hps3/emc/nems/noscrub/emc.nemspara/soft/esmf/8.0.0/lib/esmf.mk -export NETCDF=/opt/cray/netcdf/4.3.3.1/INTEL/14.0 +#module load esmf/8.0.0 +setenv ESMFMKFILE /gpfs/hps3/emc/nems/noscrub/emc.nemspara/soft/esmf/8.0.0/lib/esmf.mk +setenv NETCDF /opt/cray/netcdf/4.3.3.1/INTEL/14.0 module rm gcc module load gcc/6.3.0 - diff --git a/modulefiles/build.wcoss_dell_p3 b/modulefiles/build.wcoss_dell_p3 index ae9d55e2c..bb9093b03 100644 --- a/modulefiles/build.wcoss_dell_p3 +++ b/modulefiles/build.wcoss_dell_p3 @@ -8,9 +8,8 @@ module load cmake/3.16.2 module load ips/18.0.1.163 module load impi/18.0.1 - module load jasper/1.900.29 -export Jasper_ROOT="/usrx/local/prod/packages/gnu/4.8.5/jasper/1.900.29" +setenv Jasper_ROOT /usrx/local/prod/packages/gnu/4.8.5/jasper/1.900.29 module use /usrx/local/nceplibs/dev/NCEPLIBS/modulefiles module load netcdf_parallel/4.7.4 diff --git a/parm/varmap_tables/GSDphys_var_map.txt b/parm/varmap_tables/GSDphys_var_map.txt new file mode 100644 index 000000000..22f6b47f5 --- /dev/null +++ b/parm/varmap_tables/GSDphys_var_map.txt @@ -0,0 +1,27 @@ +dzdt dzdt set_to_fill 0 D +delta_p delp skip 0 D +sphum sphum set_to_fill 1E-7 T +liq_wat liq_wat set_to_fill 0 T +o3mr o3mr set_to_fill 1E-7 T +rainwat rainwat set_to_fill 0 T +ice_wat ice_wat set_to_fill 0 T +snowwat snowwat set_to_fill 0 T +graupel graupel set_to_fill 0 T +ice_nc ice_nc set_to_fill -1.0 T +rain_nc rain_nc set_to_fill -1.0 T +water_nc water_nc set_to_fill -1.0 T +liq_aero liq_aero set_to_fill 0 T +ice_aero ice_aero set_to_fill 0 T +sgs_tke sgs_tke set_to_fill 0 T +vtype vtype skip 0 S +sotype stype skip 0 S +vfrac vfrac skip 0 S +fricv uustar skip 0 S +sfcr zorl set_to_fill 0.01 S +soilw smc stop 0 S +soilt stc stop 0 S +cnwat cnwat set_to_fill 0.0 S +icetk icetk set_to_fill 265.0 S +weasd weasd set_to_fill 0.0 S +snod snod set_to_fill 0.0 S +tprcp tprcp set_to_fill 0.0 S diff --git a/reg_tests/chgres_cube/c96.regional.sh b/reg_tests/chgres_cube/c96.regional.sh index cecb199cc..e67df060b 100755 --- a/reg_tests/chgres_cube/c96.regional.sh +++ b/reg_tests/chgres_cube/c96.regional.sh @@ -60,6 +60,9 @@ fi cd $DATA +mv out.sfc.tile7.nc out.sfc.tile1.nc +mv out.atm.tile7.nc out.atm.tile1.nc + test_failed=0 for files in *.nc do diff --git a/reg_tests/chgres_cube/driver.cray.sh b/reg_tests/chgres_cube/driver.cray.sh index cae83b182..ee3f4d424 100755 --- a/reg_tests/chgres_cube/driver.cray.sh +++ b/reg_tests/chgres_cube/driver.cray.sh @@ -23,7 +23,8 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target module list export OUTDIR=/gpfs/hps3/stmp/$LOGNAME/chgres_reg_tests diff --git a/reg_tests/chgres_cube/driver.dell.sh b/reg_tests/chgres_cube/driver.dell.sh index 4cbd48361..97247cbfb 100755 --- a/reg_tests/chgres_cube/driver.dell.sh +++ b/reg_tests/chgres_cube/driver.dell.sh @@ -23,7 +23,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list export OUTDIR=/gpfs/dell1/stmp/$LOGNAME/chgres_reg_tests QUEUE="debug" diff --git a/reg_tests/chgres_cube/driver.hera.sh b/reg_tests/chgres_cube/driver.hera.sh index c61b72c87..b6f78c461 100755 --- a/reg_tests/chgres_cube/driver.hera.sh +++ b/reg_tests/chgres_cube/driver.hera.sh @@ -25,7 +25,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list export OUTDIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/chgres_reg_tests PROJECT_CODE="fv3-cpu" diff --git a/reg_tests/chgres_cube/driver.jet.sh b/reg_tests/chgres_cube/driver.jet.sh index a9ee38707..c093eb7cb 100755 --- a/reg_tests/chgres_cube/driver.jet.sh +++ b/reg_tests/chgres_cube/driver.jet.sh @@ -25,7 +25,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list export OUTDIR=/lfs4/HFIP/emcda/$LOGNAME/stmp/chgres_reg_tests PROJECT_CODE="hfv3gfs" diff --git a/reg_tests/chgres_cube/driver.orion.sh b/reg_tests/chgres_cube/driver.orion.sh index 479eedb96..0886871ad 100755 --- a/reg_tests/chgres_cube/driver.orion.sh +++ b/reg_tests/chgres_cube/driver.orion.sh @@ -25,7 +25,8 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target module list export OUTDIR=/work/noaa/stmp/$LOGNAME/chgres_reg_tests diff --git a/reg_tests/global_cycle/driver.cray.sh b/reg_tests/global_cycle/driver.cray.sh index ffd5048dd..288c38edf 100755 --- a/reg_tests/global_cycle/driver.cray.sh +++ b/reg_tests/global_cycle/driver.cray.sh @@ -28,7 +28,8 @@ #BSUB -extsched 'CRAYLINUX[]' source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target module list export DATA=/gpfs/hps3/stmp/$LOGNAME/reg_tests.cycle diff --git a/reg_tests/global_cycle/driver.dell.sh b/reg_tests/global_cycle/driver.dell.sh index 383124240..178355667 100755 --- a/reg_tests/global_cycle/driver.dell.sh +++ b/reg_tests/global_cycle/driver.dell.sh @@ -33,7 +33,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list export DATA=/gpfs/dell1/stmp/$LOGNAME/reg_tests.cycle diff --git a/reg_tests/global_cycle/driver.hera.sh b/reg_tests/global_cycle/driver.hera.sh index ecc05cd9b..9ee1cb64a 100755 --- a/reg_tests/global_cycle/driver.hera.sh +++ b/reg_tests/global_cycle/driver.hera.sh @@ -30,7 +30,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list export DATA=/scratch2/NCEPDEV/stmp1/$LOGNAME/reg_tests.cycle diff --git a/reg_tests/global_cycle/driver.jet.sh b/reg_tests/global_cycle/driver.jet.sh index 74183c565..aa2d7285a 100755 --- a/reg_tests/global_cycle/driver.jet.sh +++ b/reg_tests/global_cycle/driver.jet.sh @@ -31,7 +31,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list export DATA=/lfs4/HFIP/emcda/$LOGNAME/stmp/reg_tests.cycle diff --git a/reg_tests/global_cycle/driver.orion.sh b/reg_tests/global_cycle/driver.orion.sh index 63c51f9f7..5731b9063 100755 --- a/reg_tests/global_cycle/driver.orion.sh +++ b/reg_tests/global_cycle/driver.orion.sh @@ -30,7 +30,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list export DATA=/work/noaa/stmp/$LOGNAME/reg_tests.cycle diff --git a/reg_tests/grid_gen/driver.cray.sh b/reg_tests/grid_gen/driver.cray.sh index 535ce28f4..e2f8e5927 100755 --- a/reg_tests/grid_gen/driver.cray.sh +++ b/reg_tests/grid_gen/driver.cray.sh @@ -20,7 +20,8 @@ #----------------------------------------------------------------------------- source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target module list set -x diff --git a/reg_tests/grid_gen/driver.dell.sh b/reg_tests/grid_gen/driver.dell.sh index 8027b84e3..5c2ae6a7f 100755 --- a/reg_tests/grid_gen/driver.dell.sh +++ b/reg_tests/grid_gen/driver.dell.sh @@ -20,7 +20,9 @@ #----------------------------------------------------------------------------- source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list set -x diff --git a/reg_tests/grid_gen/driver.hera.sh b/reg_tests/grid_gen/driver.hera.sh index f2a8536cf..0dc66996c 100755 --- a/reg_tests/grid_gen/driver.hera.sh +++ b/reg_tests/grid_gen/driver.hera.sh @@ -22,7 +22,9 @@ #----------------------------------------------------------------------------- source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list set -x diff --git a/reg_tests/grid_gen/driver.jet.sh b/reg_tests/grid_gen/driver.jet.sh index 5c1facea3..d38c08f8a 100755 --- a/reg_tests/grid_gen/driver.jet.sh +++ b/reg_tests/grid_gen/driver.jet.sh @@ -22,7 +22,9 @@ #----------------------------------------------------------------------------- source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list set -x diff --git a/reg_tests/grid_gen/driver.orion.sh b/reg_tests/grid_gen/driver.orion.sh index 12e56d21b..cdad89801 100755 --- a/reg_tests/grid_gen/driver.orion.sh +++ b/reg_tests/grid_gen/driver.orion.sh @@ -22,7 +22,9 @@ #----------------------------------------------------------------------------- source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list set -x diff --git a/reg_tests/ice_blend/driver.cray.sh b/reg_tests/ice_blend/driver.cray.sh index f2904b0df..c34cb3bca 100755 --- a/reg_tests/ice_blend/driver.cray.sh +++ b/reg_tests/ice_blend/driver.cray.sh @@ -29,7 +29,8 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target module list export DATA=/gpfs/hps3/stmp/$LOGNAME/reg_tests.ice_blend diff --git a/reg_tests/ice_blend/driver.dell.sh b/reg_tests/ice_blend/driver.dell.sh index 9ca96d131..1296c7436 100755 --- a/reg_tests/ice_blend/driver.dell.sh +++ b/reg_tests/ice_blend/driver.dell.sh @@ -27,7 +27,9 @@ #BSUB -P GFS-DEV source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list set -x diff --git a/reg_tests/ice_blend/driver.hera.sh b/reg_tests/ice_blend/driver.hera.sh index 4866e7974..63967711a 100755 --- a/reg_tests/ice_blend/driver.hera.sh +++ b/reg_tests/ice_blend/driver.hera.sh @@ -30,7 +30,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list export DATA="/scratch2/NCEPDEV/stmp1/$LOGNAME/reg_test.ice_blend" diff --git a/reg_tests/ice_blend/driver.jet.sh b/reg_tests/ice_blend/driver.jet.sh index bc55aa272..160b21a94 100755 --- a/reg_tests/ice_blend/driver.jet.sh +++ b/reg_tests/ice_blend/driver.jet.sh @@ -29,7 +29,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list export DATA="/lfs4/HFIP/emcda/$LOGNAME/stmp/reg_test.ice_blend" diff --git a/reg_tests/ice_blend/driver.orion.sh b/reg_tests/ice_blend/driver.orion.sh index 188ede2bb..df2b108e1 100755 --- a/reg_tests/ice_blend/driver.orion.sh +++ b/reg_tests/ice_blend/driver.orion.sh @@ -30,7 +30,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list export DATA="/work/noaa/stmp/$LOGNAME/reg_test.ice_blend" diff --git a/reg_tests/snow2mdl/driver.cray.sh b/reg_tests/snow2mdl/driver.cray.sh index f39c5b3ce..064b8a7d8 100755 --- a/reg_tests/snow2mdl/driver.cray.sh +++ b/reg_tests/snow2mdl/driver.cray.sh @@ -29,7 +29,8 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target module list export DATA=/gpfs/hps3/stmp/$LOGNAME/reg_tests.snow2mdl diff --git a/reg_tests/snow2mdl/driver.dell.sh b/reg_tests/snow2mdl/driver.dell.sh index 610f726d8..2b3e603d8 100755 --- a/reg_tests/snow2mdl/driver.dell.sh +++ b/reg_tests/snow2mdl/driver.dell.sh @@ -27,7 +27,9 @@ #BSUB -P GFS-DEV source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list set -x diff --git a/reg_tests/snow2mdl/driver.hera.sh b/reg_tests/snow2mdl/driver.hera.sh index cd0457104..8c074f66c 100755 --- a/reg_tests/snow2mdl/driver.hera.sh +++ b/reg_tests/snow2mdl/driver.hera.sh @@ -30,7 +30,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list export DATA="/scratch2/NCEPDEV/stmp1/$LOGNAME/reg_tests.snow2mdl" diff --git a/reg_tests/snow2mdl/driver.jet.sh b/reg_tests/snow2mdl/driver.jet.sh index c4679031e..e12a69790 100755 --- a/reg_tests/snow2mdl/driver.jet.sh +++ b/reg_tests/snow2mdl/driver.jet.sh @@ -29,7 +29,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list export DATA="/lfs4/HFIP/emcda/$LOGNAME/stmp/reg_tests.snow2mdl" diff --git a/reg_tests/snow2mdl/driver.orion.sh b/reg_tests/snow2mdl/driver.orion.sh index fbc331510..be991b359 100755 --- a/reg_tests/snow2mdl/driver.orion.sh +++ b/reg_tests/snow2mdl/driver.orion.sh @@ -30,7 +30,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list export DATA="/work/noaa/stmp/$LOGNAME/reg_tests.snow2mdl" diff --git a/sorc/chgres_cube.fd/atmosphere.F90 b/sorc/chgres_cube.fd/atmosphere.F90 index a76ea36b7..f372d5dbb 100644 --- a/sorc/chgres_cube.fd/atmosphere.F90 +++ b/sorc/chgres_cube.fd/atmosphere.F90 @@ -164,7 +164,7 @@ subroutine atmosphere_driver(localpet) real(esmf_kind_r8), parameter :: exponent = rd*lapse/grav real(esmf_kind_r8), parameter :: one_over_exponent = 1.0 / exponent - real(esmf_kind_r8), pointer :: psptr(:,:) + real(esmf_kind_r8), pointer :: psptr(:,:), tempptr(:,:,:) !----------------------------------------------------------------------------------- ! Read atmospheric fields on the input grid. @@ -212,7 +212,6 @@ subroutine atmosphere_driver(localpet) temp_b4adj_target_grid, & polemethod=ESMF_POLEMETHOD_ALLAVG, & srctermprocessing=isrctermprocessing, & - extrapmethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & routehandle=regrid_bl, & regridmethod=method, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -256,7 +255,25 @@ subroutine atmosphere_driver(localpet) termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) + + nullify(tempptr) + print*,"- CALL FieldGet FOR INPUT GRID VERTICAL VEL." + call ESMF_FieldGet(dzdt_input_grid, & + farrayPtr=tempptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*, "MIN MAX W INPUT = ", minval(tempptr), maxval(tempptr) + nullify(tempptr) + print*,"- CALL FieldGet FOR VERTICAL VEL B4ADJ." + call ESMF_FieldGet(dzdt_b4adj_target_grid, & + farrayPtr=tempptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*, "MIN MAX W B4ADJ = ", minval(tempptr), maxval(tempptr) + nullify(psptr) print*,"- CALL FieldGet FOR INPUT SURFACE PRESSURE." call ESMF_FieldGet(ps_input_grid, & @@ -364,8 +381,8 @@ subroutine atmosphere_driver(localpet) wind_w_target_grid, & polemethod=ESMF_POLEMETHOD_ALLAVG, & srctermprocessing=isrctermprocessing, & - extrapMethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & routehandle=regrid_bl, & + extrapMethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & regridmethod=method, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridStore", rc) @@ -391,8 +408,8 @@ subroutine atmosphere_driver(localpet) wind_s_target_grid, & polemethod=ESMF_POLEMETHOD_ALLAVG, & srctermprocessing=isrctermprocessing, & - extrapMethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & routehandle=regrid_bl, & + extrapMethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & regridmethod=method, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegridStore", rc) @@ -722,6 +739,7 @@ subroutine convert_winds enddo enddo enddo + print*,"- CALL FieldGet FOR 3-D WIND_W." call ESMF_FieldGet(wind_w_target_grid, & @@ -1221,7 +1239,6 @@ subroutine horiz_interp_thomp_mp_climo qnifa_climo_b4adj_target_grid, & polemethod=ESMF_POLEMETHOD_ALLAVG, & srctermprocessing=isrctermprocessing, & - extrapmethod=ESMF_EXTRAPMETHOD_NEAREST_STOD, & routehandle=regrid_bl, & regridmethod=method, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -1478,7 +1495,7 @@ SUBROUTINE VINTG C1(:,:,:,1) = WIND1PTR(:,:,:,1) C1(:,:,:,2) = WIND1PTR(:,:,:,2) C1(:,:,:,3) = WIND1PTR(:,:,:,3) - + print*,"- CALL FieldGet FOR VERTICAL VELOCITY." call ESMF_FieldGet(dzdt_b4adj_target_grid, & farrayPtr=DZDT1PTR, rc=rc) @@ -1486,6 +1503,7 @@ SUBROUTINE VINTG call error_handler("IN FieldGet", rc) C1(:,:,:,4) = DZDT1PTR(:,:,:) + print*,"MIN MAX W TARGETB4 IN VINTG = ", minval(DZDT1PTR(:,:,:)), maxval(DZDT1PTR(:,:,:)) print*,"- CALL FieldGet FOR 3-D TEMP." call ESMF_FieldGet(temp_b4adj_target_grid, & diff --git a/sorc/chgres_cube.fd/grib2_util.F90 b/sorc/chgres_cube.fd/grib2_util.F90 index 64a1cdb71..195d5c71d 100644 --- a/sorc/chgres_cube.fd/grib2_util.F90 +++ b/sorc/chgres_cube.fd/grib2_util.F90 @@ -74,4 +74,25 @@ subroutine convert_omega(omega,p,t,q,clb,cub) end subroutine convert_omega +function to_upper(strIn) result(strOut) +! Adapted from http://www.star.le.ac.uk/~cgp/fortran.html (25 May 2012) +! Original author: Clive Page + + implicit none + + character(len=*), intent(in) :: strIn + character(len=len(strIn)) :: strOut + integer :: i,j + + do i = 1, len(strIn) + j = iachar(strIn(i:i)) + if (j>= iachar("a") .and. j<=iachar("z") ) then + strOut(i:i) = achar(iachar(strIn(i:i))-32) + else + strOut(i:i) = strIn(i:i) + end if + end do + +end function to_upper + end module grib2_util diff --git a/sorc/chgres_cube.fd/input_data.F90 b/sorc/chgres_cube.fd/input_data.F90 index f5847fe6d..9011a1e1b 100644 --- a/sorc/chgres_cube.fd/input_data.F90 +++ b/sorc/chgres_cube.fd/input_data.F90 @@ -39,7 +39,12 @@ module input_data orog_files_input_grid, & tracers_input, num_tracers, & input_type, tracers, & - get_var_cond, read_from_input + get_var_cond, read_from_input, & + geogrid_file_input_grid, & + external_model, & + vgfrc_from_climo, & + minmax_vgfrc_from_climo, & + lai_from_climo use model_grid, only : input_grid, & i_input, j_input, & @@ -47,7 +52,7 @@ module input_data num_tiles_input_grid, & latitude_input_grid, & longitude_input_grid, & - inv_file + inv_file!, the_file_hrrr implicit none @@ -98,9 +103,13 @@ module input_data type(esmf_field), public :: ustar_input_grid ! fric velocity type(esmf_field), public :: veg_type_input_grid ! vegetation type type(esmf_field), public :: z0_input_grid ! roughness length + type(esmf_field), public :: veg_greenness_input_grid ! vegetation fraction + type(esmf_field), public :: lai_input_grid ! leaf area index + type(esmf_field), public :: max_veg_greenness_input_grid ! shdmax + type(esmf_field), public :: min_veg_greenness_input_grid ! shdmin - integer, public :: lsoil_input=4 ! # of soil layers, - ! # hardwire for now + integer, public :: lsoil_input=4 ! # of soil layers, no longer hardwired to allow + ! # for 7 layers of soil for the RUC LSM character(len=50), private, allocatable :: slevs(:) @@ -537,6 +546,42 @@ subroutine read_input_sfc_data(localpet) ungriddedUBound=(/lsoil_input/), rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldCreate", rc) + + + + if (.not. vgfrc_from_climo) then + print*,"- CALL FieldCreate FOR INPUT VEGETATION GREENNESS." + veg_greenness_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + endif + + if (.not. minmax_vgfrc_from_climo) then + print*,"- CALL FieldCreate FOR INPUT MIN VEGETATION GREENNESS." + min_veg_greenness_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldCreate", rc) + + print*,"- CALL FieldCreate FOR INPUT MAX VEGETATION GREENNESS." + max_veg_greenness_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldCreate", rc) + endif + + if (.not. lai_from_climo) then + print*,"- CALL FieldCreate FOR INPUT LEAF AREA INDEX." + lai_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldCreate", rc) + endif !------------------------------------------------------------------------------- ! Read the tiled 'warm' restart files. @@ -2432,11 +2477,13 @@ subroutine read_input_atm_grib2_file(localpet) logical :: lret logical :: conv_omega=.false., & - hasspfh=.true. + hasspfh=.true., & + isnative=.false. real(esmf_kind_r8), allocatable :: rlevs(:) real(esmf_kind_r4), allocatable :: dummy2d(:,:) - real(esmf_kind_r8), allocatable :: dummy3d(:,:,:), dummy2d_8(:,:) + real(esmf_kind_r8), allocatable :: dummy3d(:,:,:), dummy2d_8(:,:),& + u_tmp_3d(:,:,:), v_tmp_3d(:,:,:) real(esmf_kind_r8), pointer :: presptr(:,:,:), psptr(:,:),tptr(:,:,:), & qptr(:,:,:), wptr(:,:,:), & uptr(:,:,:), vptr(:,:,:) @@ -2472,17 +2519,24 @@ subroutine read_input_atm_grib2_file(localpet) if (.not.lret) call error_handler("OPENING GRIB2 ATM FILE.", iret) print*,"- READ VERTICAL COORDINATE." - iret = grb2_inq(the_file,inv_file,":var_0_2","_0_0:"," hybrid level:") + iret = grb2_inq(the_file,inv_file,":var0_2","_0_0:"," hybrid ") if (iret <= 0) then lvl_str = "mb:" lvl_str_space = " mb:" lvl_str_space_len = 4 + isnative = .false. iret = grb2_inq(the_file,inv_file,":UGRD:",lvl_str_space) lev_input=iret if (localpet == 0) print*,"- DATA IS ON ", lev_input, " ISOBARIC LEVELS." else - call error_handler("HYBRID VERTICAL COORD DATA NOT SUPPORTED", -1) + lvl_str = " level:" + lvl_str_space = " hybrid " + lvl_str_space_len = 7 + isnative = .true. + iret = grb2_inq(the_file,inv_file,":UGRD:",lvl_str_space, " level:") + if (iret < 0) call error_handler("READING VERTICAL LEVEL TYPE.", iret) + lev_input=iret endif allocate(slevs(lev_input)) @@ -2500,8 +2554,8 @@ subroutine read_input_atm_grib2_file(localpet) read(metadata(j:k),*) rlevs(i) - slevs(i) = metadata(j-1:k) - rlevs(i) = rlevs(i) * 100.0 + slevs(i) = metadata(j-1:k) + if (.not. isnative) rlevs(i) = rlevs(i) * 100.0 if (localpet==0) print*, "- LEVEL = ", slevs(i) enddo @@ -2509,28 +2563,30 @@ subroutine read_input_atm_grib2_file(localpet) call quicksort(rlevs,1,lev_input) - do i = 1,lev_input - write(slevs(i),"(F20.10)") rlevs(i)/100.0 - len_str = len_trim(slevs(i)) + if (.not. isnative) then + do i = 1,lev_input + write(slevs(i),"(F20.10)") rlevs(i)/100.0 + len_str = len_trim(slevs(i)) - do while (slevs(i)(len_str:len_str) .eq. '0') - slevs(i) = slevs(i)(:len_str-1) - len_str = len_str - 1 - end do + do while (slevs(i)(len_str:len_str) .eq. '0') + slevs(i) = slevs(i)(:len_str-1) + len_str = len_str - 1 + end do - if (slevs(i)(len_str:len_str) .eq. '.') then + if (slevs(i)(len_str:len_str) .eq. '.') then slevs(i) = slevs(i)(:len_str-1) len_str = len_str - 1 - end if + end if - slevs(i) = trim(slevs(i)) - - slevs(i) = ":"//trim(adjustl(slevs(i)))//" mb:" - if (localpet==0) print*, "- LEVEL AFTER SORT = ",slevs(i) - enddo + slevs(i) = trim(slevs(i)) + slevs(i) = ":"//trim(adjustl(slevs(i)))//" mb:" + if (localpet==0) print*, "- LEVEL AFTER SORT = ",slevs(i) + enddo + endif + if (localpet == 0) print*,"- FIND SPFH OR RH IN FILE" - iret = grb2_inq(the_file,inv_file,trac_names_grib_1(1),trac_names_grib_2(1),lvl_str_space) + iret = grb2_inq(the_file,inv_file,trim(trac_names_grib_1(1)),trac_names_grib_2(1),lvl_str_space) if (iret <= 0) then iret = grb2_inq(the_file,inv_file, ':var0_2','_1_1:',lvl_str_space) @@ -2541,8 +2597,53 @@ subroutine read_input_atm_grib2_file(localpet) else if (localpet == 0) print*,"- FILE CONTAINS SPFH." endif + + if (localpet == 0) print*,"- FIND ICMR, SCLIWC, OR CICE IN FILE" + iret = grb2_inq(the_file,inv_file,trac_names_grib_1(4),trac_names_grib_2(4),lvl_str_space) + + if (iret <= 0) then + vname = trac_names_vmap(4) + print*, "vname = ", vname + call get_var_cond(vname,this_miss_var_method=method, this_miss_var_value=value, & + this_field_var_name=tmpstr,loc=varnum) + iret = grb2_inq(the_file,inv_file, ':var0_2','_1_84:',lvl_str_space) + if (iret <= 0) then + iret = grb2_inq(the_file,inv_file, ':var0_2','_6_0:',lvl_str_space) + if (iret <= 0 ) then + call handle_grib_error(vname, slevs(1),method,value,varnum,rc,var=dummy2d) + else + trac_names_grib_2(4) = '_6_0' + if (localpet == 0) print*,"- FILE CONTAINS CICE." + endif + else + trac_names_grib_2(4)='_1_84:' + if (localpet == 0) print*,"- FILE CONTAINS SCLIWC." + endif + else + if (localpet == 0) print*,"- FILE CONTAINS ICMR." + endif + + if (localpet == 0) print*,"- FIND CLWMR or SCLLWC IN FILE" + iret = grb2_inq(the_file,inv_file,trac_names_grib_1(5),trac_names_grib_2(5),lvl_str_space) + + if (iret <= 0) then + vname = trac_names_vmap(5) + print*, "vname = ", vname + call get_var_cond(vname,this_miss_var_method=method, this_miss_var_value=value, & + this_field_var_name=tmpstr,loc=varnum) + iret = grb2_inq(the_file,inv_file, ':var0_2','_1_83:',lvl_str_space) + if (iret <= 0) then + call handle_grib_error(vname, slevs(1),method,value,varnum,rc,var=dummy2d) + elseif (iret <=0 .and. rc .ne. 1) then + call error_handler("READING CLOUD WATER VARIABLE.", iret) + else + trac_names_grib_2(4)='_1_83:' + if (localpet == 0) print*,"- FILE CONTAINS SCLLWC." + endif + else + if (localpet == 0) print*,"- FILE CONTAINS CLWMR." + endif - print*,"- COUNT NUMBER OF TRACERS TO BE READ IN BASED ON PHYSICS SUITE TABLE" do n = 1, num_tracers vname = tracers_input(n) @@ -2556,7 +2657,7 @@ subroutine read_input_atm_grib2_file(localpet) enddo - if (localpet==0) print*, "- NUMBER OF TRACERS IN FILE = ", num_tracers + if (localpet==0) print*, "- NUMBER OF TRACERS TO BE PROCESSED = ", num_tracers !--------------------------------------------------------------------------- ! Initialize esmf atmospheric fields. @@ -2574,10 +2675,11 @@ subroutine read_input_atm_grib2_file(localpet) allocate(dummy3d(0,0,0)) endif -!----------------------------------------------------------------------- -! Fields in non-native files read in from top to bottom. We will -! flip indices later. This program expects bottom to top. -!----------------------------------------------------------------------- +!---------------------------------------------------------------------------------- +! This program expects field levels from bottom to top. Fields in non-native +! files read in from top to bottom. We will flip indices later. Fields on +! native vertical coordinates read from bottom to top so those need no adjustments. +!---------------------------------------------------------------------------------- if (localpet == 0) then print*,"- READ TEMPERATURE." @@ -2609,6 +2711,7 @@ subroutine read_input_atm_grib2_file(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) endif + if (localpet == 0) then vname = trim(tracers_input_grib_1(n)) vname2 = trim(tracers_input_grib_2(n)) @@ -2623,8 +2726,6 @@ subroutine read_input_atm_grib2_file(localpet) trim(vname2) == ":14:192:") then call error_handler("READING IN "//trim(vname)//" AT LEVEL "//trim(slevs(vlev))& //". SET A FILL VALUE IN THE VARMAP TABLE IF THIS ERROR IS NOT DESIRABLE.",iret) - else - exit endif endif endif @@ -2645,51 +2746,20 @@ subroutine read_input_atm_grib2_file(localpet) enddo - if (localpet==0) then - do vlev = 1, lev_input - - vname = ":var0_2" - vname2 = "_2_2:" - iret = grb2_inq(the_file,inv_file,vname,vname2,slevs(vlev),data2=dummy2d) - if (iret<=0) then - call error_handler("READING UWIND AT LEVEL "//trim(slevs(vlev)),iret) - endif - - print*, 'max, min U ', minval(dummy2d), maxval(dummy2d) - dummy3d(:,:,vlev) = real(dummy2d,esmf_kind_r8) - - enddo - endif +call read_winds(the_file,inv_file,u_tmp_3d,v_tmp_3d, localpet) if (localpet == 0) print*,"- CALL FieldScatter FOR INPUT U-WIND." - call ESMF_FieldScatter(u_input_grid, dummy3d, rootpet=0, rc=rc) + call ESMF_FieldScatter(u_input_grid, u_tmp_3d, rootpet=0, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) - if (localpet==0) then - do vlev = 1, lev_input - - vname = ":var0_2" - vname2 = "_2_3:" - iret = grb2_inq(the_file,inv_file,vname,vname2,slevs(vlev),data2=dummy2d) - if (iret<=0) then - call error_handler("READING VWIND AT LEVEL "//trim(slevs(vlev)),iret) - endif - - print*, 'max, min V ', minval(dummy2d), maxval(dummy2d) - dummy3d(:,:,vlev) = real(dummy2d,esmf_kind_r8) - - enddo - endif - if (localpet == 0) print*,"- CALL FieldScatter FOR INPUT V-WIND." - call ESMF_FieldScatter(v_input_grid, dummy3d, rootpet=0, rc=rc) + call ESMF_FieldScatter(v_input_grid, v_tmp_3d, rootpet=0, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) if (localpet == 0) then print*,"- READ SURFACE PRESSURE." - !vname = ":PRES:" vname = ":var0_2" vname2 = "_3_0:" vlevtyp = ":surface:" @@ -2708,18 +2778,14 @@ subroutine read_input_atm_grib2_file(localpet) vname = "dzdt" call get_var_cond(vname,this_miss_var_method=method, this_miss_var_value=value, & loc=varnum) - !vname = ":DZDT:" vname = ":var0_2" vname2 = "_2_9:" do vlev = 1, lev_input iret = grb2_inq(the_file,inv_file,vname,vname2,slevs(vlev),data2=dummy2d) if (iret <= 0 ) then print*,"DZDT not available at level ", trim(slevs(vlev)), " so checking for VVEL" - !vname = ":VVEL:" vname2 = "_2_8:" iret = grb2_inq(the_file,inv_file,vname,vname2,slevs(vlev),data2=dummy2d) - - if (iret <= 0) then call handle_grib_error(vname, slevs(vlev),method,value,varnum,iret,var=dummy2d) if (iret==1) then ! missing_var_method == skip @@ -2742,7 +2808,6 @@ subroutine read_input_atm_grib2_file(localpet) if (localpet == 0) then print*,"- READ TERRAIN." - !vname = ":HGT:" vname = ":var0_2" vname2 = "_3_5:" vlevtyp = ":surface:" @@ -2756,72 +2821,73 @@ subroutine read_input_atm_grib2_file(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) - deallocate(dummy2d, dummy3d, dummy2d_8) + deallocate(dummy2d, dummy2d_8) -!--------------------------------------------------------------------------- -! Flip 'z' indices to all 3-d variables. Data is read in from model -! top to surface. This program expects surface to model top. -!--------------------------------------------------------------------------- - - if (localpet == 0) print*,"- CALL FieldGet FOR SURFACE PRESSURE." - nullify(psptr) - call ESMF_FieldGet(ps_input_grid, & - farrayPtr=psptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & +if (.not. isnative) then + !--------------------------------------------------------------------------- + ! Flip 'z' indices to all 3-d variables. Data is read in from model + ! top to surface. This program expects surface to model top. + !--------------------------------------------------------------------------- + + if (localpet == 0) print*,"- CALL FieldGet FOR SURFACE PRESSURE." + nullify(psptr) + call ESMF_FieldGet(ps_input_grid, & + farrayPtr=psptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - - nullify(presptr) - if (localpet == 0) print*,"- CALL FieldGet FOR 3-D PRESSURE." - call ESMF_FieldGet(pres_input_grid, & - computationalLBound=clb, & - computationalUBound=cub, & - farrayPtr=presptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + + nullify(presptr) + if (localpet == 0) print*,"- CALL FieldGet FOR 3-D PRESSURE." + call ESMF_FieldGet(pres_input_grid, & + computationalLBound=clb, & + computationalUBound=cub, & + farrayPtr=presptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - nullify(tptr) - if (localpet == 0) print*,"- CALL FieldGet TEMPERATURE." - call ESMF_FieldGet(temp_input_grid, & - farrayPtr=tptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + nullify(tptr) + if (localpet == 0) print*,"- CALL FieldGet TEMPERATURE." + call ESMF_FieldGet(temp_input_grid, & + farrayPtr=tptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - nullify(uptr) - if (localpet == 0) print*,"- CALL FieldGet FOR U" - call ESMF_FieldGet(u_input_grid, & - farrayPtr=uptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + nullify(uptr) + if (localpet == 0) print*,"- CALL FieldGet FOR U" + call ESMF_FieldGet(u_input_grid, & + farrayPtr=uptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - - nullify(vptr) - if (localpet == 0) print*,"- CALL FieldGet FOR V" - call ESMF_FieldGet(v_input_grid, & - farrayPtr=vptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + + nullify(vptr) + if (localpet == 0) print*,"- CALL FieldGet FOR V" + call ESMF_FieldGet(v_input_grid, & + farrayPtr=vptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - nullify(wptr) - if (localpet == 0) print*,"- CALL FieldGet FOR W" - call ESMF_FieldGet(dzdt_input_grid, & - farrayPtr=wptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + nullify(wptr) + if (localpet == 0) print*,"- CALL FieldGet FOR W" + call ESMF_FieldGet(dzdt_input_grid, & + farrayPtr=wptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - if (localpet == 0) print*,"- CALL FieldGet FOR TRACERS." - do n=1,num_tracers + if (localpet == 0) print*,"- CALL FieldGet FOR TRACERS." + do n=1,num_tracers nullify(qptr) call ESMF_FieldGet(tracers_input_grid(n), & - farrayPtr=qptr, rc=rc) + farrayPtr=qptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) do i = clb(1),cub(1) do j = clb(2),cub(2) - qptr(i,j,:) = qptr(i,j,lev_input:1:-1) + qptr(i,j,:) = qptr(i,j,lev_input:1:-1) end do end do - end do - - do i = clb(1),cub(1) + end do + + do i = clb(1),cub(1) do j = clb(2),cub(2) presptr(i,j,:) = rlevs(lev_input:1:-1) tptr(i,j,:) = tptr(i,j,lev_input:1:-1) @@ -2829,17 +2895,39 @@ subroutine read_input_atm_grib2_file(localpet) vptr(i,j,:) = vptr(i,j,lev_input:1:-1) wptr(i,j,:) = wptr(i,j,lev_input:1:-1) end do - end do + end do - if (localpet == 0) then - print*,'psfc is ',clb(1),clb(2),psptr(clb(1),clb(2)) - print*,'pres is ',cub(1),cub(2),presptr(cub(1),cub(2),:) - - print*,'pres check 1',localpet,maxval(presptr(clb(1):cub(1),clb(2):cub(2),1)), & - minval(presptr(clb(1):cub(1),clb(2):cub(2),1)) - print*,'pres check lev',localpet,maxval(presptr(clb(1):cub(1),clb(2):cub(2), & - lev_input)),minval(presptr(clb(1):cub(1),clb(2):cub(2),lev_input)) + if (localpet == 0) then + print*,'psfc is ',clb(1),clb(2),psptr(clb(1),clb(2)) + print*,'pres is ',cub(1),cub(2),presptr(cub(1),cub(2),:) + + print*,'pres check 1',localpet,maxval(presptr(clb(1):cub(1),clb(2):cub(2),1)), & + minval(presptr(clb(1):cub(1),clb(2):cub(2),1)) + print*,'pres check lev',localpet,maxval(presptr(clb(1):cub(1),clb(2):cub(2), & + lev_input)),minval(presptr(clb(1):cub(1),clb(2):cub(2),lev_input)) + endif + +else + ! For native files, read in pressure field directly from file but don't flip levels + if (localpet == 0) then + print*,"- READ PRESSURE." + vname = ":PRES:" + do vlev = 1, lev_input + iret = grb2_inq(the_file,inv_file,vname,slevs(vlev),data2=dummy2d) + if (iret<=0) then + call error_handler("READING IN PRESSURE AT LEVEL "//trim(slevs(vlev)),iret) + endif + dummy3d(:,:,vlev) = real(dummy2d,esmf_kind_r8) + print*,'pres check after read ',vlev, dummy3d(1,1,vlev) + enddo + endif + + if (localpet == 0) print*,"- CALL FieldScatter FOR INPUT GRID PRESSURE." + call ESMF_FieldScatter(pres_input_grid, dummy3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) endif + deallocate(dummy3d) !--------------------------------------------------------------------------- ! Convert from 2-d to 3-d component winds. @@ -4498,31 +4586,44 @@ end subroutine read_input_sfc_netcdf_file subroutine read_input_sfc_grib2_file(localpet) use wgrib2api + use grib2_util, only : to_upper + use program_setup, only : vgtyp_from_climo, sotyp_from_climo + use model_grid, only : input_grid_type + use search_util + implicit none integer, intent(in) :: localpet character(len=250) :: the_file + character(len=250) :: geo_file character(len=20) :: vname, vname_file,slev character(len=50) :: method integer :: rc, varnum, iret, i, j,k + integer :: ncid2d, varid integer, parameter :: icet_default = 265.0 - logical :: exist + logical :: exist, rap_latlon real(esmf_kind_r4) :: value real(esmf_kind_r4), allocatable :: dummy2d(:,:),tsk_save(:,:),icec_save(:,:) - real(esmf_kind_r8), allocatable :: dummy2d_8(:,:) - real(esmf_kind_r8), allocatable :: dummy3d(:,:,:) + real(esmf_kind_r4), allocatable :: dummy1d(:) + real(esmf_kind_r8), allocatable :: dummy2d_8(:,:),dummy2d_82(:,:) + real(esmf_kind_r8), allocatable :: dummy3d(:,:,:), dummy3d_stype(:,:,:) integer(esmf_kind_i4), allocatable :: slmsk_save(:,:) + integer(esmf_kind_i8), allocatable :: dummy2d_i(:,:) + + rap_latlon = trim(to_upper(external_model))=="RAP" .and. trim(input_grid_type) == "rotated_latlon" the_file = trim(data_dir_input_grid) // "/" // trim(grib2_file_input_grid) - + geo_file = trim(geogrid_file_input_grid) + + print*,"- READ SFC DATA FROM GRIB2 FILE: ", trim(the_file) inquire(file=the_file,exist=exist) if (.not.exist) then @@ -4533,17 +4634,58 @@ subroutine read_input_sfc_grib2_file(localpet) lsoil_input = grb2_inq(the_file, inv_file, ':TSOIL:',' below ground:') print*, "- FILE HAS ", lsoil_input, " SOIL LEVELS" if (lsoil_input <= 0) call error_handler("COUNTING SOIL LEVELS.", rc) + + !We need to recreate the soil fields if we have something other than 4 levels + if (lsoil_input /= 4) then + + call ESMF_FieldDestroy(soil_temp_input_grid, rc=rc) + call ESMF_FieldDestroy(soilm_tot_input_grid, rc=rc) + call ESMF_FieldDestroy(soilm_liq_input_grid, rc=rc) + + print*,"- CALL FieldCreate FOR INPUT SOIL TEMPERATURE." + soil_temp_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lsoil_input/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- CALL FieldCreate FOR INPUT TOTAL SOIL MOISTURE." + soilm_tot_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lsoil_input/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- CALL FieldCreate FOR INPUT LIQUID SOIL MOISTURE." + soilm_liq_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lsoil_input/), rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + endif if (localpet == 0) then allocate(dummy2d(i_input,j_input)) allocate(slmsk_save(i_input,j_input)) + allocate(dummy2d_i(i_input,j_input)) allocate(tsk_save(i_input,j_input)) allocate(icec_save(i_input,j_input)) allocate(dummy2d_8(i_input,j_input)) + allocate(dummy2d_82(i_input,j_input)) allocate(dummy3d(i_input,j_input,lsoil_input)) + allocate(dummy3d_stype(i_input,j_input,16)) + allocate(dummy1d(16)) else allocate(dummy3d(0,0,0)) allocate(dummy2d_8(0,0)) + allocate(dummy2d_82(0,0)) allocate(dummy2d(0,0)) endif @@ -4582,8 +4724,8 @@ subroutine read_input_sfc_grib2_file(localpet) !---------------------------------------------------------------------------------- ! GFS v14 and v15.2 grib data has two land masks. LANDN is created by ! nearest neighbor interpolation. LAND is created by bilinear interpolation. -! LANDN matches the bitmap. So use it first. For other GFS versions, use LAND. -! Mask in grib file is '1' (land), '0' (not land). Add sea/lake ice category +! LANDN matches the bitmap. So use it first. For other GFS versions or other models, +! use LAND. Mask in grib file is '1' (land), '0' (not land). Add sea/lake ice category ! '2' based on ice concentration. !---------------------------------------------------------------------------------- @@ -4647,7 +4789,7 @@ subroutine read_input_sfc_grib2_file(localpet) if(dummy2d(i,j) == grb2_UNDEFINED) dummy2d(i,j) = 0.0_esmf_kind_r4 enddo enddo -! print*,'weasd ',maxval(dummy2d),minval(dummy2d) + print*,'weasd ',maxval(dummy2d),minval(dummy2d) endif print*,"- CALL FieldScatter FOR INPUT GRID SNOW LIQUID EQUIVALENT." @@ -4662,7 +4804,7 @@ subroutine read_input_sfc_grib2_file(localpet) where(dummy2d == grb2_UNDEFINED) dummy2d = 0.0_esmf_kind_r4 dummy2d = dummy2d*1000.0 ! Grib2 files have snow depth in (m), fv3 expects it in mm where(slmsk_save == 0) dummy2d = 0.0_esmf_kind_r4 -! print*,'snod ',maxval(dummy2d),minval(dummy2d) + print*,'snod ',maxval(dummy2d),minval(dummy2d) endif print*,"- CALL FieldScatter FOR INPUT GRID SNOW DEPTH." @@ -4727,9 +4869,100 @@ subroutine read_input_sfc_grib2_file(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN FieldScatter", rc) -! Soil type is not available. Set to a large negative fill value. + if (localpet == 0) then + print*,"- READ SOIL TYPE." + slev=":surface:" + vname=":SOTYP:" + rc = grb2_inq(the_file, inv_file, vname,slev, data2=dummy2d) + !failed => rc = 0 + if (rc <= 0 .and. (trim(to_upper(external_model))=="HRRR" .or. rap_latlon)) then + ! Some HRRR and RAP files don't have dominant soil type in the output, but the geogrid files + ! do, so this gives users the option to provide the geogrid file and use input soil + ! type + print*, "OPEN GEOGRID FILE ", trim(geo_file) + rc = nf90_open(geo_file,NF90_NOWRITE,ncid2d) + ! failed => rc < 0 + if (rc == 0) then + print*, "INQUIRE ABOUT SOIL TYPE FROM GEOGRID FILE" + rc = nf90_inq_varid(ncid2d,"SCT_DOM",varid) + ! failed => rc < 0 + if (rc<0) print*, "ERROR FINDING SCT_DOM IN GEOGRID FILE" + if (rc == 0) then + print*, "READ SOIL TYPE FROM GEOGRID FILE " + rc = nf90_get_var(ncid2d,varid,dummy2d) + ! failed => rc < 0 + if (rc<0) print*, "ERROR READING SCT_DOM FROM FILE" + print*, "min max dummy2d = ", minval(dummy2d), maxval(dummy2d) + endif + print*, "INQUIRE ABOUT SOIL TYPE FRACTIONS FROM GEOGRID FILE" + rc = nf90_inq_varid(ncid2d,"SOILCTOP",varid) + ! failed => rc < 0 + if (rc<0) print*, "ERROR FINDING SOILCTOP IN GEOGRID FILE" + if (rc == 0) then + print*, "READ SOIL TYPE FRACTIONS FROM GEOGRID FILE " + rc = nf90_get_var(ncid2d,varid,dummy3d_stype) + ! failed => rc < 0 + if (rc<0) print*, "ERROR READING SCT_DOM FROM FILE" + print*, "min max dummy3d_stype = ", minval(dummy3d_stype), maxval(dummy3d_stype) + endif - dummy2d_8 = -99999.0_esmf_kind_r8 + print*, "CLOSE GEOGRID FILE " + iret = nf90_close(ncid2d) + endif + + ! There's an issue with the geogrid file containing soil type water at land points. + ! This correction replaces the soil type at these points with the soil type with + ! the next highest fractional coverage. + do j = 1, j_input + do i = 1, i_input + if(dummy2d(i,j) == 14.0_esmf_kind_r4 .and. slmsk_save(i,j) == 1) then + dummy1d(:) = dummy3d_stype(i,j,:) + dummy1d(14) = 0.0_esmf_kind_r4 + dummy2d(i,j) = real(MAXLOC(dummy1d, 1),esmf_kind_r4) + endif + enddo + enddo + endif + + if ((rc <= 0 .and. trim(to_upper(external_model)) /= "HRRR" .and. .not. rap_latlon) & + .or. (rc < 0 .and. (trim(to_upper(external_model)) == "HRRR" .or. rap_latlon))) then + if (.not. sotyp_from_climo) then + call error_handler("COULD NOT FIND SOIL TYPE IN FILE. PLEASE SET SOTYP_FROM_CLIMO=.TRUE. . EXITING", rc) + else + vname = "sotyp" + call get_var_cond(vname,this_miss_var_method=method, this_miss_var_value=value, & + loc=varnum) + call handle_grib_error(vname, slev ,method,value,varnum,rc, var= dummy2d) + if (rc == 1) then ! missing_var_method == skip or no entry in varmap table + print*, "WARNING: "//trim(vname)//" NOT AVAILABLE IN FILE. WILL NOT "//& + "SCALE SOIL MOISTURE FOR DIFFERENCES IN SOIL TYPE. " + dummy2d(:,:) = -99999.0_esmf_kind_r4 + endif + endif + endif + + ! In the event that the soil type on the input grid still contains mismatches between + ! soil type and landmask, this correction is a last-ditch effort to replace these points + ! with soil type from a nearby land point. + if (.not. sotyp_from_climo) then + do j = 1, j_input + do i = 1, i_input + if(dummy2d(i,j) == 14.0_esmf_kind_r4 .and. slmsk_save(i,j) == 1) dummy2d(i,j) = -99999.9 + enddo + enddo + + dummy2d_8 = real(dummy2d,esmf_kind_r8) + dummy2d_i(:,:) = 0 + where(slmsk_save == 1) dummy2d_i = 1 + + call search(dummy2d_8,dummy2d_i,i_input,j_input,1,230) + endif + + print*,'sotype ',maxval(dummy2d_8),minval(dummy2d_8) + deallocate(dummy2d_i) + deallocate(dummy3d_stype) + endif + print*,"- CALL FieldScatter FOR INPUT GRID SOIL TYPE." call ESMF_FieldScatter(soil_type_input_grid,dummy2d_8, rootpet=0, rc=rc) @@ -4738,10 +4971,127 @@ subroutine read_input_sfc_grib2_file(localpet) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! Begin variables whose presence in grib2 files varies, but no climatological - ! data is - ! available, so we have to account for values in the varmap table + ! data is available, so we have to account for values in the varmap table !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + if (.not. vgfrc_from_climo) then + if (localpet == 0) then + print*,"- READ VEG FRACTION." + vname="vfrac" + slev=":surface:" + call get_var_cond(vname,this_miss_var_method=method, this_miss_var_value=value, & + loc=varnum) + !! Changing these for GSD internal runs using new HRRR files + vname=":VEG:" + rc= grb2_inq(the_file, inv_file, vname,slev, data2=dummy2d) + + if (rc > 1) then + rc= grb2_inq(the_file, inv_file, vname,slev,'n=1105:', data2=dummy2d) + if (rc <= 0) then + rc= grb2_inq(the_file, inv_file, vname,slev,'n=1101:', data2=dummy2d) + if (rc <= 0) then + rc= grb2_inq(the_file, inv_file, vname,slev,'n=1151:', data2=dummy2d) + if (rc <= 0) call error_handler("COULD NOT DETERMINE VEGETATION FRACTION IN FILE. & + RECORD NUMBERS MAY HAVE CHANGED. PLEASE SET VGFRC_FROM_CLIMO=.TRUE. EXITING", rc) + endif + endif + elseif (rc <= 0) then + call error_handler("COULD NOT FIND VEGETATION FRACTION IN FILE. & + PLEASE SET VGFRC_FROM_CLIMO=.TRUE. EXITING", rc) + endif + if(maxval(dummy2d) > 2.0) dummy2d = dummy2d / 100.0_esmf_kind_r4 + print*,'vfrac ',maxval(dummy2d),minval(dummy2d) + endif + + + print*,"- CALL FieldScatter FOR INPUT GRID VEG GREENNESS." + call ESMF_FieldScatter(veg_greenness_input_grid,real(dummy2d,esmf_kind_r8), rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + endif + + if (.not. minmax_vgfrc_from_climo) then + if (localpet == 0) then + print*,"- READ MIN VEG FRACTION." + vname="vfrac_min" + slev=":surface:" + call get_var_cond(vname,this_miss_var_method=method,this_miss_var_value=value, & + loc=varnum) + vname=":VEG:" + rc= grb2_inq(the_file, inv_file, vname,slev,'n=1106:',data2=dummy2d) + + if (rc <= 0) then + rc= grb2_inq(the_file, inv_file, vname,slev,'n=1102:',data2=dummy2d) + if (rc <= 0) then + rc= grb2_inq(the_file, inv_file, vname,slev,'n=1152:',data2=dummy2d) + if (rc<=0) call error_handler("COULD NOT FIND MIN VEGETATION FRACTION IN FILE. & + PLEASE SET MINMAX_VGFRC_FROM_CLIMO=.TRUE. . EXITING",rc) + endif + endif + if(maxval(dummy2d) > 2.0) dummy2d = dummy2d / 100.0_esmf_kind_r4 + print*,'vfrac min',maxval(dummy2d),minval(dummy2d) + + endif + + print*,"- CALL FieldScatter FOR INPUT GRID MIN VEG GREENNESS." + call ESMF_FieldScatter(min_veg_greenness_input_grid,real(dummy2d,esmf_kind_r8), rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + if (localpet == 0) then + print*,"- READ MAX VEG FRACTION." + vname="vfrac_max" + slev=":surface:" + call get_var_cond(vname,this_miss_var_method=method,this_miss_var_value=value, & + loc=varnum) + + vname=":VEG:" + rc= grb2_inq(the_file, inv_file, vname,slev,'n=1107:',data2=dummy2d) + if (rc <=0) then + rc= grb2_inq(the_file, inv_file, vname,slev,'n=1103:',data2=dummy2d) + if (rc <=0) then + rc= grb2_inq(the_file, inv_file, vname,slev,'n=1153:',data2=dummy2d) + if (rc <= 0) call error_handler("COULD NOT FIND MAX VEGETATION FRACTION IN FILE. & + PLEASE SET MINMAX_VGFRC_FROM_CLIMO=.TRUE. . EXITING",rc) + endif + endif + if(maxval(dummy2d) > 2.0) dummy2d = dummy2d / 100.0_esmf_kind_r4 + print*,'vfrac max',maxval(dummy2d),minval(dummy2d) + + endif !localpet==0 + + print*,"- CALL FieldScatter FOR INPUT GRID MAX VEG GREENNESS." + call ESMF_FieldScatter(max_veg_greenness_input_grid,real(dummy2d,esmf_kind_r8),rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + endif !minmax_vgfrc_from_climo + + if (.not. lai_from_climo) then + if (localpet == 0) then + print*,"- READ LAI." + vname="lai" + slev=":surface:" + call get_var_cond(vname,this_miss_var_method=method,this_miss_var_value=value, & + loc=varnum) + vname=":var0_7_198:" + rc= grb2_inq(the_file, inv_file, vname,slev,':n=1108:',data2=dummy2d) + if (rc <=0) then + rc= grb2_inq(the_file, inv_file, vname,slev,':n=1104:',data2=dummy2d) + if (rc <=0) then + rc= grb2_inq(the_file, inv_file, vname,slev,':n=1154:',data2=dummy2d) + if (rc <= 0) call error_handler("COULD NOT FIND LAI IN FILE. & + PLEASE SET LAI_FROM_CLIMO=.TRUE. . EXITING",rc) + endif + endif + print*,'lai',maxval(dummy2d),minval(dummy2d) + endif !localpet==0 + + print*,"- CALL FieldScatter FOR INPUT GRID LAI." + call ESMF_FieldScatter(lai_input_grid,real(dummy2d,esmf_kind_r8),rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + endif if (localpet == 0) then print*,"- READ SEAICE DEPTH." vname="hice" @@ -4929,7 +5279,6 @@ subroutine read_input_sfc_grib2_file(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN FieldScatter", rc) - deallocate(dummy2d) if (localpet == 0) then print*,"- READ LIQUID SOIL MOISTURE." @@ -4953,38 +5302,91 @@ subroutine read_input_sfc_grib2_file(localpet) call read_grib_soil(the_file,inv_file,vname,vname_file,dummy3d,rc) print*,'soilm ',maxval(dummy3d),minval(dummy3d) endif + + print*,"- CALL FieldScatter FOR INPUT TOTAL SOIL MOISTURE." + call ESMF_FieldScatter(soilm_tot_input_grid, dummy3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + +!---------------------------------------------------------------------------------------- +! Vegetation type is not available in some files. However, it is needed to identify +! permanent land ice points. At land ice, the total soil moisture is a flag value of +! '1'. Use this flag as a temporary solution. +!---------------------------------------------------------------------------------------- -!----------------------------------------------------------------------- -! Vegetation type is not available. However, it is needed to identify -! permanent land ice points. At land ice, the total soil moisture -! is a flag value of '1'. Use this flag as a temporary solution. -!----------------------------------------------------------------------- - + print*, "- CALL FieldGather for INPUT SOIL TYPE." + call ESMF_FieldGather(soil_type_input_grid, dummy2d_82, rootPet=0, tile=1, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) if (localpet == 0) then - dummy2d_8(:,:) = 0.0_esmf_kind_r8 + print*,"- READ VEG TYPE." + vname="vtype" + slev=":surface:" + call get_var_cond(vname,this_miss_var_method=method, this_miss_var_value=value, & + loc=varnum) + !Note: sometimes the grib files don't have this one named. Searching for this string + ! ensures that the data is found when it exists + + vname="var2_2" + rc= grb2_inq(the_file, inv_file, vname,"_0_198:",slev,' hour fcst:', data2=dummy2d) + if (rc <= 0) then + rc= grb2_inq(the_file, inv_file, vname,"_0_198:",slev,':anl:', data2=dummy2d) + if (rc <= 0) then + if (.not. vgtyp_from_climo) then + call error_handler("COULD NOT FIND VEGETATION TYPE IN FILE. PLEASE SET VGTYP_FROM_CLIMO=.TRUE. . EXITING", rc) + else + do j = 1, j_input + do i = 1, i_input + dummy2d(i,j) = 0.0_esmf_kind_r4 + if(slmsk_save(i,j) == 1 .and. dummy3d(i,j,1) > 0.99) & + dummy2d(i,j) = real(veg_type_landice_input,esmf_kind_r4) + enddo + enddo + endif ! replace_vgtyp + endif !not find :anl: + endif !not find hour fcst: + + if (trim(external_model) .ne. "GFS") then do j = 1, j_input - do i = 1, i_input - if(slmsk_save(i,j) == 1_esmf_kind_i4 .and. dummy3d(i,j,1) > 0.99) & - dummy2d_8(i,j) = real(veg_type_landice_input,esmf_kind_r8) - enddo + do i = 1,i_input + if (dummy2d(i,j) == 15.0_esmf_kind_r4 .and. slmsk_save(i,j) == 1) then + if (dummy3d(i,j,1) < 0.6) then + dummy2d(i,j) = real(veg_type_landice_input,esmf_kind_r4) + elseif (dummy3d(i,j,1) > 0.99) then + slmsk_save(i,j) = 0 + dummy2d(i,j) = 0.0_esmf_kind_r4 + dummy2d_82(i,j) = 0.0_esmf_kind_r8 + endif + elseif (dummy2d(i,j) == 17.0_esmf_kind_r4 .and. slmsk_save(i,j)==0) then + dummy2d(i,j) = 0.0_esmf_kind_r4 + endif + enddo enddo - endif - + endif + dummy2d_8= real(dummy2d,esmf_kind_r8) + print*,'vgtyp ',maxval(dummy2d),minval(dummy2d) + endif !localpet + deallocate(dummy2d) print*,"- CALL FieldScatter FOR INPUT VEG TYPE." call ESMF_FieldScatter(veg_type_input_grid, dummy2d_8, rootpet=0, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN FieldScatter", rc) - print*,"- CALL FieldScatter FOR INPUT TOTAL SOIL MOISTURE." - call ESMF_FieldScatter(soilm_tot_input_grid, dummy3d, rootpet=0, rc=rc) + print*,"- CALL FieldScatter FOR INPUT VEG TYPE." + call ESMF_FieldScatter(soil_type_input_grid, dummy2d_82, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + print*,"- CALL FieldScatter FOR INPUT LANDSEA MASK." + call ESMF_FieldScatter(landsea_mask_input_grid,real(slmsk_save,esmf_kind_r8),rootpet=0, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& call error_handler("IN FieldScatter", rc) !--------------------------------------------------------------------------------- ! At open water (slmsk==0), the soil temperature array is not used and set ! to the filler value of SST. At lake/sea ice points (slmsk=2), the soil -! temperature array holds ice column temperature. That field is not available -! in GFS grib data, so set to a default value. +! temperature array holds ice column temperature. This field is not available +! in the grib data, so set to a default value. !--------------------------------------------------------------------------------- if (localpet == 0) then @@ -5604,6 +6006,166 @@ SUBROUTINE READ_FV3_GRID_DATA_NETCDF(FIELD,TILE_NUM,IMO,JMO,LMO, & ERROR = NF90_CLOSE(NCID) END SUBROUTINE READ_FV3_GRID_DATA_NETCDF + + !--------------------------------------------------------------------------- +! Read winds from a grib2 file +!--------------------------------------------------------------------------- + + subroutine read_winds(file,inv,u,v,localpet) + + use wgrib2api + use netcdf + use program_setup, only : get_var_cond, fix_dir_input_grid + use model_grid, only : input_grid_type + implicit none + + character(len=250), intent(in) :: file + character(len=10), intent(in) :: inv + integer, intent(in) :: localpet + real(esmf_kind_r8), intent(inout), allocatable :: u(:,:,:),v(:,:,:) + + real(esmf_kind_r4), dimension(i_input,j_input) :: alpha + real(esmf_kind_r8), dimension(i_input,j_input) :: lon, lat + real(esmf_kind_r4), allocatable :: u_tmp(:,:),v_tmp(:,:) + real(esmf_kind_r4), dimension(i_input,j_input) :: ws,wd + real(esmf_kind_r4) :: value_u, value_v,lov,latin1,latin2 + real(esmf_kind_r8) :: d2r + + integer :: varnum_u, varnum_v, vlev, & !ncid, id_var, & + error, iret, i,istr + + character(len=20) :: vname + character(len=50) :: method_u, method_v + character(len=250) :: file_coord, cmdline_msg + character(len=10000) :: temp_msg + + d2r=acos(-1.0_esmf_kind_r8) / 180.0_esmf_kind_r8 + if (localpet==0) then + allocate(u(i_input,j_input,lev_input)) + allocate(v(i_input,j_input,lev_input)) + else + allocate(u(0,0,0)) + allocate(v(0,0,0)) + endif + + file_coord = trim(fix_dir_input_grid)//"/latlon_grid3.32769.nc" + + vname = "u" + call get_var_cond(vname,this_miss_var_method=method_u, this_miss_var_value=value_u, & + loc=varnum_u) + vname = "v" + call get_var_cond(vname,this_miss_var_method=method_v, this_miss_var_value=value_v, & + loc=varnum_v) + + if (trim(input_grid_type)=="rotated_latlon") then + print*,"- CALL FieldGather FOR INPUT GRID LONGITUDE" + call ESMF_FieldGather(longitude_input_grid, lon, rootPet=0, tile=1, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + print*,"- CALL FieldGather FOR INPUT GRID LATITUDE" + call ESMF_FieldGather(latitude_input_grid, lat, rootPet=0, tile=1, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + + if (localpet==0) then + print*,"- CALCULATE ROTATION ANGLE FOR ROTATED_LATLON INPUT GRID" + error = grb2_inq(file, inv,grid_desc=temp_msg) + !1:0:grid_template=32769:winds(grid): + ! I am not an Arakawa E-grid. + ! I am rotated but have no rotation angle. + ! I am staggered. What am I? + ! (953 x 834) units 1e-06 input WE:SN output WE:SN res 56 + ! lat0 -10.590603 lat-center 54.000000 dlat 121.813000 + ! lon0 220.914154 lon-center 254.000000 dlon 121.813000 #points=794802 + + istr = index(temp_msg, "lat-center ") + len("lat_center ") + read(temp_msg(istr:istr+9),"(F8.5)") latin1 + istr = index(temp_msg, "lon-center ") + len("lon-center ") + read(temp_msg(istr:istr+10),"(F9.6)") lov + + print*, "- CALL CALCALPHA_ROTLATLON with center lat,lon = ",latin1,lov + call calcalpha_rotlatlon(lat,lon,latin1,lov,alpha) + print*, " alpha min/max = ",MINVAL(alpha),MAXVAL(alpha) + endif + elseif (trim(input_grid_type) == "lambert") then + !# NG this has been edited to correctly calculate gridrot for Lambert grids + ! Previously was incorrectly using polar-stereographic formation + print*,"- CALL FieldGather FOR INPUT GRID LONGITUDE" + call ESMF_FieldGather(longitude_input_grid, lon, rootPet=0, tile=1, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + + if (localpet==0) then + error = grb2_inq(file, inv,grid_desc=temp_msg) + !1:0:grid_template=30:winds(grid): + ! Lambert Conformal: (1799 x 1059) input WE:SN output WE:SN res 8 + ! Lat1 21.138123 Lon1 237.280472 LoV 262.500000 + ! LatD 38.500000 Latin1 38.500000 Latin2 38.500000 + ! LatSP 0.000000 LonSP 0.000000 + ! North Pole (1799 x 1059) Dx 3000.000000 m Dy 3000.000000 m mode 8 + + istr = index(temp_msg, "LoV ") + len("LoV ") + read(temp_msg(istr:istr+10),"(F9.6)") lov + istr = index(temp_msg, "Latin1 ") + len("Latin1 ") + read(temp_msg(istr:istr+9),"(F8.5)") latin1 + istr = index(temp_msg, "Latin2 ") + len("Latin2 ") + read(temp_msg(istr:istr+9),"(F8.5)") latin2 + + print*, "- CALL GRIDROT for LC grid with lov,latin1/2 = ",lov,latin1,latin2 + call gridrot(lov,latin1,latin2,lon,alpha) + print*, " alpha min/max = ",MINVAL(alpha),MAXVAL(alpha) + endif + endif + + if (localpet==0) then + do vlev = 1, lev_input + + vname = ":UGRD:" + iret = grb2_inq(file,inv,vname,slevs(vlev),data2=u_tmp) + if (iret <= 0) then + call handle_grib_error(vname, slevs(vlev),method_u,value_u,varnum_u,iret,var=u_tmp) + if (iret==1) then ! missing_var_method == skip + call error_handler("READING IN U AT LEVEL "//trim(slevs(vlev))//". SET A FILL "// & + "VALUE IN THE VARMAP TABLE IF THIS ERROR IS NOT DESIRABLE.",iret) + endif + endif + + vname = ":VGRD:" + iret = grb2_inq(file,inv,vname,slevs(vlev),data2=v_tmp) + if (iret <= 0) then + call handle_grib_error(vname, slevs(vlev),method_v,value_v,varnum_v,iret,var=v_tmp) + if (iret==1) then ! missing_var_method == skip + call error_handler("READING IN V AT LEVEL "//trim(slevs(vlev))//". SET A FILL "// & + "VALUE IN THE VARMAP TABLE IF THIS ERROR IS NOT DESIRABLE.",iret) + endif + endif + + if (trim(input_grid_type) == "latlon") then + if (external_model == 'UKMET') then + u(:,:,vlev) = u_tmp + v(:,:,vlev) = (v_tmp(:,2:jp1_input) + v_tmp(:,1:j_input))/2 + else + u(:,:,vlev) = u_tmp + v(:,:,vlev) = v_tmp + endif + else if (trim(input_grid_type) == "rotated_latlon") then + ws = sqrt(u_tmp**2 + v_tmp**2) + wd = atan2(-u_tmp,-v_tmp) / d2r ! calculate grid-relative wind direction + wd = wd + alpha + 180.0 ! Rotate from grid- to earth-relative direction + wd = 270.0 - wd ! Convert from meteorological (true N) to mathematical direction + u(:,:,vlev) = -ws*cos(wd*d2r) + v(:,:,vlev) = -ws*sin(wd*d2r) + else + u(:,:,vlev) = real(u_tmp * cos(alpha) + v_tmp * sin(alpha),esmf_kind_r8) + v(:,:,vlev) = real(v_tmp * cos(alpha) - u_tmp * sin(alpha),esmf_kind_r8) + endif + + print*, 'max, min U ', minval(u(:,:,vlev)), maxval(u(:,:,vlev)) + print*, 'max, min V ', minval(v(:,:,vlev)), maxval(v(:,:,vlev)) + enddo + endif + +end subroutine read_winds !--------------------------------------------------------------------------- ! Convert from 2-d to 3-d winds. @@ -5672,6 +6234,85 @@ subroutine convert_winds end subroutine convert_winds +!--------------------------------------------------------------------------- +! Compute grid rotation angle for non-latlon grids +!--------------------------------------------------------------------------- + +!# NG The original gridrot subroutine was specific to polar stereographic grids. +! We need to compute it for Lambert Conformal grids. So we need lat1,lat2 +! Note this follows the ncl_ncarg source code +! ncl_ncarg-6.6.2/ni/src/ncl/GetGrids.c +subroutine gridrot(lov,latin1,latin2,lon,rot) + + use model_grid, only : i_input,j_input + implicit none + + + real(esmf_kind_r4), intent(in) :: lov,latin1,latin2 + real(esmf_kind_r4), intent(inout) :: rot(i_input,j_input) + real(esmf_kind_r8), intent(in) :: lon(i_input,j_input) + + real(esmf_kind_r4) :: trot(i_input,j_input), tlon(i_input,j_input) + real(esmf_kind_r4) :: dtor = 3.14159265359/180.0_esmf_kind_r4 + real(esmf_kind_r4) :: an + !trot_tmp = real(lon,esmf_kind_r4)-lov + !trot = trot_tmp + !where(trot_tmp > 180.0) trot = trot-360.0_esmf_kind_r4 + !where(trot_tmp < -180.0) trot = trot-360.0_esmf_kind_r4 + + if ( (latin1 - latin2) .lt. 0.000001 ) then + an = sin(latin1*dtor) + else + an = log( cos(latin1*dtor) / cos(latin2*dtor) ) / & + log( tan(dtor*(90.0-latin1)/2.) / tan(dtor*(90.0-latin2)/2.)) + end if + + tlon = mod(lon - lov + 180. + 3600., 360.) - 180. + trot = an * tlon + + rot = trot * dtor + +end subroutine gridrot + +! Subroutine calcalpha_rotlatlon calculates rotation angle +! specific to rotated latlon grids, needed to convert to +! earth-relative winds +subroutine calcalpha_rotlatlon(latgrid,longrid,cenlat,cenlon,alpha) + + use model_grid, only : i_input,j_input + implicit none + + real(esmf_kind_r8), intent(in) :: latgrid(i_input,j_input), & + longrid(i_input,j_input) + real(esmf_kind_r4), intent(in) :: cenlat, cenlon + real(esmf_kind_r4), intent(out) :: alpha(i_input,j_input) + + ! Variables local to subroutine + real(esmf_kind_r8) :: D2R,lon0_r,lat0_r,sphi0,cphi0 + real(esmf_kind_r8), DIMENSION(i_input,j_input) :: tlat,tlon,tph,sinalpha + + D2R = acos(-1.0_esmf_kind_r8) / 180.0_esmf_kind_r8 + if (cenlon .lt. 0) then + lon0_r = (cenlon + 360.0)*D2R + else + lon0_r = cenlon*D2R + end if + lat0_r=cenlat*D2R + sphi0=sin(lat0_r) + cphi0=cos(lat0_r) + + ! deal with input lat/lon + tlat = latgrid * D2R + tlon = longrid * D2R + + ! Calculate alpha (rotation angle) + tlon = -tlon + lon0_r + tph = asin(cphi0*sin(tlat) - sphi0*cos(tlat)*cos(tlon)) + sinalpha = sphi0 * sin(tlon) / cos(tph) + alpha = -asin(sinalpha)/D2R + ! returns alpha in degrees +end subroutine calcalpha_rotlatlon + subroutine handle_grib_error(vname,lev,method,value,varnum, iret,var,var8,var3d) use, intrinsic :: ieee_arithmetic @@ -5748,9 +6389,13 @@ subroutine read_grib_soil(the_file,inv_file,vname,vname_file,dummy3d,rc) if(lsoil_input == 4) then slevs = (/character(24)::':0-0.1 m below ground:', ':0.1-0.4 m below ground:', & ':0.4-1 m below ground:', ':1-2 m below ground:'/) + elseif(lsoil_input == 9) then + slevs = (/character(26)::':0-0 m below ground',':0.01-0.01 m below ground:',':0.04-0.04 m below ground:', & + ':0.1-0.1 m below ground:',':0.3-0.3 m below ground:',':0.6-0.6 m below ground:', & + ':1-1 m below ground:',':1.6-1.6 m below ground:',':3-3 m below ground:'/) else rc = -1 - call error_handler("reading soil levels. File must have 4 soil levels.", rc) + call error_handler("reading soil levels. File must have 4 or 9 soil levels.", rc) endif call get_var_cond(vname,this_miss_var_method=method,this_miss_var_value=value, & @@ -5864,6 +6509,16 @@ subroutine cleanup_input_sfc_data call ESMF_FieldDestroy(veg_type_input_grid, rc=rc) call ESMF_FieldDestroy(z0_input_grid, rc=rc) call ESMF_FieldDestroy(terrain_input_grid, rc=rc) + if (.not. vgfrc_from_climo) then + call ESMF_FieldDestroy(veg_greenness_input_grid, rc=rc) + endif + if (.not. minmax_vgfrc_from_climo) then + call ESMF_FieldDestroy(min_veg_greenness_input_grid, rc=rc) + call ESMF_FieldDestroy(max_veg_greenness_input_grid, rc=rc) + endif + if (.not. lai_from_climo) then + call ESMF_FieldDestroy(lai_input_grid, rc=rc) + endif end subroutine cleanup_input_sfc_data diff --git a/sorc/chgres_cube.fd/model_grid.F90 b/sorc/chgres_cube.fd/model_grid.F90 index 84e84a7a3..5f207657e 100644 --- a/sorc/chgres_cube.fd/model_grid.F90 +++ b/sorc/chgres_cube.fd/model_grid.F90 @@ -56,6 +56,7 @@ module model_grid !-------------------------------------------------------------------------- use esmf + use ESMF_LogPublicMod implicit none @@ -63,8 +64,12 @@ module model_grid character(len=5), allocatable, public :: tiles_target_grid(:) character(len=10), public :: inv_file = "chgres.inv" + character(len=50), public :: input_grid_type = "latlon" + !character(len=100), public :: the_file_hrrr = "./HRRR_adj_rad.grib2" - integer, parameter, public :: lsoil_target = 4 ! # soil layers + ! Made lsoil_target non-parameter to allow for RAP land surface initiation + integer, public :: lsoil_target = 4 ! # soil layers + integer, public :: i_input, j_input integer, public :: ip1_input, jp1_input integer, public :: i_target, j_target @@ -109,7 +114,7 @@ module model_grid subroutine define_input_grid(localpet, npets) - use program_setup, only : input_type + use program_setup, only : input_type, external_model implicit none @@ -120,8 +125,10 @@ subroutine define_input_grid(localpet, npets) trim(input_type) == "gfs_sigio" .or. & trim(input_type) == "gaussian_netcdf") then call define_input_grid_gaussian(localpet, npets) - elseif (trim(input_type) == "grib2") then + elseif (trim(external_model) == "GFS" .and. trim(input_type) == "grib2") then call define_input_grid_gfs_grib2(localpet,npets) + elseif (trim(input_type) == "grib2") then + call define_input_grid_grib2(localpet,npets) else call define_input_grid_mosaic(localpet, npets) endif @@ -602,10 +609,8 @@ end subroutine define_input_grid_mosaic subroutine define_input_grid_gfs_grib2(localpet, npets) - use mpi - use wgrib2api - + use mpi use program_setup, only : data_dir_input_grid, & grib2_file_input_grid @@ -615,7 +620,8 @@ subroutine define_input_grid_gfs_grib2(localpet, npets) character(len=250) :: the_file - integer :: i, j, rc, clb(2), cub(2), ierr + integer :: i, j, rc, clb(2), cub(2) + integer :: ierr real(esmf_kind_r8), allocatable :: latitude(:,:) real(esmf_kind_r8), allocatable :: longitude(:,:) @@ -633,15 +639,15 @@ subroutine define_input_grid_gfs_grib2(localpet, npets) num_tiles_input_grid = 1 the_file = trim(data_dir_input_grid) // "/" // grib2_file_input_grid - if(localpet == 0) then + if (localpet == 0) then print*,'- OPEN AND INVENTORY GRIB2 FILE: ',trim(the_file) rc=grb2_mk_inv(the_file,inv_file) if (rc /=0) call error_handler("OPENING GRIB2 FILE",rc) endif -! Wait for localpet 0 to create inventory. +! Wait for localpet 0 to create inventory call mpi_barrier(mpi_comm_world, ierr) - + rc = grb2_inq(the_file,inv_file,':PRES:',':surface:',nx=i_input, ny=j_input, & lat=lat4, lon=lon4) if (rc /= 1) call error_handler("READING GRIB2 FILE", rc) @@ -788,12 +794,311 @@ subroutine define_input_grid_gfs_grib2(localpet, npets) end subroutine define_input_grid_gfs_grib2 + subroutine define_input_grid_grib2(localpet, npets) + + use mpi + use netcdf + use wgrib2api + use program_setup, only : grib2_file_input_grid, data_dir_input_grid, & + fix_dir_input_grid, external_model + implicit none + + character(len=500) :: the_file, temp_file + + integer, intent(in) :: localpet, npets + + integer :: error, extra, i, j, clb(2), cub(2) + + real(esmf_kind_r4), allocatable :: latitude_one_tile(:,:), lat_corners(:,:) + real(esmf_kind_r4), allocatable :: longitude_one_tile(:,:), lon_corners(:,:) + real(esmf_kind_r8) :: lat_target(i_target,j_target), & + lon_target(i_target,j_target) + real(esmf_kind_r8) :: deltalon, dx + integer :: ncid,id_var, id_dim + real(esmf_kind_r8), pointer :: lat_src_ptr(:,:), lon_src_ptr(:,:) + character(len=10000) :: cmdline_msg, temp_msg, temp_msg2 + character(len=10) :: temp_num = 'NA' + + num_tiles_input_grid = 1 + + !inv_file = "chgres.inv" + the_file = trim(data_dir_input_grid) // "/" // grib2_file_input_grid + temp_file = trim(fix_dir_input_grid)//"/latlon_grid3.32769.nc" + + call ESMF_FieldGather(latitude_target_grid, lat_target, rootPet=0, tile=1, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + call ESMF_FieldGather(longitude_target_grid, lon_target, rootPet=0, tile=1, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + + if (localpet==0) then + print*,'- OPEN AND INVENTORY GRIB2 FILE: ',trim(the_file) + error=grb2_mk_inv(the_file,inv_file) + if (error /=0) call error_handler("OPENING GRIB2 FILE",error) + error = grb2_inq(the_file, inv_file,grid_desc=temp_msg) + i = index(temp_msg, "grid_template=") + len("grid_template=") + j = index(temp_msg,":winds(") + temp_num=temp_msg(i:j-1) + endif + call MPI_BARRIER(MPI_COMM_WORLD, error) + call MPI_BCAST(temp_num,10,MPI_CHAR,0,MPI_COMM_WORLD,error) + + ! Wgrib2 can't properly read the lat/lon arrays of data on NCEP rotated lat/lon + ! grids, so read in lat/lon from fixed coordinate file + print*, 'temp num =', temp_num + if (trim(temp_num)=="3.32769" .or. trim(temp_num)=="32769") then + + input_grid_type = "rotated_latlon" + + error=nf90_open(trim(temp_file),nf90_nowrite,ncid) + call netcdf_err(error, 'opening: '//trim(temp_file)) + + error=nf90_inq_dimid(ncid, 'nx', id_dim) + call netcdf_err(error, 'reading nx id' ) + error=nf90_inquire_dimension(ncid,id_dim,len=i_input) + call netcdf_err(error, 'reading nx value' ) + + error=nf90_inq_dimid(ncid, 'ny', id_dim) + call netcdf_err(error, 'reading ny id' ) + error=nf90_inquire_dimension(ncid,id_dim,len=j_input) + call netcdf_err(error, 'reading ny value' ) + + allocate(longitude_one_tile(i_input,j_input)) + allocate(latitude_one_tile(i_input,j_input)) + + error=nf90_inq_varid(ncid, 'gridlat', id_var) + call netcdf_err(error, 'reading field id' ) + error=nf90_get_var(ncid, id_var, latitude_one_tile) + call netcdf_err(error, 'reading field' ) + + error=nf90_inq_varid(ncid, 'gridlon', id_var) + call netcdf_err(error, 'reading field id' ) + error=nf90_get_var(ncid, id_var, longitude_one_tile) + call netcdf_err(error, 'reading field' ) + + elseif (temp_num == "3.0" .or. temp_num == "3.30" .or. temp_num=="30" .or. temp_num == "0") then + + if (temp_num =="3.0" .or. temp_num == "0") input_grid_type = "latlon" + if (temp_num =="3.30" .or. temp_num=='30') input_grid_type = "lambert" + + error = grb2_inq(the_file,inv_file,':PRES:',':surface:',nx=i_input, ny=j_input, & + lat=latitude_one_tile, lon=longitude_one_tile) + if (error /= 1) call error_handler("READING FILE", error) + + + if (localpet==0) print*, "from file lon(1:10,1) = ", longitude_one_tile(1:10,1) + if (localpet==0) print*, "from file lat(1,1:10) = ", latitude_one_tile(1,1:10) + elseif (temp_num=="NA") then + error = 0 + call error_handler("Grid template number cannot be read from the input file. Please " //& + "check that the wgrib2 executable is in your path.", error) + else + error = 0 + call error_handler("Unknown input file grid template number. Must be one of: " //& + "3, 3.30, 3.32769", error) + endif + + print*,"- I/J DIMENSIONS OF THE INPUT GRID TILES ", i_input, j_input + + ip1_input = i_input + 1 + jp1_input = j_input + 1 + +!----------------------------------------------------------------------- +! Create ESMF grid object for the model grid. +!----------------------------------------------------------------------- + + extra = npets / num_tiles_input_grid + + print*,"- CALL GridCreateNoPeriDim FOR INPUT MODEL GRID" + input_grid = ESMF_GridCreateNoPeriDim(maxIndex=(/i_input,j_input/), & + indexflag=ESMF_INDEX_GLOBAL, & + rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridCreateNoPeriDim", error) + + +!----------------------------------------------------------------------- +! Read the mask and lat/lons. +!----------------------------------------------------------------------- + + print*,"- CALL FieldCreate FOR INPUT GRID LATITUDE." + latitude_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + name="input_grid_latitude", & + rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", error) + + print*,"- CALL FieldCreate FOR INPUT GRID LONGITUDE." + longitude_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + name="input_grid_longitude", & + rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", error) + + print*,"- CALL FieldScatter FOR INPUT GRID LATITUDE. " + call ESMF_FieldScatter(latitude_input_grid, real(latitude_one_tile,esmf_kind_r8), rootpet=0, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", error) + +print*,"- CALL FieldScatter FOR INPUT GRID LONGITUDE." + call ESMF_FieldScatter(longitude_input_grid, real(longitude_one_tile,esmf_kind_r8), rootpet=0, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", error) + + + print*,"- CALL GridAddCoord FOR INPUT GRID." + call ESMF_GridAddCoord(input_grid, & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridAddCoord", error) + + + print*,"- CALL GridGetCoord FOR INPUT GRID X-COORD." + nullify(lon_src_ptr) + call ESMF_GridGetCoord(input_grid, & + staggerLoc=ESMF_STAGGERLOC_CENTER, & + coordDim=1, & + farrayPtr=lon_src_ptr, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridGetCoord", error) + + print*,"- CALL GridGetCoord FOR INPUT GRID Y-COORD." + nullify(lat_src_ptr) + call ESMF_GridGetCoord(input_grid, & + staggerLoc=ESMF_STAGGERLOC_CENTER, & + coordDim=2, & + computationalLBound=clb, & + computationalUBound=cub, & + farrayPtr=lat_src_ptr, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridGetCoord", error) + + do j = clb(2),cub(2) + do i = clb(1), cub(1) + lon_src_ptr(i,j)=real(longitude_one_tile(i,j),esmf_kind_r8) + lat_src_ptr(i,j)=real(latitude_one_tile(i,j),esmf_kind_r8) + enddo + enddo + + print*,"- CALL GridAddCoord FOR INPUT GRID." + call ESMF_GridAddCoord(input_grid, & + staggerloc=ESMF_STAGGERLOC_CORNER, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridAddCoord", error) + + print*,"- CALL GridGetCoord FOR INPUT GRID X-COORD." + nullify(lon_src_ptr) + call ESMF_GridGetCoord(input_grid, & + staggerLoc=ESMF_STAGGERLOC_CORNER, & + coordDim=1, & + farrayPtr=lon_src_ptr, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridGetCoord", error) + + print*,"- CALL GridGetCoord FOR INPUT GRID Y-COORD." + nullify(lat_src_ptr) + call ESMF_GridGetCoord(input_grid, & + staggerLoc=ESMF_STAGGERLOC_CORNER, & + coordDim=2, & + computationalLBound=clb, & + computationalUBound=cub, & + farrayPtr=lat_src_ptr, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN GridGetCoord", error) + + print*,'bounds for corners ',localpet,clb(1),cub(1),clb(2),cub(2) + + ! If we have data on a lat/lon or lambert grid, create staggered coordinates + if(trim(input_grid_type)=="latlon" .or. trim(input_grid_type) == "lambert") then + if (trim(input_grid_type) == "latlon") then + + deltalon = abs(longitude_one_tile(2,1)-longitude_one_tile(1,1)) + do j = clb(2), cub(2) + do i = clb(1), cub(1) + + if (i == ip1_input) then + lon_src_ptr(i,j) = longitude_one_tile(i_input,1) + (0.5_esmf_kind_r8*deltalon) + else + lon_src_ptr(i,j) = longitude_one_tile(i,1) - (0.5_esmf_kind_r8*deltalon) + endif + + if (j == jp1_input) then + lat_src_ptr(i,j) = latitude_one_tile(1,j_input) + (0.5_esmf_kind_r8*deltalon) + else + lat_src_ptr(i,j) = latitude_one_tile(1,j) - (0.5_esmf_kind_r8*deltalon) + endif + + enddo + enddo + else + if (localpet==0) then + !cmdline_msg = "wgrib2 "//trim(the_file)//" -d 1 -grid &> temp2.out" + !call system(cmdline_msg) + !open(4,file="temp2.out") + !do i = 1,6 + ! read(4,"(A)") temp_msg2 + !enddo + !close(4) + print*, trim(temp_msg) + i = index(temp_msg, "Dx ") + len("Dx ") + j = index(temp_msg," m Dy") + read(temp_msg(i:j-1),"(F9.6)") dx + print*, "DX = ", dx + endif + call MPI_BARRIER(MPI_COMM_WORLD,error) + call MPI_BCAST(dx,1,MPI_REAL8,0,MPI_COMM_WORLD,error) + + call get_cell_corners(real(latitude_one_tile,esmf_kind_r8), & + real(longitude_one_tile, esmf_kind_r8), & + lat_src_ptr, lon_src_ptr, dx, clb, cub) + endif + elseif (trim(input_grid_type) == "rotated_latlon") then !Read the corner coords from file + + allocate(lon_corners(ip1_input,jp1_input)) + allocate(lat_corners(ip1_input,jp1_input)) + + error=nf90_inq_varid(ncid, 'gridlon_corners', id_var) + call netcdf_err(error, 'reading field id' ) + error=nf90_get_var(ncid, id_var, lon_corners) + call netcdf_err(error, 'reading field' ) + + error=nf90_inq_varid(ncid, 'gridlat_corners', id_var) + call netcdf_err(error, 'reading field id' ) + error=nf90_get_var(ncid, id_var, lat_corners) + call netcdf_err(error, 'reading field' ) + print*, 'min, max lat corners =', minval(lat_corners), maxval(lat_corners) + print*, 'min, max lon corners =', minval(lon_corners), maxval(lon_corners) + + do j = clb(2),cub(2) + do i = clb(1), cub(1) + lon_src_ptr(i,j)=real(lon_corners(i,j),esmf_kind_r8) + lat_src_ptr(i,j)=real(lat_corners(i,j),esmf_kind_r8) + enddo + enddo + + error= nf90_close(ncid) + endif + + nullify(lon_src_ptr) + nullify(lat_src_ptr) + + deallocate(longitude_one_tile) + deallocate(latitude_one_tile) + + end subroutine define_input_grid_grib2 + subroutine define_target_grid(localpet, npets) use netcdf use program_setup, only : mosaic_file_target_grid, & orog_dir_target_grid, & - orog_files_target_grid + orog_files_target_grid, & + nsoill_out implicit none @@ -817,6 +1122,8 @@ subroutine define_target_grid(localpet, npets) real(esmf_kind_r8), allocatable :: longitude_w_one_tile(:,:) real(esmf_kind_r8), allocatable :: terrain_one_tile(:,:) + lsoil_target = nsoill_out + print*,'- OPEN TARGET GRID MOSAIC FILE: ',trim(mosaic_file_target_grid) error=nf90_open(trim(mosaic_file_target_grid),nf90_nowrite,ncid) call netcdf_err(error, 'opening grid mosaic file') @@ -1200,6 +1507,84 @@ subroutine get_model_latlons(mosaic_file, orog_dir, num_tiles, tile, & error = nf90_close(ncid) end subroutine get_model_latlons + + !---------------------------------------------------------------------------------------- +! For grids with equal cell sizes (e.g., lambert conformal), get lat and on of the grid +! cell corners +!---------------------------------------------------------------------------------------- + + subroutine get_cell_corners( latitude, longitude, latitude_sw, longitude_sw, dx,clb,cub) + implicit none + + real(esmf_kind_r8), intent(in) :: latitude(i_input,j_input) + real(esmf_kind_r8), intent(inout), pointer :: latitude_sw(:,:) + real(esmf_kind_r8), intent(in) :: longitude(i_input, j_input) + real(esmf_kind_r8), intent(inout), pointer :: longitude_sw(:,:) + real(esmf_kind_r8), intent(in) :: dx !grid cell side size (m) + + integer, intent(in) :: clb(2), cub(2) + + real(esmf_kind_r8) :: lat1, lon1, lat2, lon2, d, brng + + + real(esmf_kind_r8), parameter :: pi = 3.14159265359 + real(esmf_kind_r8), parameter :: R = 6370000.0 + real(esmf_kind_r8), parameter :: bearingInDegrees = 135.0 + + integer :: i, j + + d = sqrt((dx**2.0_esmf_kind_r8)/2.0_esmf_kind_r8) + + do j = clb(2),cub(2) + do i = clb(1), cub(1) + + if (j == jp1_input .and. i == ip1_input) then + lat1 = latitude(i_input,j_input) * ( pi / 180.0_esmf_kind_r8 ) + lon1 = longitude(i_input,j_input) * ( pi / 180.0_esmf_kind_r8 ) + brng = 315.0_esmf_kind_r8 * pi / 180.0_esmf_kind_r8 + lat2 = asin( sin( lat1 ) * cos( d / R ) + cos( lat1 ) * sin( d / R ) * cos( brng ) ); + lon2= lon1 + atan2( sin( brng ) * sin( d / R ) * cos( lat1 ), cos( d / R ) - sin( lat1 ) * sin( lat2 ) ); + latitude_sw(ip1_input,jp1_input) = lat2 * 180.0_esmf_kind_r8 / pi + longitude_sw(ip1_input,jp1_input) = lon2 * 180.0_esmf_kind_r8 / pi + cycle + endif + + if (i == ip1_input) then + brng = 225.0_esmf_kind_r8 * pi / 180.0_esmf_kind_r8 + lat1 = latitude(i_input,j) * ( pi / 180.0_esmf_kind_r8 ) + lon1 = longitude(i_input,j) * ( pi / 180.0_esmf_kind_r8 ) + lat2 = asin( sin( lat1 ) * cos( d / R ) + cos( lat1 ) * sin( d / R ) * cos( brng ) ); + lon2= lon1 + atan2( sin( brng ) * sin( d / R ) * cos( lat1 ), cos( d / R ) - sin( lat1 ) * sin( lat2 ) ); + latitude_sw(ip1_input,j) = lat2 * 180.0_esmf_kind_r8 / pi + longitude_sw(ip1_input,j) = lon2 * 180.0_esmf_kind_r8 / pi + cycle + endif + + if (j == jp1_input) then + brng = 45.0_esmf_kind_r8 * pi / 180.0_esmf_kind_r8 + lat1 = latitude(i,j_input) * ( pi / 180.0_esmf_kind_r8 ) + lon1 = longitude(i,j_input) * ( pi / 180.0_esmf_kind_r8 ) + lat2 = asin( sin( lat1 ) * cos( d / R ) + cos( lat1 ) * sin( d / R ) * cos( brng ) ); + lon2= lon1 + atan2( sin( brng ) * sin( d / R ) * cos( lat1 ), cos( d / R ) - sin( lat1 ) * sin( lat2 ) ); + latitude_sw(i,jp1_input) = lat2 * 180.0_esmf_kind_r8 / pi + longitude_sw(i,jp1_input) = lon2 * 180.0_esmf_kind_r8 / pi + cycle + endif + + lat1 = latitude(i,j) * ( pi / 180.0_esmf_kind_r8 ) + lon1 = longitude(i,j) * ( pi / 180.0_esmf_kind_r8 ) + + brng = bearingInDegrees * ( pi / 180.0_esmf_kind_r8 ); + lat2 = asin( sin( lat1 ) * cos( d / R ) + cos( lat1 ) * sin( d / R ) * cos( brng ) ); + lon2= lon1 + atan2( sin( brng ) * sin( d / R ) * cos( lat1 ), cos( d / R ) - sin( lat1 ) * sin( lat2 ) ); + + latitude_sw(i,j) = lat2 * 180.0_esmf_kind_r8 / pi + longitude_sw(i,j) = lon2 * 180.0_esmf_kind_r8 / pi + + enddo + enddo + + end subroutine get_cell_corners !----------------------------------------------------------------------- ! Read the model land mask and terrain for a single tile. diff --git a/sorc/chgres_cube.fd/program_setup.f90 b/sorc/chgres_cube.fd/program_setup.f90 index ed6935457..6340e13b8 100644 --- a/sorc/chgres_cube.fd/program_setup.f90 +++ b/sorc/chgres_cube.fd/program_setup.f90 @@ -36,10 +36,6 @@ module program_setup ! target grids. ! fix_dir_target_grid Directory containing target grid ! pre-computed fixed data (ex: soil type) -! grib2_file_input_grid File name of grib2 input data. -! Assumes atmospheric and surface data -! are in a single file. 'grib2' input -! type only. ! halo_blend Number of row/cols of blending halo, ! where model tendencies and lateral ! boundary tendencies are applied. @@ -56,7 +52,7 @@ module program_setup ! nemsio files; ! (4) "gaussian_netcdf" for fv3 gaussian ! netcdf files. -! (5) "grib2" for fv3gfs grib2 files. +! (5) "grib2" for grib2 files. ! (6) "gfs_gaussian_nemsio" for spectral gfs ! gaussian nemsio files ! (7) "gfs_sigio" for spectral gfs @@ -98,16 +94,71 @@ module program_setup ! These names will be used to identify ! the tracer records in the output files. ! Follows the convention in the field table. +! FOR GRIB2 FILES: Not used. Tracers instead taken +! from the varmap file. ! tracers_input Name of each atmos tracer record in ! the input file. May be different from ! value in 'tracers'. +! FOR GRIB2 FILES: Not used. Tracers instead taken +! from the varmap file. ! use_thomp_mp_climo When true, read and process Thompson ! MP climatological tracers. False, ! when 'thomp_mp_climo_file' is NULL. ! vcoord_file_target_grid Vertical coordinate definition file ! wltsmc_input/target Wilting point soil moisture content ! input/target grids -! +! +! nsoill_out Number of soil levels desired in the output data. +! chgres_cube can interpolate from 9 input to 4 output +! levels. +! DEFAULT: 4 +! +! Variables that are relevant only for "grib2" input type: +! +! grib2_file_input_grid REQUIRED. File name of grib2 input data. +! Assumes atmospheric and surface data are in a single +! file. +! +! varmap_file REQUIRED. Full path of the relevant varmap file. +! +! external_model The model that the input data is derived from. Current +! supported options are: "GFS", "HRRR", "NAM", "RAP". +! Default: "GFS" +! +! vgtyp_from_climo If false, interpolate vegetation type from the input +! data to the target grid instead of using data from +! static data. Use with caution as vegetation categories +! can vary. +! Default: False +! +! sotyp_from_climo If false, interpolate soil type from the input +! data to the target grid instead of using data from +! static data. Use with caution as the code assumes +! input soil type use STATSGO soil categories. +! Default: False +! +! vgfrc_from_climo If false, interpolate vegetation fraction from the input +! data to the target grid instead of using data from +! static data. Use with caution as vegetation categories +! can vary. +! Default: False +! +! minmax_vgfrc_from_climo If false, interpolate min/max vegetation fraction from +! the input data to the target grid instead of using data +! from static data. Use with caution as vegetation +! categories can vary. +! Default: False +! +! lai_from_climo If false, interpolate leaf area index from the input +! data to the target grid instead of using data from +! static data. +! Default: False +! +! tg3_from_soil If false, use lowest level soil temperature for the +! base soil temperature instead of using data from +! static data. +! Default: False +! !-------------------------------------------------------------------------- implicit none @@ -124,6 +175,7 @@ module program_setup character(len=500), public :: mosaic_file_target_grid = "NULL" character(len=500), public :: nst_files_input_grid = "NULL" character(len=500), public :: grib2_file_input_grid = "NULL" + character(len=500), public :: geogrid_file_input_grid = "NULL" character(len=500), public :: orog_dir_input_grid = "NULL" character(len=500), public :: orog_files_input_grid(6) = "NULL" character(len=500), public :: orog_dir_target_grid = "NULL" @@ -134,7 +186,12 @@ module program_setup character(len=6), public :: cres_target_grid = "NULL" character(len=500), public :: atm_weight_file="NULL" character(len=25), public :: input_type="restart" - character(len=20), public :: phys_suite="GFS" !Default to gfs physics suite + character(len=20), public :: external_model="GFS" !Default assume gfs data + + + + character(len=500), public :: fix_dir_input_grid = "NULL" + integer, parameter, public :: max_tracers=100 integer, public :: num_tracers, num_tracers_input @@ -154,11 +211,20 @@ module program_setup integer, public :: regional = 0 integer, public :: halo_bndy = 0 integer, public :: halo_blend = 0 + integer, public :: nsoill_out = 4 logical, public :: convert_atm = .false. logical, public :: convert_nst = .false. logical, public :: convert_sfc = .false. - + + ! Options for replacing vegetation/soil type, veg fraction, and lai with data from the grib2 file + ! Default is to use climatology instead + logical, public :: vgtyp_from_climo = .true. + logical, public :: sotyp_from_climo = .true. + logical, public :: vgfrc_from_climo = .true. + logical, public :: minmax_vgfrc_from_climo = .true. + logical, public :: lai_from_climo = .true. + logical, public :: tg3_from_soil = .false. logical, public :: use_thomp_mp_climo=.false. real, allocatable, public :: drysmc_input(:), drysmc_target(:) @@ -199,16 +265,26 @@ subroutine read_setup_namelist atm_core_files_input_grid, & atm_tracer_files_input_grid, & grib2_file_input_grid, & + geogrid_file_input_grid, & data_dir_input_grid, & vcoord_file_target_grid, & cycle_mon, cycle_day, & cycle_hour, convert_atm, & convert_nst, convert_sfc, & + vgtyp_from_climo, & + sotyp_from_climo, & + vgfrc_from_climo, & + minmax_vgfrc_from_climo, & + lai_from_climo, tg3_from_soil, & regional, input_type, & + external_model, & atm_weight_file, tracers, & - tracers_input,phys_suite, & + tracers_input, & halo_bndy, & - halo_blend, thomp_mp_climo_file + halo_blend, & + fix_dir_input_grid, & + nsoill_out, & + thomp_mp_climo_file print*,"- READ SETUP NAMELIST" @@ -219,7 +295,7 @@ subroutine read_setup_namelist close (41) call to_lower(input_type) - call to_upper(phys_suite) +! call to_upper(phys_suite) orog_dir_target_grid = trim(orog_dir_target_grid) // '/' orog_dir_input_grid = trim(orog_dir_input_grid) // '/' @@ -229,7 +305,7 @@ subroutine read_setup_namelist !------------------------------------------------------------------------- is = index(mosaic_file_target_grid, "/", .true.) - ie = index(mosaic_file_target_grid, "_mosaic") + ie = index(mosaic_file_target_grid, "mosaic") - 1 if (is == 0 .or. ie == 0) then call error_handler("CANT DETERMINE CRES FROM MOSAIC FILE.", 1) @@ -293,6 +369,45 @@ subroutine read_setup_namelist case default call error_handler("UNRECOGNIZED INPUT DATA TYPE.", 1) end select + +!------------------------------------------------------------------------- +! Ensure proper file variable provided for grib2 input +!------------------------------------------------------------------------- + + if (trim(input_type) == "grib2") then + if (trim(grib2_file_input_grid) == "NULL" .or. trim(grib2_file_input_grid) == "") then + call error_handler("FOR GRIB2 DATA, PLEASE PROVIDE GRIB2_FILE_INPUT_GRID", 1) + endif + endif + + !------------------------------------------------------------------------- +! For grib2 input, warn about possibly unsupported external model types +!------------------------------------------------------------------------- + + if (trim(input_type) == "grib2") then + if (.not. any((/character(4)::"GFS","NAM","RAP","HRRR"/)==trim(external_model))) then + call error_handler( "KNOWN SUPPORTED external_model INPUTS ARE GFS, NAM, RAP, AND HRRR. " // & + "IF YOU WISH TO PROCESS GRIB2 DATA FROM ANOTHER MODEL, YOU MAY ATTEMPT TO DO SO AT YOUR OWN RISK. " // & + "ONE WAY TO DO THIS IS PROVIDE NAM FOR external_model AS IT IS A RELATIVELY STRAIGHT-" // & + "FORWARD REGIONAL GRIB2 FILE. YOU MAY ALSO COMMENT OUT THIS ERROR MESSAGE IN " // & + "program_setup.f90 LINE 389. NO GUARANTEE IS PROVIDED THAT THE CODE WILL WORK OR "// & + "THAT THE RESULTING DATA WILL BE CORRECT OR WORK WITH THE ATMOSPHERIC MODEL.", 1) + endif + endif + +!------------------------------------------------------------------------- +! For grib2 hrrr input without geogrid file input, warn that soil moisture interpolation +! will be less accurate +!------------------------------------------------------------------------- + + if (trim(input_type) == "grib2" .and. trim(external_model)=="HRRR") then + if (trim(geogrid_file_input_grid) == "NULL" .or. trim(grib2_file_input_grid) == "") then + print*, "HRRR DATA DOES NOT CONTAIN SOIL TYPE INFORMATION. WITHOUT & + GEOGRID_FILE_INPUT_GRID SPECIFIED, SOIL MOISTURE INTERPOLATION MAY BE LESS & + ACCURATE. " + endif + endif + return if (trim(thomp_mp_climo_file) /= "NULL") then use_thomp_mp_climo=.true. @@ -346,6 +461,12 @@ subroutine read_varmap if(trim(var_type(k))=='T') then num_tracers = num_tracers + 1 tracers_input(num_tracers)=chgres_var_names(k) + if ((trim(chgres_var_names(k)) == "ice_aero" .or. trim(chgres_var_names(k)) == "liq_aero") .and. & + trim(thomp_mp_climo_file) .ne. "NULL" .and. trim(input_type) == "grib2") then + call error_handler("VARMAP TABLE CONTAINS TRACER ENTRIES FOR THOMPSON AEROSOLS liq_aero or "// & + "ice_aero. REMOVE THESE ENTRIES OR REMOVE THE NAMELIST ENTRY FOR "// & + "thomp_mp_climo_file AND TRY AGAIN.",1) + endif endif enddo close(14) diff --git a/sorc/chgres_cube.fd/search_util.f90 b/sorc/chgres_cube.fd/search_util.f90 index 58bb3cf37..e5bec9c53 100644 --- a/sorc/chgres_cube.fd/search_util.f90 +++ b/sorc/chgres_cube.fd/search_util.f90 @@ -19,7 +19,7 @@ module search_util contains - subroutine search (field, mask, idim, jdim, tile, field_num, latitude) + subroutine search (field, mask, idim, jdim, tile, field_num, latitude, terrain_land, soilt_climo) !----------------------------------------------------------------------- ! Replace undefined values on the model grid with a valid value at @@ -43,6 +43,8 @@ subroutine search (field, mask, idim, jdim, tile, field_num, latitude) integer(esmf_kind_i8), intent(in) :: mask(idim,jdim) real(esmf_kind_r8), intent(in), optional :: latitude(idim,jdim) + real(esmf_kind_r8), intent(in), optional :: terrain_land(idim,jdim) + real(esmf_kind_r8), intent(in), optional :: soilt_climo(idim,jdim) real(esmf_kind_r8), intent(inout) :: field(idim,jdim) @@ -53,6 +55,7 @@ subroutine search (field, mask, idim, jdim, tile, field_num, latitude) real :: default_value real(esmf_kind_r8) :: field_save(idim,jdim) + integer :: repl_nearby, repl_default !----------------------------------------------------------------------- ! Set default value. @@ -90,6 +93,18 @@ subroutine search (field, mask, idim, jdim, tile, field_num, latitude) default_value = 0.0 case (224) ! soil type, flag value to turn off soil moisture rescaling. default_value = -99999.9 + case (225) ! vegetation type, flag value to be replaced + default_value = -99999.9 + case (226) ! vegetation fraction, flag value to be replaced + default_value = 0.5 + case (227) ! max vegetation fraction, flag value to be replaced + default_value = 0.5 + case (228) ! min vegetation fraction, flag value to be replaced + default_value = 0.5 + case (229) ! lai, flag value to be replaced + default_value = 1.0 + case (230) ! soil type on the input grid + default_value = 11.0 case default print*,'- FATAL ERROR. UNIDENTIFIED FIELD NUMBER : ', field call mpi_abort(mpi_comm_world, 77, ierr) @@ -100,9 +115,10 @@ subroutine search (field, mask, idim, jdim, tile, field_num, latitude) !----------------------------------------------------------------------- field_save = field - + repl_nearby = 0 + repl_default = 0 !$OMP PARALLEL DO DEFAULT(NONE), & -!$OMP SHARED(IDIM,JDIM,MASK,FIELD_SAVE,FIELD,TILE,LATITUDE,DEFAULT_VALUE,FIELD_NUM), & +!$OMP SHARED(IDIM,JDIM,MASK,FIELD_SAVE,FIELD,TILE,LATITUDE,DEFAULT_VALUE,FIELD_NUM,REPL_NEARBY,REPL_DEFAULT,SOILT_CLIMO,TERRAIN_LAND), & !$OMP PRIVATE(I,J,KRAD,ISTART,IEND,JSTART,JEND,II,JJ) J_LOOP : do j = 1, jdim @@ -132,7 +148,10 @@ subroutine search (field, mask, idim, jdim, tile, field_num, latitude) if (mask(ii,jj) == 1 .and. field_save(ii,jj) > -9999.0) then field(i,j) = field_save(ii,jj) - write(6,100) tile,i,j,ii,jj,field(i,j) + ! write(6,100) field_num,tile,i,j,ii,jj,field(i,j) + ! When using non-GFS data, there are a lot of these print statements even + ! when everything is working correctly. Count instead of printing each + repl_nearby = repl_nearby + 1 cycle I_LOOP endif @@ -148,22 +167,39 @@ subroutine search (field, mask, idim, jdim, tile, field_num, latitude) elseif (field_num == 91) then ! sea ice fract if (abs(latitude(i,j)) > 55.0) then field(i,j) = default_value + repl_default = repl_default + 1 else field(i,j) = 0.0 + repl_default = repl_default + 1 endif + elseif (field_num == 7 .and. PRESENT(terrain_land)) then + ! Terrain heights for isolated landice points never get a correct value, so replace + ! with terrain height from the input grid interpolated to the target grid + field(i,j) = terrain_land(i,j) + repl_default = repl_default + 1 + elseif (field_num == 224 .and. PRESENT(soilt_climo)) then + ! When using input soil type fields instead of climatological data on the + ! target grid, isolated land locations that exist in the target grid but + ! not the input grid don't receiving proper soil type information, so replace + ! with climatological values + field(i,j) = soilt_climo(i,j) + repl_default = repl_default + 1 else field(i,j) = default_value ! Search failed. Use default value. + repl_default = repl_default + 1 endif - write(6,101) tile,i,j,field(i,j) + !write(6,101) field_num,tile,i,j,field(i,j) endif enddo I_LOOP enddo J_LOOP !$OMP END PARALLEL DO - 100 format(1x,"- MISSING POINT TILE: ",i2," I/J: ",i5,i5," SET TO VALUE AT: ",i5,i5,". NEW VALUE IS: ",f8.3) - 101 format(1x,"- MISSING POINT TILE: ",i2," I/J: ",i5,i5," SET TO DEFAULT VALUE OF: ",f8.3) +! 100 format(1x,"- MISSING POINT FIELD ",i4," TILE: ",i2," I/J: ",i5,i5," SET TO VALUE AT: ",i5,i5,". NEW VALUE IS: ",f8.3) +! 101 format(1x,"- MISSING POINT FIELD ",i4," TILE: ",i2," I/J: ",i5,i5," SET TO DEFAULT VALUE OF: ",f8.3) + print*, "- TOTAL POINTS FOR VAR ", field_num, " REPLACED BY NEARBY VALUES: ", repl_nearby + print*, "- TOTAL POINTS FOR VAR ", field_num, " REPLACED BY DEFAULT VALUE: ", repl_default end subroutine search diff --git a/sorc/chgres_cube.fd/surface.F90 b/sorc/chgres_cube.fd/surface.F90 index ce1b64198..7701534aa 100644 --- a/sorc/chgres_cube.fd/surface.F90 +++ b/sorc/chgres_cube.fd/surface.F90 @@ -68,6 +68,8 @@ module surface ! friction velocity type(esmf_field), public :: z0_target_grid ! roughness length + type(esmf_field), public :: lai_target_grid + ! leaf area index ! nst fields type(esmf_field), public :: c_d_target_grid @@ -96,6 +98,9 @@ module surface type(esmf_field) :: terrain_from_input_grid ! terrain height interpolated ! from input grid + type(esmf_field) :: terrain_from_input_grid_land + ! terrain height interpolated + ! from input grid at all land points real, parameter, private :: blim = 5.5 ! soil 'b' parameter limit @@ -120,9 +125,10 @@ subroutine surface_driver(localpet) read_input_nst_data use program_setup, only : calc_soil_params_driver, & - convert_nst - - use static_data, only : get_static_fields, & + convert_nst, & + vgtyp_from_climo, & + sotyp_from_climo + use static_data, only : get_static_fields, & cleanup_static_fields implicit none @@ -164,26 +170,54 @@ subroutine surface_driver(localpet) !----------------------------------------------------------------------- if (convert_nst) call create_nst_esmf_fields + +!----------------------------------------------------------------------- +! Adjust soil levels of input grid !! not implemented yet +!----------------------------------------------------------------------- + + call adjust_soil_levels(localpet) !----------------------------------------------------------------------- ! Horizontally interpolate fields. !----------------------------------------------------------------------- call interp(localpet) - + + !if (.not. (vgtyp_from_climo .or. sotyp_from_climo)) then + !--------------------------------------------------------------------------------------------- + ! Check for points where smois is too high to be a land point at a land point + !--------------------------------------------------------------------------------------------- + ! + !call check_smois_water + !endif + !--------------------------------------------------------------------------------------------- -! Adjust soil/landice column temperatures for any change in elevation between the +! Adjust soil/landice column temperatures for any change in elevation between +! the ! input and target grids. !--------------------------------------------------------------------------------------------- call adjust_soilt_for_terrain - + !--------------------------------------------------------------------------------------------- ! Rescale soil moisture for changes in soil type between the input and target grids. !--------------------------------------------------------------------------------------------- call rescale_soil_moisture + + !if (.not. (vgtyp_from_climo .or. sotyp_from_climo)) then + !--------------------------------------------------------------------------------------------- + ! Check soil moisture again for mismatches after rescale_soil_moisture subroutine + !--------------------------------------------------------------------------------------------- + ! call check_smois_land + + !--------------------------------------------------------------------------------------------- + ! Replacing values various land surface parameters at points identified as mis-masked in + ! check_smois_land + !--------------------------------------------------------------------------------------------- + ! call replace_land_sfcparams(localpet) + !endif !--------------------------------------------------------------------------------------------- ! Compute liquid portion of total soil moisture. !--------------------------------------------------------------------------------------------- @@ -283,7 +317,11 @@ subroutine interp(localpet) xzts_input_grid, & z_c_input_grid, & zm_input_grid, terrain_input_grid, & - veg_type_landice_input + veg_type_landice_input, & + veg_greenness_input_grid, & + max_veg_greenness_input_grid, & + min_veg_greenness_input_grid, & + lai_input_grid use model_grid, only : input_grid, target_grid, & i_target, j_target, & @@ -293,10 +331,22 @@ subroutine interp(localpet) seamask_target_grid, & latitude_target_grid - use program_setup, only : convert_nst, input_type - + use program_setup, only : convert_nst, & + vgtyp_from_climo, & + sotyp_from_climo, & + vgfrc_from_climo, & + minmax_vgfrc_from_climo, & + lai_from_climo, & + tg3_from_soil, & + external_model, & + input_type + use static_data, only : veg_type_target_grid, & - soil_type_target_grid + soil_type_target_grid, & + veg_greenness_target_grid, & + substrate_temp_target_grid,& + min_veg_greenness_target_grid,& + max_veg_greenness_target_grid use search_util @@ -356,6 +406,10 @@ subroutine interp(localpet) real(esmf_kind_r8), pointer :: landmask_input_ptr(:,:) real(esmf_kind_r8), pointer :: veg_type_input_ptr(:,:) real(esmf_kind_r8), allocatable :: veg_type_target_one_tile(:,:) + real(esmf_kind_r8), pointer :: veg_greenness_target_ptr(:,:) + real(esmf_kind_r8), pointer :: min_veg_greenness_target_ptr(:,:) + real(esmf_kind_r8), pointer :: max_veg_greenness_target_ptr(:,:) + real(esmf_kind_r8), pointer :: lai_target_ptr(:,:) type(esmf_regridmethod_flag) :: method type(esmf_routehandle) :: regrid_bl_no_mask @@ -459,8 +513,6 @@ subroutine interp(localpet) call error_handler("IN FieldRegridRelease", rc) !----------------------------------------------------------------------- -! Next, determine the sea ice fraction on target grid. -! ! First, set the mask on the target and input grids. !----------------------------------------------------------------------- @@ -485,8 +537,12 @@ subroutine interp(localpet) farrayPtr=seamask_target_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) - - mask_target_ptr = seamask_target_ptr + + print*,"- CALL FieldGet FOR TARGET GRID LANDMASK." + call ESMF_FieldGet(landmask_target_grid, & + farrayPtr=landmask_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) print*,"- CALL GridAddItem FOR INPUT GRID SEAMASK." call ESMF_GridAddItem(input_grid, & @@ -507,25 +563,176 @@ subroutine interp(localpet) farrayPtr=mask_input_ptr, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN GridGetItem", rc) - - mask_input_ptr = 1 - where (nint(landmask_input_ptr) == 1) mask_input_ptr = 0 - -!----------------------------------------------------------------------- -! Interpolate. -!----------------------------------------------------------------------- - - if (localpet == 0) then + + if (localpet == 0) then allocate(data_one_tile(i_target,j_target)) - allocate(data_one_tile2(i_target,j_target)) allocate(data_one_tile_3d(i_target,j_target,lsoil_target)) allocate(mask_target_one_tile(i_target,j_target)) else allocate(data_one_tile(0,0)) - allocate(data_one_tile2(0,0)) allocate(data_one_tile_3d(0,0,0)) allocate(mask_target_one_tile(0,0)) endif + + !----------------------------------------------------------------------- + ! Interpolate vegetation type to target grid if chosen in namelist and terrain + ! for use in replacing isolated bad terrain values + !----------------------------------------------------------------------- + + method=ESMF_REGRIDMETHOD_NEAREST_STOD + + isrctermprocessing = 1 + + mask_input_ptr = 0 + where (nint(landmask_input_ptr) == 1) mask_input_ptr = 1 + + mask_target_ptr = 0 + where (landmask_target_ptr == 1) mask_target_ptr = 1 + + print*,"- CALL FieldCreate FOR TERRAIN FROM INPUT GRID LAND." + terrain_from_input_grid_land = ESMF_FieldCreate(target_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- CALL FieldRegridStore for land fields." + call ESMF_FieldRegridStore(terrain_input_grid, & + terrain_from_input_grid_land, & + srcmaskvalues=(/0/), & + dstmaskvalues=(/0/), & + polemethod=ESMF_POLEMETHOD_NONE, & + srctermprocessing=isrctermprocessing, & + unmappedaction=ESMF_UNMAPPEDACTION_IGNORE, & + normtype=ESMF_NORMTYPE_FRACAREA, & + routehandle=regrid_all_land, & + regridmethod=method, & + unmappedDstList=unmapped_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldRegridStore", rc) + + print*,"- CALL Field_Regrid TERRAIN." + call ESMF_FieldRegrid(terrain_input_grid, & + terrain_from_input_grid_land, & + routehandle=regrid_all_land, & + termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldRegrid", rc) + + print*,"- CALL FieldGet FOR terrain from input grid at land." + call ESMF_FieldGet(terrain_from_input_grid_land, & + farrayPtr=terrain_from_input_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + l = lbound(unmapped_ptr) + u = ubound(unmapped_ptr) + + do ij = l(1), u(1) + call ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j) + terrain_from_input_ptr(i,j) = -9999.9 + enddo + nullify(terrain_from_input_ptr) + + do tile = 1, num_tiles_target_grid + + print*,"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile + call ESMF_FieldGather(landmask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + + print*,"- CALL FieldGather FOR TERRAIN FROM INPUT GRID: ", tile + call ESMF_FieldGather(terrain_from_input_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + + if (localpet == 0) then + allocate(land_target_one_tile(i_target,j_target)) + land_target_one_tile = 0 + where(mask_target_one_tile == 1) land_target_one_tile = 1 + call search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 7) + deallocate(land_target_one_tile) + endif + + print*,"- CALL FieldScatter FOR TERRAIN FROM INPUT GRID: ", tile + call ESMF_FieldScatter(terrain_from_input_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + enddo + + if(.not. vgtyp_from_climo) then + + do tile = 1, num_tiles_target_grid + print*,"-CALL FieldGather VEG TYPE TARGET GRID" + call ESMF_FieldGather(veg_type_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + + data_one_tile(:,:) = 0 + enddo + + print*,"- CALL FieldRegrid VEG TYPE." + call ESMF_FieldRegrid(veg_type_input_grid, & + veg_type_target_grid, & + routehandle=regrid_all_land, & + termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldRegrid", rc) + + print*,"- CALL FieldGet FOR TARGET grid veg type." + call ESMF_FieldGet(veg_type_target_grid, & + farrayPtr=veg_type_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + l = lbound(unmapped_ptr) + u = ubound(unmapped_ptr) + + do ij = l(1), u(1) + call ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j) + veg_type_target_ptr(i,j) = -9999.9 + enddo + + do tile = 1, num_tiles_target_grid + print*,"- CALL FieldGather FOR TARGET GRID VEG TYPE TILE: ", tile + call ESMF_FieldGather(veg_type_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + + print*,"- CALL FieldGather FOR TARGET LANDMASK TILE: ", tile + call ESMF_FieldGather(landmask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + + if (localpet == 0) then + allocate(land_target_one_tile(i_target,j_target)) + land_target_one_tile = 0 + where(mask_target_one_tile == 1) land_target_one_tile = 1 + call search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 225) + deallocate(land_target_one_tile) + endif + + print*,"- CALL FieldScatter FOR TARGET GRID VEG TYPE: ", tile + call ESMF_FieldScatter(veg_type_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + enddo + nullify(veg_type_target_ptr) + endif + print*,"- CALL FieldRegridRelease." + call ESMF_FieldRegridRelease(routehandle=regrid_all_land, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldRegridRelease", rc) + +!----------------------------------------------------------------------- +! Next, determine the sea ice fraction on target grid. +! Interpolate. +!----------------------------------------------------------------------- + + mask_input_ptr = 1 + where (nint(landmask_input_ptr) == 1) mask_input_ptr = 0 + + mask_target_ptr = seamask_target_ptr method=ESMF_REGRIDMETHOD_CONSERVE @@ -582,7 +789,7 @@ subroutine interp(localpet) call ESMF_FieldGather(seaice_fract_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) - + print*,"- CALL FieldGather FOR TARGET GRID MASK TILE: ", tile call ESMF_FieldGather(seamask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -602,7 +809,7 @@ subroutine interp(localpet) call ESMF_FieldGather(landmask_target_grid, mask_target_one_tile, rootPet=0, tile=tile, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) - + if (localpet == 0) then do j = 1, j_target @@ -713,7 +920,7 @@ subroutine interp(localpet) print*,"- CALL FieldGet FOR TARGET grid snow depth." call ESMF_FieldGet(snow_depth_target_grid, & farrayPtr=snow_depth_target_ptr, rc=rc) - if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) print*,"- CALL Field_Regrid for snow liq equiv." @@ -769,6 +976,9 @@ subroutine interp(localpet) call error_handler("IN FieldGather", rc) if (localpet == 0) then + ! I don't think is needed anymore with the more recent fixes to fill values in input_data + !if (count(landmask_target_ptr == 2) == 0) data_one_tile(:,:) =0.0_esmf_kind_r8 + where(mask_target_one_tile == 1) mask_target_one_tile = 0 where(mask_target_one_tile == 2) mask_target_one_tile = 1 call search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 92) @@ -1795,9 +2005,11 @@ subroutine interp(localpet) if (localpet == 0) then allocate (veg_type_target_one_tile(i_target,j_target)) allocate (land_target_one_tile(i_target,j_target)) + allocate (data_one_tile2(i_target,j_target)) else allocate (veg_type_target_one_tile(0,0)) allocate (land_target_one_tile(0,0)) + allocate (data_one_tile2(0,0)) endif do tile = 1, num_tiles_target_grid @@ -1827,9 +2039,14 @@ subroutine interp(localpet) call ESMF_FieldGather(terrain_from_input_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGather", rc) + + print*,"- CALL FieldGather FOR TERRAIN FROM INPUT GRID LAND, TILE: ", tile + call ESMF_FieldGather(terrain_from_input_grid_land, data_one_tile2, rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) if (localpet == 0) then - call search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 7) + call search(data_one_tile, land_target_one_tile, i_target, j_target, tile, 7, terrain_land=data_one_tile2) endif print*,"- CALL FieldScatter FOR TERRAIN FROM INPUT GRID, TILE: ", tile @@ -1937,6 +2154,45 @@ subroutine interp(localpet) termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldRegrid", rc) + + if (.not. vgfrc_from_climo) then + print*,"- CALL Field_Regrid for veg greenness over land." + call ESMF_FieldRegrid(veg_greenness_input_grid, & + veg_greenness_target_grid, & + routehandle=regrid_land, & + termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldRegrid", rc) + endif + + if (.not. minmax_vgfrc_from_climo) then + print*,"- CALL Field_Regrid for max veg greenness over land." + call ESMF_FieldRegrid(max_veg_greenness_input_grid, & + max_veg_greenness_target_grid, & + routehandle=regrid_land, & + termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldRegrid", rc) + + print*,"- CALL Field_Regrid for min veg greenness over land." + call ESMF_FieldRegrid(min_veg_greenness_input_grid, & + min_veg_greenness_target_grid, & + routehandle=regrid_land, & + termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldRegrid", rc) + endif + + if (.not. lai_from_climo) then + print*,"- CALL Field_Regrid for leaf area index over land." + call ESMF_FieldRegrid(lai_input_grid, & + lai_target_grid, & + routehandle=regrid_land, & + termorderflag=ESMF_TERMORDER_SRCSEQ, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldRegrid", rc) + + endif print*,"- CALL FieldGet FOR TARGET grid total soil moisture over land." call ESMF_FieldGet(soilm_tot_target_grid, & @@ -1968,9 +2224,38 @@ subroutine interp(localpet) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldGet", rc) + if (.not. vgfrc_from_climo) then + print*,"- CALL FieldGet FOR TARGET veg greenness." + call ESMF_FieldGet(veg_greenness_target_grid, & + farrayPtr=veg_greenness_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + endif + + if (.not. minmax_vgfrc_from_climo) then + print*,"- CALL FieldGet FOR TARGET max veg greenness." + call ESMF_FieldGet(max_veg_greenness_target_grid, & + farrayPtr=max_veg_greenness_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET min veg greenness." + call ESMF_FieldGet(min_veg_greenness_target_grid, & + farrayPtr=min_veg_greenness_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldGet", rc) + endif + + if (.not. lai_from_climo) then + print*,"- CALL FieldGet FOR TARGET lai." + call ESMF_FieldGet(lai_target_grid, & + farrayPtr=lai_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldGet", rc) + endif + l = lbound(unmapped_ptr) u = ubound(unmapped_ptr) - do ij = l(1), u(1) call ij_to_i_j(unmapped_ptr(ij), i_target, j_target, i, j) soilm_tot_target_ptr(i,j,:) = -9999.9 @@ -1978,6 +2263,10 @@ subroutine interp(localpet) skin_temp_target_ptr(i,j) = -9999.9 terrain_from_input_ptr(i,j) = -9999.9 soil_type_from_input_ptr(i,j) = -9999.9 + veg_greenness_target_ptr(i,j) = -9999.9 + max_veg_greenness_target_ptr(i,j) = -9999.9 + min_veg_greenness_target_ptr(i,j) = -9999.9 + lai_target_ptr(i,j) = -9999.9 enddo if (localpet == 0) then @@ -2038,24 +2327,103 @@ subroutine interp(localpet) call error_handler("IN FieldGather", rc) !--------------------------------------------------------------------------------------- -! grib2 data does not have soil type. Set soil type interpolated from input +! Some grib2 data does not have soil type. Set soil type interpolated from input ! grid to the target (model) grid soil type. This turns off the soil moisture ! rescaling. !--------------------------------------------------------------------------------------- - if (localpet == 0) then - if (trim(input_type) .ne. "grib2") then + if (.not. sotyp_from_climo) then + if (localpet==0) then + call search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 224,soilt_climo=data_one_tile2) + endif + else + if (localpet == 0 .and. maxval(data_one_tile) > 0 .and. (trim(external_model) .ne. "GFS" .or. trim(input_type) .ne. "grib2")) then + ! If soil type from the input grid has any non-zero points then soil type must exist for + ! use call search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 224) - else + elseif (localpet == 0) then data_one_tile = data_one_tile2 endif endif + + if (.not. sotyp_from_climo) then + print*,"- CALL FieldScatter FOR SOIL TYPE TARGET GRID, TILE: ", tile + call ESMF_FieldScatter(soil_type_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + endif print*,"- CALL FieldScatter FOR SOIL TYPE FROM INPUT GRID, TILE: ", tile call ESMF_FieldScatter(soil_type_from_input_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) + + + + if (.not. vgfrc_from_climo) then + print*,"- CALL FieldGather FOR TARGET GRID VEG GREENNESS, TILE: ", tile + call ESMF_FieldGather(veg_greenness_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + + if (localpet == 0 .and. maxval(data_one_tile) > 0.0) then + call search(data_one_tile, mask_target_one_tile, i_target, j_target, tile, 226) + endif + + print*,"- CALL FieldScatter FOR VEG GREENNESS TARGET GRID, TILE: ", tile + call ESMF_FieldScatter(veg_greenness_target_grid, data_one_tile, rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + endif + + if (.not. minmax_vgfrc_from_climo) then + print*,"- CALL FieldGather FOR TARGET GRID MAX VEG GREENNESS, TILE: ", tile + call ESMF_FieldGather(max_veg_greenness_target_grid, data_one_tile, rootPet=0,tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldGather", rc) + if (localpet == 0 .and. maxval(data_one_tile) > 0.0) then + call search(data_one_tile, mask_target_one_tile, i_target, j_target,tile, 227) + endif + + print*,"- CALL FieldScatter FOR MAX VEG GREENNESS TARGET GRID, TILE: ", tile + call ESMF_FieldScatter(max_veg_greenness_target_grid, data_one_tile, rootPet=0,tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + print*,"- CALL FieldGather FOR TARGET GRID MIN VEG GREENNESS, TILE: ", tile + call ESMF_FieldGather(min_veg_greenness_target_grid, data_one_tile,rootPet=0,tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldGather", rc) + + if (localpet == 0 .and. maxval(data_one_tile) > 0.0) then + call search(data_one_tile, mask_target_one_tile, i_target, j_target,tile,228) + endif + + + print*,"- CALL FieldScatter FOR MIN VEG GREENNESS TARGET GRID, TILE: ",tile + call ESMF_FieldScatter(min_veg_greenness_target_grid, data_one_tile,rootPet=0,tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + + endif + + if (.not. lai_from_climo) then + print*,"- CALL FieldGather FOR TARGET GRID LEAF AREA INDEX, TILE: ", tile + call ESMF_FieldGather(lai_target_grid, data_one_tile, rootPet=0,tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldGather", rc) + + if (localpet == 0 .and. maxval(data_one_tile) > 0.0) then + call search(data_one_tile, mask_target_one_tile, i_target, j_target,tile, 229) + endif + + print*,"- CALL FieldScatter FOR LEAF AREA INDEX TARGET GRID, TILE: ", tile + call ESMF_FieldScatter(lai_target_grid, data_one_tile, rootPet=0,tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldScatter", rc) + endif + print*,"- CALL FieldGather FOR TARGET GRID TOTAL SOIL MOISTURE, TILE: ", tile call ESMF_FieldGather(soilm_tot_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & @@ -2091,6 +2459,13 @@ subroutine interp(localpet) call ESMF_FieldScatter(soil_temp_target_grid, data_one_tile_3d, rootPet=0, tile=tile, rc=rc) if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & call error_handler("IN FieldScatter", rc) + + if (tg3_from_soil) then + print*,"- CALL FieldScatter FOR TARGET GRID SUBSTRATE TEMPERATURE, TILE: ", tile + call ESMF_FieldScatter(substrate_temp_target_grid, data_one_tile_3d(:,:,lsoil_target), rootPet=0, tile=tile, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + endif enddo @@ -2233,6 +2608,518 @@ subroutine calc_liq_soil_moisture end subroutine calc_liq_soil_moisture +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! This subroutine was previously used to correct for points with soil moisture that was +!! too high for land points. This happened when there was a mismatch between input and +!! target landmasks, specifically when input vegetation type was used to replace that +!! in the geogrid file. The functions performed by this subroutine are now performed +!! when the data is read in. Note that the target grid landmask is no longer modified +!! anywhere in the code, and the input data is modified instead. +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!subroutine check_smois_water +! +!use model_grid, only : landmask_target_grid +! +!use static_data, only : veg_type_target_grid, veg_greenness_target_grid, & +! soil_type_target_grid, max_veg_greenness_target_grid,& +! min_veg_greenness_target_grid, mxsno_albedo_target_grid, & +! alvsf_target_grid,alvwf_target_grid,& +! alnsf_target_grid,alnwf_target_grid +! +! implicit none +! +! integer :: clb(3), cub(3), i, j, rc +! +! integer(esmf_kind_r8), pointer :: landmask_ptr(:,:) +! +! real(esmf_kind_r8), pointer :: soilm_target_ptr(:,:,:), & +! alvsf_target_ptr(:,:), & +! alnsf_target_ptr(:,:), & +! alvwf_target_ptr(:,:), & +! alnwf_target_ptr(:,:), & +! veg_greenness_target_ptr(:,:), & +! min_veg_greenness_target_ptr(:,:), & +! max_veg_greenness_target_ptr(:,:), & +! canopy_mc_target_ptr(:,:), & +! mxsno_albedo_target_ptr(:,:), & +! soil_type_target_ptr(:,:), & +! veg_type_target_ptr(:,:) +! +! +! print*,"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK." +! call ESMF_FieldGet(landmask_target_grid, & +! farrayPtr=landmask_ptr, rc=rc) +! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & +! call error_handler("IN FieldGet", rc) +! +! print*,"- CALL FieldGet FOR SOIL MOIS TARGET GRID." +! call ESMF_FieldGet(soilm_tot_target_grid, & +! computationalLBound=clb, & +! computationalUBound=cub, & +! farrayPtr=soilm_target_ptr, rc=rc) +! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & +! call error_handler("IN FieldGet", rc) +! +! print*,"- CALL FieldGet FOR TARGET GRID SOIL TYPE." +! call ESMF_FieldGet(soil_type_target_grid, & +! farrayPtr=soil_type_target_ptr, rc=rc) +! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & +! call error_handler("IN FieldGet", rc) +! +! print*,"- CALL FieldGet FOR TARGET GRID VEG TYPE." +! call ESMF_FieldGet(veg_type_target_grid, & +! farrayPtr=veg_type_target_ptr, rc=rc) +! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & +! call error_handler("IN FieldGet", rc) +! +! print*,"- CALL FieldGet FOR TARGET GRID ALVSF." +! call ESMF_FieldGet(alvsf_target_grid, & +! farrayPtr=alvsf_target_ptr, rc=rc) +! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & +! call error_handler("IN FieldGet", rc) +! +! print*,"- CALL FieldGet FOR TARGET GRID ALNSF." +! call ESMF_FieldGet(alnsf_target_grid, & +! farrayPtr=alnsf_target_ptr, rc=rc) +! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & +! call error_handler("IN FieldGet", rc) +! +! print*,"- CALL FieldGet FOR TARGET GRID ALVWF." +! call ESMF_FieldGet(alvwf_target_grid, & +! farrayPtr=alvwf_target_ptr, rc=rc) +! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & +! call error_handler("IN FieldGet", rc) +! +! print*,"- CALL FieldGet FOR TARGET GRID ALNWF." +! call ESMF_FieldGet(alnwf_target_grid, & +! farrayPtr=alnwf_target_ptr, rc=rc) +! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & +! call error_handler("IN FieldGet", rc) +! +! print*,"- CALL FieldGet FOR TARGET GRID VEG FRAC." +! call ESMF_FieldGet(veg_greenness_target_grid, & +! farrayPtr=veg_greenness_target_ptr, rc=rc) +! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & +! call error_handler("IN FieldGet", rc) +! +! print*,"- CALL FieldGet FOR TARGET GRID MAX VEG FRAC." +! call ESMF_FieldGet(max_veg_greenness_target_grid, & +! farrayPtr=max_veg_greenness_target_ptr, rc=rc) +! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & +! call error_handler("IN FieldGet", rc) +! +! print*,"- CALL FieldGet FOR TARGET GRID MIN VEG FRAC." +! call ESMF_FieldGet(min_veg_greenness_target_grid, & +! farrayPtr=min_veg_greenness_target_ptr, rc=rc) +! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & +! call error_handler("IN FieldGet", rc) +! +! print*,"- CALL FieldGet FOR TARGET GRID CANOPY MC." +! call ESMF_FieldGet(canopy_mc_target_grid, & +! farrayPtr=canopy_mc_target_ptr, rc=rc) +! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & +! call error_handler("IN FieldGet", rc) +! +! print*,"- CALL FieldGet FOR TARGET GRID SNOW ALBEDO." +! call ESMF_FieldGet(mxsno_albedo_target_grid, & +! farrayPtr=mxsno_albedo_target_ptr, rc=rc) +! if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & +! call error_handler("IN FieldGet", rc) +! +! do i =clb(1),cub(1) +! do j = clb(2),cub(2) +! if (landmask_ptr(i,j)==1 .and. soilm_target_ptr(i,j,1) > 0.75 .and. nint(veg_type_target_ptr(i,j)) /= veg_type_landice_target) then +! !write(*,'(a,2i5,a,i3,f5.2,2i3)') "CORRECTING G.P.",i,j," FROM LAND TO SEA VALUES; & +! ! curr landmask, soilm, stype, vtype = ",landmask_ptr(i,j),& +! ! soilm_target_ptr(i,j,1),nint(soil_type_target_ptr(i,j)), & +! ! nint(veg_type_target_ptr(i,j)) +! soil_type_target_ptr(i,j) = 0.0 +! veg_type_target_ptr(i,J) = 0.0 +! landmask_ptr(i,j) = 0 +! alvsf_target_ptr(i,j) = 0.06 +! alvwf_target_ptr(i,j) = 0.06 +! alnsf_target_ptr(i,j) = 0.06 +! alnwf_target_ptr(i,j) = 0.06 +! min_veg_greenness_target_ptr(i,j) = 0.0 +! max_veg_greenness_target_ptr(i,j) = 0.0 +! veg_greenness_target_ptr(i,j) = 0.0 +! mxsno_albedo_target_ptr(i,j) = 0.0 +! canopy_mc_target_ptr(i,j) = 0.0 +! endif +! enddo +! enddo +! +!end subroutine check_smois_water + + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! When using vegetation type from the input data instead of the orography file, there +!! are frequently points with ~0 soil moisture at land points. For these points, set +!! values in all relevant target grid surface arrays to fill values (done in +!! check_smois_land) then run the search routine again to fill with appropriate values +!! from nearby points (done in replace_land_sfcparams). +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +subroutine check_smois_land + +use model_grid, only : landmask_target_grid + +use static_data, only : veg_type_target_grid, veg_greenness_target_grid, & + soil_type_target_grid, max_veg_greenness_target_grid,& + min_veg_greenness_target_grid, mxsno_albedo_target_grid, & + alvsf_target_grid,alvwf_target_grid,& + alnsf_target_grid,alnwf_target_grid,& + facsf_target_grid,facwf_target_grid, & + slope_type_target_grid + + implicit none + + integer :: clb(3), cub(3), i, j, rc + + integer(esmf_kind_r8), pointer :: landmask_ptr(:,:) + + real(esmf_kind_r8), pointer :: soilm_target_ptr(:,:,:), & + soilt_target_ptr(:,:,:), & + alvsf_target_ptr(:,:), & + alnsf_target_ptr(:,:), & + alvwf_target_ptr(:,:), & + alnwf_target_ptr(:,:), & + veg_greenness_target_ptr(:,:), & + min_veg_greenness_target_ptr(:,:), & + max_veg_greenness_target_ptr(:,:), & + canopy_mc_target_ptr(:,:), & + mxsno_albedo_target_ptr(:,:), & + soil_type_target_ptr(:,:), & + veg_type_target_ptr(:,:), & + facsf_target_ptr(:,:), & + facwf_target_ptr(:,:), & + slope_type_target_ptr(:,:) + + + print*,"- CALL FieldGet FOR TARGET GRID LAND-SEA MASK." + call ESMF_FieldGet(landmask_target_grid, & + farrayPtr=landmask_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR SOIL MOIS TARGET GRID." + call ESMF_FieldGet(soilm_tot_target_grid, & + computationalLBound=clb, & + computationalUBound=cub, & + farrayPtr=soilm_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR SOIL TEMP TARGET GRID." + call ESMF_FieldGet(soil_temp_target_grid, & + farrayPtr=soilt_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID SOIL TYPE." + call ESMF_FieldGet(soil_type_target_grid, & + farrayPtr=soil_type_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID SOIL TYPE." + call ESMF_FieldGet(slope_type_target_grid, & + farrayPtr=slope_type_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID VEG TYPE." + call ESMF_FieldGet(veg_type_target_grid, & + farrayPtr=veg_type_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID ALVSF." + call ESMF_FieldGet(alvsf_target_grid, & + farrayPtr=alvsf_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID ALNSF." + call ESMF_FieldGet(alnsf_target_grid, & + farrayPtr=alnsf_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID ALVWF." + call ESMF_FieldGet(alvwf_target_grid, & + farrayPtr=alvwf_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID ALNWF." + call ESMF_FieldGet(alnwf_target_grid, & + farrayPtr=alnwf_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + +print*,"- CALL FieldGet FOR TARGET GRID FACSF." + call ESMF_FieldGet(facsf_target_grid, & + farrayPtr=facsf_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID FACWF." + call ESMF_FieldGet(facwf_target_grid, & + farrayPtr=facwf_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID VEG FRAC." + call ESMF_FieldGet(veg_greenness_target_grid, & + farrayPtr=veg_greenness_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID MAX VEG FRAC." + call ESMF_FieldGet(max_veg_greenness_target_grid, & + farrayPtr=max_veg_greenness_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID MIN VEG FRAC." + call ESMF_FieldGet(min_veg_greenness_target_grid, & + farrayPtr=min_veg_greenness_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID CANOPY MC." + call ESMF_FieldGet(canopy_mc_target_grid, & + farrayPtr=canopy_mc_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + print*,"- CALL FieldGet FOR TARGET GRID SNOW ALBEDO." + call ESMF_FieldGet(mxsno_albedo_target_grid, & + farrayPtr=mxsno_albedo_target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + do i =clb(1),cub(1) + do j = clb(2),cub(2) + if (landmask_ptr(i,j)==1 .and. soilm_target_ptr(i,j,1) < 0.001 .and. nint(veg_type_target_ptr(i,j)) /= veg_type_landice_target) then !.and. & + WRITE(*,'(a,2i5,a,2i3)'), " CORRECTING G.P. ",i,j," PARAMS FROM SEA TO LAND & + VALUES; curr stype,vtype=", nint(soil_type_target_ptr(i,j)),nint(veg_type_target_ptr(i,j)) + ! Set values to missing so that search function can then replace + ! them with nearby point values (see replace_land_sfcparams) + ! subroutine) + soilm_target_ptr(i,j,:) = -99999.9 + soilt_target_ptr(i,j,:) = -99999.9 + + soil_type_target_ptr(i,j) = -99999.9 + veg_type_target_ptr(i,J) = -99999.9 + + alvsf_target_ptr(i,j) = -99999.9 + alvwf_target_ptr(i,j) = -99999.9 + alnsf_target_ptr(i,j) = -99999.9 + alnwf_target_ptr(i,j) = -99999.9 + facsf_target_ptr(i,j) = -99999.9 + facwf_target_ptr(i,j) = -99999.9 + min_veg_greenness_target_ptr(i,j) = -99999.9 + max_veg_greenness_target_ptr(i,j) = -99999.9 + veg_greenness_target_ptr(i,j) = -99999.9 + mxsno_albedo_target_ptr(i,j) = -99999.9 + canopy_mc_target_ptr(i,j) = -99999.9 + slope_type_target_ptr(i,j) = -99999.9 + end if + enddo + enddo + !search (field, mask, idim, jdim, tile, field_num, + !call search(soilm_target_ptr(clb(1):cub(1),clb(2):cub(2), +end subroutine check_smois_land + + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! When using vegetation type from the input data instead of the orography file, there +!! are frequently points with ~0 soil moisture at land points. For these points, set +!! values in all relevant target grid surface arrays to fill values (done in +!! check_smois_land) then run the search routine again to fill with appropriate values +!! from nearby points (done in replace_land_sfcparams). +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + subroutine replace_land_sfcparams(localpet) + + use search_util + use model_grid, only : lsoil_target, i_target, j_target, & + landmask_target_grid + use static_data, only : soil_type_target_grid, & + alvsf_target_grid, & + alvwf_target_grid, & + alnsf_target_grid, & + alnwf_target_grid, & + facsf_target_grid, & + facwf_target_grid, & + mxsno_albedo_target_grid, & + max_veg_greenness_target_grid, & + min_veg_greenness_target_grid, & + slope_type_target_grid, & + veg_greenness_target_grid, & + veg_type_target_grid + +!i_input, j_input, input_grid + implicit none + integer, intent(in) :: localpet + !character(len=1000) :: msg + integer :: rc, k_soil + integer(esmf_kind_i8) :: maskdata_one_tile(i_target,j_target) + real(esmf_kind_r8) :: soiltdata_one_tile_3d(i_target,j_target,lsoil_target), & + soilmdata_one_tile_3d(i_target,j_target,lsoil_target), & + soiltype_one_tile(i_target,j_target), & + alvsf_one_tile(i_target,j_target), & + alvwf_one_tile(i_target,j_target), & + alnsf_one_tile(i_target,j_target), & + alnwf_one_tile(i_target,j_target), & + facsf_one_tile(i_target,j_target), & + facwf_one_tile(i_target,j_target), & + mxsno_albedo_one_tile(i_target,j_target), & + max_veg_greenness_one_tile(i_target,j_target), & + min_veg_greenness_one_tile(i_target,j_target), & + slope_type_one_tile(i_target,j_target), & + veg_greenness_one_tile(i_target,j_target), & + veg_type_one_tile(i_target,j_target), & + canopy_mc_one_tile(i_target,j_target), & + tmp(i_target,j_target) + + !if (localpet==0) PRINT *, "STARTING SUBROUTINE replace_land_sfcparams" + call ESMF_FieldGather(landmask_target_grid, maskdata_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + + +! Now get all variables to call search routine for + call ESMF_FieldGather(soil_temp_target_grid, soiltdata_one_tile_3d, rootPet=0, tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(soilm_tot_target_grid, soilmdata_one_tile_3d, rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(soil_type_target_grid, soiltype_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(alvsf_target_grid, alvsf_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(alvwf_target_grid, alvwf_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(alnsf_target_grid, alnsf_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(alnwf_target_grid, alnwf_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(facsf_target_grid, facsf_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(facwf_target_grid, facwf_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(mxsno_albedo_target_grid,mxsno_albedo_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(max_veg_greenness_target_grid, max_veg_greenness_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(min_veg_greenness_target_grid, min_veg_greenness_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(slope_type_target_grid, slope_type_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(veg_greenness_target_grid, veg_greenness_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(veg_type_target_grid, veg_type_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + call ESMF_FieldGather(canopy_mc_target_grid,canopy_mc_one_tile,rootPet=0,tile=1,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__))& + call error_handler("IN FieldGather", rc) + if (localpet == 0) then + ! 2d vars + call search(soiltype_one_tile,maskdata_one_tile,i_target,j_target,1,224) + call search(alvsf_one_tile,maskdata_one_tile,i_target,j_target,1,0) + call search(alvwf_one_tile,maskdata_one_tile,i_target,j_target,1,0) + call search(alnsf_one_tile,maskdata_one_tile,i_target,j_target,1,0) + call search(alnwf_one_tile,maskdata_one_tile,i_target,j_target,1,0) + call search(facsf_one_tile,maskdata_one_tile,i_target,j_target,1,0) + call search(facwf_one_tile,maskdata_one_tile,i_target,j_target,1,0) + call search(mxsno_albedo_one_tile,maskdata_one_tile,i_target,j_target,1,0) + call search(max_veg_greenness_one_tile,maskdata_one_tile,i_target,j_target,1,226) + call search(min_veg_greenness_one_tile,maskdata_one_tile,i_target,j_target,1,226) + call search(slope_type_one_tile,maskdata_one_tile,i_target,j_target,1,0) + call search(veg_greenness_one_tile,maskdata_one_tile,i_target,j_target,1,226) + call search(veg_type_one_tile,maskdata_one_tile,i_target,j_target,1,225) + call search(canopy_mc_one_tile,maskdata_one_tile,i_target,j_target,1,223) + ! 3d vars + do k_soil = 1, lsoil_target + tmp = soiltdata_one_tile_3d(:,:,k_soil) + call search(tmp,maskdata_one_tile,i_target,j_target,1,85) + soiltdata_one_tile_3d(:,:,k_soil) = tmp + + tmp = soilmdata_one_tile_3d(:,:,k_soil) + call search(tmp,maskdata_one_tile,i_target,j_target,1,86) + soilmdata_one_tile_3d(:,:,k_soil) = tmp + end do + end if ! localpet + +! scatter data back to procs + call ESMF_FieldScatter(soilm_tot_target_grid, soilmdata_one_tile_3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(soil_temp_target_grid, soiltdata_one_tile_3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(soil_type_target_grid, soiltype_one_tile, rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(alvsf_target_grid, alvsf_one_tile, rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(alvwf_target_grid, alvwf_one_tile, rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(alnsf_target_grid, alnsf_one_tile, rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(alnwf_target_grid, alnwf_one_tile, rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(facsf_target_grid, facsf_one_tile, rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(facwf_target_grid, facwf_one_tile, rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(mxsno_albedo_target_grid, mxsno_albedo_one_tile, rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(max_veg_greenness_target_grid, max_veg_greenness_one_tile, rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(min_veg_greenness_target_grid, min_veg_greenness_one_tile, rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(slope_type_target_grid, slope_type_one_tile, rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(veg_greenness_target_grid, veg_greenness_one_tile, rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(veg_type_target_grid, veg_type_one_tile, rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + call ESMF_FieldScatter(canopy_mc_target_grid, canopy_mc_one_tile, rootpet=0,rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + +end subroutine replace_land_sfcparams + + FUNCTION FRH2O (TKELV,SMC,SH2O,SMCMAX,BEXP,PSIS) !$$$ function documentation block ! @@ -2500,7 +3387,6 @@ subroutine rescale_soil_moisture !--------------------------------------------------------------------------------------------- if (soilt_target /= soilt_input) then - !--------------------------------------------------------------------------------------------- ! Rescale top layer. First, determine direct evaporation part: !--------------------------------------------------------------------------------------------- @@ -2653,6 +3539,122 @@ subroutine adjust_soilt_for_terrain end subroutine adjust_soilt_for_terrain +!--------------------------------------------------------------------------------------------- +! Adjust soil levels of the input grid if there's a mismatch between input and +! target grids. Presently can only convert from 9 to 4 levels. +!--------------------------------------------------------------------------------------------- + + subroutine adjust_soil_levels(localpet) + use model_grid, only : lsoil_target, i_input, j_input, input_grid + use input_data, only : lsoil_input, soil_temp_input_grid, & + soilm_liq_input_grid, soilm_tot_input_grid + implicit none + integer, intent(in) :: localpet + character(len=1000) :: msg + integer :: rc + real(esmf_kind_r8) :: tmp(i_input,j_input), & + data_one_tile(i_input,j_input,lsoil_input), & + tmp3d(i_input,j_input,lsoil_target) + if (lsoil_input == 9 .and. lsoil_target == 4) then + print*, "CONVERTING FROM 9 INPUT SOIL LEVELS TO 4 TARGET SOIL LEVELS" + call ESMF_FieldGather(soil_temp_input_grid, data_one_tile, rootPet=0, tile=1, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + + call ESMF_FieldDestroy(soil_temp_input_grid,rc=rc) + soil_temp_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lsoil_target/), rc=rc) + + if(localpet==0)then + tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + & + (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + & + (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6 + tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5) !Linear approx. of 40 cm obs + tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + & + (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25 + tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + & + (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0) + tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8) !Linear approx of 200 cm obs + tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + & + (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4 + endif + + call ESMF_FieldScatter(soil_temp_input_grid, tmp3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + call ESMF_FieldGather(soilm_tot_input_grid, data_one_tile, rootPet=0, tile=1, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + + call ESMF_FieldDestroy(soilm_tot_input_grid,rc=rc) + soilm_tot_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lsoil_target/), rc=rc) + + if(localpet==0) then + tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + & + (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + & + (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6 + tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5) !Linear approx. of 40 cm obs + tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + & + (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25 + tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + & + (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0) + tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8) !Linear approx of 200 cm obs + tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + & + (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4 + endif + + call ESMF_FieldScatter(soilm_tot_input_grid, tmp3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + call ESMF_FieldGather(soilm_liq_input_grid, data_one_tile, rootPet=0, tile=1, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", rc) + + call ESMF_FieldDestroy(soilm_liq_input_grid,rc=rc) + soilm_liq_input_grid = ESMF_FieldCreate(input_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, & + ungriddedLBound=(/1/), & + ungriddedUBound=(/lsoil_target/), rc=rc) + if(localpet==0) then + tmp3d(:,:,1)= (data_one_tile(:,:,1) + data_one_tile(:,:,2))/2.0 * 0.1 + & + (data_one_tile(:,:,2) + data_one_tile(:,:,3))/2.0 * 0.3 + & + (data_one_tile(:,:,3) + data_one_tile(:,:,4))/2.0 * 0.6 + tmp = (data_one_tile(:,:,6) - data_one_tile(:,:,5)) / 30.0 * 10.0 + data_one_tile(:,:,5) !Linear approx. of 40 cm obs + tmp3d(:,:,2)= (data_one_tile(:,:,4) + data_one_tile(:,:,5)) / 2.0 * 0.75 + & + (data_one_tile(:,:,5) + tmp) / 2.0 * 0.25 + tmp3d(:,:,3)= (tmp + data_one_tile(:,:,6)) /2.0 * (1.0/3.0) + & + (data_one_tile(:,:,6) + data_one_tile(:,:,7)) / 2.0 * (2.0/3.0) + tmp = (data_one_tile(:,:,9) - data_one_tile(:,:,9)) / 140.0 * 40.0 + data_one_tile(:,:,8) !Linear approx of 200 cm obs + tmp3d(:,:,4)= (data_one_tile(:,:,7) + data_one_tile(:,:,8)) / 2.0 * 0.6 + & + (data_one_tile(:,:,8) + tmp) / 2.0 * 0.4 + endif + + call ESMF_FieldScatter(soilm_liq_input_grid, tmp3d, rootpet=0, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldScatter", rc) + + elseif (lsoil_input /= lsoil_target) then + rc = -1 + + write(msg,'("NUMBER OF SOIL LEVELS IN INPUT (",I2,") and OUPUT & + (",I2,") MUST EITHER BE EQUAL OR 9 AND 4, RESPECTIVELY")') & + lsoil_input, lsoil_target + + call error_handler(trim(msg), rc) + endif + + end subroutine adjust_soil_levels + !--------------------------------------------------------------------------------------------- ! Set roughness at land and sea ice. !--------------------------------------------------------------------------------------------- @@ -3474,6 +4476,21 @@ subroutine create_surface_esmf_fields call error_handler("IN FieldGet", rc) target_ptr = init_val + + print*,"- CALL FieldCreate FOR TARGET GRID LEAF AREA INDEX." + lai_target_grid = ESMF_FieldCreate(target_grid, & + typekind=ESMF_TYPEKIND_R8, & + staggerloc=ESMF_STAGGERLOC_CENTER, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldCreate", rc) + + print*,"- INITIALIZE TARGET leaf area index." + call ESMF_FieldGet(lai_target_grid, & + farrayPtr=target_ptr, rc=rc) + if(ESMF_logFoundError(rcToCheck=rc,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGet", rc) + + target_ptr = init_val print*,"- CALL FieldCreate FOR TARGET GRID Z0." z0_target_grid = ESMF_FieldCreate(target_grid, & @@ -3758,6 +4775,7 @@ subroutine cleanup_target_sfc_data call ESMF_FieldDestroy(canopy_mc_target_grid, rc=rc) call ESMF_FieldDestroy(z0_target_grid, rc=rc) call ESMF_FieldDestroy(terrain_from_input_grid, rc=rc) + call ESMF_FieldDestroy(terrain_from_input_grid_land, rc=rc) call ESMF_FieldDestroy(soil_type_from_input_grid, rc=rc) call ESMF_FieldDestroy(soil_temp_target_grid, rc=rc) call ESMF_FieldDestroy(soilm_tot_target_grid, rc=rc) diff --git a/sorc/chgres_cube.fd/write_data.F90 b/sorc/chgres_cube.fd/write_data.F90 index 0e04e7330..a05c824d8 100644 --- a/sorc/chgres_cube.fd/write_data.F90 +++ b/sorc/chgres_cube.fd/write_data.F90 @@ -1198,7 +1198,8 @@ subroutine write_fv3_atm_data_netcdf(localpet) use program_setup, only : halo=>halo_bndy, & input_type, tracers, num_tracers, & - use_thomp_mp_climo + use_thomp_mp_climo, & + regional use atmosphere, only : lev_target, & levp1_target, & @@ -1283,7 +1284,11 @@ subroutine write_fv3_atm_data_netcdf(localpet) HEADER : if (localpet < num_tiles_target_grid) then tile = localpet + 1 - WRITE(OUTFILE, '(A, I1, A)') 'out.atm.tile', tile, '.nc' + if (regional > 0) then + outfile = "out.atm.tile7.nc" + else + WRITE(OUTFILE, '(A, I1, A)') 'out.atm.tile', tile, '.nc' + endif !--- open the file error = nf90_create(outfile, IOR(NF90_NETCDF4,NF90_CLASSIC_MODEL), & @@ -1530,6 +1535,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) if (localpet < num_tiles_target_grid) then dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:j_end,:) dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1) + print*,"MIN MAX W AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:)) error = nf90_put_var( ncid, id_w, dum3d) call netcdf_err(error, 'WRITING VERTICAL VELOCITY RECORD' ) endif @@ -1680,6 +1686,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) if (localpet < num_tiles_target_grid) then dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:jp1_end,:) dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1) + print*,"MIN MAX US AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:)) error = nf90_put_var( ncid, id_u_s, dum3d) call netcdf_err(error, 'WRITING U_S RECORD' ) endif @@ -1696,6 +1703,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) if (localpet < num_tiles_target_grid) then dum3d(:,:,:) = data_one_tile_3d(i_start:i_end,j_start:jp1_end,:) dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1) + print*,"MIN MAX VS AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:)) error = nf90_put_var( ncid, id_v_s, dum3d) call netcdf_err(error, 'WRITING V_S RECORD' ) endif @@ -1760,6 +1768,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) if (localpet < num_tiles_target_grid) then dum3d(:,:,:) = data_one_tile_3d(i_start:ip1_end,j_start:j_end,:) dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1) + print*,"MIN MAX UW AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:)) error = nf90_put_var( ncid, id_u_w, dum3d) call netcdf_err(error, 'WRITING U_W RECORD' ) endif @@ -1776,6 +1785,7 @@ subroutine write_fv3_atm_data_netcdf(localpet) if (localpet < num_tiles_target_grid) then dum3d(:,:,:) = data_one_tile_3d(i_start:ip1_end,j_start:j_end,:) dum3d(:,:,1:lev_target) = dum3d(:,:,lev_target:1:-1) + print*,"MIN MAX VW AT WRITE = ", minval(dum3d(:,:,:)), maxval(dum3d(:,:,:)) error = nf90_put_var( ncid, id_v_w, dum3d) call netcdf_err(error, 'WRITING V_W RECORD' ) endif @@ -1804,7 +1814,8 @@ subroutine write_fv3_sfc_data_netcdf(localpet) longitude_target_grid, & i_target, j_target, lsoil_target - use program_setup, only : convert_nst, halo=>halo_bndy + use program_setup, only : convert_nst, halo=>halo_bndy, & + regional, lai_from_climo use surface, only : canopy_mc_target_grid, & f10m_target_grid, & @@ -1824,6 +1835,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) tprcp_target_grid, & ustar_target_grid, & z0_target_grid, & + lai_target_grid, & c_d_target_grid, & c_0_target_grid, & d_conv_target_grid, & @@ -1880,6 +1892,7 @@ subroutine write_fv3_sfc_data_netcdf(localpet) integer :: id_fice, id_tisfc, id_tprcp integer :: id_srflag, id_snwdph, id_shdmin integer :: id_shdmax, id_slope, id_snoalb + integer :: id_lai integer :: id_stc, id_smc, id_slc integer :: id_tref, id_z_c, id_c_0 integer :: id_c_d, id_w_0, id_w_d @@ -1947,7 +1960,11 @@ subroutine write_fv3_sfc_data_netcdf(localpet) LOCAL_PET : if (localpet == 0) then - WRITE(OUTFILE, '(A, I1, A)') 'out.sfc.tile', tile, '.nc' + if (regional > 0) then + outfile = "out.sfc.tile7.nc" + else + WRITE(OUTFILE, '(A, I1, A)') 'out.sfc.tile', tile, '.nc' + endif !--- open the file error = nf90_create(outfile, IOR(NF90_NETCDF4,NF90_CLASSIC_MODEL), & @@ -2293,6 +2310,17 @@ subroutine write_fv3_sfc_data_netcdf(localpet) call netcdf_err(error, 'DEFINING SNOALB UNITS' ) error = nf90_put_att(ncid, id_snoalb, "coordinates", "geolon geolat") call netcdf_err(error, 'DEFINING SNOALB COORD' ) + + if (.not. lai_from_climo) then + error = nf90_def_var(ncid, 'lai', NF90_DOUBLE, (/dim_x,dim_y,dim_time/), id_lai) + call netcdf_err(error, 'DEFINING LAI' ) + error = nf90_put_att(ncid, id_lai, "long_name", "lai") + call netcdf_err(error, 'DEFINING LAI LONG NAME' ) + error = nf90_put_att(ncid, id_lai, "units", "none") + call netcdf_err(error, 'DEFINING LAI UNITS' ) + error = nf90_put_att(ncid, id_lai, "coordinates", "geolon geolat") + call netcdf_err(error, 'DEFINING LAI COORD' ) + endif error = nf90_def_var(ncid, 'stc', NF90_DOUBLE, (/dim_x,dim_y,dim_lsoil,dim_time/), id_stc) call netcdf_err(error, 'DEFINING STC' ) @@ -2580,7 +2608,20 @@ subroutine write_fv3_sfc_data_netcdf(localpet) error = nf90_put_var( ncid, id_snoalb, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/)) call netcdf_err(error, 'WRITING MAX SNOW ALBEDO RECORD' ) endif + + if (.not. lai_from_climo) then + print*,"- CALL FieldGather FOR TARGET GRID LEAF AREA INDEX FOR TILE: ", tile + call ESMF_FieldGather(lai_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) + if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & + call error_handler("IN FieldGather", error) + if (localpet == 0) then + dum2d(:,:) = data_one_tile(istart:iend, jstart:jend) + error = nf90_put_var( ncid, id_lai, dum2d, start=(/1,1,1/), count=(/i_target_out,j_target_out,1/)) + call netcdf_err(error, 'WRITING LEAF AREA INDEX RECORD' ) + endif + endif + print*,"- CALL FieldGather FOR TARGET GRID SOIL TYPE FOR TILE: ", tile call ESMF_FieldGather(soil_type_target_grid, data_one_tile, rootPet=0, tile=tile, rc=error) if(ESMF_logFoundError(rcToCheck=error,msg=ESMF_LOGERR_PASSTHRU,line=__LINE__,file=__FILE__)) & diff --git a/sorc/emcsfc_snow2mdl.fd/.gitignore b/sorc/emcsfc_snow2mdl.fd/.gitignore deleted file mode 100644 index 80df0fa54..000000000 --- a/sorc/emcsfc_snow2mdl.fd/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.o -*.mod -emcsfc_snow2mdl diff --git a/sorc/global_chgres.fd/.gitignore b/sorc/global_chgres.fd/.gitignore deleted file mode 100644 index 013de5d46..000000000 --- a/sorc/global_chgres.fd/.gitignore +++ /dev/null @@ -1 +0,0 @@ -global_chgres diff --git a/sorc/machine-setup.sh b/sorc/machine-setup.sh index 08e500537..6664446fe 100644 --- a/sorc/machine-setup.sh +++ b/sorc/machine-setup.sh @@ -78,12 +78,12 @@ elif [[ -L /usrx && "$( readlink /usrx 2> /dev/null )" =~ dell ]] ; then target=wcoss_dell_p3 module purge elif [[ -d /glade ]] ; then - # We are on NCAR Yellowstone + # We are on NCAR Cheyenne if ( ! eval module help > /dev/null 2>&1 ) ; then echo load the module command 1>&2 - . /usr/share/Modules/init/$__ms_shell + . /glade/u/apps/ch/opt/lmod/8.1.7/lmod/8.1.7/init/sh fi - target=yellowstone + target=cheyenne module purge elif [[ -d /lustre && -d /ncrc ]] ; then # We are on GAEA. @@ -103,6 +103,9 @@ elif [[ "$(hostname)" =~ "Orion" ]]; then module purge elif [[ "$(hostname)" =~ "odin" ]]; then target="odin" +elif [[ -d /work/00315 && -d /scratch/00315 ]] ; then + target=stampede + module purge else echo WARNING: UNKNOWN PLATFORM 1>&2 fi diff --git a/sorc/nst_tf_chg.fd/.gitignore b/sorc/nst_tf_chg.fd/.gitignore deleted file mode 100644 index 3eff26396..000000000 --- a/sorc/nst_tf_chg.fd/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.o -*.mod -nst_tf_chg.x diff --git a/sorc/sfc_climo_gen.fd/.gitignore b/sorc/sfc_climo_gen.fd/.gitignore deleted file mode 100644 index 3c4362860..000000000 --- a/sorc/sfc_climo_gen.fd/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.o -*.mod -gridgen_sfc diff --git a/util/gdas_init/driver.cray.sh b/util/gdas_init/driver.cray.sh index 93cae342b..28d92a63a 100755 --- a/util/gdas_init/driver.cray.sh +++ b/util/gdas_init/driver.cray.sh @@ -9,7 +9,8 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target module list PROJECT_CODE=GFS-DEV diff --git a/util/gdas_init/driver.dell.sh b/util/gdas_init/driver.dell.sh index ec18e09a9..f6a0ccb49 100755 --- a/util/gdas_init/driver.dell.sh +++ b/util/gdas_init/driver.dell.sh @@ -9,7 +9,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list PROJECT_CODE=GFS-DEV diff --git a/util/gdas_init/driver.hera.sh b/util/gdas_init/driver.hera.sh index 3fee1147e..9bf57791b 100755 --- a/util/gdas_init/driver.hera.sh +++ b/util/gdas_init/driver.hera.sh @@ -9,7 +9,9 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target +module list # Needed for NDATE utility module use -a /scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles diff --git a/util/vcoord_gen/run.cray.sh b/util/vcoord_gen/run.cray.sh index b6f9c7e13..451fc7c3c 100755 --- a/util/vcoord_gen/run.cray.sh +++ b/util/vcoord_gen/run.cray.sh @@ -21,7 +21,8 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 -source ../../modulefiles/build.$target +module use ../../modulefiles +module load build.$target module list outfile="./global_hyblev.txt" From bf70549328bc3151955eeab62f09cb922081478f Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Tue, 20 Oct 2020 10:23:21 -0400 Subject: [PATCH 042/192] Remove landsfcutil library dependency from snow2mdl program Incorporate landsfcutil library routines 'uninterpred' and 'intlon' into the snow2mdl program. The goal is to eventually retire the landsfcutil library. For details, see issue #169. --- sorc/emcsfc_snow2mdl.fd/CMakeLists.txt | 1 - sorc/emcsfc_snow2mdl.fd/snow2mdl.f | 72 +++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 3 deletions(-) diff --git a/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt b/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt index e884e1d7a..c3cba21da 100644 --- a/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt +++ b/sorc/emcsfc_snow2mdl.fd/CMakeLists.txt @@ -19,7 +19,6 @@ target_link_libraries( g2::g2_d ip::ip_d sp::sp_d - landsfcutil::landsfcutil_d bacio::bacio_4 w3nco::w3nco_d) if(OpenMP_Fortran_FOUND) diff --git a/sorc/emcsfc_snow2mdl.fd/snow2mdl.f b/sorc/emcsfc_snow2mdl.fd/snow2mdl.f index 4102dd045..200fd45a8 100755 --- a/sorc/emcsfc_snow2mdl.fd/snow2mdl.f +++ b/sorc/emcsfc_snow2mdl.fd/snow2mdl.f @@ -87,8 +87,6 @@ module snow2mdl kgds_autosnow, & bad_afwa_nh, bad_afwa_sh - use read_write_utils, only : uninterpred - private real, allocatable :: snow_cvr_mdl(:,:) ! cover in % on mdl grid @@ -1145,4 +1143,74 @@ subroutine write_grib1 end subroutine write_grib1 +!----------------------------------------------------------------------- +! fills out full grid using thinned grid data. use an iord of +! "1" to use a nearest neighbor approach. +!----------------------------------------------------------------------- + + subroutine uninterpred(iord,kmsk,fi,f,lonl,latd,len,lonsperlat) + + implicit none + + integer, intent(in) :: len + integer, intent(in) :: iord + integer, intent(in) :: lonl + integer, intent(in) :: latd + integer, intent(in) :: lonsperlat(latd/2) + integer, intent(in) :: kmsk(lonl*latd) + integer :: j,lons,jj,latd2,ii,i + + real, intent(in) :: fi(len) + real, intent(out) :: f(lonl,latd) + + latd2 = latd / 2 + ii = 1 + + do j=1,latd + + jj = j + if (j .gt. latd2) jj = latd - j + 1 + lons=lonsperlat(jj) + + if(lons.ne.lonl) then + call intlon(iord,1,1,lons,lonl,kmsk(ii),fi(ii),f(1,j)) + else + do i=1,lonl + f(i,j) = fi(ii+i-1) + enddo + endif + + ii = ii + lons + + enddo + + end subroutine uninterpred + + subroutine intlon(iord,imon,imsk,m1,m2,k1,f1,f2) + + implicit none + + integer,intent(in) :: iord,imon,imsk,m1,m2 + integer,intent(in) :: k1(m1) + integer :: i2,in,il,ir + + real,intent(in) :: f1(m1) + real,intent(out) :: f2(m2) + real :: r,x1 + + r=real(m1)/real(m2) + do i2=1,m2 + x1=(i2-1)*r + il=int(x1)+1 + ir=mod(il,m1)+1 + if(iord.eq.2.and.(imsk.eq.0.or.k1(il).eq.k1(ir))) then + f2(i2)=f1(il)*(il-x1)+f1(ir)*(x1-il+1) + else + in=mod(nint(x1),m1)+1 + f2(i2)=f1(in) + endif + enddo + + end subroutine intlon + end module snow2mdl From bc40cddd138524dda024f360bb7c27ca1ff34447 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Wed, 21 Oct 2020 10:13:45 -0600 Subject: [PATCH 043/192] added README --- README.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 000000000..609bc7817 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ + +# UFS_UTILS + +Utilities for the NCEP models. This is part of the +[NCEPLIBS](https://github.com/NOAA-EMC/NCEPLIBS) project. + +## Authors + +NCEP/EMC developers. + +Code manager: George Gayno + +## Installing + +``` +mkdir build +cd build +cmake -DCMAKE_INSTALL_PREFIX=/path/to/install .. +make -j2 +make install +``` + +## Disclaimer + +The United States Department of Commerce (DOC) GitHub project code is +provided on an "as is" basis and the user assumes responsibility for +its use. DOC has relinquished control of the information and no longer +has responsibility to protect the integrity, confidentiality, or +availability of the information. Any claims against the Department of +Commerce stemming from the use of its GitHub project will be governed +by all applicable Federal law. Any reference to specific commercial +products, processes, or services by service mark, trademark, +manufacturer, or otherwise, does not constitute or imply their +endorsement, recommendation or favoring by the Department of +Commerce. The Department of Commerce seal and logo, or the seal and +logo of a DOC bureau, shall not be used in any manner to imply +endorsement of any commercial product or activity by DOC or the United +States Government. + From 1be59bd7aa7db3916d64e2a9a806a4967c1b94c0 Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Thu, 22 Oct 2020 10:58:51 -0400 Subject: [PATCH 044/192] Add test for GNU compiler on Hera Add option to compile UFS_UTILS with GNU on Hera. Update regression and utility scripts to optionally load the GNU-based build module on Hera. For more details, see issue #151. --- build_all.sh | 9 ++++-- driver_scripts/driver_grid.cray.sh | 2 +- driver_scripts/driver_grid.dell.sh | 2 +- driver_scripts/driver_grid.hera.sh | 3 +- driver_scripts/driver_grid.jet.sh | 2 +- driver_scripts/driver_grid.orion.sh | 2 +- .../{build.cheyenne => build.cheyenne.intel} | 0 modulefiles/build.hera.gnu | 29 +++++++++++++++++++ modulefiles/{build.hera => build.hera.intel} | 0 modulefiles/{build.jet => build.jet.intel} | 0 modulefiles/{build.odin => build.odin.intel} | 0 .../{build.orion => build.orion.intel} | 0 .../{build.stampede => build.stampede.intel} | 0 ...uild.wcoss_cray => build.wcoss_cray.intel} | 0 ...coss_dell_p3 => build.wcoss_dell_p3.intel} | 0 reg_tests/chgres_cube/driver.cray.sh | 2 +- reg_tests/chgres_cube/driver.dell.sh | 2 +- reg_tests/chgres_cube/driver.hera.sh | 6 ++-- reg_tests/chgres_cube/driver.jet.sh | 2 +- reg_tests/chgres_cube/driver.orion.sh | 2 +- reg_tests/global_cycle/driver.cray.sh | 2 +- reg_tests/global_cycle/driver.dell.sh | 2 +- reg_tests/global_cycle/driver.hera.sh | 6 ++-- reg_tests/global_cycle/driver.jet.sh | 2 +- reg_tests/global_cycle/driver.orion.sh | 2 +- reg_tests/grid_gen/driver.cray.sh | 2 +- reg_tests/grid_gen/driver.dell.sh | 2 +- reg_tests/grid_gen/driver.hera.sh | 6 ++-- reg_tests/grid_gen/driver.jet.sh | 2 +- reg_tests/grid_gen/driver.orion.sh | 2 +- reg_tests/ice_blend/driver.cray.sh | 2 +- reg_tests/ice_blend/driver.dell.sh | 2 +- reg_tests/ice_blend/driver.hera.sh | 4 ++- reg_tests/ice_blend/driver.jet.sh | 2 +- reg_tests/ice_blend/driver.orion.sh | 2 +- reg_tests/snow2mdl/driver.cray.sh | 2 +- reg_tests/snow2mdl/driver.dell.sh | 2 +- reg_tests/snow2mdl/driver.hera.sh | 4 ++- reg_tests/snow2mdl/driver.jet.sh | 2 +- reg_tests/snow2mdl/driver.orion.sh | 2 +- util/gdas_init/driver.cray.sh | 2 +- util/gdas_init/driver.dell.sh | 2 +- util/gdas_init/driver.hera.sh | 3 +- util/vcoord_gen/run.cray.sh | 2 +- 44 files changed, 84 insertions(+), 40 deletions(-) rename modulefiles/{build.cheyenne => build.cheyenne.intel} (100%) create mode 100644 modulefiles/build.hera.gnu rename modulefiles/{build.hera => build.hera.intel} (100%) rename modulefiles/{build.jet => build.jet.intel} (100%) rename modulefiles/{build.odin => build.odin.intel} (100%) rename modulefiles/{build.orion => build.orion.intel} (100%) rename modulefiles/{build.stampede => build.stampede.intel} (100%) rename modulefiles/{build.wcoss_cray => build.wcoss_cray.intel} (100%) rename modulefiles/{build.wcoss_dell_p3 => build.wcoss_dell_p3.intel} (100%) diff --git a/build_all.sh b/build_all.sh index 273b40f1e..8b8ffade1 100755 --- a/build_all.sh +++ b/build_all.sh @@ -2,6 +2,7 @@ set -eux target=${target:-"NULL"} +compiler=${compiler:-"intel"} export MOD_PATH @@ -14,7 +15,7 @@ else set +x source ./sorc/machine-setup.sh module use ./modulefiles - module load build.$target > /dev/null 2>&1 + module load build.$target.$compiler > /dev/null 2>&1 module list set -x fi @@ -28,8 +29,10 @@ cd ./build CMAKE_FLAGS="-DCMAKE_INSTALL_PREFIX=../ -DEMC_EXEC_DIR=ON" -if [[ "$target" != "wcoss_cray" && "$target" != "odin" ]]; then - CMAKE_FLAGS+=" -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_C_COMPILER=icc" +if [[ "$compiler" == "intel" ]]; then + if [[ "$target" != "wcoss_cray" && "$target" != "odin" ]]; then + CMAKE_FLAGS+=" -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_C_COMPILER=icc" + fi fi cmake .. ${CMAKE_FLAGS} diff --git a/driver_scripts/driver_grid.cray.sh b/driver_scripts/driver_grid.cray.sh index 1aa1088bb..323d93835 100755 --- a/driver_scripts/driver_grid.cray.sh +++ b/driver_scripts/driver_grid.cray.sh @@ -58,7 +58,7 @@ source ../sorc/machine-setup.sh > /dev/null 2>&1 module use ../modulefiles -module load build.$target +module load build.$target.intel module list #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.dell.sh b/driver_scripts/driver_grid.dell.sh index 760c44151..e871ffcbd 100755 --- a/driver_scripts/driver_grid.dell.sh +++ b/driver_scripts/driver_grid.dell.sh @@ -60,7 +60,7 @@ source ../sorc/machine-setup.sh > /dev/null 2>&1 module use ../modulefiles -module load build.$target +module load build.$target.intel module list #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.hera.sh b/driver_scripts/driver_grid.hera.sh index 6fbe90c37..96479d27e 100755 --- a/driver_scripts/driver_grid.hera.sh +++ b/driver_scripts/driver_grid.hera.sh @@ -58,9 +58,10 @@ set -x +compiler=${compiler:-"intel"} source ../sorc/machine-setup.sh > /dev/null 2>&1 module use ../modulefiles -module load build.$target +module load build.$target.$compiler module list #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.jet.sh b/driver_scripts/driver_grid.jet.sh index 88e7e7cda..0358a3d71 100755 --- a/driver_scripts/driver_grid.jet.sh +++ b/driver_scripts/driver_grid.jet.sh @@ -61,7 +61,7 @@ set -x source ../sorc/machine-setup.sh > /dev/null 2>&1 module use ../modulefiles -module load build.$target +module load build.$target.intel module list #----------------------------------------------------------------------- diff --git a/driver_scripts/driver_grid.orion.sh b/driver_scripts/driver_grid.orion.sh index 97dce226c..c08a2ffc2 100755 --- a/driver_scripts/driver_grid.orion.sh +++ b/driver_scripts/driver_grid.orion.sh @@ -60,7 +60,7 @@ set -x source ../sorc/machine-setup.sh > /dev/null 2>&1 module use ../modulefiles -module load build.$target +module load build.$target.intel module list #----------------------------------------------------------------------- diff --git a/modulefiles/build.cheyenne b/modulefiles/build.cheyenne.intel similarity index 100% rename from modulefiles/build.cheyenne rename to modulefiles/build.cheyenne.intel diff --git a/modulefiles/build.hera.gnu b/modulefiles/build.hera.gnu new file mode 100644 index 000000000..c6d533643 --- /dev/null +++ b/modulefiles/build.hera.gnu @@ -0,0 +1,29 @@ +#%Module##################################################### +## Build and run module for Hera +############################################################# + +module load hpss +module load cmake/3.16.1 +module load gnu/9.2.0 +module use -a /scratch1/BMC/gmtb/software/modulefiles/gnu-9.2.0/mpich-3.3.2 +module load mpich/3.3.2 + +module use -a /scratch1/BMC/gmtb/software/ufs-stack-20200909/gnu-9.2.0/mpich-3.3.2/modules + +module load libpng/1.6.35 +module load netcdf/4.7.4 +module load esmf/8.1.0bs27 + +module load bacio/2.4.0 +module load g2/3.4.0 +module load ip/3.3.0 +module load nemsio/2.5.1 +module load sp/2.3.0 +module load w3emc/2.7.0 +module load w3nco/2.4.0 +module load gfsio/1.4.0 +module load sfcio/1.4.0 +module load sigio/2.3.0 +module load nemsiogfs/2.5.0 +module load landsfcutil/2.4.0 +module load wgrib2/2.0.8 diff --git a/modulefiles/build.hera b/modulefiles/build.hera.intel similarity index 100% rename from modulefiles/build.hera rename to modulefiles/build.hera.intel diff --git a/modulefiles/build.jet b/modulefiles/build.jet.intel similarity index 100% rename from modulefiles/build.jet rename to modulefiles/build.jet.intel diff --git a/modulefiles/build.odin b/modulefiles/build.odin.intel similarity index 100% rename from modulefiles/build.odin rename to modulefiles/build.odin.intel diff --git a/modulefiles/build.orion b/modulefiles/build.orion.intel similarity index 100% rename from modulefiles/build.orion rename to modulefiles/build.orion.intel diff --git a/modulefiles/build.stampede b/modulefiles/build.stampede.intel similarity index 100% rename from modulefiles/build.stampede rename to modulefiles/build.stampede.intel diff --git a/modulefiles/build.wcoss_cray b/modulefiles/build.wcoss_cray.intel similarity index 100% rename from modulefiles/build.wcoss_cray rename to modulefiles/build.wcoss_cray.intel diff --git a/modulefiles/build.wcoss_dell_p3 b/modulefiles/build.wcoss_dell_p3.intel similarity index 100% rename from modulefiles/build.wcoss_dell_p3 rename to modulefiles/build.wcoss_dell_p3.intel diff --git a/reg_tests/chgres_cube/driver.cray.sh b/reg_tests/chgres_cube/driver.cray.sh index ee3f4d424..4082b738a 100755 --- a/reg_tests/chgres_cube/driver.cray.sh +++ b/reg_tests/chgres_cube/driver.cray.sh @@ -24,7 +24,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list export OUTDIR=/gpfs/hps3/stmp/$LOGNAME/chgres_reg_tests diff --git a/reg_tests/chgres_cube/driver.dell.sh b/reg_tests/chgres_cube/driver.dell.sh index 97247cbfb..cd7a435a9 100755 --- a/reg_tests/chgres_cube/driver.dell.sh +++ b/reg_tests/chgres_cube/driver.dell.sh @@ -24,7 +24,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list export OUTDIR=/gpfs/dell1/stmp/$LOGNAME/chgres_reg_tests diff --git a/reg_tests/chgres_cube/driver.hera.sh b/reg_tests/chgres_cube/driver.hera.sh index b6f78c461..3830511f9 100755 --- a/reg_tests/chgres_cube/driver.hera.sh +++ b/reg_tests/chgres_cube/driver.hera.sh @@ -24,9 +24,11 @@ set -x +compiler=${compiler:-"intel"} + source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.$compiler module list export OUTDIR=/scratch2/NCEPDEV/stmp1/$LOGNAME/chgres_reg_tests @@ -43,7 +45,7 @@ export HOMEufs=$PWD/../.. export HOMEreg=/scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/chgres_cube -export NCCMP=/apps/nccmp/1.8.5/intel/18.0.3.051/bin/nccmp +export NCCMP=/scratch2/NCEPDEV/nwprod/hpc-stack/libs/hpc-stack/v1.0.0-beta1/intel-18.0.5.274/impi-2018.0.4/nccmp/1.8.7.0/bin/nccmp LOG_FILE=regression.log SUM_FILE=summary.log diff --git a/reg_tests/chgres_cube/driver.jet.sh b/reg_tests/chgres_cube/driver.jet.sh index c093eb7cb..d579dc9ad 100755 --- a/reg_tests/chgres_cube/driver.jet.sh +++ b/reg_tests/chgres_cube/driver.jet.sh @@ -26,7 +26,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list export OUTDIR=/lfs4/HFIP/emcda/$LOGNAME/stmp/chgres_reg_tests diff --git a/reg_tests/chgres_cube/driver.orion.sh b/reg_tests/chgres_cube/driver.orion.sh index 0886871ad..e936ff3a5 100755 --- a/reg_tests/chgres_cube/driver.orion.sh +++ b/reg_tests/chgres_cube/driver.orion.sh @@ -26,7 +26,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list export OUTDIR=/work/noaa/stmp/$LOGNAME/chgres_reg_tests diff --git a/reg_tests/global_cycle/driver.cray.sh b/reg_tests/global_cycle/driver.cray.sh index 288c38edf..d7b64ed43 100755 --- a/reg_tests/global_cycle/driver.cray.sh +++ b/reg_tests/global_cycle/driver.cray.sh @@ -29,7 +29,7 @@ source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list export DATA=/gpfs/hps3/stmp/$LOGNAME/reg_tests.cycle diff --git a/reg_tests/global_cycle/driver.dell.sh b/reg_tests/global_cycle/driver.dell.sh index 178355667..dc2846dc1 100755 --- a/reg_tests/global_cycle/driver.dell.sh +++ b/reg_tests/global_cycle/driver.dell.sh @@ -34,7 +34,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list export DATA=/gpfs/dell1/stmp/$LOGNAME/reg_tests.cycle diff --git a/reg_tests/global_cycle/driver.hera.sh b/reg_tests/global_cycle/driver.hera.sh index 9ee1cb64a..90bb8230b 100755 --- a/reg_tests/global_cycle/driver.hera.sh +++ b/reg_tests/global_cycle/driver.hera.sh @@ -29,9 +29,11 @@ set -x +compiler=${compiler:-"intel"} + source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.$compiler module list export DATA=/scratch2/NCEPDEV/stmp1/$LOGNAME/reg_tests.cycle @@ -50,7 +52,7 @@ export NWPROD=$PWD/../.. export COMOUT=$DATA -export NCCMP=/apps/nccmp/1.8.5/intel/18.0.3.051/bin/nccmp +export NCCMP=/scratch2/NCEPDEV/nwprod/hpc-stack/libs/hpc-stack/v1.0.0-beta1/intel-18.0.5.274/impi-2018.0.4/nccmp/1.8.7.0/bin/nccmp reg_dir=$PWD diff --git a/reg_tests/global_cycle/driver.jet.sh b/reg_tests/global_cycle/driver.jet.sh index aa2d7285a..797aa9845 100755 --- a/reg_tests/global_cycle/driver.jet.sh +++ b/reg_tests/global_cycle/driver.jet.sh @@ -32,7 +32,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list export DATA=/lfs4/HFIP/emcda/$LOGNAME/stmp/reg_tests.cycle diff --git a/reg_tests/global_cycle/driver.orion.sh b/reg_tests/global_cycle/driver.orion.sh index 5731b9063..02ec4d4cc 100755 --- a/reg_tests/global_cycle/driver.orion.sh +++ b/reg_tests/global_cycle/driver.orion.sh @@ -31,7 +31,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list export DATA=/work/noaa/stmp/$LOGNAME/reg_tests.cycle diff --git a/reg_tests/grid_gen/driver.cray.sh b/reg_tests/grid_gen/driver.cray.sh index e2f8e5927..619286a9f 100755 --- a/reg_tests/grid_gen/driver.cray.sh +++ b/reg_tests/grid_gen/driver.cray.sh @@ -21,7 +21,7 @@ source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list set -x diff --git a/reg_tests/grid_gen/driver.dell.sh b/reg_tests/grid_gen/driver.dell.sh index 5c2ae6a7f..719d7fc9d 100755 --- a/reg_tests/grid_gen/driver.dell.sh +++ b/reg_tests/grid_gen/driver.dell.sh @@ -21,7 +21,7 @@ source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list set -x diff --git a/reg_tests/grid_gen/driver.hera.sh b/reg_tests/grid_gen/driver.hera.sh index 0dc66996c..e97a21f73 100755 --- a/reg_tests/grid_gen/driver.hera.sh +++ b/reg_tests/grid_gen/driver.hera.sh @@ -21,9 +21,11 @@ # #----------------------------------------------------------------------------- +compiler=${compiler:-"intel"} + source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.$compiler module list set -x @@ -43,7 +45,7 @@ export APRUN=time export APRUN_SFC=srun export OMP_STACKSIZE=2048m export machine=HERA -export NCCMP=/apps/nccmp/1.8.5/intel/18.0.3.051/bin/nccmp +export NCCMP=/scratch2/NCEPDEV/nwprod/hpc-stack/libs/hpc-stack/v1.0.0-beta1/intel-18.0.5.274/impi-2018.0.4/nccmp/1.8.7.0/bin/nccmp export HOMEreg=/scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/grid_gen/baseline_data ulimit -a diff --git a/reg_tests/grid_gen/driver.jet.sh b/reg_tests/grid_gen/driver.jet.sh index d38c08f8a..397884db7 100755 --- a/reg_tests/grid_gen/driver.jet.sh +++ b/reg_tests/grid_gen/driver.jet.sh @@ -23,7 +23,7 @@ source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list set -x diff --git a/reg_tests/grid_gen/driver.orion.sh b/reg_tests/grid_gen/driver.orion.sh index cdad89801..11eb23f88 100755 --- a/reg_tests/grid_gen/driver.orion.sh +++ b/reg_tests/grid_gen/driver.orion.sh @@ -23,7 +23,7 @@ source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list set -x diff --git a/reg_tests/ice_blend/driver.cray.sh b/reg_tests/ice_blend/driver.cray.sh index c34cb3bca..2aa975161 100755 --- a/reg_tests/ice_blend/driver.cray.sh +++ b/reg_tests/ice_blend/driver.cray.sh @@ -30,7 +30,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list export DATA=/gpfs/hps3/stmp/$LOGNAME/reg_tests.ice_blend diff --git a/reg_tests/ice_blend/driver.dell.sh b/reg_tests/ice_blend/driver.dell.sh index 1296c7436..417e80051 100755 --- a/reg_tests/ice_blend/driver.dell.sh +++ b/reg_tests/ice_blend/driver.dell.sh @@ -28,7 +28,7 @@ source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list set -x diff --git a/reg_tests/ice_blend/driver.hera.sh b/reg_tests/ice_blend/driver.hera.sh index 63967711a..479804537 100755 --- a/reg_tests/ice_blend/driver.hera.sh +++ b/reg_tests/ice_blend/driver.hera.sh @@ -29,9 +29,11 @@ set -x +compiler=${compiler:-"intel"} + source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.$compiler module list export DATA="/scratch2/NCEPDEV/stmp1/$LOGNAME/reg_test.ice_blend" diff --git a/reg_tests/ice_blend/driver.jet.sh b/reg_tests/ice_blend/driver.jet.sh index 160b21a94..6d693b1c3 100755 --- a/reg_tests/ice_blend/driver.jet.sh +++ b/reg_tests/ice_blend/driver.jet.sh @@ -30,7 +30,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list export DATA="/lfs4/HFIP/emcda/$LOGNAME/stmp/reg_test.ice_blend" diff --git a/reg_tests/ice_blend/driver.orion.sh b/reg_tests/ice_blend/driver.orion.sh index df2b108e1..83c23e35b 100755 --- a/reg_tests/ice_blend/driver.orion.sh +++ b/reg_tests/ice_blend/driver.orion.sh @@ -31,7 +31,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list export DATA="/work/noaa/stmp/$LOGNAME/reg_test.ice_blend" diff --git a/reg_tests/snow2mdl/driver.cray.sh b/reg_tests/snow2mdl/driver.cray.sh index 064b8a7d8..2c1646118 100755 --- a/reg_tests/snow2mdl/driver.cray.sh +++ b/reg_tests/snow2mdl/driver.cray.sh @@ -30,7 +30,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list export DATA=/gpfs/hps3/stmp/$LOGNAME/reg_tests.snow2mdl diff --git a/reg_tests/snow2mdl/driver.dell.sh b/reg_tests/snow2mdl/driver.dell.sh index 2b3e603d8..4b06502f5 100755 --- a/reg_tests/snow2mdl/driver.dell.sh +++ b/reg_tests/snow2mdl/driver.dell.sh @@ -28,7 +28,7 @@ source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list set -x diff --git a/reg_tests/snow2mdl/driver.hera.sh b/reg_tests/snow2mdl/driver.hera.sh index 8c074f66c..599819384 100755 --- a/reg_tests/snow2mdl/driver.hera.sh +++ b/reg_tests/snow2mdl/driver.hera.sh @@ -29,9 +29,11 @@ set -x +compiler=${compiler:-"intel"} + source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.$compiler module list export DATA="/scratch2/NCEPDEV/stmp1/$LOGNAME/reg_tests.snow2mdl" diff --git a/reg_tests/snow2mdl/driver.jet.sh b/reg_tests/snow2mdl/driver.jet.sh index e12a69790..289f9dcc2 100755 --- a/reg_tests/snow2mdl/driver.jet.sh +++ b/reg_tests/snow2mdl/driver.jet.sh @@ -30,7 +30,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list export DATA="/lfs4/HFIP/emcda/$LOGNAME/stmp/reg_tests.snow2mdl" diff --git a/reg_tests/snow2mdl/driver.orion.sh b/reg_tests/snow2mdl/driver.orion.sh index be991b359..94971f6b5 100755 --- a/reg_tests/snow2mdl/driver.orion.sh +++ b/reg_tests/snow2mdl/driver.orion.sh @@ -31,7 +31,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list export DATA="/work/noaa/stmp/$LOGNAME/reg_tests.snow2mdl" diff --git a/util/gdas_init/driver.cray.sh b/util/gdas_init/driver.cray.sh index 28d92a63a..e5392721f 100755 --- a/util/gdas_init/driver.cray.sh +++ b/util/gdas_init/driver.cray.sh @@ -10,7 +10,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list PROJECT_CODE=GFS-DEV diff --git a/util/gdas_init/driver.dell.sh b/util/gdas_init/driver.dell.sh index f6a0ccb49..3461475d8 100755 --- a/util/gdas_init/driver.dell.sh +++ b/util/gdas_init/driver.dell.sh @@ -10,7 +10,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list PROJECT_CODE=GFS-DEV diff --git a/util/gdas_init/driver.hera.sh b/util/gdas_init/driver.hera.sh index 9bf57791b..9c871d3b2 100755 --- a/util/gdas_init/driver.hera.sh +++ b/util/gdas_init/driver.hera.sh @@ -8,9 +8,10 @@ set -x +compiler=${compiler:-"intel"} source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.$compiler module list # Needed for NDATE utility diff --git a/util/vcoord_gen/run.cray.sh b/util/vcoord_gen/run.cray.sh index 451fc7c3c..968625a19 100755 --- a/util/vcoord_gen/run.cray.sh +++ b/util/vcoord_gen/run.cray.sh @@ -22,7 +22,7 @@ set -x source ../../sorc/machine-setup.sh > /dev/null 2>&1 module use ../../modulefiles -module load build.$target +module load build.$target.intel module list outfile="./global_hyblev.txt" From 21543e0c48412b98b2a6352a08380496df6cf8d9 Mon Sep 17 00:00:00 2001 From: Larissa Reames <52886575+LarissaReames-NOAA@users.noreply.github.com> Date: Thu, 22 Oct 2020 14:12:00 -0500 Subject: [PATCH 045/192] Fix bug in chgres_cube that prevents Thompson aerosols from being created The return statement in read_setup_namelist is a few lines too early, and before the if statement that sets use_thomp_mp_climo to true if thomp_mp_climo_file is set in the namelist. This prevents the aerosols from ever being created or written to file, regardless of input data type. Addresses issue #178 --- sorc/chgres_cube.fd/program_setup.f90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sorc/chgres_cube.fd/program_setup.f90 b/sorc/chgres_cube.fd/program_setup.f90 index 6340e13b8..fbae1ba28 100644 --- a/sorc/chgres_cube.fd/program_setup.f90 +++ b/sorc/chgres_cube.fd/program_setup.f90 @@ -407,13 +407,14 @@ subroutine read_setup_namelist ACCURATE. " endif endif - return if (trim(thomp_mp_climo_file) /= "NULL") then use_thomp_mp_climo=.true. print*,"- WILL PROCESS CLIMO THOMPSON MP TRACERS FROM FILE: ", trim(thomp_mp_climo_file) endif + return + end subroutine read_setup_namelist subroutine read_varmap From 0d2bc7b8422392d853fbe6b991f4b24dc10c234c Mon Sep 17 00:00:00 2001 From: GeorgeGayno-NOAA <52789452+GeorgeGayno-NOAA@users.noreply.github.com> Date: Thu, 22 Oct 2020 16:45:40 -0400 Subject: [PATCH 046/192] Update the 'chgres_cube.rst' documentation file Update to the version used by the MRW App v1.1.0 Issue #175. --- docs/source/chgres_cube.rst | 41 +++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/docs/source/chgres_cube.rst b/docs/source/chgres_cube.rst index f0285b869..ef663e530 100644 --- a/docs/source/chgres_cube.rst +++ b/docs/source/chgres_cube.rst @@ -4,10 +4,10 @@ Introduction ************************ -The chgres_cube program creates initial condition files to “coldstart” the forecast model. The initial conditions are created from either Global Forecast System (GFS) gridded binary version 2 (GRIB2) or NOAA Environmental Modeling System Input/Output (NEMSIO) data. +The chgres_cube program creates initial condition files to “coldstart” the forecast model. The initial conditions are created from either Global Forecast System (GFS) gridded binary version 2 (GRIB2), NOAA Environmental Modeling System Input/Output (NEMSIO) data, or Network Common Data Form (NetCDF) data. ************************************************ -Where to find GFS GRIB2 and NEMSIO data +Where to find GFS GRIB2, NEMSIO and NetCDF data ************************************************ **GRIB2:** @@ -22,6 +22,9 @@ Where to find GFS GRIB2 and NEMSIO data * T1534 gaussian (last 10 days only) - Use the **gfs.tHHz.atmanl.nemsio** (atmospheric fields) and **gfs.tHHz.sfcanl.nemsio** (surface fields) files in subdirectory gfs.YYYYMMDD/HH `here `_. +**NetCDF:** + + * T1534 gaussian (don't have any more details at this time). ************************************************ Initializing with GRIB2 data - some caveats @@ -46,11 +49,11 @@ Keep this in mind when using GFS GRIB2 data for model initialization: The issue with not having NSST data is important. In GFS we use the foundation temperature (Tref) and add a diurnal warming/cooling layer using NSST. This is the surface temperature that is passed to the atmospheric boundary layer. This is a critical feature, especially when we are doing Data Assimilation. -When using NEMSIO data to initialize the model, both the foundation and surface temperature are available and the atmospheric model should be run using the NSST option as this will properly account for in the forward run of the model. +When using NEMSIO or NetCDF data to initialize the model, both the foundation and surface temperature are available and the atmospheric model should be run using the NSST option as this will properly account for in the forward run of the model. In GRIB2 files only the Tsfc is stored and that is set as foundation temperature as well. So the diurnal heating / cooling is baked into the initial condition for the extent of the run. This can be critical if the model is being initialized when the ocean is warm and initialization is occuring at the peak of the diurnal warming. That warm ocean will be baked in for the extent of the run and may spawn off a number of fake hurricanes. The user has two options -- either to use a spin up cycle to spin up NSST (set **nstf_name** = [2,1,0,0,0] in **input.nml** of the model namelist file. This will create a diurnal cycle after 24 hours of spin up), or to run the model without any NSST option ( set **nstf_name** = [0,0,0,0,0] in **input.nml** of the model namelist file. The user will also have to choose one of the no NSST physics suite options in **input.nml**). -Note, that neither of these two options will get rid of the underlying baked in heating/cooling in the surface temperature fields. For most cases this may not be an issue, but where it is then the user will either have to initialize the model with NEMSIO data or replace the surface temperature in the GRIB2 fields with independently obtained foundation temperature. +Note, that neither of these two options will get rid of the underlying baked in heating/cooling in the surface temperature fields. For most cases this may not be an issue, but where it is then the user will either have to initialize the model with NEMSIO or NetCDF data, or replace the surface temperature in the GRIB2 fields with independently obtained foundation temperature. ************************************************ chgres_cube namelist options @@ -83,7 +86,7 @@ When using NEMSIO data as input to chgres_cube, set namelist as follows: * data_dir_input_grid - directory containing the NEMSIO input data * atm_files_input_grid - name of the NEMSIO input atmospheric data file * sfc_files_input_grid - name of the NEMSIO input surface/Near Sea Surface Temperature (NSST) data file - * input_type - input data type. Set to ‘gaussian’. + * input_type - input data type. Set to ‘gaussian_nemsio’. * cycle_mon/day/hour - month/day/hour of your model run * convert_atm - set to ‘true’ to process the atmospheric fields * convert_sfc - set to ‘true’ to process the surface fields @@ -91,6 +94,25 @@ When using NEMSIO data as input to chgres_cube, set namelist as follows: * tracers_input - names of tracer records in input file. For GFDL microphysics, set to “spfh”,”clwmr”,”o3mr”,”icmr”,”rwmr”,”snmr”,”grle”. * tracers - names of tracer records in output file expected by model. For GFDL microphysics, set to “sphum”,”liq_wat”,”o3mr”,”ice_wat”,”rainwat”,”snowwat”,”graupel”. +When using NetCDF data as input to chgres_cube, set namelist as follows: + + * fix_dir_target_grid - Path to the tiled FV3 surface climatological files (such as albedo). + * mosaic_file_target_grid - Path and name of the FV3 mosaic file. + * orog_dir_target_grid - directory containing the tiled FV3 orography and grid files (NetCDF). + * orog_files_target_grid - names of the six tiled FV3 orography files. + * vcoord_file_target_grid - path and name of the model vertical coordinate definition file (“global_hyblev.l$LEVS.txt). + * data_dir_input_grid - directory containing the NetCDF input data + * atm_files_input_grid - name of the NetCDF input atmospheric data file + * sfc_files_input_grid - name of the NetCDF input surface/Near Sea Surface Temperature (NSST) data file + * input_type - input data type. Set to ‘gaussian_netcdf’. + * cycle_mon/day/hour - month/day/hour of your model run + * convert_atm - set to ‘true’ to process the atmospheric fields + * convert_sfc - set to ‘true’ to process the surface fields + * convert_nst - set to ‘true’ to process NSST fields + * tracers_input - names of tracer records in input file. For GFDL microphysics, set to “spfh”,”clwmr”,”o3mr”,”icmr”,”rwmr”,”snmr”,”grle”. + * tracers - names of tracer records in output file expected by model. For GFDL microphysics, set to “sphum”,”liq_wat”,”o3mr”,”ice_wat”,”rainwat”,”snowwat”,”graupel”. + + ************************ Compiling the program ************************ @@ -106,9 +128,10 @@ If the NCEPLIBS have been installed and the user wants to compile chgres_cube ag * set cmake compiler - export FC=ifort (if ifort is the compiler chosen) * cd to where you checked out the UFS_Utils * mkdir build and cd build - * cmake .. -DCMAKE_INSTALL_PREFIX=/path/where/you/want/the/code/installed + * cmake .. -DCMAKE_INSTALL_PREFIX=/path/where/you/want/the/code/installed -DCMAKE_PREFIX_PATH=/path/to/nceplibs/installed * make -j x (where x is a number that can be chosen to speed up the make, usually 8) * make install + * if you do get errors that cmake cannot find "FindNETCDF" or "FindESMF", run: git submodule update --init --recursive ************************************************ Program inputs and outputs @@ -150,7 +173,7 @@ The following four sets of files are located here: https://ftp.emc.ncep.noaa.gov * FV3 vertical coordinate file. Text file. Located here: https://ftp.emc.ncep.noaa.gov/EIB/UFS/global/fix/fix_am.v20191213/ * global_hyblev.l$LEVS.txt - * Input data files. GRIB2 or NEMSIO. See above section for how to find this data. + * Input data files. GRIB2, NEMSIO or NetCDF. See above section for how to find this data. **Outputs** @@ -185,7 +208,7 @@ Running the program stand alone Code structure ************************ -Note on variable names: “input” refers to the data input to the program (i.e., GRIB2, NEMSIO). “Target” refers to the target or FV3 model grid. See routine doc blocks for more details. +Note on variable names: “input” refers to the data input to the program (i.e., GRIB2, NEMSIO, NetCDF). “Target” refers to the target or FV3 model grid. See routine doc blocks for more details. * chgres.F90 - This is the main driver routine. * program_setup.F90 - Sets up the program execution. @@ -195,7 +218,7 @@ Note on variable names: “input” refers to the data input to the program (i.e * model_grid.F90 - Sets up the ESMF grid objects for the input data grid and target FV3 grid. * static_data.F90 - Reads static surface climatological data for the target FV3 grid (such as soil type and vegetation type). Time interpolates time-varying fields, such as monthly plant greenness, to the model run time. Data for each target FV3 resolution resides in the ‘fixed’ directory. Set path via the fix_dir_target_grid namelist variable. * write_data.F90 - Writes the tiled and header files expected by the forecast model. - * input_data.F90 - Contains routines to read atmospheric and surface data from GRIB2 and NEMSIO files. + * input_data.F90 - Contains routines to read atmospheric and surface data from GRIB2, NEMSIO and NetCDF files. * utils.f90 - Contains utility routines, such as error handling. * grib2_util.F90 - Routines to (1) convert from RH to specific humidity; (2) convert from omega to dzdt. Required for GRIB2 input data. * atmosphere.F90 - Process atmospheric fields. Horizontally interpolate from input to target FV3 grid using ESMF regridding. Adjust surface pressure according to terrain differences between input and target grid. Vertically interpolate to target FV3 grid vertical levels. Description of main routines: From ddd0f50191da82b1e4db5a48f722b5eb891d778f Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Mon, 26 Oct 2020 14:42:41 -0600 Subject: [PATCH 047/192] adding docs --- CMakeLists.txt | 26 +- README.md | 17 + cmake/FindNetCDF.cmake | 347 ++++++ docs/CMakeLists.txt | 18 + docs/Doxyfile.in | 2292 ++++++++++++++++++++++++++++++++++++++++ docs/user_guide.md | 6 + 6 files changed, 2696 insertions(+), 10 deletions(-) create mode 100644 cmake/FindNetCDF.cmake create mode 100644 docs/CMakeLists.txt create mode 100644 docs/Doxyfile.in create mode 100644 docs/user_guide.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c7357146..f563b3b8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,19 @@ +# This is the main CMake file for NCEPLIBS-ip. +# +# George Gayno cmake_minimum_required(VERSION 3.15) +# Get the version from the VERSION file. file(STRINGS "VERSION" pVersion) project( ufs_util VERSION ${pVersion} LANGUAGES C Fortran) -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/Modules") +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") + +# User options. +option(OPENMP "use OpenMP threading" ON) if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") message(STATUS "Setting build type to 'Release' as none was specified.") @@ -17,14 +24,7 @@ if(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") "MinSizeRel" "RelWithDebInfo") endif() -if(NOT CMAKE_C_COMPILER_ID MATCHES "^(Intel|GNU|Clang|AppleClang)$") - message(WARNING "Compiler not officially supported: ${CMAKE_C_COMPILER_ID}") -endif() - -if(NOT CMAKE_Fortran_COMPILER_ID MATCHES "^(Intel|GNU)$") - message(WARNING "Compiler not officially supported: ${CMAKE_Fortran_COMPILER_ID}") -endif() - +# Set compiler flags. 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") @@ -41,11 +41,11 @@ if(CMAKE_C_COMPILER_ID MATCHES "^(Intel)$") set(CMAKE_C_FLAGS_DEBUG "-O0") endif() +# Find packages. find_package(NetCDF REQUIRED C Fortran) find_package(MPI REQUIRED) find_package(ESMF MODULE REQUIRED) -option(OPENMP "use OpenMP threading" ON) if(OPENMP) find_package(OpenMP REQUIRED COMPONENTS Fortran) endif() @@ -71,3 +71,9 @@ if(EMC_EXEC_DIR) endif() add_subdirectory(sorc) + +# If doxygen documentation we enabled, build it. +if(ENABLE_DOCS) + find_package(Doxygen REQUIRED) +endif() +add_subdirectory(docs) diff --git a/README.md b/README.md index 609bc7817..b07bf89db 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,23 @@ NCEP/EMC developers. Code manager: George Gayno +## Prerequisites + +This package requires: + - [NCEPLIBS-gfsio](https://github.com/NOAA-EMC/NCEPLIBS-gfsio) + - [NCEPLIBS-sfcio](https://github.com/NOAA-EMC/NCEPLIBS-sfcio) + - [NCEPLIBS-w3nco](https://github.com/NOAA-EMC/NCEPLIBS-w3nco) + - [NCEPLIBS-landsfcutil](https://github.com/NOAA-EMC/NCEPLIBS-landsfcutil) + - [NCEPLIBS-bacio](https://github.com/NOAA-EMC/NCEPLIBS-bacio) + - [NCEPLIBS-nemsio](https://github.com/NOAA-EMC/NCEPLIBS-nemsio) + - [NCEPLIBS-nemsiogfs](https://github.com/NOAA-EMC/NCEPLIBS-nemsiogfs) + - [NCEPLIBS-sigio](https://github.com/NOAA-EMC/NCEPLIBS-sigio) + - [NCEPLIBS-sp](https://github.com/NOAA-EMC/NCEPLIBS-sp) + - [NCEPLIBS-ip](https://github.com/NOAA-EMC/NCEPLIBS-ip) + - [NCEPLIBS-w3emc](https://github.com/NOAA-EMC/NCEPLIBS-w3emc) + - [NCEPLIBS-g2](https://github.com/NOAA-EMC/NCEPLIBS-g2) + - [NCEPLIBS-wgrib2](https://github.com/NOAA-EMC/NCEPLIBS-wgrib2) + ## Installing ``` diff --git a/cmake/FindNetCDF.cmake b/cmake/FindNetCDF.cmake new file mode 100644 index 000000000..9e32378ff --- /dev/null +++ b/cmake/FindNetCDF.cmake @@ -0,0 +1,347 @@ +# (C) Copyright 2011- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation nor +# does it submit to any jurisdiction. + +# Try to find NetCDF includes and library. +# Supports static and shared libaries and allows each component to be found in sepearte prefixes. +# +# This module defines +# +# - NetCDF_FOUND - System has NetCDF +# - NetCDF_INCLUDE_DIRS - the NetCDF include directories +# - NetCDF_VERSION - the version of NetCDF +# - NetCDF_CONFIG_EXECUTABLE - the netcdf-config executable if found +# - NetCDF_PARALLEL - Boolean True if NetCDF4 has parallel IO support via hdf5 and/or pnetcdf +# - NetCDF_HAS_PNETCDF - Boolean True if NetCDF4 has pnetcdf support +# +# Deprecated Defines +# - NetCDF_LIBRARIES - [Deprecated] Use NetCDF::NetCDF_ targets instead. +# +# +# Following components are available: +# +# - C - C interface to NetCDF (netcdf) +# - CXX - CXX4 interface to NetCDF (netcdf_c++4) +# - Fortran - Fortran interface to NetCDF (netcdff) +# +# For each component the following are defined: +# +# - NetCDF__FOUND - whether the component is found +# - NetCDF__LIBRARIES - the libraries for the component +# - NetCDF__LIBRARY_SHARED - Boolean is true if libraries for component are shared +# - NetCDF__INCLUDE_DIRS - the include directories for specified component +# - NetCDF::NetCDF_ - target of component to be used with target_link_libraries() +# +# The following paths will be searched in order if set in CMake (first priority) or environment (second priority) +# +# - NetCDF_ROOT - root of NetCDF installation +# - NetCDF_PATH - root of NetCDF installation +# +# The search process begins with locating NetCDF Include headers. If these are in a non-standard location, +# set one of the following CMake or environment variables to point to the location: +# +# - NetCDF_INCLUDE_DIR or NetCDF_${comp}_INCLUDE_DIR +# - NetCDF_INCLUDE_DIRS or NetCDF_${comp}_INCLUDE_DIR +# +# Notes: +# +# - Use "NetCDF::NetCDF_" targets only. NetCDF_LIBRARIES exists for backwards compatibility and should not be used. +# - These targets have all the knowledge of include directories and library search directories, and a single +# call to target_link_libraries will provide all these transitive properties to your target. Normally all that is +# needed to build and link against NetCDF is, e.g.: +# target_link_libraries(my_c_tgt PUBLIC NetCDF::NetCDF_C) +# - "NetCDF" is always the preferred naming for this package, its targets, variables, and environment variables +# - For compatibility, some variables are also set/checked using alternate names NetCDF4, NETCDF, or NETCDF4 +# - Environments relying on these older environment variable names should move to using a "NetCDF_ROOT" environment variable +# - Preferred component capitalization follows the CMake LANGUAGES variables: i.e., C, Fortran, CXX +# - For compatibility, alternate capitalizations are supported but should not be used. +# - If no components are defined, all components will be searched +# + +list( APPEND _possible_components C CXX Fortran ) + +## Include names for each component +set( NetCDF_C_INCLUDE_NAME netcdf.h ) +set( NetCDF_CXX_INCLUDE_NAME netcdf ) +set( NetCDF_Fortran_INCLUDE_NAME netcdf.mod ) + +## Library names for each component +set( NetCDF_C_LIBRARY_NAME netcdf ) +set( NetCDF_CXX_LIBRARY_NAME netcdf_c++4 ) +set( NetCDF_Fortran_LIBRARY_NAME netcdff ) + +## Enumerate search components +foreach( _comp ${_possible_components} ) + string( TOUPPER "${_comp}" _COMP ) + set( _arg_${_COMP} ${_comp} ) + set( _name_${_COMP} ${_comp} ) +endforeach() + +set( _search_components C) +foreach( _comp ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS} ) + string( TOUPPER "${_comp}" _COMP ) + set( _arg_${_COMP} ${_comp} ) + list( APPEND _search_components ${_name_${_COMP}} ) + if( NOT _name_${_COMP} ) + message(SEND_ERROR "Find${CMAKE_FIND_PACKAGE_NAME}: COMPONENT ${_comp} is not a valid component. Valid components: ${_possible_components}" ) + endif() +endforeach() +list( REMOVE_DUPLICATES _search_components ) + +## Search hints for finding include directories and libraries +foreach( _comp IN ITEMS "_" "_C_" "_Fortran_" "_CXX_" ) + foreach( _name IN ITEMS NetCDF4 NetCDF NETCDF4 NETCDF ) + foreach( _var IN ITEMS ROOT PATH ) + list(APPEND _search_hints ${${_name}${_comp}${_var}} $ENV{${_name}${_comp}${_var}} ) + list(APPEND _include_search_hints + ${${_name}${_comp}INCLUDE_DIR} $ENV{${_name}${_comp}INCLUDE_DIR} + ${${_name}${_comp}INCLUDE_DIRS} $ENV{${_name}${_comp}INCLUDE_DIRS} ) + endforeach() + endforeach() +endforeach() +#Old-school HPC module env variable names +foreach( _name IN ITEMS NetCDF4 NetCDF NETCDF4 NETCDF ) + foreach( _comp IN ITEMS "_C" "_Fortran" "_CXX" ) + list(APPEND _search_hints ${${_name}} $ENV{${_name}}) + list(APPEND _search_hints ${${_name}${_comp}} $ENV{${_name}${_comp}}) + endforeach() +endforeach() + +## Find headers for each component +set(NetCDF_INCLUDE_DIRS) +set(_new_search_components) +foreach( _comp IN LISTS _search_components ) + if(NOT ${PROJECT_NAME}_NetCDF_${_comp}_FOUND) + list(APPEND _new_search_components ${_comp}) + endif() + find_file(NetCDF_${_comp}_INCLUDE_FILE + NAMES ${NetCDF_${_comp}_INCLUDE_NAME} + DOC "NetCDF ${_comp} include directory" + HINTS ${_include_search_hints} ${_search_hints} + PATH_SUFFIXES include include/netcdf + ) + mark_as_advanced(NetCDF_${_comp}_INCLUDE_FILE) + message(DEBUG "NetCDF_${_comp}_INCLUDE_FILE: ${NetCDF_${_comp}_INCLUDE_FILE}") + if( NetCDF_${_comp}_INCLUDE_FILE ) + get_filename_component(NetCDF_${_comp}_INCLUDE_FILE ${NetCDF_${_comp}_INCLUDE_FILE} ABSOLUTE) + get_filename_component(NetCDF_${_comp}_INCLUDE_DIR ${NetCDF_${_comp}_INCLUDE_FILE} DIRECTORY) + list(APPEND NetCDF_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIR}) + endif() +endforeach() +if(NetCDF_INCLUDE_DIRS) + list(REMOVE_DUPLICATES NetCDF_INCLUDE_DIRS) +endif() +set(NetCDF_INCLUDE_DIRS "${NetCDF_INCLUDE_DIRS}" CACHE STRING "NetCDF Include directory paths" FORCE) + +## Find n*-config executables for search components +foreach( _comp IN LISTS _search_components ) + if( _comp MATCHES "^(C)$" ) + set(_conf "c") + elseif( _comp MATCHES "^(Fortran)$" ) + set(_conf "f") + elseif( _comp MATCHES "^(CXX)$" ) + set(_conf "cxx4") + endif() + find_program( NetCDF_${_comp}_CONFIG_EXECUTABLE + NAMES n${_conf}-config + HINTS ${NetCDF_INCLUDE_DIRS} ${_include_search_hints} ${_search_hints} + PATH_SUFFIXES bin Bin ../bin ../../bin + DOC "NetCDF n${_conf}-config helper" ) + message(DEBUG "NetCDF_${_comp}_CONFIG_EXECUTABLE: ${NetCDF_${_comp}_CONFIG_EXECUTABLE}") +endforeach() + +set(_C_libs_flag --libs) +set(_Fortran_libs_flag --flibs) +set(_CXX_libs_flag --libs) +set(_C_includes_flag --includedir) +set(_Fortran_includes_flag --includedir) +set(_CXX_includes_flag --includedir) +function(netcdf_config exec flag output_var) + set(${output_var} False PARENT_SCOPE) + if( exec ) + execute_process( COMMAND ${exec} ${flag} RESULT_VARIABLE _ret OUTPUT_VARIABLE _val) + if( _ret EQUAL 0 ) + string( STRIP ${_val} _val ) + set( ${output_var} ${_val} PARENT_SCOPE ) + endif() + endif() +endfunction() + +## Detect additional package properties +netcdf_config(${NetCDF_C_CONFIG_EXECUTABLE} --has-parallel4 _val) +if( NOT _val MATCHES "^(yes|no)$" ) + netcdf_config(${NetCDF_C_CONFIG_EXECUTABLE} --has-parallel _val) +endif() +if( _val MATCHES "^(yes)$" ) + set(NetCDF_PARALLEL TRUE CACHE STRING "NetCDF has parallel IO capability via pnetcdf or hdf5." FORCE) +else() + set(NetCDF_PARALLEL FALSE CACHE STRING "NetCDF has no parallel IO capability." FORCE) +endif() + +if(NetCDF_PARALLEL) + find_package(MPI REQUIRED) +endif() + +## Find libraries for each component +set( NetCDF_LIBRARIES ) +foreach( _comp IN LISTS _search_components ) + string( TOUPPER "${_comp}" _COMP ) + + find_library( NetCDF_${_comp}_LIBRARY + NAMES ${NetCDF_${_comp}_LIBRARY_NAME} + DOC "NetCDF ${_comp} library" + HINTS ${NetCDF_${_comp}_INCLUDE_DIRS} ${_search_hints} + PATH_SUFFIXES lib64 lib ../lib64 ../lib ../../lib64 ../../lib ) + mark_as_advanced( NetCDF_${_comp}_LIBRARY ) + get_filename_component(NetCDF_${_comp}_LIBRARY ${NetCDF_${_comp}_LIBRARY} ABSOLUTE) + set(NetCDF_${_comp}_LIBRARY ${NetCDF_${_comp}_LIBRARY} CACHE STRING "NetCDF ${_comp} library" FORCE) + message(DEBUG "NetCDF_${_comp}_LIBRARY: ${NetCDF_${_comp}_LIBRARY}") + + if( NetCDF_${_comp}_LIBRARY ) + if( NetCDF_${_comp}_LIBRARY MATCHES ".a$" ) + set( NetCDF_${_comp}_LIBRARY_SHARED FALSE ) + set( _library_type STATIC) + else() + list( APPEND NetCDF_LIBRARIES ${NetCDF_${_comp}_LIBRARY} ) + set( NetCDF_${_comp}_LIBRARY_SHARED TRUE ) + set( _library_type SHARED) + endif() + endif() + + #Use nc-config to set per-component LIBRARIES variable if possible + netcdf_config( ${NetCDF_${_comp}_CONFIG_EXECUTABLE} ${_${_comp}_libs_flag} _val ) + if( _val ) + set( NetCDF_${_comp}_LIBRARIES ${_val} ) + if(NOT NetCDF_${_comp}_LIBRARY_SHARED AND NOT NetCDF_${_comp}_FOUND) #Static targets should use nc_config to get a proper link line with all necessary static targets. + list( APPEND NetCDF_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) + endif() + else() + set( NetCDF_${_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARY} ) + if(NOT NetCDF_${_comp}_LIBRARY_SHARED) + message(SEND_ERROR "Unable to properly find NetCDF. Found static libraries at: ${NetCDF_${_comp}_LIBRARY} but could not run nc-config: ${NetCDF_CONFIG_EXECUTABLE}") + endif() + endif() + + #Use nc-config to set per-component INCLUDE_DIRS variable if possible + netcdf_config( ${NetCDF_${_comp}_CONFIG_EXECUTABLE} ${_${_comp}_includes_flag} _val ) + if( _val ) + string( REPLACE " " ";" _val ${_val} ) + set( NetCDF_${_comp}_INCLUDE_DIRS ${_val} ) + else() + set( NetCDF_${_comp}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIR} ) + endif() + + if( NetCDF_${_comp}_LIBRARIES AND NetCDF_${_comp}_INCLUDE_DIRS ) + set( ${CMAKE_FIND_PACKAGE_NAME}_${_arg_${_COMP}}_FOUND TRUE ) + if (NOT TARGET NetCDF::NetCDF_${_comp}) + add_library(NetCDF::NetCDF_${_comp} ${_library_type} IMPORTED) + set_target_properties(NetCDF::NetCDF_${_comp} PROPERTIES + IMPORTED_LOCATION ${NetCDF_${_comp}_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES "${NetCDF_${_comp}_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) + if( NOT _comp MATCHES "^(C)$" ) + target_link_libraries(NetCDF::NetCDF_${_comp} INTERFACE NetCDF::NetCDF_C) + endif() + if(MPI_${_comp}_FOUND) + target_link_libraries(NetCDF::NetCDF_${_comp} INTERFACE MPI::MPI_${_comp}) + endif() + endif() + endif() +endforeach() +if(NetCDF_LIBRARIES AND NetCDF_${_comp}_LIBRARY_SHARED) + list(REMOVE_DUPLICATES NetCDF_LIBRARIES) +endif() +set(NetCDF_LIBRARIES "${NetCDF_LIBRARIES}" CACHE STRING "NetCDF library targets" FORCE) + +## Find version via netcdf-config if possible +if (NetCDF_INCLUDE_DIRS) + if( NetCDF_C_CONFIG_EXECUTABLE ) + netcdf_config( ${NetCDF_C_CONFIG_EXECUTABLE} --version _vers ) + if( _vers ) + string(REGEX REPLACE ".* ((([0-9]+)\\.)+([0-9]+)).*" "\\1" NetCDF_VERSION "${_vers}" ) + endif() + else() + foreach( _dir IN LISTS NetCDF_INCLUDE_DIRS) + if( EXISTS "${_dir}/netcdf_meta.h" ) + file(STRINGS "${_dir}/netcdf_meta.h" _netcdf_version_lines + REGEX "#define[ \t]+NC_VERSION_(MAJOR|MINOR|PATCH|NOTE)") + string(REGEX REPLACE ".*NC_VERSION_MAJOR *\([0-9]*\).*" "\\1" _netcdf_version_major "${_netcdf_version_lines}") + string(REGEX REPLACE ".*NC_VERSION_MINOR *\([0-9]*\).*" "\\1" _netcdf_version_minor "${_netcdf_version_lines}") + string(REGEX REPLACE ".*NC_VERSION_PATCH *\([0-9]*\).*" "\\1" _netcdf_version_patch "${_netcdf_version_lines}") + string(REGEX REPLACE ".*NC_VERSION_NOTE *\"\([^\"]*\)\".*" "\\1" _netcdf_version_note "${_netcdf_version_lines}") + set(NetCDF_VERSION "${_netcdf_version_major}.${_netcdf_version_minor}.${_netcdf_version_patch}${_netcdf_version_note}") + unset(_netcdf_version_major) + unset(_netcdf_version_minor) + unset(_netcdf_version_patch) + unset(_netcdf_version_note) + unset(_netcdf_version_lines) + endif() + endforeach() + endif() +endif () + +## Finalize find_package +include(FindPackageHandleStandardArgs) + +if(NOT NetCDF_FOUND OR _new_search_components) + find_package_handle_standard_args( ${CMAKE_FIND_PACKAGE_NAME} + REQUIRED_VARS NetCDF_INCLUDE_DIRS NetCDF_LIBRARIES + VERSION_VAR NetCDF_VERSION + HANDLE_COMPONENTS ) +endif() + +foreach( _comp IN LISTS _search_components ) + if( NetCDF_${_comp}_FOUND ) + #Record found components to avoid duplication in NetCDF_LIBRARIES for static libraries + set(NetCDF_${_comp}_FOUND ${NetCDF_${_comp}_FOUND} CACHE BOOL "NetCDF ${_comp} Found" FORCE) + #Set a per-package, per-component found variable to communicate between multiple calls to find_package() + set(${PROJECT_NAME}_NetCDF_${_comp}_FOUND True) + endif() +endforeach() + +if( ${CMAKE_FIND_PACKAGE_NAME}_FOUND AND NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY AND _new_search_components) + message( STATUS "Find${CMAKE_FIND_PACKAGE_NAME} defines targets:" ) + message( STATUS " - NetCDF_VERSION [${NetCDF_VERSION}]") + message( STATUS " - NetCDF_PARALLEL [${NetCDF_PARALLEL}]") + foreach( _comp IN LISTS _new_search_components ) + string( TOUPPER "${_comp}" _COMP ) + message( STATUS " - NetCDF_${_comp}_CONFIG_EXECUTABLE [${NetCDF_${_comp}_CONFIG_EXECUTABLE}]") + if( ${CMAKE_FIND_PACKAGE_NAME}_${_arg_${_COMP}}_FOUND ) + get_filename_component(_root ${NetCDF_${_comp}_INCLUDE_DIR}/.. ABSOLUTE) + if( NetCDF_${_comp}_LIBRARY_SHARED ) + message( STATUS " - NetCDF::NetCDF_${_comp} [SHARED] [Root: ${_root}] Lib: ${NetCDF_${_comp}_LIBRARY} ") + else() + message( STATUS " - NetCDF::NetCDF_${_comp} [STATIC] [Root: ${_root}] Lib: ${NetCDF_${_comp}_LIBRARY} ") + endif() + endif() + endforeach() +endif() + +foreach( _prefix NetCDF NetCDF4 NETCDF NETCDF4 ${CMAKE_FIND_PACKAGE_NAME} ) + set( ${_prefix}_INCLUDE_DIRS ${NetCDF_INCLUDE_DIRS} ) + set( ${_prefix}_LIBRARIES ${NetCDF_LIBRARIES}) + set( ${_prefix}_VERSION ${NetCDF_VERSION} ) + set( ${_prefix}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_FOUND} ) + set( ${_prefix}_CONFIG_EXECUTABLE ${NetCDF_CONFIG_EXECUTABLE} ) + set( ${_prefix}_PARALLEL ${NetCDF_PARALLEL} ) + + foreach( _comp ${_search_components} ) + string( TOUPPER "${_comp}" _COMP ) + set( _arg_comp ${_arg_${_COMP}} ) + set( ${_prefix}_${_comp}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} ) + set( ${_prefix}_${_COMP}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} ) + set( ${_prefix}_${_arg_comp}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} ) + + set( ${_prefix}_${_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) + set( ${_prefix}_${_COMP}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) + set( ${_prefix}_${_arg_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) + + set( ${_prefix}_${_comp}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIRS} ) + set( ${_prefix}_${_COMP}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIRS} ) + set( ${_prefix}_${_arg_comp}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIRS} ) + endforeach() +endforeach() diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt new file mode 100644 index 000000000..0f4bec724 --- /dev/null +++ b/docs/CMakeLists.txt @@ -0,0 +1,18 @@ +# This is the CMake file for building the docs directory of NCEPLIBS-ip. +# +# Ed Hartnett 10/5/20 + +if(ENABLE_DOCS) + + # Create doxyfile. + set(abs_top_srcdir "${CMAKE_SOURCE_DIR}") + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) + + # Build documentation with target all. + add_custom_target(doc ALL + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API Documentation with Doxygen" VERBATIM) + +endif(ENABLE_DOCS) + diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in new file mode 100644 index 000000000..da8ff3a32 --- /dev/null +++ b/docs/Doxyfile.in @@ -0,0 +1,2292 @@ +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the config file +# that follow. The default is UTF-8 which is also the encoding used for all text +# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv +# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv +# for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = UFS_UTILS + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = @PROJECT_VERSION@ + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = + +# With the PROJECT_LOGO tag one can specify an logo or icon that is included in +# the documentation. The maximum height of the logo should not exceed 55 pixels +# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo +# to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = YES + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = YES + +# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = NO + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = YES + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = YES + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a +# new page for each member. If set to NO, the documentation of a member will be +# part of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines. + +ALIASES = + +# This tag can be used to specify a number of word-keyword mappings (TCL only). +# A mapping has the form "name=value". For example adding "class=itcl::class" +# will allow you to use the command class in the itcl::class meaning. + +TCL_SUBST = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = YES + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, Javascript, +# C#, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL. For instance to make +# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C +# (default is Fortran), use: inc=Fortran f=C. +# +# Note For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See http://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by by putting a % sign in front of the word +# or globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = YES + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = YES + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = YES + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = NO + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = YES + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = NO + +# This flag is only useful for Objective-C code. When set to YES local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO these classes will be included in the various overviews. This option has +# no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# (class|struct|union) declarations. If set to NO these declarations will be +# included in the documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file +# names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = YES + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = YES + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = YES + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the +# todo list. This list is created by putting \todo commands in the +# documentation. +# The default value is: YES. + +GENERATE_TODOLIST = NO + +# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the +# test list. This list is created by putting \test commands in the +# documentation. +# The default value is: YES. + +GENERATE_TESTLIST = NO + +# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = NO + +# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES the list +# will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. Do not use file names with spaces, bibtex cannot handle them. See +# also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = NO + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO doxygen will only warn about wrong or incomplete parameter +# documentation, but not about the absence of documentation. +# The default value is: NO. + +WARN_NO_PARAMDOC = YES + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. +# Note: If this tag is empty the current directory is searched. + +INPUT = @abs_top_srcdir@/docs/user_guide.md @abs_top_srcdir@/src + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank the +# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii, +# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp, +# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown, +# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, +# *.qsf, *.as and *.js. + +FILE_PATTERNS = *.F90 *.f90 + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER ) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = @abs_top_srcdir@/docs/sp_user_guide.md + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# function all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES, then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see http://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the config file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES, then doxygen will use the +# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the +# cost of reduced performance. This can be particularly helpful with template +# rich C++ code for which doxygen's built-in parser lacks the necessary type +# information. +# Note: The availability of this option depends on whether or not doxygen was +# compiled with the --with-libclang option. +# The default value is: NO. + +# CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +# CLANG_OPTIONS = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = NO + +# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in +# which the alphabetical index list will be split. +# Minimum value: 1, maximum value: 20, default value: 5. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +COLS_IN_ALPHA_INDEX = 5 + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional user- +# defined cascading style sheet that is included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet file to the output directory. For an example +# see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +# HTML_ALIGN_MEMBERS = YES + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the stylesheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a +# Makefile in the HTML output directory. Running make will produce the docset in +# that directory and running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on +# Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler ( hhc.exe). If non-empty +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated ( +# YES) or that it should be included in the master .chm file ( NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated ( +# YES) or a normal table of contents ( NO) in the .chm file. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- +# folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- +# filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location of Qt's +# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the +# generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. +# If the tag value is set to YES, a side panel will be generated +# containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). +# Windows users are probably better off using the HTML help feature. + +GENERATE_TREEVIEW = YES + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# http://www.mathjax.org) which uses client side Javascript for the rendering +# instead of using prerendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from http://www.mathjax.org before deployment. +# The default value is: http://cdn.mathjax.org/mathjax/latest. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /