diff --git a/Makefile b/Makefile index 775eb3c246..2bdff94d81 100644 --- a/Makefile +++ b/Makefile @@ -97,7 +97,7 @@ configcheck: echo "------------------------------------------------------------------------------" ; \ exit 21 ; \ fi - + framework_only : configcheck $(MAKE) MODULE_DIRS="$(ALL_MODULES)" ext @@ -154,7 +154,7 @@ wrfplus : configcheck @echo "build started: $(START_OF_COMPILE)" @echo "build completed:" `date` -all_wrfvar : +all_wrfvar : $(MAKE) MODULE_DIRS="$(DA_WRFVAR_MODULES)" ext $(MAKE) MODULE_DIRS="$(DA_WRFVAR_MODULES)" toolsdir if [ $(CRTM) -ne 0 ] ; then \ @@ -498,7 +498,7 @@ em_scm_xy : wrf ln -sf ../../run/LANDUSE.TBL . ; \ ln -sf ../../run/SOILPARM.TBL . ; \ ln -sf ../../run/VEGPARM.TBL . ; \ - ln -sf ../../run/RRTM_DATA . ) + ln -sf ../../run/RRTM_DATA . ) ( cd run ; /bin/rm -f ideal.exe ; ln -s ../main/ideal.exe . ) ( cd run ; if test -f namelist.input ; then \ /bin/cp -f namelist.input namelist.input.backup.`date +%Y-%m-%d_%H_%M_%S` ; fi ; \ @@ -529,11 +529,11 @@ convert_em : framework_only ( cd main ; $(MAKE) RLFLAGS="$(RLFLAGS)" MODULE_DIRS="$(ALL_MODULES)" convert_em ) ; \ fi -# Link wrf.exe and wrf_SST_ESMF.exe into -# test/em_esmf_exp when ESMF_COUPLING is set. wrf.exe -# can be used for stand-alone testing in this case. -# wrf_SST_ESMF.exe is a coupled application. Note that make -# target $(SOLVER)_wrf_SST_ESMF builds wrf_SST_ESMF.exe. +# Link wrf.exe and wrf_SST_ESMF.exe into +# test/em_esmf_exp when ESMF_COUPLING is set. wrf.exe +# can be used for stand-alone testing in this case. +# wrf_SST_ESMF.exe is a coupled application. Note that make +# target $(SOLVER)_wrf_SST_ESMF builds wrf_SST_ESMF.exe. em_real : wrf @/bin/rm -f real.exe > /dev/null 2>&1 @/bin/rm -f tc.exe > /dev/null 2>&1 @@ -923,31 +923,31 @@ framework : @ echo '--------------------------------------' ( cd frame ; $(MAKE) $(J) LLIST="$(LINKLIST)" framework ; \ cd ../external/io_netcdf ; \ - $(MAKE) NETCDFPATH="$(NETCDFPATH)" \ + $(MAKE) NETCDFPATH="$(NETCDFPATH)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(FC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \ LIB_LOCAL="$(LIB_LOCAL)" \ ESMF_MOD_DEPENDENCE="$(ESMF_MOD_DEPENDENCE)" AR="INTERNAL_BUILD_ERROR_SHOULD_NOT_NEED_AR" diffwrf; \ cd ../io_netcdf ; \ - $(MAKE) NETCDFPATH="$(NETCDFPATH)" \ + $(MAKE) NETCDFPATH="$(NETCDFPATH)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(SFC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \ LIB_LOCAL="$(LIB_LOCAL)" \ ESMF_MOD_DEPENDENCE="$(ESMF_MOD_DEPENDENCE)" AR="INTERNAL_BUILD_ERROR_SHOULD_NOT_NEED_AR"; \ cd ../io_netcdfpar ; \ - $(NETCDFPAR_BUILD) $(MAKE) NETCDFPARPATH="$(NETCDFPATH)" \ + $(NETCDFPAR_BUILD) $(MAKE) NETCDFPARPATH="$(NETCDFPATH)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(FC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \ LIB_LOCAL="$(LIB_LOCAL)" \ ESMF_MOD_DEPENDENCE="$(ESMF_MOD_DEPENDENCE)" AR="INTERNAL_BUILD_ERROR_SHOULD_NOT_NEED_AR" diffwrf; \ cd ../io_netcdfpar ; \ - $(NETCDFPAR_BUILD) $(MAKE) NETCDFPARPATH="$(NETCDFPATH)" \ + $(NETCDFPAR_BUILD) $(MAKE) NETCDFPARPATH="$(NETCDFPATH)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(SFC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \ LIB_LOCAL="$(LIB_LOCAL)" \ ESMF_MOD_DEPENDENCE="$(ESMF_MOD_DEPENDENCE)" AR="INTERNAL_BUILD_ERROR_SHOULD_NOT_NEED_AR"; \ cd ../io_pio ; \ - echo SKIPPING PIO BUILD $(MAKE) NETCDFPATH="$(PNETCDFPATH)" \ + echo SKIPPING PIO BUILD $(MAKE) NETCDFPATH="$(PNETCDFPATH)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(SFC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \ LIB_LOCAL="$(LIB_LOCAL)" \ @@ -964,13 +964,13 @@ framework_plus : @ echo '--------------------------------------' ( cd frame ; $(MAKE) $(J) LLIST="$(MODLL)" framework ; \ cd ../external/io_netcdf ; \ - $(MAKE) NETCDFPATH="$(NETCDFPATH)" \ + $(MAKE) NETCDFPATH="$(NETCDFPATH)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(FC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \ LIB_LOCAL="$(LIB_LOCAL)" \ ESMF_MOD_DEPENDENCE="$(ESMF_MOD_DEPENDENCE)" AR="INTERNAL_BUILD_ERROR_SHOULD_NOT_NEED_AR" diffwrf; \ cd ../io_netcdf ; \ - $(MAKE) NETCDFPATH="$(NETCDFPATH)" \ + $(MAKE) NETCDFPATH="$(NETCDFPATH)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(SFC) $(FCBASEOPTS) $(PROMOTION) $(FCDEBUG) $(OMP)" RANLIB="$(RANLIB)" \ CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" TRADFLAG="$(TRADFLAG)" ESMF_IO_LIB_EXT="$(ESMF_IO_LIB_EXT)" \ LIB_LOCAL="$(LIB_LOCAL)" \ @@ -1069,10 +1069,10 @@ fseek_test : # rule used by configure to test if this will compile with netcdf4 nc4_test: - if [ $(USENETCDFPAR) -eq 0 ] ; then \ - ( cd tools ; /bin/rm -f nc4_test.{exe,nc,o} ; $(SCC) -o nc4_test.exe nc4_test.c -I$(NETCDF)/include -L$(NETCDF)/lib -lnetcdf $(NETCDF4_DEP_LIB) ; cd .. ) ; \ + if [ -z "$(USENETCDFPAR)" ] || [ $(USENETCDFPAR) -eq 0 ] ; then \ + ( cd tools ; /bin/rm -f nc4_test.{exe,nc,o} ; $(SCC) -o nc4_test.exe nc4_test.c -I$(NETCDF_C)/include $(NETCDF4_DEP_LIB) ; cd .. ) ; \ else \ - ( cd tools ; /bin/rm -f nc4_test.{exe,nc,o} ; $(DM_CC) -o nc4_test.exe nc4_test.c -I$(NETCDF)/include -L$(NETCDF)/lib -lnetcdf $(NETCDF4_DEP_LIB) ; cd .. ) ; \ + ( cd tools ; /bin/rm -f nc4_test.{exe,nc,o} ; $(DM_CC) -o nc4_test.exe nc4_test.c -I$(NETCDF_C)/include $(NETCDF4_DEP_LIB) ; cd .. ) ; \ fi # rule used by configure to test if Fortran 2003 IEEE signaling is available @@ -1110,8 +1110,8 @@ toolsdir : # ( cd tools ; $(MAKE) CC_TOOLS="$(CC_TOOLS) -DIO_MASK_SIZE=$(IO_MASK_SIZE)" ) -# Use this target to build stand-alone tests of esmf_time_f90. -# Only touches external/esmf_time_f90/. +# Use this target to build stand-alone tests of esmf_time_f90. +# Only touches external/esmf_time_f90/. esmf_time_f90_only : @ echo '--------------------------------------' ( cd external/esmf_time_f90 ; $(MAKE) FC="$(FC) $(FCFLAGS)" CPP="$(CPP) -DTIME_F90_ONLY" tests ) diff --git a/README b/README index 18c13efec1..30879e360b 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -WRF Model Version 4.5.1 +WRF Model Version 4.5.2 https://www2.mmm.ucar.edu/wrf/users/ diff --git a/arch/Config.pl b/arch/Config.pl index 9585dfd3a1..761c540abe 100644 --- a/arch/Config.pl +++ b/arch/Config.pl @@ -49,8 +49,9 @@ $sw_time = "" ; # name of a timer to time fortran compiles, e.g. timex or time $sw_ifort_r8 = 0 ; $sw_hdf5 = "-lhdf5_hl -lhdf5"; +$sw_hdf5_hl_fortran="-lhdf5_hl_fortran"; $sw_zlib = "-lz"; -$sw_dep_lib_path = ""; +$sw_netcdf4_dep_lib = ""; $sw_gpfs_path = ""; $sw_gpfs_lib = "-lgpfs"; $sw_curl_path = ""; @@ -69,10 +70,10 @@ { $sw_netcdf_path = substr( $ARGV[0], 8 ) ; } - if ( substr( $ARGV[0], 1, 13 ) eq "dep_lib_path=" ) + if ( substr( $ARGV[0], 1, 16 ) eq "netcdf4_dep_lib=" ) { - $sw_dep_lib_path = substr( $ARGV[0], 14 ) ; - $sw_dep_lib_path =~ s/\r|\n/ /g ; + $sw_netcdf4_dep_lib = substr( $ARGV[0], 17 ) ; + $sw_netcdf4_dep_lib =~ s/\r|\n/ /g ; } if ( substr( $ARGV[0], 1, 5 ) eq "gpfs=" ) { @@ -349,6 +350,15 @@ $sw_ctsm_mkfile_path = $ENV{WRF_CTSM_MKFILE}; } +if ( $sw_hdf5_path ) { + opendir(my $dh, "$sw_hdf5_path/lib"); + ($hl) = grep(/hdf5hl_fortran/i, readdir $dh); + closedir($dh); + if ($hl ne "") { + $sw_hdf5_hl_fortran="-lhdf5hl_fortran"; + } +} + # parse the configure.wrf file $validresponse = 0 ; @@ -453,6 +463,7 @@ } else { $sw_terrain_and_landuse =" -DLANDREAD_STUB=1" ; } + open CONFIGURE_DEFAULTS, "cat ./arch/configure.defaults |" ; $latchon = 0 ; while ( ) @@ -732,7 +743,7 @@ } if ( $sw_hdf5_path ) - { $_ =~ s:CONFIGURE_HDF5_LIB_PATH:-L$sw_hdf5_path/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lm -lz: ; + { $_ =~ s:CONFIGURE_HDF5_LIB_PATH:-L$sw_hdf5_path/lib $sw_hdf5_hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lm -lz: ; $_ =~ s:CONFIGURE_HDF5_FLAG:-DHDF5: ; } else @@ -1039,7 +1050,7 @@ $_ =~ s/CONFIGURE_CONFIG_NUM/Compiler choice: $response_opt/g ; $_ =~ s/CONFIGURE_CONFIG_NEST/Nesting option: $response_nesting/g ; - $_ =~ s/CONFIGURE_DEP_LIB_PATH/$sw_dep_lib_path/g ; + $_ =~ s/CONFIGURE_NETCDF4_DEP_LIB/$sw_netcdf4_dep_lib/g ; $_ =~ s/CONFIGURE_COMMS_LIB/$sw_comms_lib/g ; if ( $sw_os ne "CYGWIN_NT" ) { @@ -1120,7 +1131,7 @@ } if ( $sw_hdf5_path ) - { $_ =~ s:CONFIGURE_HDF5_LIB_PATH:-L$sw_hdf5_path/lib -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lm -lz: ; + { $_ =~ s:CONFIGURE_HDF5_LIB_PATH:-L$sw_hdf5_path/lib $sw_hdf5_hl_fortran -lhdf5_hl -lhdf5_fortran -lhdf5 -lm -lz: ; $_ =~ s:CONFIGURE_HDF5_FLAG:-DHDF5: ; } else @@ -1169,7 +1180,7 @@ $_ .= " " . $sw_curl_lib . "\n" ; } } - if ( $sw_dep_lib_path ne "" ) + if ( $sw_netcdf4_dep_lib ne "" ) { if (/^HDF5.*=/) { $_ =~ s/\r|\n//g; $_ .= " " . $sw_hdf5 . "\n" ; @@ -1200,4 +1211,3 @@ printf "Configuration successful! \n" ; printf "------------------------------------------------------------------------\n" ; - diff --git a/arch/configure.defaults b/arch/configure.defaults index aed98042a2..36ca1b6e00 100644 --- a/arch/configure.defaults +++ b/arch/configure.defaults @@ -304,7 +304,7 @@ DESCRIPTION = INTEL ($SFC/$SCC) DMPARALLEL = # 1 OMPCPP = # -D_OPENMP OMP = # -qopenmp -fpp -auto -OMPCC = # -qopenmp -fpp -auto +OMPCC = # -qopenmp SFC = ifort SCC = icc CCOMP = icc @@ -350,7 +350,7 @@ DESCRIPTION = INTEL ($SFC/$SCC): Xeon Phi (MIC architecture) DMPARALLEL = 1 OMPCPP = -D_OPENMP OMP = -qopenmp -fpp -auto -OMPCC = -qopenmp -fpp -auto +OMPCC = -qopenmp SFC = ifort -mmic SCC = icc -mmic CCOMP = icc -mmic @@ -398,7 +398,7 @@ DESCRIPTION = INTEL ($SFC/$SCC): Xeon (SNB with AVX mods) DMPARALLEL = # 1 OMPCPP = # -D_OPENMP OMP = # -qopenmp -fpp -auto -OMPCC = # -qopenmp -fpp -auto +OMPCC = # -qopenmp SFC = ifort SCC = icc CCOMP = icc @@ -472,7 +472,7 @@ DESCRIPTION = INTEL ($SFC/$SCC): SGI MPT DMPARALLEL = # 1 OMPCPP = # -D_OPENMP OMP = # -qopenmp -fpp -auto -OMPCC = # -qopenmp -fpp -auto +OMPCC = # -qopenmp SFC = ifort SCC = icc CCOMP = icc @@ -522,7 +522,7 @@ DESCRIPTION = INTEL ($SFC/$SCC): IBM POE DMPARALLEL = # 1 OMPCPP = # -D_OPENMP OMP = # -qopenmp -fpp -auto -OMPCC = # -qopenmp -fpp -auto +OMPCC = # -qopenmp SFC = ifort SCC = icc CCOMP = icc @@ -602,7 +602,7 @@ DESCRIPTION = INTEL ($SFC/$SCC): ia64 DMPARALLEL = # 1 OMPCPP = # -D_OPENMP OMP = # -qopenmp -fpp -auto -OMPCC = # -qopenmp -fpp -auto +OMPCC = # -qopenmp SFC = ifort SCC = icc CCOMP = icc @@ -686,7 +686,7 @@ DESCRIPTION = INTEL ($SFC/$SCC): SGI Altix DMPARALLEL = # 1 OMPCPP = # -D_OPENMP OMP = # -qopenmp -fpp -auto -OMPCC = # -qopenmp -fpp -auto +OMPCC = # -qopenmp SFC = ifort SCC = icc CCOMP = icc @@ -868,7 +868,7 @@ DESCRIPTION = INTEL ($SFC/$SCC) DMPARALLEL = # 1 OMPCPP = # -D_OPENMP OMP = # -qopenmp -fpp -auto -OMPCC = # -qopenmp -fpp -auto +OMPCC = # -qopenmp SFC = ifort SCC = icc CCOMP = icc @@ -1358,7 +1358,7 @@ DESCRIPTION = INTEL ($SFC/$SCC): Cray XC DMPARALLEL = # 1 OMPCPP = # -D_OPENMP OMP = # -qopenmp -fpp -auto -OMPCC = # -qopenmp -fpp -auto +OMPCC = # -qopenmp SFC = ftn SCC = icc CCOMP = icc @@ -1745,7 +1745,7 @@ DESCRIPTION = INTEL ($SFC/$SCC): Open MPI DMPARALLEL = # 1 OMPCPP = # -D_OPENMP OMP = # -qopenmp -fpp -auto -OMPCC = # -qopenmp -fpp -auto +OMPCC = # -qopenmp SFC = ifort SCC = icc CCOMP = icc @@ -1881,7 +1881,7 @@ DESCRIPTION = INTEL ($SFC/$SCC): HSW/BDW DMPARALLEL = # 1 OMPCPP = # -D_OPENMP OMP = # -qopenmp -fpp -auto -OMPCC = # -qopenmp -fpp -auto +OMPCC = # -qopenmp SFC = ifort SCC = icc CCOMP = icc @@ -1926,7 +1926,7 @@ DESCRIPTION = INTEL ($SFC/$SCC): KNL MIC DMPARALLEL = # 1 OMPCPP = # -D_OPENMP OMP = # -qopenmp -fpp -auto -OMPCC = # -qopenmp -fpp -auto +OMPCC = # -qopenmp SFC = ifort SCC = icc CCOMP = icc @@ -2124,6 +2124,92 @@ NETCDFPAR_BUILD = CONFIGURE_NETCDFPAR_BUILD #insert new stanza here +########################################################### +#ARCH Linux x86_64 ppc64le i486 i586 i686, Intel oneAPI compiler with icx #serial smpar dmpar dm+sm +# This mirrors the above Intel build but changes ifort=>ifx icc=>icx + +DESCRIPTION = INTEL ($SFC/$SCC) : oneAPI LLVM +DMPARALLEL = # 1 +OMPCPP = # -D_OPENMP +OMP = # -qopenmp -fpp -auto +OMPCC = # -qopenmp -auto +SFC = ifx +SCC = icx +CCOMP = icx +DM_FC = mpif90 -f90=$(SFC) +DM_CC = mpicc -cc=$(SCC) +FC = CONFIGURE_FC +CC = CONFIGURE_CC +LD = $(FC) +RWORDSIZE = CONFIGURE_RWORDSIZE +PROMOTION = -real-size `expr 8 \* $(RWORDSIZE)` -i4 +ARCH_LOCAL = -DNONSTANDARD_SYSTEM_FUNC CONFIGURE_D_CTSM +CFLAGS_LOCAL = -w -O3 -ip #-xHost -fp-model fast=2 -no-prec-div -no-prec-sqrt -ftz -no-multibyte-chars # -DRSL0_ONLY +LDFLAGS_LOCAL = -ip #-xHost -fp-model fast=2 -no-prec-div -no-prec-sqrt -ftz -align all -fno-alias -fno-common +CPLUSPLUSLIB = +ESMF_LDFLAG = $(CPLUSPLUSLIB) +FCOPTIM = -O3 +FCREDUCEDOPT = $(FCOPTIM) +FCNOOPT = -O0 -fno-inline -no-ip +FCDEBUG = # -g $(FCNOOPT) -traceback # -fpe0 -check noarg_temp_created,bounds,format,output_conversion,pointers,uninit -ftrapuv -unroll0 -u +FORMAT_FIXED = -FI +FORMAT_FREE = -FR +FCSUFFIX = +BYTESWAPIO = -convert big_endian +RECORDLENGTH = -assume byterecl +FCBASEOPTS_NO_G = -ip -fp-model precise -w -ftz -align all -fno-alias $(FORMAT_FREE) $(BYTESWAPIO) #-xHost -fp-model fast=2 -no-heap-arrays -no-prec-div -no-prec-sqrt -fno-common +FCBASEOPTS = $(FCBASEOPTS_NO_G) $(FCDEBUG) +MODULE_SRCH_FLAG = +TRADFLAG = CONFIGURE_TRADFLAG +CPP = /lib/cpp CONFIGURE_CPPFLAGS +AR = ar +ARFLAGS = ru +M4 = m4 +RANLIB = ranlib +RLFLAGS = +CC_TOOLS = $(SCC) +NETCDFPAR_BUILD = CONFIGURE_NETCDFPAR_BUILD + +########################################################### +#ARCH Linux aarch64, armclang compiler OpenMPI # serial smpar dmpar dm+sm +# +DESCRIPTION = armclang ($SFC/$SCC): Aarch64 +DMPARALLEL = +OMPCPP = -fopenmp +OMP = -fopenmp +OMPCC = -fopenmp +SFC = armflang +SCC = armclang +CCOMP = armclang +DM_FC = mpif90 +DM_CC = mpicc -DMPI2_SUPPORT +FC = CONFIGURE_FC +CC = CONFIGURE_CC +LD = $(FC) +RWORDSIZE = CONFIGURE_RWORDSIZE +PROMOTION = +ARCH_LOCAL = +CFLAGS_LOCAL = -w -O3 -c -Wno-implicit-function-declaration -Wno-int-conversion -Wno-implicit-int +LDFLAGS_LOCAL = -fopenmp +FCOPTIM = -Ofast -mcpu=native -funroll-loops +FCREDUCEDOPT = $(FCOPTIM) +FCNOOPT = -O0 -fopenmp -frecursive +FCDEBUG = -g $(FCNOOPT) +FORMAT_FIXED = -ffixed-form -ffixed-line-length-0 +FORMAT_FREE = -ffree-form -ffree-line-length-0 +FCSUFFIX = +BYTESWAPIO = -fconvert=big-endian -frecord-marker=4 +FCBASEOPTS = -w $(FORMAT_FREE) $(BYTESWAPIO) +MODULE_SRCH_FLAG= -I$(WRF_SRC_ROOT_DIR)/main +TRADFLAG = -traditional-cpp +CPP = /lib/cpp CONFIGURE_CPPFLAGS +AR = ar +ARFLAGS = ru +M4 = m4 -B 14000 +RANLIB = ranlib +RLFLAGS = +CC_TOOLS = $(SCC) -Wno-implicit-function-declaration -Wno-int-conversion -Wno-implicit-int + ########################################################### #ARCH Linux aarch64, GCC compiler OpenMPI # serial smpar dmpar dm+sm # diff --git a/arch/postamble b/arch/postamble index 061fb4e0da..936f0405c8 100644 --- a/arch/postamble +++ b/arch/postamble @@ -94,15 +94,16 @@ module_dm_rsllite : ( if [ ! -e module_dm.F ] ; then /bin/cp module_dm_warning module_dm.F ; \ cat $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/module_dm.F >> module_dm.F ; fi ) -wrfio_nf : +wrfio_nf : ( cd $(WRF_SRC_ROOT_DIR)/external/io_netcdf ; \ make $(J) NETCDFPATH="$(NETCDFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP)" \ - CC="$(SCC)" CFLAGS="$(CFLAGS)" \ + CC="$(SCC)" CFLAGS="$(CFLAGS)" NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(SFC) $(PROMOTION) $(OMP) $(FCFLAGS)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ) wrfio_nfpar : ( cd $(WRF_SRC_ROOT_DIR)/external/io_netcdfpar ; \ make $(J) NETCDFPARPATH="$(NETCDFPATH)" RANLIB="$(RANLIB)" CPP="$(CPP) $(ARCHFLAGS)" \ + NETCDF4_DEP_LIB="$(NETCDF4_DEP_LIB)" \ FC="$(FC) $(PROMOTION) $(OMP) $(FCFLAGS)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ) wrfio_pnf : @@ -118,7 +119,7 @@ wrfio_adios2 : wrfio_grib_share : ( cd $(WRF_SRC_ROOT_DIR)/external/io_grib_share ; \ make $(J) CC="$(SCC)" CFLAGS="$(CFLAGS)" RM="$(RM)" RANLIB="$(RANLIB)" CPP="$(CPP)" \ - FC="$(SFC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" archive) + FC="$(SFC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" archive) wrfio_grib1 : ( cd $(WRF_SRC_ROOT_DIR)/external/io_grib1 ; \ @@ -132,13 +133,13 @@ wrfio_grib2 : FC="$(SFC) $(PROMOTION) -I. $(FCDEBUG) $(FCBASEOPTS) $(FCSUFFIX)" TRADFLAG="-traditional" AR="$(AR)" ARFLAGS="$(ARFLAGS)" \ FIXED="$(FORMAT_FIXED)" archive) -wrfio_int : +wrfio_int : ( cd $(WRF_SRC_ROOT_DIR)/external/io_int ; \ make $(J) CC="$(CC)" CFLAGS_LOCAL="$(CFLAGS_LOCAL)" RM="$(RM)" RANLIB="$(RANLIB)" CPP="$(CPP)" \ FC="$(FC) $(PROMOTION) $(FCDEBUG) $(FCBASEOPTS) $(OMP)" FGREP="$(FGREP)" \ TRADFLAG="$(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ARCHFLAGS="$(ARCHFLAGS)" all ) -esmf_time : +esmf_time : ( cd $(WRF_SRC_ROOT_DIR)/external/esmf_time_f90 ; \ make $(J) FC="$(SFC) $(PROMOTION) $(FCDEBUG) $(FCBASEOPTS)" RANLIB="$(RANLIB)" \ CPP="$(CPP) -I$(WRF_SRC_ROOT_DIR)/inc -I. $(ARCHFLAGS) $(TRADFLAG)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" ) @@ -201,12 +202,12 @@ wrfio_esmf : mv $*.f90.tmp $*.f90 ; \ fi $(FC) -o $@ -c $(FCFLAGS) $(OMP) $(MODULE_DIRS) $(PROMOTION) $(FCSUFFIX) $*.f90 - + .F.f90: $(RM) $@ sed -e "s/^\!.*'.*//" -e "s/^ *\!.*'.*//" $*.F > $*.G - $(SED_FTN) $*.G > $*.H + $(SED_FTN) $*.G > $*.H $(CPP) -I$(WRF_SRC_ROOT_DIR)/inc $(CPPFLAGS) $*.H > $@ $(RM) $*.G $*.H diff --git a/arch/preamble b/arch/preamble index ab97abbb4b..4543411e6f 100644 --- a/arch/preamble +++ b/arch/preamble @@ -94,8 +94,7 @@ GPFS = CURL = HDF5 = ZLIB = -DEP_LIB_PATH = CONFIGURE_DEP_LIB_PATH -NETCDF4_DEP_LIB = $(DEP_LIB_PATH) $(HDF5) $(ZLIB) $(GPFS) $(CURL) +NETCDF4_DEP_LIB = CONFIGURE_NETCDF4_DEP_LIB # NETCDF4INCLUDEGOESHERE diff --git a/configure b/configure index 27b01b19ce..41243e2813 100755 --- a/configure +++ b/configure @@ -50,7 +50,7 @@ if [ -n "$print_usage" ] ; then echo '-help print this message' echo '*****************************************************************************' echo ' ' - exit + exit fi if `pwd | grep ' ' > /dev/null ` ; then @@ -123,7 +123,7 @@ do else echo "$ac_t""found $ac_prog_where ($PERL)" 1>&1 fi - PERLFULLPATH=$ac_prog_where + PERLFULLPATH=$ac_prog_where else if test -z "$ac_echo_test" -a 1 = 1 ; then echo "$ac_t""no" @@ -135,16 +135,16 @@ do done if test -z "$PERL" ; then - # We have to set this outside of the loop lest the first failure in + # We have to set this outside of the loop lest the first failure in # PROGRAM_CHECK set the value (which then terminates the effect of the - # loop, since autoconf macros only set values that are null, they + # loop, since autoconf macros only set values that are null, they # don't override them PERL="" fi if test -n "$PERL" ; then PERL="$PERL" - + perlversion=`$PERL -v | grep 'This is perl' | \ sed -e 's/^.*v[a-z ]*\([0-9]\).*$/\1/'` @@ -159,8 +159,31 @@ if test -n "$PERL" ; then fi -if [ -e $NETCDF/bin/nc-config ] ; then - ncversion=`nc-config --version | awk '{print $2}'` +# We just need to find nc-config. First, check if NETCDF_C is set; if not, check +# $NETCDF/bin; otherwise, try `which nc-config`. If all that fails, warn user that WRF +# may fail to build beacuse of an incomplete NetCDF configuration. It could still be +# successfull if NetCDF was built statically because the results of `nf-config --flibs` +# should contain the necessary information for linking as long as NetCDF-Fortran is not +# version 4.5.3 (see https://github.com/Unidata/netcdf-fortran/issues/270) + +if [ -n "$NETCDF_C" ] ; then + if [ -f "$NETCDF_C/bin/nc-config" ] ; then + export NETCDF_C=$NETCDF_C + fi +elif [ -f "${NETCDF}/bin/nc-config" ] ; then + export NETCDF_C=$NETCDF +else + ans="`which nc-config`" + status="$?" + if [ "$ans" != "nc-config:" -a "$ans" != "" -a "$status" = "0" ] ; then + export NETCDF_C=`echo $ans | awk -F/ '{NF=NF-2;$NF=$NF}1' OFS=/` + else + export NETCDF_C="NOT_FOUND" + fi +fi + +if [ -e $NETCDF_C/bin/nc-config ] ; then + ncversion=`$NETCDF_C/bin/nc-config --version | awk '{print $2}'` else ncversion=OLD fi @@ -168,10 +191,10 @@ fi PROBS=FALSE if [ -n "$NETCDFPAR" ] ; then NETCDF="$NETCDFPAR" - if [ ! -e $NETCDF/bin/nc-config ] ; then + if [ ! -e $NETCDF_C/bin/nc-config ] ; then PROBS=TRUE else - ncversion=`nc-config --version | awk '{print $2}'` + ncversion=`$NETCDF_C/bin/nc-config --version | awk '{print $2}'` ncversiona=`echo $ncversion | cut -c 1` ncversionb=`echo $ncversion | cut -c 3` ncversionc=`echo $ncversion | cut -c 5` @@ -224,7 +247,7 @@ if [ -n "$NETCDF" ] ; then else USENETCDFF=" " fi - if [ -f "$NETCDF/lib/libnetcdf.a" -o -f "$NETCDF/lib/libnetcdf.so" -o -f "$NETCDF/lib/libnetcdf.dll.a" ] ; then + if [ -f "$NETCDF_C/lib/libnetcdf.a" -o -f "$NETCDF_C/lib/libnetcdf.so" -o -f "$NETCDF_C/lib/libnetcdf.dll.a" ] ; then USENETCDF="-lnetcdf" else USENETCDF=" " @@ -243,9 +266,7 @@ fi # If the user asked for classic netcdf, acquiesce to the request. -ans="`which nf-config`" -status="$?" -if [ "$ans" = "nf-config:" -o "$ans" = "" -o "$status" != "0" ] ; then +if [ ! -f "$NETCDF/bin/nf-config" ] ; then export NETCDF_classic=1 unset NETCDF4 else @@ -257,7 +278,7 @@ else export NETCDF4=1 fi else - if [ "`nf-config --has-nc4`" = "yes" ] ; then + if [ "`$NETCDF/bin/nf-config --has-nc4`" = "yes" ] ; then unset NETCDF_classic export NETCDF4=1 else @@ -274,76 +295,19 @@ if [ -z "$CURL_PATH" ] ; then CURL_PATH=''; fi if [ -n "$NETCDF4" ] ; then if [ $NETCDF4 -eq 1 ] ; then - DEP_LIB_PATH='' - if [ -f $NETCDF/bin/nf-config ] ; then - nx_config="$NETCDF/bin/nf-config --flibs" - DEP_LIB_PATH="`$nx_config | awk '{for(i=1;i<=NF;i++){if(match($i, /-L.*/)) {print $i} } }'`" - CURL="`$nx_config | awk '{for(i=1;i<=NF;i++){if($i == "-lcurl") {print $i} } }'`" - GPFS="`$nx_config | awk '{for(i=1;i<=NF;i++){if($i == "-lgpfs") {print $i} } }'`" - fi - if [ "$DEP_LIB_PATH" = '' ] ; then - if [ -f $NETCDF/bin/nc-config ] ; then - nx_config="$NETCDF/bin/nc-config --libs" - DEP_LIB_PATH="`$nx_config | awk '{for(i=1;i<=NF;i++){if(match($i, /-L.*/)) {print $i} } }'`" - CURL="`$nx_config | awk '{for(i=1;i<=NF;i++){if($i == "-lcurl") {print $i} } }'`" - GPFS="`$nx_config | awk '{for(i=1;i<=NF;i++){if($i == "-lgpfs") {print $i} } }'`" - if [ "$CURL" != '' -a "$CURL_PATH" = '' ] ; then - CURL_PATH="DEFAULT" - fi - if [ "$GPFS" != '' -a "$GPFS_PATH" = '' ] ; then - GPFS_PATH="DEFAULT" - fi - fi - fi - for P in "$HDF5_PATH" "$ZLIB_PATH" "$GPFS_PATH" "$CURL_PATH" - do - if [ "$P" != '' -a "$P" != "DEFAULT" ] ; then - if [ "${P#${P%?}}" = "/" ] ; then - P=`echo $P | sed 's/\/$//'` - fi - DEP_LIB_PATH="`echo $DEP_LIB_PATH | awk -v VAR=-L$P/lib '{for(i=1;i<=NF;i++){if ($i != VAR ) {print $i} } }'`" - DEP_LIB_PATH="$DEP_LIB_PATH -L$P/lib" - fi - done - if [ "${NETCDF#${NETCDF%?}}" = "/" ] ; then - NETCDF=`echo $NETCDF | sed 's/\/$//'` - fi - buff="`ls -l $NETCDF | sed 's/ */ /g'`" - while [ "`echo $buff | grep lib`" = "" -a "`echo $buff | grep '\->'`" != "" ] - do - buff="`echo $buff | sed -e 's/->//' -e 's/ */ /g'`" - n=`echo $buff | wc -w` - lastword=`echo "$buff" | cut -d' ' -f$n | sed 's/\/$//'` - c="`echo $lastword | cut -c1`" - if [ "$c" = "/" ] ; then - NETCDF=$lastword - else - c="`echo $lastword | cut -c1-2`" - if [ "$c" = "./" ] ; then - lastword="echo $lastword | cut -c3-" - fi - NETCDF=${NETCDF%/*}/$lastword - fi - buff="`ls -l $NETCDF | sed 's/ */ /g'`" - done - if [ "`echo $NETCDF | grep '..'`" != "" ] ; then - buff="`echo $NETCDF | sed -e 's/^\///' -e 's/\// /g'`" - n=`echo $buff | wc -w` - i=1 - while [ $i -le $n ] - do - if [ "`echo $buff | cut -d' ' -f$i`" = ".." ] ; then - m=$i - fi - i=$(( $i + 1 )) - done - m=$(( $m + 1 )) - NETCDF=/"`echo $buff | cut -d' ' -f${m}- | sed 's/ */\//g'`" - fi - if [ "${DEP_LIB_PATH#${DEP_LIB_PATH%?}}" = "/" ] ; then - DEP_LIB_PATH=`echo $DEP_LIB_PATH | sed 's/\/$//'` + NETCDF4_DEP_LIB='' + if [ "$NETCDF_C" != "NOT_FOUND" -a -f $NETCDF_C/bin/nc-config ] ; then + nx_config="`$NETCDF_C/bin/nc-config --libs`" + NETCDF4_DEP_LIB="$NETCDF4_DEP_LIB $nx_config" + else + echo ' ' + echo '*****************************************************************************' + echo 'WARNING! Unable to find nc-config. Linking with NetCDF may fail.' + echo '*****************************************************************************' + echo ' ' fi - DEP_LIB_PATH="`echo $DEP_LIB_PATH | awk -v VAR=-L$NETCDF/lib '{for(i=1;i<=NF;i++){if ($i != VAR ) {print $i} } }'`" + nx_config="`$NETCDF/bin/nf-config --flibs`" + NETCDF4_DEP_LIB="$NETCDF4_DEP_LIB $nx_config" fi fi @@ -398,12 +362,12 @@ else unset WRFPLUS_DIR fi fi -# Users who are cross-compiling can set environment variable -# $WRF_OS to override the value normally obtained from `uname`. -# If $WRF_OS is set, then $WRF_MACH can also be set to override -# the value normally obtained from `uname -m`. If $WRF_OS is -# set and $WRF_MACH is not set, then $WRF_MACH defaults to "ARCH". -# If $WRF_OS is not set then $WRF_MACH is ignored. +# Users who are cross-compiling can set environment variable +# $WRF_OS to override the value normally obtained from `uname`. +# If $WRF_OS is set, then $WRF_MACH can also be set to override +# the value normally obtained from `uname -m`. If $WRF_OS is +# set and $WRF_MACH is not set, then $WRF_MACH defaults to "ARCH". +# If $WRF_OS is not set then $WRF_MACH is ignored. if [ -n "$WRF_OS" ] ; then echo "${0}: WRF operating system set to \"${WRF_OS}\" via environment variable \$WRF_OS" os=$WRF_OS @@ -456,7 +420,7 @@ fi # the "!" is removed by Config.pl if [ -n "$WRF_HYDRO" ] ; then if [ $WRF_HYDRO = 1 ] ; then - echo building WRF-HYDRO + echo building WRF-HYDRO compileflags="${compileflags}!-DWRF_HYDRO" echo $compileflags fi @@ -517,11 +481,11 @@ if [ -n "$WRF_CHEM" ] ; then echo building WRF with chemistry option compileflags="${compileflags}!-DWRF_CHEM!-DBUILD_CHEM=1" if [ -n "$WRF_KPP" ] ; then - if [ $WRF_KPP = 1 ] ; then + if [ $WRF_KPP = 1 ] ; then echo building WRF with KPP chemistry option compileflags="${compileflags}!-DWRF_KPP" fi - fi + fi else compileflags="${compileflags} " fi @@ -575,7 +539,7 @@ if test -n "$PERL" ; then -netcdf=$NETCDF -pnetcdf=$PNETCDF -netcdfpar=$NETCDFPAR -adios2=$ADIOS2 -hdf5=$HDF5 -phdf5=$PHDF5 -os=$os -mach=$mach -ldflags=$ldflags \ -compileflags=$compileflags -opt_level=$opt_level -USENETCDFF=$USENETCDFF -USENETCDF=$USENETCDF \ -time=$FORTRAN_COMPILER_TIMER -tfl="$TFL" -cfl="$CFL" -config_line="$config_line" \ - -wrf_core=$wrf_core -gpfs=$GPFS_PATH -curl=$CURL_PATH -dep_lib_path="$DEP_LIB_PATH" + -wrf_core=$wrf_core -gpfs=$GPFS_PATH -curl=$CURL_PATH -netcdf4_dep_lib="$NETCDF4_DEP_LIB" if test ! -f configure.wrf ; then echo "configure.wrf not created! Exiting configure script..." exit 1 @@ -620,7 +584,7 @@ if test -f configure.wrf ; then if [ "$os" = "Darwin" ] ; then # fseeko64 does not exist under Darwin fseeko does. Remove the 0 length executable # file that might get generated anyway, even though the compiler complains about missing reference. - /bin/rm -f tools/fseeko64_test + /bin/rm -f tools/fseeko64_test fi if test -x tools/fseeko64_test ; then ( tools/fseeko64_test 2> /dev/null ) 1> /dev/null @@ -665,7 +629,7 @@ if test -n "$NETCDF" ; then configure_aaaa=$? ; export configure_aaaa if [ $configure_aaaa -a -z "$WRFIO_NCD_NO_LARGE_FILE_SUPPORT" ] ; then echo "NetCDF users note:" - echo " This installation of NetCDF supports large file support. To DISABLE large file" + echo " This installation of NetCDF supports large file support. To DISABLE large file" echo " support in NetCDF, set the environment variable WRFIO_NCD_NO_LARGE_FILE_SUPPORT" echo " to 1 and run configure again. Set to any other value to avoid this message." fi @@ -690,7 +654,7 @@ if [ -n "$WRFPLUS" ] ; then fi fi -#Checking cross-compiling capability for some particular environment +#Checking cross-compiling capability for some particular environment #on Linux and Mac box if [ $os = "Linux" -o $os = "Darwin" ]; then @@ -724,7 +688,7 @@ EOF rm ${foo} ${foo}.F 2> /dev/null fi -cat > ${foo}.c < ${foo}.c < ${foo}.o + ar p $NETCDF_C/lib/libnetcdf.a `ar t $NETCDF_C/lib/libnetcdf.a | grep -E '\.o' | head -n 1 | sed 's/://'` > ${foo}.o netcdf_arch="`file ${foo}.o | grep -o -E '[0-9]{2}-bit|i386'`" rm ${foo}.o - $SFC -o ${foo} ${foo}.f > /dev/null 2>&1 + $SFC -o ${foo} ${foo}.f > /dev/null 2>&1 SFC_arch="`file ${foo} | grep -o -E '[0-9]{2}-bit|i386'`" rm ${foo} ${foo}.o 2> /dev/null @@ -790,7 +754,7 @@ EOF if [ "$SFC_arch" = "" -o "$SCC_arch" = "" -o "$CCOMP_arch" = "" ]; then echo " One of compilers testing failed!" echo " Please check your compiler" - echo + echo rm -f ${foo} ${foo}.[cfo] 2> /dev/null exit else @@ -901,14 +865,14 @@ EOF echo Please check your NetCDF lib and compiler else echo -m64 is appended to configure.wrf - echo It will be forced to build in 64-bit. + echo It will be forced to build in 64-bit. echo If you don\'t want 64-bit binaries, please use 32-bit NetCDF, and re-run the configure script. fi fi ;; esac - if [ -e configure.wrf.edit ]; then + if [ -e configure.wrf.edit ]; then mv configure.wrf.edit configure.wrf fi @@ -918,10 +882,10 @@ EOF echo " Fortran compiler is $SFC_arch" echo " It will build in $netcdf_arch" echo " " - if [ -e $NETCDF/bin/nc-config ] ; then + if [ -e $NETCDF_C/bin/nc-config ] ; then echo "NetCDF version: ${ncversion}" - echo "Enabled NetCDF-4/HDF-5: `nc-config --has-nc4`" - echo "NetCDF built with PnetCDF: `nc-config --has-pnetcdf`" + echo "Enabled NetCDF-4/HDF-5: `$NETCDF_C/bin/nc-config --has-nc4`" + echo "NetCDF built with PnetCDF: `$NETCDF_C/bin/nc-config --has-pnetcdf`" if [ "$USENETCDFPAR" = "1" ] ; then echo "Using parallel NetCDF via NETCDFPAR option" fi diff --git a/dyn_em/module_advect_em.F b/dyn_em/module_advect_em.F index ff03d1a695..62f4fafaa6 100644 --- a/dyn_em/module_advect_em.F +++ b/dyn_em/module_advect_em.F @@ -4620,14 +4620,14 @@ SUBROUTINE advect_w ( w, w_old, tendency, & ! (latitudes are as for u grid, longitudes are displaced) ! Therefore: flow is only from one side for points next to poles IF ( config_flags%polar .AND. (j == jds+1) ) THEN - DO k=kts,ktf + DO k=kts+1,ktf+1 DO i = i_start, i_end mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS tendency(i,k,j-1) = tendency(i,k,j-1) - mrdy*fqy(i,k,jp1) END DO END DO ELSE IF( config_flags%polar .AND. (j == jde) ) THEN - DO k=kts,ktf + DO k=kts+1,ktf+1 DO i = i_start, i_end mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS tendency(i,k,j-1) = tendency(i,k,j-1) + mrdy*fqy(i,k,jp0) @@ -4934,14 +4934,14 @@ SUBROUTINE advect_w ( w, w_old, tendency, & ! (latitudes are as for u grid, longitudes are displaced) ! Therefore: flow is only from one side for points next to poles IF ( config_flags%polar .AND. (j == jds+1) ) THEN - DO k=kts,ktf + DO k=kts+1,ktf+1 DO i = i_start, i_end mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS tendency(i,k,j-1) = tendency(i,k,j-1) - mrdy*fqy(i,k,jp1) END DO END DO ELSE IF( config_flags%polar .AND. (j == jde) ) THEN - DO k=kts,ktf + DO k=kts+1,ktf+1 DO i = i_start, i_end mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS tendency(i,k,j-1) = tendency(i,k,j-1) + mrdy*fqy(i,k,jp0) @@ -5293,14 +5293,14 @@ SUBROUTINE advect_w ( w, w_old, tendency, & ! (latitudes are as for u grid, longitudes are displaced) ! Therefore: flow is only from one side for points next to poles IF ( config_flags%polar .AND. (j == jds+1) ) THEN - DO k=kts,ktf + DO k=kts+1,ktf+1 DO i = i_start, i_end mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS tendency(i,k,j-1) = tendency(i,k,j-1) - mrdy*fqy(i,k,jp1) END DO END DO ELSE IF( config_flags%polar .AND. (j == jde) ) THEN - DO k=kts,ktf + DO k=kts+1,ktf+1 DO i = i_start, i_end mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS tendency(i,k,j-1) = tendency(i,k,j-1) + mrdy*fqy(i,k,jp0) @@ -5525,14 +5525,14 @@ SUBROUTINE advect_w ( w, w_old, tendency, & ! (latitudes are as for u grid, longitudes are displaced) ! Therefore: flow is only from one side for points next to poles IF ( config_flags%polar .AND. (j == jds+1) ) THEN - DO k=kts,ktf + DO k=kts+1,ktf+1 DO i = i_start, i_end mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS tendency(i,k,j-1) = tendency(i,k,j-1) - mrdy*fqy(i,k,jp1) END DO END DO ELSE IF( config_flags%polar .AND. (j == jde) ) THEN - DO k=kts,ktf + DO k=kts+1,ktf+1 DO i = i_start, i_end mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS tendency(i,k,j-1) = tendency(i,k,j-1) + mrdy*fqy(i,k,jp0) @@ -12541,14 +12541,14 @@ SUBROUTINE advect_weno_w ( w, w_old, tendency, & ! (latitudes are as for u grid, longitudes are displaced) ! Therefore: flow is only from one side for points next to poles IF ( config_flags%polar .AND. (j == jds+1) ) THEN - DO k=kts,ktf + DO k=kts+1,ktf+1 DO i = i_start, i_end mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS tendency(i,k,j-1) = tendency(i,k,j-1) - mrdy*fqy(i,k,jp1) END DO END DO ELSE IF( config_flags%polar .AND. (j == jde) ) THEN - DO k=kts,ktf + DO k=kts+1,ktf+1 DO i = i_start, i_end mrdy=msftx(i,j-1)*rdy ! see ADT eqn 46 dividing by my, 2nd term RHS tendency(i,k,j-1) = tendency(i,k,j-1) + mrdy*fqy(i,k,jp0) diff --git a/external/RSL_LITE/buf_for_proc.c b/external/RSL_LITE/buf_for_proc.c index 5d50cbf14a..e31703091a 100755 --- a/external/RSL_LITE/buf_for_proc.c +++ b/external/RSL_LITE/buf_for_proc.c @@ -148,6 +148,7 @@ fprintf(stderr,"buffer_for_proc %s %d : was %d, increasing to %d\n", return(ret) ; } +int show_tot_size() { int P ; @@ -164,9 +165,7 @@ show_tot_size() } int -buffer_size_for_proc( P, code ) - int P ; - int code ; +buffer_size_for_proc( int P, int code ) { return( buftab[code][P].size ) ; } diff --git a/external/RSL_LITE/c_code.c b/external/RSL_LITE/c_code.c index 27549bdf9c..8db9aba3ba 100755 --- a/external/RSL_LITE/c_code.c +++ b/external/RSL_LITE/c_code.c @@ -14,6 +14,8 @@ #ifdef _WIN32 #include +#else +#include #endif #ifdef NCEP_DEBUG_MULTIDIR // # include @@ -243,6 +245,7 @@ gethostid () } #endif +int RSL_LITE_GET_HOSTNAME ( char * hn, int * size, int *n, int *hostid ) { char temp[512] ; @@ -256,6 +259,7 @@ RSL_LITE_GET_HOSTNAME ( char * hn, int * size, int *n, int *hostid ) return(0) ; } +int BYTE_BCAST ( char * buf, int * size, int * Fcomm ) { #ifndef STUBMPI @@ -275,6 +279,7 @@ BYTE_BCAST ( char * buf, int * size, int * Fcomm ) #endif } +int BYTE_BCAST_FROM_ROOT ( char * buf, int * size, int *root , int * Fcomm ) { #ifndef STUBMPI @@ -297,6 +302,7 @@ BYTE_BCAST_FROM_ROOT ( char * buf, int * size, int *root , int * Fcomm ) static int yp_curs, ym_curs, xp_curs, xm_curs ; static int yp_curs_recv, ym_curs_recv, xp_curs_recv, xm_curs_recv ; +int RSL_LITE_INIT_EXCH ( int * Fcomm0, int * shw0, int * xy0 , @@ -395,6 +401,7 @@ RSL_LITE_INIT_EXCH ( xp_curs_recv = nbytes_x_recv ; xm_curs_recv = nbytes_x_recv ; } +int RSL_LITE_PACK ( int * Fcomm0, char * buf , int * shw0 , int * sendbegm0 , int * sendwm0 , int * sendbegp0 , int * sendwp0 , int * recvbegm0 , int * recvwm0 , int * recvbegp0 , int * recvwp0 , @@ -690,6 +697,7 @@ RSL_LITE_PACK ( int * Fcomm0, char * buf , int * shw0 , } #if ( WRFPLUS == 1 ) +int RSL_LITE_PACK_AD ( int * Fcomm0, char * buf , int * shw0 , int * sendbegm0 , int * sendwm0 , int * sendbegp0 , int * sendwp0 , int * recvbegm0 , int * recvwm0 , int * recvbegp0 , int * recvwp0 , @@ -989,6 +997,7 @@ static MPI_Request yp_recv, ym_recv, yp_send, ym_send ; static MPI_Request xp_recv, xm_recv, xp_send, xm_send ; #endif +int RSL_LITE_EXCH_Y ( int * Fcomm0, int *me0, int * np0 , int * np_x0 , int * np_y0 , int * sendw_m, int * sendw_p, int * recvw_m , int * recvw_p ) { @@ -1026,6 +1035,7 @@ RSL_LITE_EXCH_Y ( int * Fcomm0, int *me0, int * np0 , int * np_x0 , int * np_y0 #endif } +int RSL_LITE_EXCH_X ( int * Fcomm0, int *me0, int * np0 , int * np_x0 , int * np_y0 , int * sendw_m, int * sendw_p, int * recvw_m , int * recvw_p ) { @@ -1065,6 +1075,7 @@ RSL_LITE_EXCH_X ( int * Fcomm0, int *me0, int * np0 , int * np_x0 , int * np_y0 #if !defined( MS_SUA) && !defined(_WIN32) #include +int RSL_INTERNAL_MILLICLOCK () { struct timeval tb ; @@ -1078,6 +1089,7 @@ RSL_INTERNAL_MILLICLOCK () msecs = 1000 * isec + usec / 1000 ; return(msecs) ; } +int RSL_INTERNAL_MICROCLOCK () { struct timeval tb ; diff --git a/external/RSL_LITE/cycle.c b/external/RSL_LITE/cycle.c index e9b2738e2d..0acfd9e3a8 100644 --- a/external/RSL_LITE/cycle.c +++ b/external/RSL_LITE/cycle.c @@ -32,7 +32,7 @@ static int *nbytes_dst = NULL ; static MPI_Request *x_recv = NULL , *x_send = NULL ; #endif -RSL_LITE_INIT_CYCLE ( int * Fcomm , +void RSL_LITE_INIT_CYCLE ( int * Fcomm , int * xy0 , int * inout0 , int * n3dR0, int *n2dR0, int * typesizeR0 , int * n3dI0, int *n2dI0, int * typesizeI0 , @@ -142,7 +142,7 @@ RSL_LITE_INIT_CYCLE ( int * Fcomm , #endif } -RSL_LITE_PACK_CYCLE ( int * Fcomm, char * buf , int * inout0 , int * typesize0 , int * xy0 , int * pu0 , char * memord , int * xstag0 , +void RSL_LITE_PACK_CYCLE ( int * Fcomm, char * buf , int * inout0 , int * typesize0 , int * xy0 , int * pu0 , char * memord , int * xstag0 , int *me0, int * np0 , int * np_x0 , int * np_y0 , int * min_subdomain, int * ids0 , int * ide0 , int * jds0 , int * jde0 , int * kds0 , int * kde0 , @@ -343,7 +343,7 @@ RSL_LITE_PACK_CYCLE ( int * Fcomm, char * buf , int * inout0 , int * typesize0 , #endif } -RSL_LITE_CYCLE ( int * Fcomm0, int *me0, int * np0 , int * np_x0 , int * np_y0 ) +void RSL_LITE_CYCLE ( int * Fcomm0, int *me0, int * np0 , int * np_x0 , int * np_y0 ) { int me, np, np_x, np_y ; int yp, ym, xp, xm, nb ; diff --git a/external/RSL_LITE/gen_comms.c b/external/RSL_LITE/gen_comms.c index 2a6b2ef5bd..d62c5cb5af 100644 --- a/external/RSL_LITE/gen_comms.c +++ b/external/RSL_LITE/gen_comms.c @@ -1218,6 +1218,7 @@ fprintf(fp,"CALL wrf_debug(3,'calling RSL_LITE_INIT_EXCH %s for Y %s')\n",maxste } #endif +int #if ( WRFPLUS == 1 ) gen_packs_halo ( FILE *fp , node_t *p, char *shw, int xy /* 0=y,1=x */ , int pu /* 0=pack,1=unpack */, int nta /* 0=NLM,1=TLM,2=ADM*/, char * packname, char * commname, int always_interp_mp ) #else @@ -1454,6 +1455,7 @@ fprintf(fp,"(ips-1)*grid%%sr_x+1,ipe*grid%%sr_x,(jps-1)*grid%%sr_y+1,jpe*grid%%s } } +int gen_packs ( FILE *fp , node_t *p, int shw, int xy /* 0=y,1=x */ , int pu /* 0=pack,1=unpack */, char * packname, char * commname ) { node_t * q ; diff --git a/external/RSL_LITE/period.c b/external/RSL_LITE/period.c index 8e288b6ccf..b0401d03c5 100755 --- a/external/RSL_LITE/period.c +++ b/external/RSL_LITE/period.c @@ -14,7 +14,7 @@ static int yp_curs, ym_curs, xp_curs, xm_curs ; -RSL_LITE_INIT_PERIOD ( +void RSL_LITE_INIT_PERIOD ( int * Fcomm0, int * shw0, int * n3dR0, int *n2dR0, int * typesizeR0 , @@ -93,7 +93,7 @@ RSL_LITE_INIT_PERIOD ( } -RSL_LITE_PACK_PERIOD ( int* Fcomm0, char * buf , int * shw0 , int * typesize0 , int * xy0 , int * pu0 , int * imemord , int * stag0 , +void RSL_LITE_PACK_PERIOD ( int* Fcomm0, char * buf , int * shw0 , int * typesize0 , int * xy0 , int * pu0 , int * imemord , int * stag0 , int *me0, int * np0 , int * np_x0 , int * np_y0 , int * ids0 , int * ide0 , int * jds0 , int * jde0 , int * kds0 , int * kde0 , int * ims0 , int * ime0 , int * jms0 , int * jme0 , int * kms0 , int * kme0 , @@ -368,7 +368,7 @@ static MPI_Request yp_recv, ym_recv, yp_send, ym_send ; static MPI_Request xp_recv, xm_recv, xp_send, xm_send ; #endif -RSL_LITE_EXCH_PERIOD_X ( int * Fcomm0, int *me0, int * np0 , int * np_x0 , int * np_y0 ) +void RSL_LITE_EXCH_PERIOD_X ( int * Fcomm0, int *me0, int * np0 , int * np_x0 , int * np_y0 ) { #ifndef STUBMPI int me, np, np_x, np_y ; @@ -414,7 +414,7 @@ fprintf(stderr,"RSL_LITE_EXCH_PERIOD_X disabled\n") ; #endif } -RSL_LITE_EXCH_PERIOD_Y ( int * Fcomm0, int *me0, int * np0 , int * np_x0 , int * np_y0 ) +void RSL_LITE_EXCH_PERIOD_Y ( int * Fcomm0, int *me0, int * np0 , int * np_x0 , int * np_y0 ) { #ifndef STUBMPI int me, np, np_x, np_y ; diff --git a/external/RSL_LITE/rsl_bcast.c b/external/RSL_LITE/rsl_bcast.c index d3e7d10691..88c03c944b 100755 --- a/external/RSL_LITE/rsl_bcast.c +++ b/external/RSL_LITE/rsl_bcast.c @@ -74,13 +74,13 @@ typedef struct bcast_point_desc { } bcast_point_desc_t ; -static destroy_par_info ( p ) +static int destroy_par_info ( p ) char * p ; { if ( p != NULL ) RSL_FREE( p ) ; } -static destroy_list( list, dfcn ) +static int destroy_list( list, dfcn ) rsl_list_t ** list ; /* pointer to pointer to list */ int (*dfcn)() ; /* pointer to function for destroying the data field of the list */ @@ -161,7 +161,7 @@ static int s_putmsg = 0 ; // It needs the minor number of tasks on the nest's MPI mesh (just pass that in) // Otherwise it doesn't need a communicator -RSL_LITE_NESTING_RESET ( +void RSL_LITE_NESTING_RESET ( ) { int j ; @@ -452,7 +452,6 @@ void RSL_LITE_TO_PARENT_INFO ( msize_p, return ; } - /********************************************/ /*@ @@ -460,28 +459,9 @@ void RSL_LITE_TO_PARENT_INFO ( msize_p, @*/ -/* parent->nest */ -RSL_LITE_TO_CHILD_MSG ( nbuf_p, buf ) - int_p - nbuf_p ; /* (I) Number of bytes to be packed. */ - char * - buf ; /* (I) Buffer containing the data to be packed. */ -{ - rsl_lite_to_peerpoint_msg ( nbuf_p, buf ) ; -} - -/* nest->parent */ -RSL_LITE_TO_PARENT_MSG ( nbuf_p, buf ) - int_p - nbuf_p ; /* (I) Number of bytes to be packed. */ - char * - buf ; /* (I) Buffer containing the data to be packed. */ -{ - rsl_lite_to_peerpoint_msg ( nbuf_p, buf ) ; -} /* common code */ -rsl_lite_to_peerpoint_msg ( nbuf_p, buf ) +void rsl_lite_to_peerpoint_msg ( nbuf_p, buf ) int_p nbuf_p ; /* (I) Number of bytes to be packed. */ char * @@ -521,6 +501,28 @@ rsl_lite_to_peerpoint_msg ( nbuf_p, buf ) } + +/* parent->nest */ +void RSL_LITE_TO_CHILD_MSG ( nbuf_p, buf ) + int_p + nbuf_p ; /* (I) Number of bytes to be packed. */ + char * + buf ; /* (I) Buffer containing the data to be packed. */ +{ + rsl_lite_to_peerpoint_msg ( nbuf_p, buf ) ; +} + +/* nest->parent */ +void RSL_LITE_TO_PARENT_MSG ( nbuf_p, buf ) + int_p + nbuf_p ; /* (I) Number of bytes to be packed. */ + char * + buf ; /* (I) Buffer containing the data to be packed. */ +{ + rsl_lite_to_peerpoint_msg ( nbuf_p, buf ) ; +} + + /********************************************/ // PARALLELNESTING NOTES @@ -530,36 +532,9 @@ rsl_lite_to_peerpoint_msg ( nbuf_p, buf ) // // nest if it's parent->nest and the parent if it's nest->parent (we'll see) -/* parent->nest */ -RSL_LITE_BCAST_MSGS ( mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, Fcomm ) - int_p mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, Fcomm ; /* offset is the id of the first task in the nest set */ -{ -#ifndef STUBMPI - MPI_Comm comm ; - - comm = MPI_Comm_f2c( *Fcomm ) ; -#else - int comm ; -#endif - rsl_lite_allgather_msgs ( mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, comm, 0 ) ; -} - -/* nest->parent */ -RSL_LITE_MERGE_MSGS ( mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, Fcomm ) - int_p mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, Fcomm ; /* offset is the id of the first task in the nest set */ -{ -#ifndef STUBMPI - MPI_Comm comm ; - - comm = MPI_Comm_f2c( *Fcomm ) ; -#else - int comm ; -#endif - rsl_lite_allgather_msgs ( mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, comm, 1 ) ; -} /* common code */ -rsl_lite_allgather_msgs ( mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, comm, dir ) +void rsl_lite_allgather_msgs ( mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, comm, dir ) int_p mytask_p, ntasks_par_p, ntasks_nest_p, offset_p ; int dir ; /* 0 = parent to nest, otherwist nest to parent */ #ifndef STUBMPI @@ -651,30 +626,38 @@ rsl_lite_allgather_msgs ( mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, comm, } -/********************************************/ - /* parent->nest */ -RSL_LITE_FROM_PARENT_INFO ( ig_p, jg_p, retval_p ) - int_p - ig_p /* (O) Global index in M dimension of nest. */ - ,jg_p /* (O) Global index in N dimension of nest. */ - ,retval_p ; /* (O) Return value; =1 valid point, =0 done. */ +void RSL_LITE_BCAST_MSGS ( mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, Fcomm ) + int_p mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, Fcomm ; /* offset is the id of the first task in the nest set */ { - rsl_lite_from_peerpoint_info ( ig_p, jg_p, retval_p ) ; +#ifndef STUBMPI + MPI_Comm comm ; + + comm = MPI_Comm_f2c( *Fcomm ) ; +#else + int comm ; +#endif + rsl_lite_allgather_msgs ( mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, comm, 0 ) ; } /* nest->parent */ -RSL_LITE_FROM_CHILD_INFO ( ig_p, jg_p, retval_p ) - int_p - ig_p /* (O) Global index in M dimension of nest. */ - ,jg_p /* (O) Global index in N dimension of nest. */ - ,retval_p ; /* (O) Return value; =1 valid point, =0 done. */ +void RSL_LITE_MERGE_MSGS ( mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, Fcomm ) + int_p mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, Fcomm ; /* offset is the id of the first task in the nest set */ { - rsl_lite_from_peerpoint_info ( ig_p, jg_p, retval_p ) ; +#ifndef STUBMPI + MPI_Comm comm ; + + comm = MPI_Comm_f2c( *Fcomm ) ; +#else + int comm ; +#endif + rsl_lite_allgather_msgs ( mytask_p, ntasks_par_p, ntasks_nest_p, offset_p, comm, 1 ) ; } +/********************************************/ + /* common code */ -rsl_lite_from_peerpoint_info ( ig_p, jg_p, retval_p ) +void rsl_lite_from_peerpoint_info ( ig_p, jg_p, retval_p ) int_p ig_p /* (O) Global index in M dimension of nest. */ ,jg_p /* (O) Global index in N dimension of nest. */ @@ -696,30 +679,31 @@ rsl_lite_from_peerpoint_info ( ig_p, jg_p, retval_p ) } -/********************************************/ - /* parent->nest */ -RSL_LITE_FROM_PARENT_MSG ( len_p, buf ) +void RSL_LITE_FROM_PARENT_INFO ( ig_p, jg_p, retval_p ) int_p - len_p ; /* (I) Number of bytes to unpack. */ - int * - buf ; /* (O) Destination buffer. */ + ig_p /* (O) Global index in M dimension of nest. */ + ,jg_p /* (O) Global index in N dimension of nest. */ + ,retval_p ; /* (O) Return value; =1 valid point, =0 done. */ { - rsl_lite_from_peerpoint_msg ( len_p, buf ) ; + rsl_lite_from_peerpoint_info ( ig_p, jg_p, retval_p ) ; } /* nest->parent */ -RSL_LITE_FROM_CHILD_MSG ( len_p, buf ) +void RSL_LITE_FROM_CHILD_INFO ( ig_p, jg_p, retval_p ) int_p - len_p ; /* (I) Number of bytes to unpack. */ - int * - buf ; /* (O) Destination buffer. */ + ig_p /* (O) Global index in M dimension of nest. */ + ,jg_p /* (O) Global index in N dimension of nest. */ + ,retval_p ; /* (O) Return value; =1 valid point, =0 done. */ { - rsl_lite_from_peerpoint_msg ( len_p, buf ) ; + rsl_lite_from_peerpoint_info ( ig_p, jg_p, retval_p ) ; } + +/********************************************/ + /* common code */ -rsl_lite_from_peerpoint_msg ( len_p, buf ) +void rsl_lite_from_peerpoint_msg ( len_p, buf ) int_p len_p ; /* (I) Number of bytes to unpack. */ int * @@ -744,5 +728,26 @@ rsl_lite_from_peerpoint_msg ( len_p, buf ) Rpointcurs += *len_p ; } +/* parent->nest */ +void RSL_LITE_FROM_PARENT_MSG ( len_p, buf ) + int_p + len_p ; /* (I) Number of bytes to unpack. */ + int * + buf ; /* (O) Destination buffer. */ +{ + rsl_lite_from_peerpoint_msg ( len_p, buf ) ; +} + +/* nest->parent */ +void RSL_LITE_FROM_CHILD_MSG ( len_p, buf ) + int_p + len_p ; /* (I) Number of bytes to unpack. */ + int * + buf ; /* (O) Destination buffer. */ +{ + rsl_lite_from_peerpoint_msg ( len_p, buf ) ; +} + + /********************************************/ diff --git a/external/RSL_LITE/rsl_lite.h b/external/RSL_LITE/rsl_lite.h index da430be967..f3e291350f 100644 --- a/external/RSL_LITE/rsl_lite.h +++ b/external/RSL_LITE/rsl_lite.h @@ -164,6 +164,8 @@ #define RSL_FREE(P) rsl_free(&(P)) char * buffer_for_proc ( int P, int size, int code ) ; +int buffer_size_for_proc( int P, int code ); + void * rsl_malloc( char * f, int l, int s ) ; void rsl_free( char ** p ) ; typedef int * int_p ; @@ -194,3 +196,18 @@ typedef struct rsl_list { #endif } rsl_list_t ; + +void F_PACK_LINT (long *inbuf, long *outbuf, int* memorder, int* js, int* je, int* ks, int* ke, int* is, int* ie, int* jms, int* jme, int* kms, int* kme, int* ims, int* ime, int* curs); +void F_PACK_INT (int *inbuf, int *outbuf, int* memorder, int* js, int* je, int* ks, int* ke, int* is, int* ie, int* jms, int* jme, int* kms, int* kme, int* ims, int* ime, int* curs); +void F_UNPACK_LINT (long *inbuf, long *outbuf, int* memorder, int* js, int* je, int* ks, int* ke, int* is, int* ie, int* jms, int* jme, int* kms, int* kme, int* ims, int* ime, int* curs); +void F_UNPACK_INT (int *inbuf, int *outbuf, int* memorder, int* js, int* je, int* ks, int* ke, int* is, int* ie, int* jms, int* jme, int* kms, int* kme, int* ims, int* ime, int* curs); + +#if ( WRFPLUS == 1 ) +void F_PACK_LINT_AD (long *inbuf, long *outbuf, int* memorder, int* js, int* je, int* ks, int* ke, int* is, int* ie, int* jms, int* jme, int* kms, int* kme, int* ims, int* ime, int* curs); +void F_PACK_INT_AD (int *inbuf, int *outbuf, int* memorder, int* js, int* je, int* ks, int* ke, int* is, int* ie, int* jms, int* jme, int* kms, int* kme, int* ims, int* ime, int* curs); +void F_UNPACK_LINT_AD (long *inbuf, long *outbuf, int* memorder, int* js, int* je, int* ks, int* ke, int* is, int* ie, int* jms, int* jme, int* kms, int* kme, int* ims, int* ime, int* curs); +void F_UNPACK_INT_AD (int *inbuf, int *outbuf, int* memorder, int* js, int* je, int* ks, int* ke, int* is, int* ie, int* jms, int* jme, int* kms, int* kme, int* ims, int* ime, int* curs); +#endif + +int TASK_FOR_POINT ( int* i_p , int* j_p , int* ids_p, int* ide_p , int* jds_p, int* jde_p , int* npx_p , int* npy_p , int* Px_p, int* Py_p , int* minx_p, int* miny_p, int* ierr_p ); +void TASK_FOR_POINT_MESSAGE(); diff --git a/external/RSL_LITE/rsl_malloc.c b/external/RSL_LITE/rsl_malloc.c index 4a4cdd1001..689eed3401 100755 --- a/external/RSL_LITE/rsl_malloc.c +++ b/external/RSL_LITE/rsl_malloc.c @@ -85,7 +85,8 @@ # include "mpi.h" #endif #include "rsl_lite.h" - +#include +#include /* extern int EF_ALIGNMENT; extern int EF_PROTECT_BELOW; diff --git a/external/RSL_LITE/swap.c b/external/RSL_LITE/swap.c index 28ac424d04..5c32380da4 100644 --- a/external/RSL_LITE/swap.c +++ b/external/RSL_LITE/swap.c @@ -2,6 +2,7 @@ # include #endif #include +#include #define STANDARD_ERROR 2 @@ -27,7 +28,7 @@ static int *nbytes = NULL ; static MPI_Request *x_recv = NULL , *x_send = NULL ; #endif -RSL_LITE_INIT_SWAP ( +void RSL_LITE_INIT_SWAP ( int * Fcomm , int * xy0 , int * n3dR0, int *n2dR0, int * typesizeR0 , @@ -119,7 +120,7 @@ RSL_LITE_INIT_SWAP ( #endif } -RSL_LITE_PACK_SWAP ( int * Fcomm , char * buf , int * odd0 , int * typesize0 , int * xy0 , int * pu0 , char * memord , int * xstag0 , +void RSL_LITE_PACK_SWAP ( int * Fcomm , char * buf , int * odd0 , int * typesize0 , int * xy0 , int * pu0 , char * memord , int * xstag0 , int *me0, int * np0 , int * np_x0 , int * np_y0 , int * min_subdomain , int * ids0 , int * ide0 , int * jds0 , int * jde0 , int * kds0 , int * kde0 , @@ -304,7 +305,7 @@ RSL_LITE_PACK_SWAP ( int * Fcomm , char * buf , int * odd0 , int * typesize0 , i #endif } -RSL_LITE_SWAP ( int * Fcomm0, int *me0, int * np0 , int * np_x0 , int * np_y0 ) +void RSL_LITE_SWAP ( int * Fcomm0, int *me0, int * np0 , int * np_x0 , int * np_y0 ) { #ifndef STUBMPI int me, np, np_x, np_y ; diff --git a/external/RSL_LITE/task_for_point.c b/external/RSL_LITE/task_for_point.c index b33a03c452..6da4cd5aa5 100644 --- a/external/RSL_LITE/task_for_point.c +++ b/external/RSL_LITE/task_for_point.c @@ -20,8 +20,7 @@ static char tfpmess[1024] ; -TASK_FOR_POINT ( i_p , j_p , ids_p, ide_p , jds_p, jde_p , npx_p , npy_p , Px_p, Py_p , minx_p, miny_p, ierr_p ) - int_p i_p , j_p , Px_p , Py_p , ids_p, ide_p , jds_p, jde_p , npx_p , npy_p, minx_p, miny_p, ierr_p ; +int TASK_FOR_POINT ( int* i_p , int* j_p , int* ids_p, int* ide_p , int* jds_p, int* jde_p , int* npx_p , int* npy_p , int* Px_p, int* Py_p , int* minx_p, int* miny_p, int* ierr_p ) { int i , j , ids, ide, jds, jde, npx, npy, minx, miny ; /* inputs */ int Px, Py ; /* output */ @@ -124,7 +123,7 @@ TASK_FOR_POINT ( i_p , j_p , ids_p, ide_p , jds_p, jde_p , npx_p , npy_p , Px_p, *Py_p = Py ; } -TASK_FOR_POINT_MESSAGE() +void TASK_FOR_POINT_MESSAGE() { fprintf(stderr,"%s\n",tfpmess) ; } diff --git a/external/io_grib1/MEL_grib1/FTP_getfile.c b/external/io_grib1/MEL_grib1/FTP_getfile.c index 8fd4d5f675..08b0820955 100644 --- a/external/io_grib1/MEL_grib1/FTP_getfile.c +++ b/external/io_grib1/MEL_grib1/FTP_getfile.c @@ -1,5 +1,12 @@ #include #include +#include + +#if defined(_WIN32) +#include +#else +#include +#endif #include "dprints.h" /* Debug printing & function prototypes*/ #include "gribfuncs.h" /* function prototypes */ diff --git a/external/io_grib1/MEL_grib1/gribfuncs.h b/external/io_grib1/MEL_grib1/gribfuncs.h index a05f0fde97..42207e457d 100644 --- a/external/io_grib1/MEL_grib1/gribfuncs.h +++ b/external/io_grib1/MEL_grib1/gribfuncs.h @@ -29,12 +29,16 @@ int grib_dec (char *,PDS_INPUT *,grid_desc_sec *,BDS_HEAD_INPUT *, int grib_enc (DATA_INPUT,USER_INPUT,GEOM_IN,float *,GRIB_HDR *,char *); float grib_ibm_local(unsigned long ibm_float); int grib_seek (char *,long *,int,GRIB_HDR *,char *); +int grib_fseek (FILE *, long *, int, GRIB_HDR *, char *); + int gribgetbds (char *,short,BMS_INPUT *,grid_desc_sec *,float **, BDS_HEAD_INPUT *, char *); int gribgetbms (char *,BMS_INPUT *,int,unsigned long,char *); int gribgetgds (char *,grid_desc_sec *,char *); int gribgetpds (char *,PDS_INPUT *,char *); int gribhdr2file (GRIB_HDR *,FILE *,char *); +int gribhdr2filed (GRIB_HDR *, int , char *); + int gribputbds (USER_INPUT,long,short,float *,BDS_HEAD_INPUT *, GRIB_HDR **,char *); int gribputgds (GEOM_IN,GDS_HEAD_INPUT *,void **,GRIB_HDR **,char *); @@ -44,10 +48,12 @@ void init_dec_struct (PDS_INPUT *,grid_desc_sec *,BMS_INPUT *,BDS_HEAD_INPUT *); void init_enc_struct (DATA_INPUT *,GEOM_IN *,USER_INPUT *); int init_gribhdr (GRIB_HDR **,char *); void init_struct (void *, int); -int inp2Grib_Lambert (void **,LAMBERT *,long *,char *); +int inp2grib_Lambert (void **,LAMBERT *,long *,char *); int inp2grib_Latlon (void **,LATLON *,long *,char *); int inp2grib_PDS (PDS_INPUT *,PDS_GRIB **,char *); int inp2grib_PolarSt (void **,POLAR *,long *,char *); +int create_inpMercator (GEOM_IN , void **, char *); +int inp2grib_Mercator (void **, MERCATOR *,long *, char *); int ld_dec_lookup (char *,char *); int ld_enc_config (char *,USER_INPUT *,char *); int ld_enc_ffinfo (char *, DATA_INPUT *,char *); @@ -65,6 +71,11 @@ void prt_inp_struct (PDS_INPUT *,grid_desc_sec *, BMS_INPUT *, struct BDS_HEAD_INPUT *,float **); void upd_child_errmsg (char *,char *); void w3ft33_(float *ain,float **out, int *nsflag); + +void set_bytes(long in, int numbytes, char *out); +void set_bytes_u(unsigned long in, int numbytes, unsigned char *out); +int grib_unthin(float *in,float *out,int *rowsizes, int ysize, int *xsize); + #else #define PROTOTYPE_NEEDED 0 diff --git a/external/io_grib1/MEL_grib1/gribgetbds.c b/external/io_grib1/MEL_grib1/gribgetbds.c index abc3e5264a..f6958a9282 100644 --- a/external/io_grib1/MEL_grib1/gribgetbds.c +++ b/external/io_grib1/MEL_grib1/gribgetbds.c @@ -1,5 +1,6 @@ #include #include +#include #include #include "dprints.h" /* for dprints */ #include "gribfuncs.h" /* prototypes */ diff --git a/external/io_grib1/MEL_grib1/gribhdr2file.c b/external/io_grib1/MEL_grib1/gribhdr2file.c index 41c248bce9..649c46dc0e 100644 --- a/external/io_grib1/MEL_grib1/gribhdr2file.c +++ b/external/io_grib1/MEL_grib1/gribhdr2file.c @@ -2,6 +2,13 @@ #include #include "dprints.h" /* for dprints */ #include "gribfuncs.h" /* prototypes */ + +#if defined(_WIN32) +#include +#else +#include +#endif + /* * ************************************************************************ diff --git a/external/io_grib1/MEL_grib1/init_enc_struct.c b/external/io_grib1/MEL_grib1/init_enc_struct.c index 9e5ce13fd6..dd2a79cdea 100644 --- a/external/io_grib1/MEL_grib1/init_enc_struct.c +++ b/external/io_grib1/MEL_grib1/init_enc_struct.c @@ -5,6 +5,7 @@ */ #include #include +#include #include "dprints.h" /* for dprints */ #include "gribfuncs.h" /* prototypes */ /* diff --git a/external/io_grib1/MEL_grib1/init_gribhdr.c b/external/io_grib1/MEL_grib1/init_gribhdr.c index ea0be9820f..b1580936e5 100644 --- a/external/io_grib1/MEL_grib1/init_gribhdr.c +++ b/external/io_grib1/MEL_grib1/init_gribhdr.c @@ -3,6 +3,7 @@ */ #include #include +#include #include "dprints.h" /* for dprints */ #include "gribfuncs.h" /* prototypes */ /* diff --git a/external/io_grib1/MEL_grib1/init_struct.c b/external/io_grib1/MEL_grib1/init_struct.c index bf81ed176c..5bc0e452ca 100644 --- a/external/io_grib1/MEL_grib1/init_struct.c +++ b/external/io_grib1/MEL_grib1/init_struct.c @@ -6,6 +6,7 @@ */ #include #include +#include #include "dprints.h" /* for dprints */ #include "gribfuncs.h" /* prototypes */ diff --git a/external/io_grib1/MEL_grib1/ld_enc_input.c b/external/io_grib1/MEL_grib1/ld_enc_input.c index b8a911925f..a4979aeb0c 100644 --- a/external/io_grib1/MEL_grib1/ld_enc_input.c +++ b/external/io_grib1/MEL_grib1/ld_enc_input.c @@ -10,6 +10,7 @@ Original version from previous Encoder Library; #include #include #include +#include #include "dprints.h" /* for dprints */ #include "gribfuncs.h" /* prototypes */ diff --git a/external/io_grib1/MEL_grib1/ld_enc_lookup.c b/external/io_grib1/MEL_grib1/ld_enc_lookup.c index 8605aac126..3330d478a2 100644 --- a/external/io_grib1/MEL_grib1/ld_enc_lookup.c +++ b/external/io_grib1/MEL_grib1/ld_enc_lookup.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include "grib_lookup.h" /* combined lookup structs */ #include "dprints.h" /* for dprints */ #include "gribfuncs.h" /* prototypes */ diff --git a/external/io_grib1/MEL_grib1/ld_grib_origctrs.c b/external/io_grib1/MEL_grib1/ld_grib_origctrs.c index 5429eca235..2db15c4b0d 100644 --- a/external/io_grib1/MEL_grib1/ld_grib_origctrs.c +++ b/external/io_grib1/MEL_grib1/ld_grib_origctrs.c @@ -1,6 +1,13 @@ #include #include #include + +#if defined(_WIN32) +#include +#else +#include +#endif + #include "grib_lookup.h" #include "dprints.h" /* for dprints */ #include "gribfuncs.h" /* prototypes */ @@ -153,7 +160,7 @@ FILE *fLook; * * A.7 RETURN with status */ - if (fLook) close(fLook); + if (fLook) fclose(fLook); DPRINT2 ("Exiting %s, Stat=%d\n", func, stat); return (stat); /* diff --git a/external/io_grib1/MEL_grib1/map_lvl.c b/external/io_grib1/MEL_grib1/map_lvl.c index bdbb7651e4..1458d033b9 100644 --- a/external/io_grib1/MEL_grib1/map_lvl.c +++ b/external/io_grib1/MEL_grib1/map_lvl.c @@ -1,5 +1,7 @@ #include #include +#include +#include #include "dprints.h" /* for debug printing */ #include "grib_lookup.h" /* LVL_DEFN */ #include "gribfuncs.h" /* prototypes */ diff --git a/external/io_grib1/MEL_grib1/map_parm.c b/external/io_grib1/MEL_grib1/map_parm.c index 18b2d049ed..83d7ce11b4 100644 --- a/external/io_grib1/MEL_grib1/map_parm.c +++ b/external/io_grib1/MEL_grib1/map_parm.c @@ -1,5 +1,6 @@ #include #include +#include #include "dprints.h" /* for debug printing */ #include "grib_lookup.h" /* PARM_DEFN */ #include "gribfuncs.h" /* prototypes */ diff --git a/external/io_grib1/MEL_grib1/prt_badmsg.c b/external/io_grib1/MEL_grib1/prt_badmsg.c index 2be1ed3383..015806b67b 100644 --- a/external/io_grib1/MEL_grib1/prt_badmsg.c +++ b/external/io_grib1/MEL_grib1/prt_badmsg.c @@ -1,5 +1,6 @@ #include #include +#include #include "gribfuncs.h" /* ************************************************************************** diff --git a/external/io_grib1/MEL_grib1/prt_inp_struct.c b/external/io_grib1/MEL_grib1/prt_inp_struct.c index 250ca780cb..23474ab1ce 100644 --- a/external/io_grib1/MEL_grib1/prt_inp_struct.c +++ b/external/io_grib1/MEL_grib1/prt_inp_struct.c @@ -6,6 +6,7 @@ */ #include #include +#include #include #include "grib_lookup.h" /* for Parm/Ctr/Levl/Mdl_defn */ #include "dprints.h" /* for dprints */ diff --git a/external/io_grib1/MEL_grib1/set_bytes.c b/external/io_grib1/MEL_grib1/set_bytes.c index b7b7aa34c1..6df01fca4b 100644 --- a/external/io_grib1/MEL_grib1/set_bytes.c +++ b/external/io_grib1/MEL_grib1/set_bytes.c @@ -1,4 +1,5 @@ #include +#include #include "isdb.h" void set_bytes(long in, int numbytes, char *out) diff --git a/external/io_grib1/MEL_grib1/upd_child_errmsg.c b/external/io_grib1/MEL_grib1/upd_child_errmsg.c index 500ce68162..d0a795e567 100644 --- a/external/io_grib1/MEL_grib1/upd_child_errmsg.c +++ b/external/io_grib1/MEL_grib1/upd_child_errmsg.c @@ -1,5 +1,6 @@ #include #include +#include #include "dprints.h" /* for dprints */ #include "gribfuncs.h" /* prototypes */ diff --git a/external/io_grib1/grib1_routines.c b/external/io_grib1/grib1_routines.c index 37dd19275f..0052cae0f8 100644 --- a/external/io_grib1/grib1_routines.c +++ b/external/io_grib1/grib1_routines.c @@ -16,17 +16,25 @@ #include "grib1_routines.h" #include "gridnav.h" #include "wrf_projection.h" +#include "trim.h" #include #include #include #include +#include +#include +#if defined(_WIN32) +#include +#else +#include +#endif -char *trim (char *str); int index_metadata(GribInfo *gribinfo, MetaData *metadata, int fid); int index_times(GribInfo *gribinfo, Times *times); int find_time(Times *times, char valid_time[15]); int get_gridnav_projection(int wrf_projection); int get_byte(int input_int, int bytenum); +int grib_time_format(char *DateStr, char *DateStrIn); /* * Allocate space for the fileindex structure diff --git a/external/io_grib1/grib1_util/read_grib.c b/external/io_grib1/grib1_util/read_grib.c index 79757d38d8..c1ebcdcb06 100644 --- a/external/io_grib1/grib1_util/read_grib.c +++ b/external/io_grib1/grib1_util/read_grib.c @@ -49,6 +49,13 @@ #include "gribfuncs.h" #include "gribsize.incl" #include "read_grib.h" +#include "alloc_2d.h" + +#if defined(_WIN32) +#include +#else +#include +#endif /* Function Declarations */ @@ -2267,7 +2274,7 @@ int rg_setup_gribmap(GribParameters *gribmap, char filename[]) gribmap->num_entries = idx; - close(fid); + fclose(fid); return 1; } diff --git a/external/io_grib1/grib1_util/read_grib.h b/external/io_grib1/grib1_util/read_grib.h index f2c628b64b..3a9d73c5cb 100644 --- a/external/io_grib1/grib1_util/read_grib.h +++ b/external/io_grib1/grib1_util/read_grib.h @@ -167,3 +167,4 @@ int rg_get_index_near_date(GribInfo *gribinfo,char targetdate[STRINGSIZE], int rg_get_date(GribInfo *gribinfo,int index); int rg_get_century(GribInfo *gribinfo,int index); int rg_get_forecast_time(GribInfo *gribinfo,int index); +int rg_get_parmtbl(GribInfo *gribinfo, int index); diff --git a/external/io_grib1/grib1_util/write_grib.c b/external/io_grib1/grib1_util/write_grib.c index 79dd956345..29646545cb 100644 --- a/external/io_grib1/grib1_util/write_grib.c +++ b/external/io_grib1/grib1_util/write_grib.c @@ -33,39 +33,14 @@ #include #include +#include #include "gribfuncs.h" -int rg_write_grib(PDS_INPUT *pds, grid_desc_sec *gds, char filename[], - float **data) -{ - char tmpfile[240]; - char tmpstring[240]; - FILE *fid; - int status; - - sprintf(tmpfile,"/tmp/tmpgribfile_%d",getpid()); - fid = fopen(tmpfile,"wb"); - if (fid == NULL) { - fprintf(stderr,"rg_write_grib: Could not open %s\n",tmpfile); - return -1; - } - - status = rg_fwrite_grib(pds,gds,data,fid); - if (status != 1) - { - fprintf(stderr,"rg_write_grib: rg_fwrite_grib failed\n"); - return -1; - } - - /* append tmpfile to filename */ - sprintf(tmpstring,"cat %s >> %s",tmpfile,filename); - system(tmpstring); - unlink(tmpfile); - - close(fid); - - return(1); -} +#if defined(_WIN32) +#include +#else +#include +#endif int rg_fwrite_grib(PDS_INPUT *pds, grid_desc_sec *gds, float **data, FILE *fid) { @@ -188,3 +163,35 @@ int rg_fwrite_grib(PDS_INPUT *pds, grid_desc_sec *gds, float **data, FILE *fid) return 1; } + +int rg_write_grib(PDS_INPUT *pds, grid_desc_sec *gds, char filename[], + float **data) +{ + char tmpfile[240]; + char tmpstring[240]; + FILE *fid; + int status; + + sprintf(tmpfile,"/tmp/tmpgribfile_%d",getpid()); + fid = fopen(tmpfile,"wb"); + if (fid == NULL) { + fprintf(stderr,"rg_write_grib: Could not open %s\n",tmpfile); + return -1; + } + + status = rg_fwrite_grib(pds,gds,data,fid); + if (status != 1) + { + fprintf(stderr,"rg_write_grib: rg_fwrite_grib failed\n"); + return -1; + } + + /* append tmpfile to filename */ + sprintf(tmpstring,"cat %s >> %s",tmpfile,filename); + system(tmpstring); + unlink(tmpfile); + + fclose(fid); + + return(1); +} diff --git a/external/io_grib1/gribmap.c b/external/io_grib1/gribmap.c index 0ad686c2fc..bfd0aa30df 100644 --- a/external/io_grib1/gribmap.c +++ b/external/io_grib1/gribmap.c @@ -1,6 +1,8 @@ #include #include +#include #include "gribmap.h" +#include "trim.h" /****************************************************************************** * diff --git a/external/io_grib1/gribmap.h b/external/io_grib1/gribmap.h index 24b56f1aca..3dd0cf32a3 100644 --- a/external/io_grib1/gribmap.h +++ b/external/io_grib1/gribmap.h @@ -52,5 +52,6 @@ int GET_GRIB1_TABLES_SIZE (int *size); int LOAD_GRIB1_TABLES (char filename[], Grib1_Tables *grib_tables, int *ret, int strlen1); +int FREE_GRIBMAP(Grib1_Tables *grib_tables); Grib1_Tables *copy_grib_tables(Grib1_Tables *); diff --git a/external/io_grib1/trim.c b/external/io_grib1/trim.c index cb219ad645..3f06fbe472 100644 --- a/external/io_grib1/trim.c +++ b/external/io_grib1/trim.c @@ -1,5 +1,6 @@ #include #include +#include char *trim (char *str) { diff --git a/external/io_grib1/trim.h b/external/io_grib1/trim.h new file mode 100644 index 0000000000..550f765a5f --- /dev/null +++ b/external/io_grib1/trim.h @@ -0,0 +1,2 @@ +char *trim (char *str); + diff --git a/external/io_grib_share/get_region_center.c b/external/io_grib_share/get_region_center.c index d708656c1e..68ad5f7bc5 100644 --- a/external/io_grib_share/get_region_center.c +++ b/external/io_grib_share/get_region_center.c @@ -2,6 +2,7 @@ #include "gridnav.h" #include #include +#include #include "wrf_projection.h" diff --git a/external/io_grib_share/open_file.c b/external/io_grib_share/open_file.c index 673b8ff544..b629bddfd8 100644 --- a/external/io_grib_share/open_file.c +++ b/external/io_grib_share/open_file.c @@ -1,9 +1,12 @@ #include #include #include - #ifdef _WIN32 #include +#include +#else +#include +#include #endif #ifndef CRAY diff --git a/frame/module_domain_type.F b/frame/module_domain_type.F index bafe99d4ed..e04b4f0231 100644 --- a/frame/module_domain_type.F +++ b/frame/module_domain_type.F @@ -224,14 +224,14 @@ MODULE module_domain_type Type(WRFU_TimeInterval) :: last_dtInterval ! Time series location information - INTEGER :: ntsloc, ntsloc_domain - INTEGER :: next_ts_time - INTEGER, POINTER, DIMENSION(:) :: itsloc, jtsloc, id_tsloc - REAL, POINTER, DIMENSION(:) :: lattsloc, lontsloc - CHARACTER (LEN=5), POINTER, DIMENSION(:) :: nametsloc - CHARACTER (LEN=25), POINTER, DIMENSION(:) :: desctsloc - CHARACTER (LEN=256), POINTER, DIMENSION(:) :: ts_filename - LOGICAL :: have_calculated_tslocs + INTEGER :: ntsloc = 0, ntsloc_domain = 0 + INTEGER :: next_ts_time = 0 + INTEGER, POINTER, DIMENSION(:) :: itsloc => NULL(), jtsloc => NULL(), id_tsloc => NULL() + REAL, POINTER, DIMENSION(:) :: lattsloc => NULL(), lontsloc => NULL() + CHARACTER (LEN=5), POINTER, DIMENSION(:) :: nametsloc => NULL() + CHARACTER (LEN=25), POINTER, DIMENSION(:) :: desctsloc => NULL() + CHARACTER (LEN=256), POINTER, DIMENSION(:) :: ts_filename => NULL() + LOGICAL :: have_calculated_tslocs = .FALSE. LOGICAL :: have_displayed_alloc_stats ! used in module_alloc_space to display alloc stats; only do it once. ! Track location information diff --git a/frame/pack_utils.c b/frame/pack_utils.c index d7669ccfd5..bdd608d3e1 100644 --- a/frame/pack_utils.c +++ b/frame/pack_utils.c @@ -59,6 +59,7 @@ /* CALL int_pack_data ( hdrbuf , hdrbufsiz * inttypesize , int_local_output_buffer, int_local_output_cursor ) */ +void INT_PACK_DATA ( unsigned char *buf , int *ninbytes , unsigned char *obuf, int *cursor ) { int i, lcurs ; @@ -372,7 +373,7 @@ void *malloc(size_t size) # endif # if !defined(MS_SUA) && !defined(_WIN32) # include -RSL_INTERNAL_MICROCLOCK () +int RSL_INTERNAL_MICROCLOCK () { struct timeval tb ; struct timezone tzp ; diff --git a/inc/version_decl b/inc/version_decl index 98f1ed2596..4ba1c7a84e 100644 --- a/inc/version_decl +++ b/inc/version_decl @@ -1 +1 @@ - CHARACTER (LEN=*), PARAMETER :: release_version = 'V4.5.1' + CHARACTER (LEN=*), PARAMETER :: release_version = 'V4.5.2' diff --git a/phys/module_diag_functions.F b/phys/module_diag_functions.F index ac920798ac..0466dff45f 100644 --- a/phys/module_diag_functions.F +++ b/phys/module_diag_functions.F @@ -760,9 +760,10 @@ FUNCTION Buoyancy ( nz, tk, rh, p, hgt, sfc, cape, cin, zlfc, plfc, lidx, & flag = .false. END IF END DO - IF (ellev >= 0) THEN !Modified by Zhixiao - pel = p(ellev) !Modified by Zhixiao - CIN=REAL ( 0 ) !Modified by Zhixiao + IF ((ellev >= 0) .and. (lfclev >= 0)) THEN !Modified by Zhixiao + plfc = p (lfclev) + pel = p (ellev) + CIN = REAL ( 0 ) DO k = sfc+1, nz ! Make CAPE and CIN consistent with AMS definition ! https://glossary.ametsoc.org/wiki/Convective_available_potential_energy diff --git a/phys/module_mp_fast_sbm.F b/phys/module_mp_fast_sbm.F index 184a9220ea..f0600fea85 100644 --- a/phys/module_mp_fast_sbm.F +++ b/phys/module_mp_fast_sbm.F @@ -4096,7 +4096,7 @@ SUBROUTINE FAST_SBM (w,u,v,th_old, & REAL (KIND=R8SIZE) :: DEL1NR,DEL2NR,DEL12R,DEL12RD,ES1N,ES2N,EW1N,EW1PN REAL (KIND=R8SIZE) :: DELSUP1,DELSUP2,DELDIV1,DELDIV2 REAL (KIND=R8SIZE) :: TT,QQ,TTA,QQA,PP,DPSA,DELTATEMP,DELTAQ - REAL (KIND=R8SIZE) :: DIV1,DIV2,DIV3,DIV4,DEL1IN,DEL2IN,DEL1AD,DEL2AD + REAL (KIND=R8SIZE) :: DIV1,DIV2,DIV3,DIV4,DEL1IN,DEL2IN,DEL1AD,DEL2AD,DEL_T,DEL_Q REAL (KIND=R4SIZE) :: DEL_BB,DEL_BBN,DEL_BBR, TTA_r REAL (KIND=R4SIZE) :: FACTZ,CONCCCN_XZ,CONCDROP REAL (KIND=R4SIZE) :: SUPICE(KTE),AR1,AR2, & @@ -4594,26 +4594,12 @@ SUBROUTINE FAST_SBM (w,u,v,th_old, & SUP2_OLD=DEL2IN IF(del1ad > 0.0 .or. del2ad > 0.0 .or. (sum(FF1R)+sum(FF3R)+sum(FF4R)+sum(FF5R)) > 1.0e-20)THEN - ! JacobS: commented for this version - ! CALL Relaxation_Time(TT,QQ,PP,rhocgs(I,K,J),DEL1IN,DEL2IN, & - ! XL,VR1_Z(:,K),FF1R,RLEC,RO1BL, & - ! XI,VR2_Z,FF2R,RIEC,RO2BL, & - ! XS,VR3_Z(:,K),FF3R,RSEC,RO3BL, & - ! XG,VR4_Z(:,K),FF4R,RGEC,RO4BL, & - ! XH,VR5_Z(:,k),FF5R,RHEC,RO5BL, & - ! NKR,ICEMAX,COL,DT,NCOND,DTCOND) - DELSUP1=(DEL1AD-DEL1IN)/NCOND - DELSUP2=(DEL2AD-DEL2IN)/NCOND - DELDIV1=(DIV3-DIV1)/NCOND - DELDIV2=(DIV4-DIV2)/NCOND - DELTATEMP = 0 - DELTAQ = 0 - tt_old = TT - qq_old = qq - DIFFU=1 - - IF (DIV1.EQ.DIV3) DIFFU = 0 - IF (DIV2.EQ.DIV4) DIFFU = 0 + DEL_T = (TTA - TT) / NCOND + DEL_Q = (QQA - QQ) / NCOND + + DIFFU=1 + IF (DIV1.EQ.DIV3) DIFFU = 0 + IF (DIV2.EQ.DIV4) DIFFU = 0 DTNEW = 0.0 DO IKL=1,NCOND @@ -4622,27 +4608,20 @@ SUBROUTINE FAST_SBM (w,u,v,th_old, & IF (DIFFU.NE.0)THEN IF (DIFFU.NE.0)THEN - DEL1IN = DEL1IN+DELSUP1 - DEL2IN = DEL2IN+DELSUP2 - DIV1 = DIV1+DELDIV1 - DIV2 = DIV2+DELDIV2 + TT = TT + DEL_T + QQ = QQ + DEL_Q + ES1N = AA1_MY*DEXP(-BB1_MY/TT) + ES2N = AA2_MY*DEXP(-BB2_MY/TT) + EW1N = QQ*PP/(0.622+0.378*QQ) + DIV1 = EW1N/ES1N + DEL1IN = EW1N/ES1N-1.0 + DIV2 = EW1N/ES2N + DEL2IN = EW1N/ES2N-1.0 END IF IF (DIV1.GT.DIV2.AND.TT.LE.265)THEN DIFFU=0 END IF IF (DIFFU == 1)THEN - DEL1NR=A1_MYN*(100.*DIV1) - DEL2NR=A2_MYN*(100.*DIV2) - IF (DEL2NR.EQ.0)print*,'ikl = ',ikl - IF (DEL2NR.EQ.0)print*,'div1,div2 = ',div1,div2 - IF (DEL2NR.EQ.0)print*,'i,j,k = ',i,j,k - IF (DEL2NR.EQ.0)call wrf_error_fatal("fatal error in module_mp_fast_sbm (DEL2NR.EQ.0) , model stop ") - DEL12R=DEL1NR/DEL2NR - DEL12RD=DEL12R**DEL_BBR - EW1PN=AA1_MY*100.*DIV1*DEL12RD/100. - TT=-DEL_BB/DLOG(DEL12R) - QQ=0.622*EW1PN/(PP-0.378*EW1PN) - IF(DEL1IN > 0.0 .OR. DEL2IN > 0.0)THEN ! +------------------------------------------+ ! Droplet nucleation : @@ -6688,26 +6667,26 @@ SUBROUTINE J_W_MELT(FF1,XL,FF2,XI,FF3,XS,FF4,XG,FF5,XH & FF2(KR,ICE) = 0.0 ELSE IF (KR .gt. 10 .and. KR .lt. 18) THEN meltrate = 0.5/50. + ARG_M=ARG_M+FF2(KR,ICE)*(meltrate*dt) FF2(KR,ICE)=FF2(KR,ICE)-FF2(KR,ICE)*(meltrate*dt) - ARG_M=ARG_M+FF2(KR,ICE)*(meltrate*dt) ELSE meltrate = 0.683/120. + ARG_M=ARG_M+FF2(KR,ICE)*(meltrate*dt) FF2(KR,ICE)=FF2(KR,ICE)-FF2(KR,ICE)*(meltrate*dt) - ARG_M=ARG_M+FF2(KR,ICE)*(meltrate*dt) ENDIF ENDIF IF (ICE ==2 .or. ICE ==3) THEN IF (kr .le. 12) THEN + ARG_M = ARG_M+FF2(KR,ICE) FF2(KR,ICE)=0. - ARG_M = ARG_M+FF2(KR,ICE) ELSE IF (kr .gt. 12 .and. kr .lt. 20) THEN meltrate = 0.5/50. + ARG_M=ARG_M+FF2(KR,ICE)*(meltrate*dt) FF2(KR,ICE)=FF2(KR,ICE)-FF2(KR,ICE)*(meltrate*dt) - ARG_M=ARG_M+FF2(KR,ICE)*(meltrate*dt) ELSE - meltrate = 0.683/120. + meltrate = 0.683/120. + ARG_M=ARG_M+FF2(KR,ICE)*(meltrate*dt) FF2(KR,ICE)=FF2(KR,ICE)-FF2(KR,ICE)*(meltrate*dt) - ARG_M=ARG_M+FF2(KR,ICE)*(meltrate*dt) ENDIF ENDIF END DO ! Do ice @@ -6717,12 +6696,12 @@ SUBROUTINE J_W_MELT(FF1,XL,FF2,XI,FF3,XS,FF4,XG,FF5,XH & FF3(KR) = 0.0 ELSE IF (kr .gt. 14 .and. kr .lt. 22) THEN meltrate = 0.5/50. - FF3(KR)=FF3(KR)-FF3(KR)*(meltrate*dt) ARG_M=ARG_M+FF3(KR)*(meltrate*dt) + FF3(KR)=FF3(KR)-FF3(KR)*(meltrate*dt) ELSE meltrate = 0.683/120. - FF3(KR)=FF3(KR)-FF3(KR)*(meltrate*dt) ARG_M=ARG_M+FF3(KR)*(meltrate*dt) + FF3(KR)=FF3(KR)-FF3(KR)*(meltrate*dt) ENDIF ! ... Graupel/Hail IF (kr .le. 13) then @@ -6731,14 +6710,14 @@ SUBROUTINE J_W_MELT(FF1,XL,FF2,XI,FF3,XS,FF4,XG,FF5,XH & FF5(KR)=0. ELSE IF (kr .gt. 13 .and. kr .lt. 23) THEN meltrate = 0.5/50. + ARG_M=ARG_M+(FF4(KR)+FF5(KR))*(meltrate*dt) FF4(KR)=FF4(KR)-FF4(KR)*(meltrate*dt) FF5(KR)=FF5(KR)-FF5(KR)*(meltrate*dt) - ARG_M=ARG_M+(FF4(KR)+FF5(KR))*(meltrate*dt) ELSE meltrate = 0.683/120. - FF4(KR)=FF4(KR)-FF4(KR)*(meltrate*dt) - FF5(KR)=FF5(KR)-FF5(KR)*(meltrate*dt) - ARG_M=ARG_M+(FF4(KR)+FF5(KR))*(meltrate*dt) + ARG_M=ARG_M+(FF4(KR)+FF5(KR))*(meltrate*dt) + FF4(KR)=FF4(KR)-FF4(KR)*(meltrate*dt) + FF5(KR)=FF5(KR)-FF5(KR)*(meltrate*dt) ENDIF FF1(KR) = FF1(KR) + ARG_M @@ -7077,26 +7056,6 @@ SUBROUTINE ONECOND1 & call wrf_error_fatal("fatal error in ONECOND1-in (ABS(DAL1*DELMASSL1) > 3.0), model stop") ENDIF - ! ... SUPERSATURATION (ONLY WATER) - ARGEXP=-BB1_MY/TPN - ES1N=AA1_MY*DEXP(ARGEXP) - ARGEXP=-BB2_MY/TPN - ES2N=AA2_MY*DEXP(ARGEXP) - EW1N=OPER3(QPN,PP) - IF(ES1N == 0.0D0)THEN - DEL1N=0.5 - DIV1=1.5 - ELSE - DIV1 = EW1N/ES1N - DEL1N = EW1N/ES1N-1. - END IF - IF(ES2N == 0.0D0)THEN - DEL2N=0.5 - DIV2=1.5 - ELSE - DEL2N = EW1N/ES2N-1. - DIV2 = EW1N/ES2N - END IF IF(ISYM1 == 1) THEN DO KR=1,NKR SUPINTW(KR)=SUPINTW(KR)+B11_MY(KR)*D1N @@ -7160,29 +7119,6 @@ SUBROUTINE ONECOND1 & ENDIF ENDIF - ! ... SUPERSATURATION - ARGEXP=-BB1_MY/TPN - ES1N=AA1_MY*DEXP(ARGEXP) - ARGEXP=-BB2_MY/TPN - ES2N=AA2_MY*DEXP(ARGEXP) - EW1N=OPER3(QPN,PP) - IF(ES1N == 0.0D0)THEN - DEL1N=0.5 - DIV1=1.5 - call wrf_error_fatal("fatal error in ONECOND1 (ES1N.EQ.0), model stop") - ELSE - DIV1=EW1N/ES1N - DEL1N=EW1N/ES1N-1. - END IF - IF(ES2N.EQ.0)THEN - DEL2N=0.5 - DIV2=1.5 - call wrf_error_fatal("fatal error in ONECOND1 (ES2N.EQ.0), model stop") - ELSE - DEL2N=EW1N/ES2N-1. - DIV2=EW1N/ES2N - END IF - TT=TPN QQ=QPN DO KR=1,NKR @@ -7745,29 +7681,6 @@ SUBROUTINE ONECOND2 & ENDIF ENDIF - ! ... SUPERSATURATION - ARGEXP=-BB1_MY/TPN - ES1N=AA1_MY*DEXP(ARGEXP) - ARGEXP=-BB2_MY/TPN - ES2N=AA2_MY*DEXP(ARGEXP) - EW1N=OPER3(QPN,PP) - IF(ES1N == 0.0)THEN - DEL1N=0.5 - DIV1=1.5 - call wrf_error_fatal("fatal error in ONECOND2 (ES1N.EQ.0), model stop") - ELSE - DIV1=EW1N/ES1N - DEL1N=EW1N/ES1N-1. - END IF - IF(ES2N == 0.0)THEN - DEL2N=0.5 - DIV2=1.5 - call wrf_error_fatal("fatal error in ONECOND2 (ES2N.EQ.0), model stop") - ELSE - DEL2N=EW1N/ES2N-1. - DIV2=EW1N/ES2N - END IF - ! END OF TIME SPLITTING ! (ONLY ICE: CONDENSATION OR EVAPORATION) IF(TIMENEW.LT.DT) GOTO 46 @@ -8312,31 +8225,7 @@ SUBROUTINE ONECOND3 & call wrf_error_fatal("fatal error in ONECOND3-out (ABS(DAL1*DELMASSL1+DAL2*DELMASSI1) > 5.0), model stop") ENDIF ENDIF - - ! SUPERSATURATION - ARGEXP=-BB1_MY/TPN - ES1N=AA1_MY*DEXP(ARGEXP) - ARGEXP=-BB2_MY/TPN - ES2N=AA2_MY*DEXP(ARGEXP) - EW1N=OPER3(QPN,PP) - IF(ES1N == 0.0)THEN - DEL1N=0.5 - DIV1=1.5 - print*,'es1n onecond3 = 0' - call wrf_error_fatal("fatal error in ONECOND3 (ES1N.EQ.0), model stop") - ELSE - DIV1=EW1N/ES1N - DEL1N=EW1N/ES1N-1. - END IF - IF(ES2N == 0.0)THEN - DEL2N=0.5 - DIV2=1.5 - print*,'es2n onecond3 = 0' - call wrf_error_fatal("fatal error in ONECOND3 (ES2N.EQ.0), model stop") - ELSE - DEL2N=EW1N/ES2N-1. - DIV2=EW1N/ES2N - END IF + ! END OF TIME SPLITTING IF(TIMENEW < DT) GOTO 16 diff --git a/phys/module_mp_wdm6.F b/phys/module_mp_wdm6.F index 4ff157910c..4509fff847 100644 --- a/phys/module_mp_wdm6.F +++ b/phys/module_mp_wdm6.F @@ -383,6 +383,12 @@ subroutine wdm62D(t, q, qci, qrs, ncr, den, p, delz & ! nccn > 100 cm-3, bae from kiaps, oct 2017 ! bug fix hydrometeros update before condensation process of rain, ! bae from kiaps, oct2017 +! bug fix in snow melting and autoconversion. +! ==> Revisions enchance melting and autoconverison. +! hong from noaa, july 2023 +! remedy for tiny nc in the presence of qc (nc = xncr, 300/cm**3) +! ==> prevents the crash in computing autoconversion +! hong from noaa, july 2023 ! ! history log : ! @@ -586,7 +592,6 @@ subroutine wdm62D(t, q, qci, qrs, ncr, den, p, delz & dend(i,k) = den(i,k) enddo enddo - ! ! latent heat for phase changes and heat capacity. neglect the ! changes during microphysical process calculation @@ -904,8 +909,7 @@ subroutine wdm62D(t, q, qci, qrs, ncr, den, p, delz & psmlt(i,k) = xka(t(i,k),den(i,k))/xlf*(t0c-t(i,k))*pi/2. & *n0sfac(i,k)*(precs1*rslope2(i,k,2) & +precs2*work2(i,k)*coeres)/den(i,k) - psmlt(i,k) = min(max(psmlt(i,k)*dtcld/mstep(i),-qrs(i,k,2) & - /mstep(i)),0.) + psmlt(i,k) = min(max(psmlt(i,k)*dtcld,-qrs(i,k,2)),0.) !------------------------------------------------------------------- ! nsmlt: melting of snow [LH A27] ! (T>T0: ->NR) @@ -928,8 +932,7 @@ subroutine wdm62D(t, q, qci, qrs, ncr, den, p, delz & pgmlt(i,k) = xka(t(i,k),den(i,k))/xlf*(t0c-t(i,k))*(precg1 & *rslope2(i,k,3) + precg2*work2(i,k)*coeres) & /den(i,k) - pgmlt(i,k) = min(max(pgmlt(i,k)*dtcld/mstep(i), & - -qrs(i,k,3)/mstep(i)),0.) + pgmlt(i,k) = min(max(pgmlt(i,k)*dtcld,-qrs(i,k,3)),0.) !------------------------------------------------------------------- ! ngmlt: melting of graupel [LH A28] ! (T>T0: ->NR) @@ -1165,7 +1168,7 @@ subroutine wdm62D(t, q, qci, qrs, ncr, den, p, delz & lencon = 2.7e-2*den(i,k)*qci(i,k,1)*(1.e20/16.*rslopec2(i,k) & *rslopec2(i,k)-0.4) lenconcr = max(1.2*lencon, qcrmin) - if(qci(i,k,1).gt.qcr(i,k)) then + if(qci(i,k,1).gt.qcr(i,k).and.ncr(i,k,2).gt.ncmin) then praut(i,k) = qck1*qci(i,k,1)**(7./3.)*ncr(i,k,2)**(-1./3.) praut(i,k) = min(praut(i,k),qci(i,k,1)/dtcld) !---------------------------------------------------------------------- @@ -2109,7 +2112,7 @@ SUBROUTINE wdm6init(den0,denr,dens,cl,cpv, ccn0, hail_opt, allowed_to_read) ! RA ! qc0 = 4./3.*pi*denr*r0**3.*xncr0/den0 qc1 = 4./3.*pi*denr*r0**3.*xncr1/den0 - qck1 = .104*9.8*peaut/(xncr*denr)**(1./3.)/xmyu*den0**(4./3.) ! 7.03 + qck1 = .104*9.8*peaut/(denr)**(1./3.)/xmyu*den0**(4./3.) ! 4706.08203 pidnc = pi*denr/6. ! bvtr1 = 1.+bvtr diff --git a/phys/module_mp_wdm7.F b/phys/module_mp_wdm7.F index e063038d78..d29374481c 100644 --- a/phys/module_mp_wdm7.F +++ b/phys/module_mp_wdm7.F @@ -380,6 +380,16 @@ SUBROUTINE wdm72D(t, q, qci, qrs, ncr, den, p, delz & ) !------------------------------------------------------------------- IMPLICIT NONE +! +! The code was first implemented in WRF in v4.1 +! Further Development: +! bug fix in snow melting and autoconversion. +! ==> Revisions enchance melting and autoconverison. +! hong from noaa, july2023 +! remedy for tiny nc in the presence of qc (nc = xncr, 300/cm**3) +! ==> prevents the crashed in computing autoconversion +! hong from noaa, july2023 +! !------------------------------------------------------------------- INTEGER, INTENT(IN ) :: ids,ide, jds,jde, kds,kde , & ims,ime, jms,jme, kms,kme , & @@ -916,8 +926,7 @@ SUBROUTINE wdm72D(t, q, qci, qrs, ncr, den, p, delz & psmlt(i,k) = xka(t(i,k),den(i,k))/xlf*(t0c-t(i,k))*pi/2. & *n0sfac(i,k)*(precs1*rslope2(i,k,2) & +precs2*work2(i,k)*coeres)/den(i,k) - psmlt(i,k) = min(max(psmlt(i,k)*dtcld/mstep(i),-qrs(i,k,2) & - /mstep(i)),0.) + psmlt(i,k) = min(max(psmlt(i,k)*dtcld,-qrs(i,k,2)),0.) ! ! nsmlt: melting of snow [LH A27] ! (T>T0: ->NR) @@ -939,8 +948,7 @@ SUBROUTINE wdm72D(t, q, qci, qrs, ncr, den, p, delz & pgmlt(i,k) = xka(t(i,k),den(i,k))/xlf*(t0c-t(i,k))*(precg1 & *rslope2(i,k,3) + precg2*work2(i,k)*coeres) & /den(i,k) - pgmlt(i,k) = min(max(pgmlt(i,k)*dtcld/mstep(i), & - -qrs(i,k,3)/mstep(i)),0.) + pgmlt(i,k) = min(max(pgmlt(i,k)*dtcld,-qrs(i,k,3)),0.) ! ! ngmlt: melting of graupel [LH A28] ! (T>T0: ->NR) @@ -1212,7 +1220,7 @@ SUBROUTINE wdm72D(t, q, qci, qrs, ncr, den, p, delz & lencon = 2.7e-2*den(i,k)*qci(i,k,1)*(1.e20/16.*rslopec2(i,k) & *rslopec2(i,k)-0.4) lenconcr = max(1.2*lencon, qcrmin) - if(qci(i,k,1).gt.qcr(i,k)) then + if(qci(i,k,1).gt.qcr(i,k).and.ncr(i,k,2).gt.ncmin) then praut(i,k) = qck1*qci(i,k,1)**(7./3.)*ncr(i,k,2)**(-1./3.) praut(i,k) = min(praut(i,k),qci(i,k,1)/dtcld) ! @@ -2381,7 +2389,7 @@ SUBROUTINE wdm7init(den0,denr,dens,cl,cpv, ccn0, allowed_to_read) ! RAS ! qc0 = 4./3.*pi*denr*r0**3.*xncr0/den0 qc1 = 4./3.*pi*denr*r0**3.*xncr1/den0 - qck1 = .104*9.8*peaut/(xncr*denr)**(1./3.)/xmyu*den0**(4./3.) ! 7.03 + qck1 = .104*9.8*peaut/(denr)**(1./3.)/xmyu*den0**(4./3.) ! 4706.08203 pidnc = pi*denr/6. ! bvtr1 = 1.+bvtr diff --git a/phys/module_sf_urban.F b/phys/module_sf_urban.F index f7c04091a4..cd1d097c77 100644 --- a/phys/module_sf_urban.F +++ b/phys/module_sf_urban.F @@ -1279,7 +1279,7 @@ SUBROUTINE urban(LSOLAR, & ! L ES=6.11*EXP( (2.5*10.**6./461.51)*(TGP-273.15)/(273.15*TGP) ) DESDT=(2.5*10.**6./461.51)*ES/(TGP**2.) QS0G=0.622*ES/(PS-0.378*ES) - DQS0GDTG=DESDT*0.22*PS/((PS-0.378*ES)**2.) + DQS0GDTG=DESDT*0.622*PS/((PS-0.378*ES)**2.) RG1=EPSG*( RX*VFGS & +EPSB*VFGW*SIG*TBP**4./60. & diff --git a/phys/module_wind_fitch.F b/phys/module_wind_fitch.F index e2b4bb3049..3adaa8274c 100644 --- a/phys/module_wind_fitch.F +++ b/phys/module_wind_fitch.F @@ -518,6 +518,7 @@ SUBROUTINE init_module_wind_fitch(id,config_flags,xlong,xlat,windfarm_initialize CALL wrf_dm_bcast_real(hubheight,nt) CALL wrf_dm_bcast_real(diameter,nt) CALL wrf_dm_bcast_real(stc,nt) + CALL wrf_dm_bcast_real(stc2,nt) CALL wrf_dm_bcast_real(npower,nt) CALL wrf_dm_bcast_real(cutin,nt) CALL wrf_dm_bcast_real(cutout,nt) diff --git a/share/mediation_integrate.F b/share/mediation_integrate.F index 98bc99643a..fb12f2eaed 100644 --- a/share/mediation_integrate.F +++ b/share/mediation_integrate.F @@ -1701,6 +1701,8 @@ SUBROUTINE open_hist_w ( grid , config_flags, stream, alarm_id, & ENDIF ierr = 0 + fname = "" + n2 = "" ! Note that computation of fname and n2 are outside of the oid IF statement ! since they are OUT args and may be used by callers even if oid/=0. diff --git a/share/wrf_tsin.F b/share/wrf_tsin.F index 0ba9729763..694a05d77e 100644 --- a/share/wrf_tsin.F +++ b/share/wrf_tsin.F @@ -24,12 +24,17 @@ SUBROUTINE wrf_tsin ( grid , ierr ) ierr = 0 + ! + ! If time series locations have already been computed by calc_ts_locations, + ! assume that we have already read the 'tslist' file for this domain and return + ! + IF ( grid%have_calculated_tslocs ) RETURN + #if ((EM_CORE == 1) && (DA_CORE != 1)) IF ( grid%dfi_opt == DFI_NODFI .OR. (grid%dfi_opt /= DFI_NODFI .AND. grid%dfi_stage == DFI_SETUP) ) THEN #endif CALL model_to_grid_config_rec ( grid%id , model_config_rec , config_flags ) grid%ntsloc = 0 - grid%have_calculated_tslocs = .FALSE. IF ( grid%max_ts_locs <= 0 ) RETURN diff --git a/tools/gen_config.c b/tools/gen_config.c index fc6573975f..c07be2e919 100644 --- a/tools/gen_config.c +++ b/tools/gen_config.c @@ -5,6 +5,7 @@ #include "registry.h" #include "data.h" #include +#include #ifndef _WIN32 # include #endif diff --git a/tools/gen_irr_diag.c b/tools/gen_irr_diag.c index 40c4219450..13071f239f 100644 --- a/tools/gen_irr_diag.c +++ b/tools/gen_irr_diag.c @@ -5,6 +5,7 @@ #include #include #include +#include int nChmOpts = 0; char rxt_tbl[5][1000][128]; diff --git a/tools/gen_streams.c b/tools/gen_streams.c index f93cf3989d..ad5251ff4d 100644 --- a/tools/gen_streams.c +++ b/tools/gen_streams.c @@ -539,6 +539,7 @@ gen_shutdown_closes ( FILE *fp ) } /* generate the calls that main/wrf_ESMFMod.F uses in wrf_state_populate() */ +int gen_med_open_esmf_calls ( FILE *fp ) { int i ; @@ -569,6 +570,7 @@ gen_med_open_esmf_calls ( FILE *fp ) } /* generate the calls that main/wrf_ESMFMod.F uses in wrf_state_populate() */ +int gen_med_find_esmf_coupling ( FILE *fp ) { int i ; diff --git a/tools/misc.c b/tools/misc.c index e0a00938dc..a794fd692a 100644 --- a/tools/misc.c +++ b/tools/misc.c @@ -6,6 +6,8 @@ # define index(X,Y) strchr(X,Y) #else # include +# include +# include #endif #include "protos.h" diff --git a/tools/protos.h b/tools/protos.h index 0191e8f4af..3d39c2dfa7 100644 --- a/tools/protos.h +++ b/tools/protos.h @@ -30,6 +30,9 @@ int print_warning( FILE * fp , char * fname ) ; int close_the_file( FILE * fp ) ; int make_entries_uniq ( char * fname ) ; int add_warning ( char * fname ) ; +int gen_dummy_decls ( char * dn ); +int gen_dummy_decls_new ( char * dn ); +int gen_i1_decls ( char * dn ); node_t * get_type_entry ( char * typename ) ; node_t * get_rconfig_entry( char * name ) ; @@ -157,6 +160,67 @@ void set_mask ( unsigned int * mask , int e ) ; int get_mask ( unsigned int * mask , int e ) ; int dims_ikj_inner(node_t *); int dims_ij_inner(node_t *); + +char *make_upper_case ( char * str ); +char *make_lower_case ( char * str ); +int sym_forget(); +int init_parser(); +int pre_parse( char * dir, FILE * infile, FILE * outfile ); +int check_dimspecs(); +int set_dim_order ( char * dimorder , node_t * dim_entry ); + +int gen_actual_args ( char * dirname ); +int gen_actual_args_new ( char * dirname ); +int gen_dummy_args ( char * dirname ); +int gen_dummy_args_new ( char * dirname ); +int gen_args ( char * dirname , int sw ); +int gen_args1 ( FILE * fp , char * outstr , char * structname , + node_t * node , int *linelen , int sw , int deep ); + + +int gen_namelist_defines ( char * dirname , int sw_dimension ); +int gen_namelist_defaults ( char * dirname ); +int gen_namelist_statements ( char * dirname ); +int gen_namelist_script ( char * dirname ); +int gen_get_nl_config ( char * dirname ); +int gen_config_assigns ( char * dirname ); +int gen_config_reads ( char * dirname ); + +int as_long(char *str,long *l); +int as_finite_double(char *str,double *d); +int contains_str( char *s1, char *s2 ); +int contains_tok( char *s1, char *s2, char *delims ); +int gen_nest_v_interp ( char * dirname ); +int gen_nest_interp ( char * dirname ); +int gen_nest_interp1 ( FILE * fp , node_t * node, char * fourdname, int down_path , int use_nest_time_level ); +int gen_nest_interp2 ( FILE * fp , node_t * node, char * fourdname, int down_path , int use_nest_time_level ); + + +int gen_streams( char * dirname ); +int gen_io_domain_defs ( FILE * fp ); +int gen_set_timekeeping_defs ( FILE *fp ); +int gen_io_form_for_dataset ( FILE *fp ); +int gen_io_form_for_stream ( FILE *fp ); +int gen_switches_and_alarms ( FILE *fp ); +int gen_check_auxstream_alarms ( FILE *fp ); +int gen_fine_stream_input ( FILE *fp ); +int gen_med_auxinput_in ( FILE *fp ); +int gen_med_hist_out_opens ( FILE *fp ); +int gen_med_hist_out_closes ( FILE *fp ); +int gen_med_auxinput_in_closes ( FILE *fp ); +int gen_med_last_solve_io ( FILE *fp ); +int gen_shutdown_closes ( FILE *fp ); +int gen_med_open_esmf_calls ( FILE *fp ); +int gen_med_find_esmf_coupling ( FILE *fp ); +int gen_io_boilerplate (); + +int gen_comms ( char * dirname ); + +int gen_set_timekeeping_alarms ( FILE * fp ); + +int create_ht(char *** p ); + + #define PROTOS_H #endif diff --git a/tools/reg_parse.c b/tools/reg_parse.c index 01176c0ea4..8e2e1a0fd1 100644 --- a/tools/reg_parse.c +++ b/tools/reg_parse.c @@ -6,6 +6,7 @@ # define index(X,Y) strchr(X,Y) #else # include +# include #endif #include "registry.h" diff --git a/tools/sym.c b/tools/sym.c index de41c2d965..d6977116f5 100644 --- a/tools/sym.c +++ b/tools/sym.c @@ -61,12 +61,43 @@ */ #include +#include +#include "protos.h" #include "sym.h" -extern sym_nodeptr symget() ; +extern sym_nodeptr symget(char *name, sym_nodeptr (*newnode)(), char **(*nodename)(sym_nodeptr), sym_nodeptr *(*nodenext)(sym_nodeptr), char ** symtab, int flag); static char ** symtab ; /* 2-19-90 */ + +sym_nodeptr +new_sym_node() +{ + sym_nodeptr p ; + p = (sym_nodeptr) malloc( sizeof( struct sym_node ) ) ; + p->name = NULL ; + p->next = NULL ; + + return( p ) ; +} + +char ** +node_name(sym_nodeptr p) +{ + char ** x ; + x = &(p->name) ; + return( x ) ; +} + +sym_nodeptr * +node_next(sym_nodeptr p) +{ + sym_nodeptr *x ; + x = &(p->next) ; + return( x ) ; +} + + int sym_init() /* 2-19-90, initialize symbol table package */ { @@ -80,58 +111,29 @@ sym_init() /* 2-19-90, initialize symbol table package */ } sym_nodeptr -sym_add( name ) -char * name ; +sym_add( char * name ) { +/* sym_nodeptr new_sym_node(); char **node_name() ; sym_nodeptr *node_next() ; +*/ return( symget( name, new_sym_node, node_name, node_next, symtab, 1 ) ) ; } sym_nodeptr -sym_get( name ) -char * name ; +sym_get( char * name ) { +/* sym_nodeptr new_sym_node(); char **node_name() ; sym_nodeptr *node_next() ; +*/ return( symget( name, new_sym_node, node_name, node_next, symtab, 0 ) ) ; } -sym_nodeptr -new_sym_node() -{ - void * malloc() ; - sym_nodeptr p ; - p = (sym_nodeptr) malloc( sizeof( struct sym_node ) ) ; - p->name = NULL ; - p->next = NULL ; - - return( p ) ; -} - -char ** -node_name(p) -sym_nodeptr p ; -{ - char ** x ; - x = &(p->name) ; - return( x ) ; -} - -sym_nodeptr * -node_next(p) -sym_nodeptr p ; -{ - sym_nodeptr *x ; - x = &(p->next) ; - return( x ) ; -} - int -show_entry(x) -sym_nodeptr x ; +show_entry(sym_nodeptr x) { int i ; if ( x == NULL ) return(0) ; diff --git a/tools/sym.h b/tools/sym.h index 9431f5d2b8..5480b9d908 100644 --- a/tools/sym.h +++ b/tools/sym.h @@ -89,7 +89,7 @@ struct sym_node int marked ; /* general purpose marker */ } ; -sym_nodeptr sym_add() ; -sym_nodeptr sym_get() ; +sym_nodeptr sym_add(char *) ; +sym_nodeptr sym_get(char *); #endif diff --git a/tools/symtab_gen.c b/tools/symtab_gen.c index 47870f6c88..a6ddcf9661 100644 --- a/tools/symtab_gen.c +++ b/tools/symtab_gen.c @@ -32,25 +32,24 @@ For a sample main or calling program see the end of this file. */ #include +#include #include #ifndef _WIN32 # include #endif +#include "protos.h" #define HASHSIZE 1024 /* commented out 2-29-90 static char * symtab[HASHSIZE] ; */ - +/* void * malloc() ; void * calloc() ; +*/ -char * symget(name,newnode,nodename,nodenext,symtab,flag) -char *name ; -char *(*newnode)(), **(*nodename)(), **(*nodenext)() ; -char *symtab[] ; -int flag ; /* 1 is create if not there, 0 return NULL if not there */ +char * symget(char *name,char *(*newnode)(),char **(*nodename)(char *),char **(*nodenext)(char *), char *symtab[], int flag) /* flag = 1 is create if not there, 0 return NULL if not there */ { int index ; int found ; @@ -94,9 +93,7 @@ int flag ; /* 1 is create if not there, 0 return NULL if not there */ return(p) ; } -int -hash(name) -char * name ; +int hash(char * name ) { register int result = 0 ; register char * p = name ; @@ -113,9 +110,7 @@ char * name ; /* added 2-19-90, attaches a new hash table to pointer */ -int -create_ht( p ) -char *** p ; +int create_ht(char *** p ) { *p = (char **) calloc( HASHSIZE , sizeof( char * ) ) ; return(0) ; @@ -130,11 +125,7 @@ function to each entry */ -int -sym_traverse( ht, nodenext, f ) -char *ht[] ; -char **(*nodenext)() ; -void (*f)() ; +int sym_traverse( char *ht[] , char **(*nodenext)(char *), void (*f)(char *) ) { char * p, **x ; int i ; @@ -173,25 +164,20 @@ struct symnode { extern struct symnode * symget() ; -struct symnode * -newnode() +struct symnode * newnode() { struct symnode * malloc() ; return( malloc( sizeof( struct symnode ) ) ) ; } -char ** -nodename(p) -struct symnode *p ; +char ** nodename(struct symnode *p) { char ** x ; x = &(p->name) ; return( x ) ; } -struct symnode ** -nodenext(p) -struct symnode *p ; +struct symnode ** nodenext(struct symnode *p) { struct symnode **x ; x = &(p->next) ;