Skip to content

Commit

Permalink
add in-flight icing products through libIFI (#536)
Browse files Browse the repository at this point in the history
* Connect to IFI

* Correct CAPE&CIN calculations

* Changes to get IFI working.

* Connect to latest version of libIFI, but in an ugly way. Also, this is sending the wrong CAPE, CIN, and APCP

* Output libIFI-style diagnostic NetCDF files on full grid instead of per-rank.

* Send the right CAPE, CIN, and APCP to libIFI

* IFI connection: disable smoothing and precision drop. Add more diagnostic output. All results match standalone program.

* IFI smoother works in MPI

* Without IFI, output missing values for IFI fields. If IFI is requested and missing, build anyway.

* delete old file RQSTFLD.F

* bug fixes to get IFI to run

* IFI works 2D

* Missing value in ifi debug files & some logging

* missing EXCH_c_float.f file

* double-specified access specification

* fix two syntax errors (missing <0)

* Build with IFI by default, if it is present.

* bug fixes for build and namelist reporting

* disable ifi by default

* Add c++ linker flags

* Bug fixes to allow IFI fields to be generated when nothing else is requested

* add ifi fields to fv3lam xml & txt files

* remove cpp directives from a file that is not passed through cpp

* -i flag to compile ifi

* Missing IGET(ient)>0 check in IFI.F caused crashes

* compile_upp.sh -i can compile with libIFI on hera

* many bug fixes

* update ifi module version on hera

* remove unused variable

* add a missing allocate()

* remove unused code and switch from abort to mpi_abort

* Point to ifi on acorn

* remove halo regions from variables sent to libIFI

* Change loops 1,IM -> ISTA,IEND in several places

* revert some problematic changes

* IFI fields

* can build with ifi inside upp

* simplify code a bit

* update hera ifi module version for unit conversion bugfix

* update internal ifi for unit conversion bugfix

* revert to develop version of post_gtg.fd

* bug fixes to get UPP to run IFI build internally, after latest few merges

* updated libifi

* correct error in postxconfig-NT-fv3lam_rrfs.txt

* switch to 1007-1010 IGET numbers for IFI

* IFI_APCP(i,jj) -> IFI_APCP(ii,jj)

* missing variables from postxconfig-NT-fv3lam_rrfs.txt

* 20220901 => 20230112 on jet

* update ifi module version

* remove duplicate code

* bug fix in libifi test program (will not affect post)

* comment-out wordy print statement

* libIFI submodule: https & update=none

* update changelogs

* remove NCEP table from non-NCEP-table variable

Co-authored-by: samuel trahan <[email protected]>
  • Loading branch information
SamuelTrahanNOAA and samuel trahan authored Jan 26, 2023
1 parent cf17f28 commit 90c26de
Show file tree
Hide file tree
Showing 26 changed files with 2,382 additions and 93 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
path = sorc/ncep_post.fd/post_gtg.fd
url = https://github.com/NCAR/UPP_GTG
update = none
[submodule "sorc/libIFI.fd"]
path = sorc/libIFI.fd
url = https://github.com/NCAR/UPP_IFI
update = none
49 changes: 48 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ file(STRINGS "VERSION" pVersion LIMIT_COUNT 1)
project(
upp
VERSION ${pVersion}
LANGUAGES Fortran)
LANGUAGES Fortran C CXX)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

# Handle user options.
option(OPENMP "use OpenMP threading" ON)
option(BUILD_POSTEXEC "Build NCEPpost executable" ON)
option(BUILD_WITH_WRFIO "Build NCEPpost with WRF-IO library" OFF)
option(BUILD_WITH_IFI "Build NCEPpost with In-Flight Icing (IFI) library if present" OFF)
option(REQUIRE_IFI "Abort if libIFI is not found ; enables BUILD_WITH_IFI=ON" OFF)
option(BUILD_WITH_GTG "Build NCEPpost with NCAR/GTG" OFF)
option(ENABLE_DOCS "Enable generation of doxygen-based documentation." OFF)

Expand Down Expand Up @@ -52,6 +54,35 @@ if(BUILD_WITH_GTG)
find_package(ip REQUIRED)
endif()

if(INTERNAL_IFI)
if(BUILD_WITH_IFI)
message(SEND_ERROR "Cannot use INTERNAL_IFI with either BUILD_WITH_IFI or REQUIRE_IFI.")
endif()
if(IFI_DIR)
message(SEND_ERROR "When INTERNAL_IFI is specified, do not set IFI_DIR.")
endif()
set(REQUIRE_IFI ON)
set(BUILD_WITH_IFI ON)
set(IFI_FOUND ON)
set(IFI_DIR ${CMAKE_INSTALL_DIR})
message(NOTICE "Building IFI inside the post.")
else()
if(REQUIRE_IFI)
set(BUILD_WITH_IFI ON)
endif()

if(BUILD_WITH_IFI)
if(REQUIRE_IFI)
find_package(IFI REQUIRED)
else()
find_package(IFI)
endif()
endif()
if(IFI_FOUND)
message(NOTICE "Linking to IFI external to the post.")
endif()
endif()

if(BUILD_POSTEXEC)
find_package(nemsio REQUIRED)
find_package(sfcio REQUIRED)
Expand All @@ -61,6 +92,22 @@ if(BUILD_POSTEXEC)
if(BUILD_WITH_WRFIO)
find_package(wrf_io REQUIRED)
endif()
if(IFI_FOUND)
if(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel$")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -cxxlib")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^GNU$")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^(GNU|AppleClang)$")
# This one is a wild guess. I haven't tried linking a Fortran
# executable with C++ libraries in clang.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++abi")
endif()
endif()
endif()

if(IFI_FOUND OR INTERNAL_IFI)
message(NOTICE "Enabling USE_IFI in the post.")
add_definitions(-DUSE_IFI=1)
endif()

add_subdirectory(sorc)
Expand Down
3 changes: 3 additions & 0 deletions modulefiles/hera.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,7 @@ setenv("CC","mpiicc")
setenv("CXX","mpiicpc")
setenv("FC","mpiifort")

prepend_path("MODULEPATH", "/scratch2/BMC/ifi/modulefiles")
try_load("ifi/20230118-intel-2022.1.2")

whatis("Description: post build environment")
3 changes: 3 additions & 0 deletions modulefiles/jet
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ module load sigio/2.3.2
module load sp/2.3.3
module load w3emc/2.9.2
module load wrf_io/1.1.1

module use /lfs4/BMC/ifi/modulefiles
module try-load ifi/20230118-intel-18.0.5.274
4 changes: 4 additions & 0 deletions modulefiles/wcoss2_a.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,8 @@ setenv("CC","cc")
setenv("CXX","CC")
setenv("FC","ftn")


prepend_path("MODULEPATH", "/lfs/h1/oar/esrl/noscrub/samuel.trahan/ifi/modulefiles")
try_load("ifi/20221006-intel-" .. intel_ver)

whatis("Description: post build environment")
46 changes: 46 additions & 0 deletions parm/fv3lam_post_avblflds.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5678,6 +5678,52 @@
<scale>4.0</scale>
</param>

<param>
<post_avblfldidx>1007</post_avblfldidx>
<shortname>ICE_PROB_IFI_FLIGHT_LEVEL</shortname>
<pname>ICPRB</pname>
<table_info>NCEP</table_info>
<fixed_sfc1_type>spec_alt_above_mean_sea_lvl</fixed_sfc1_type>
<scale>4.0</scale>
<!-- Level units are in 0.1 feet, so final output will be in units of 0.1 meters -->
<scale_fact_fixed_sfc1>1</scale_fact_fixed_sfc1>
<level>5000. 10000. 15000. 20000. 25000. 30000. 35000. 40000. 45000. 50000. 55000. 60000. 65000. 70000. 75000. 80000. 85000. 90000. 95000. 100000. 105000. 110000. 115000. 120000. 125000. 130000. 135000. 140000. 145000. 150000. 155000. 160000. 165000. 170000. 175000. 180000. 185000. 190000. 195000. 200000. 205000. 210000. 215000. 220000. 225000. 230000. 235000. 240000. 245000. 250000. 255000. 260000. 265000. 270000. 275000. 280000. 285000. 290000. 295000. 300000.</level>
</param>

<param>
<post_avblfldidx>1008</post_avblfldidx>
<shortname>SLD_IFI_FLIGHT_LEVEL</shortname>
<pname>SIPD</pname>
<table_info>NCEP</table_info>
<fixed_sfc1_type>spec_alt_above_mean_sea_lvl</fixed_sfc1_type>
<scale>4.0</scale>
<!-- Level units are in 0.1 feet, so final output will be in units of 0.1 meters -->
<scale_fact_fixed_sfc1>1</scale_fact_fixed_sfc1>
<level>5000. 10000. 15000. 20000. 25000. 30000. 35000. 40000. 45000. 50000. 55000. 60000. 65000. 70000. 75000. 80000. 85000. 90000. 95000. 100000. 105000. 110000. 115000. 120000. 125000. 130000. 135000. 140000. 145000. 150000. 155000. 160000. 165000. 170000. 175000. 180000. 185000. 190000. 195000. 200000. 205000. 210000. 215000. 220000. 225000. 230000. 235000. 240000. 245000. 250000. 255000. 260000. 265000. 270000. 275000. 280000. 285000. 290000. 295000. 300000.</level>
</param>

<param>
<post_avblfldidx>1009</post_avblfldidx>
<shortname>ICE_SEV_CAT_IFI_FLIGHT_LEVEL</shortname>
<pname>ICSEV</pname>
<table_info>NCEP</table_info>
<fixed_sfc1_type>spec_alt_above_mean_sea_lvl</fixed_sfc1_type>
<scale>4.0</scale>
<!-- Level units are in 0.1 feet, so final output will be in units of 0.1 meters -->
<scale_fact_fixed_sfc1>1</scale_fact_fixed_sfc1>
<level>5000. 10000. 15000. 20000. 25000. 30000. 35000. 40000. 45000. 50000. 55000. 60000. 65000. 70000. 75000. 80000. 85000. 90000. 95000. 100000. 105000. 110000. 115000. 120000. 125000. 130000. 135000. 140000. 145000. 150000. 155000. 160000. 165000. 170000. 175000. 180000. 185000. 190000. 195000. 200000. 205000. 210000. 215000. 220000. 225000. 230000. 235000. 240000. 245000. 250000. 255000. 260000. 265000. 270000. 275000. 280000. 285000. 290000. 295000. 300000.</level>
</param>

<param>
<post_avblfldidx>1010</post_avblfldidx>
<shortname>WMO_ICE_SEV_CAT_IFI_FLIGHT_LEVEL</shortname>
<pname>ICESEV</pname>
<fixed_sfc1_type>spec_alt_above_mean_sea_lvl</fixed_sfc1_type>
<scale>4.0</scale>
<!-- Level units are in 0.1 feet, so final output will be in units of 0.1 meters -->
<scale_fact_fixed_sfc1>1</scale_fact_fixed_sfc1>
<level>5000. 10000. 15000. 20000. 25000. 30000. 35000. 40000. 45000. 50000. 55000. 60000. 65000. 70000. 75000. 80000. 85000. 90000. 95000. 100000. 105000. 110000. 115000. 120000. 125000. 130000. 135000. 140000. 145000. 150000. 155000. 160000. 165000. 170000. 175000. 180000. 185000. 190000. 195000. 200000. 205000. 210000. 215000. 220000. 225000. 230000. 235000. 240000. 245000. 250000. 255000. 260000. 265000. 270000. 275000. 280000. 285000. 290000. 295000. 300000.</level>
</param>

</post_avblflds>
</postxml>
Expand Down
53 changes: 53 additions & 0 deletions parm/fv3lam_rrfs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3631,4 +3631,57 @@
</param>

</paramset>

<paramset>
<datset>IFIFIP</datset>
<grid_num>4</grid_num>
<sub_center>ncep_emc</sub_center>
<version_no>v2003</version_no>
<local_table_vers_no>local_tab_yes1</local_table_vers_no>
<sigreftime>fcst</sigreftime>
<prod_status>oper</prod_status>
<data_type>fcst</data_type>
<gen_proc_type>fcst</gen_proc_type>
<time_range_unit>hour</time_range_unit>
<orig_center>nws_ncep</orig_center>
<gen_proc>hrrr</gen_proc>
<packing_method>complex_packing_spatial_diff</packing_method>
<order_of_sptdiff>2nd_ord_sptdiff</order_of_sptdiff>
<field_datatype>fltng_pnt</field_datatype>
<comprs_type>lossless</comprs_type>

<!-- New IFI products, only available if libIFI is linked to a post with USE_IFI enabled -->

<param>
<shortname>ICE_PROB_IFI_FLIGHT_LEVEL</shortname>
<scale>4.0</scale>
<!-- Level units are in 0.1 feet, so final output will be in units of 0.1 meters -->
<scale_fact_fixed_sfc1>1</scale_fact_fixed_sfc1>
<level>5000. 10000. 15000. 20000. 25000. 30000. 35000. 40000. 45000. 50000. 55000. 60000. 65000. 70000. 75000. 80000. 85000. 90000. 95000. 100000. 105000. 110000. 115000. 120000. 125000. 130000. 135000. 140000. 145000. 150000. 155000. 160000. 165000. 170000. 175000. 180000. 185000. 190000. 195000. 200000. 205000. 210000. 215000. 220000. 225000. 230000. 235000. 240000. 245000. 250000. 255000. 260000. 265000. 270000. 275000. 280000. 285000. 290000. 295000. 300000.</level>
</param>

<param>
<shortname>SLD_IFI_FLIGHT_LEVEL</shortname>
<scale>4.0</scale>
<!-- Level units are in 0.1 feet, so final output will be in units of 0.1 meters -->
<scale_fact_fixed_sfc1>1</scale_fact_fixed_sfc1>
<level>5000. 10000. 15000. 20000. 25000. 30000. 35000. 40000. 45000. 50000. 55000. 60000. 65000. 70000. 75000. 80000. 85000. 90000. 95000. 100000. 105000. 110000. 115000. 120000. 125000. 130000. 135000. 140000. 145000. 150000. 155000. 160000. 165000. 170000. 175000. 180000. 185000. 190000. 195000. 200000. 205000. 210000. 215000. 220000. 225000. 230000. 235000. 240000. 245000. 250000. 255000. 260000. 265000. 270000. 275000. 280000. 285000. 290000. 295000. 300000.</level>
</param>

<param>
<shortname>ICE_SEV_CAT_IFI_FLIGHT_LEVEL</shortname>
<scale>4.0</scale>
<!-- Level units are in 0.1 feet, so final output will be in units of 0.1 meters -->
<scale_fact_fixed_sfc1>1</scale_fact_fixed_sfc1>
<level>5000. 10000. 15000. 20000. 25000. 30000. 35000. 40000. 45000. 50000. 55000. 60000. 65000. 70000. 75000. 80000. 85000. 90000. 95000. 100000. 105000. 110000. 115000. 120000. 125000. 130000. 135000. 140000. 145000. 150000. 155000. 160000. 165000. 170000. 175000. 180000. 185000. 190000. 195000. 200000. 205000. 210000. 215000. 220000. 225000. 230000. 235000. 240000. 245000. 250000. 255000. 260000. 265000. 270000. 275000. 280000. 285000. 290000. 295000. 300000.</level>
</param>

<param>
<shortname>WMO_ICE_SEV_CAT_IFI_FLIGHT_LEVEL</shortname>
<scale>4.0</scale>
<!-- Level units are in 0.1 feet, so final output will be in units of 0.1 meters -->
<scale_fact_fixed_sfc1>1</scale_fact_fixed_sfc1>
<level>5000. 10000. 15000. 20000. 25000. 30000. 35000. 40000. 45000. 50000. 55000. 60000. 65000. 70000. 75000. 80000. 85000. 90000. 95000. 100000. 105000. 110000. 115000. 120000. 125000. 130000. 135000. 140000. 145000. 150000. 155000. 160000. 165000. 170000. 175000. 180000. 185000. 190000. 195000. 200000. 205000. 210000. 215000. 220000. 225000. 230000. 235000. 240000. 245000. 250000. 255000. 260000. 265000. 270000. 275000. 280000. 285000. 290000. 295000. 300000.</level>
</param>
</paramset>
</postxml>
47 changes: 47 additions & 0 deletions parm/post_avblflds.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8200,5 +8200,52 @@
<scale>6.0</scale>
</param>

<param>
<post_avblfldidx>1007</post_avblfldidx>
<shortname>ICE_PROB_IFI_FLIGHT_LEVEL</shortname>
<pname>ICPRB</pname>
<table_info>NCEP</table_info>
<fixed_sfc1_type>spec_alt_above_mean_sea_lvl</fixed_sfc1_type>
<scale>4.0</scale>
<!-- Level units are in 0.1 feet, so final output will be in units of 0.1 meters -->
<scale_fact_fixed_sfc1>1</scale_fact_fixed_sfc1>
<level>5000. 10000. 15000. 20000. 25000. 30000. 35000. 40000. 45000. 50000. 55000. 60000. 65000. 70000. 75000. 80000. 85000. 90000. 95000. 100000. 105000. 110000. 115000. 120000. 125000. 130000. 135000. 140000. 145000. 150000. 155000. 160000. 165000. 170000. 175000. 180000. 185000. 190000. 195000. 200000. 205000. 210000. 215000. 220000. 225000. 230000. 235000. 240000. 245000. 250000. 255000. 260000. 265000. 270000. 275000. 280000. 285000. 290000. 295000. 300000.</level>
</param>

<param>
<post_avblfldidx>1008</post_avblfldidx>
<shortname>SLD_IFI_FLIGHT_LEVEL</shortname>
<pname>SIPD</pname>
<table_info>NCEP</table_info>
<fixed_sfc1_type>spec_alt_above_mean_sea_lvl</fixed_sfc1_type>
<scale>4.0</scale>
<!-- Level units are in 0.1 feet, so final output will be in units of 0.1 meters -->
<scale_fact_fixed_sfc1>1</scale_fact_fixed_sfc1>
<level>5000. 10000. 15000. 20000. 25000. 30000. 35000. 40000. 45000. 50000. 55000. 60000. 65000. 70000. 75000. 80000. 85000. 90000. 95000. 100000. 105000. 110000. 115000. 120000. 125000. 130000. 135000. 140000. 145000. 150000. 155000. 160000. 165000. 170000. 175000. 180000. 185000. 190000. 195000. 200000. 205000. 210000. 215000. 220000. 225000. 230000. 235000. 240000. 245000. 250000. 255000. 260000. 265000. 270000. 275000. 280000. 285000. 290000. 295000. 300000.</level>
</param>

<param>
<post_avblfldidx>1009</post_avblfldidx>
<shortname>ICE_SEV_CAT_IFI_FLIGHT_LEVEL</shortname>
<pname>ICSEV</pname>
<table_info>NCEP</table_info>
<fixed_sfc1_type>spec_alt_above_mean_sea_lvl</fixed_sfc1_type>
<scale>4.0</scale>
<!-- Level units are in 0.1 feet, so final output will be in units of 0.1 meters -->
<scale_fact_fixed_sfc1>1</scale_fact_fixed_sfc1>
<level>5000. 10000. 15000. 20000. 25000. 30000. 35000. 40000. 45000. 50000. 55000. 60000. 65000. 70000. 75000. 80000. 85000. 90000. 95000. 100000. 105000. 110000. 115000. 120000. 125000. 130000. 135000. 140000. 145000. 150000. 155000. 160000. 165000. 170000. 175000. 180000. 185000. 190000. 195000. 200000. 205000. 210000. 215000. 220000. 225000. 230000. 235000. 240000. 245000. 250000. 255000. 260000. 265000. 270000. 275000. 280000. 285000. 290000. 295000. 300000.</level>
</param>

<param>
<post_avblfldidx>1010</post_avblfldidx>
<shortname>WMO_ICE_SEV_CAT_IFI_FLIGHT_LEVEL</shortname>
<pname>ICESEV</pname>
<fixed_sfc1_type>spec_alt_above_mean_sea_lvl</fixed_sfc1_type>
<scale>4.0</scale>
<!-- Level units are in 0.1 feet, so final output will be in units of 0.1 meters -->
<scale_fact_fixed_sfc1>1</scale_fact_fixed_sfc1>
<level>5000. 10000. 15000. 20000. 25000. 30000. 35000. 40000. 45000. 50000. 55000. 60000. 65000. 70000. 75000. 80000. 85000. 90000. 95000. 100000. 105000. 110000. 115000. 120000. 125000. 130000. 135000. 140000. 145000. 150000. 155000. 160000. 165000. 170000. 175000. 180000. 185000. 190000. 195000. 200000. 205000. 210000. 215000. 220000. 225000. 230000. 235000. 240000. 245000. 250000. 255000. 260000. 265000. 270000. 275000. 280000. 285000. 290000. 295000. 300000.</level>
</param>

</post_avblflds>
</postxml>
Loading

0 comments on commit 90c26de

Please sign in to comment.