From aabc189372f048b72c68688bfbac3783fce0c9cd Mon Sep 17 00:00:00 2001 From: pcampbe8 Date: Tue, 12 Jul 2022 09:54:56 -0400 Subject: [PATCH] Fixed memory issues and array bounds check. --- parallel/src/Makefile_gcc_hopper_debug | 188 +++++++++++++++++++++++++ parallel/src/ctmproc.f90 | 52 +++---- parallel/src/metvars2ctm.f90 | 2 +- serial/src/ctmproc.f90 | 52 +++---- serial/src/metvars2ctm.f90 | 2 +- 5 files changed, 242 insertions(+), 54 deletions(-) create mode 100644 parallel/src/Makefile_gcc_hopper_debug diff --git a/parallel/src/Makefile_gcc_hopper_debug b/parallel/src/Makefile_gcc_hopper_debug new file mode 100644 index 0000000..3d6a664 --- /dev/null +++ b/parallel/src/Makefile_gcc_hopper_debug @@ -0,0 +1,188 @@ +#------------------------------------------------------------------------------# +# The Community Multiscale Air Quality (CMAQ) system software is in # +# continuous development by various groups and is based on information # +# from these groups: Federal Government employees, contractors working # +# within a United States Government contract, and non-Federal sources # +# including research institutions. These groups give the Government # +# permission to use, prepare derivative works of, and distribute copies # +# of their work in the CMAQ system to the public and to permit others # +# to do so. The United States Environmental Protection Agency # +# therefore grants similar permission to use the CMAQ system software, # +# but users are requested to provide copies of derivative works or # +# products designed to operate in the CMAQ system to the United States # +# Government without restrictions as to use by others. Software # +# that is used with the CMAQ system but distributed under the GNU # +# General Public License or the GNU Lesser General Public License is # +# subject to their copyright restrictions. # +#------------------------------------------------------------------------------# + +.SUFFIXES: +.SUFFIXES: .o .f90 .F90 + +MODEL = mcip.exe + +#...Portland Group Fortran +#FC = /usr/local/apps/pgi/linux86-64/17.10/bin/pgf90 +#NETCDF = /usr/local/apps/netcdf-4.6.3/pgi-17.10 +#IOAPI_ROOT = /usr/local/apps/ioapi-3.2_20181011/pgi-17.10 +###FFLAGS = -g -O0 -Ktrap=unf -Ktrap=denorm -Ktrap=inv -Ktrap=ovf -Ktrap=divz \ +### -Ktrap=fp -pc 32 -Mbounds -Mchkfpstk -Mchkptr -Kieee \ +### -Minform,inform -Mfree -byteswapio -I$(NETCDF)/include \ +### -I$(IOAPI_ROOT)/Linux2_x86_64pg +#FFLAGS = -O4 -fastsse -pc 32 -Mfree -byteswapio -I$(NETCDF)/include \ +# -I$(IOAPI_ROOT)/Linux2_x86_64pg +#LIBS = -L$(IOAPI_ROOT)/Linux2_x86_64pg -lioapi \ +# -L$(NETCDF)/lib -lnetcdff -lnetcdf + +#...gfortran +#FC = gfortran +#NETCDF = /usr/local/apps/netcdf-4.6.3/gcc-6.1.0 +#IOAPI_ROOT = /usr/local/apps/ioapi-3.2_20181011/gcc-6.1.0 +#FFLAGS = -O3 -I$(NETCDF)/include -I$(IOAPI_ROOT)/Linux2_x86_64 +###FFLAGS = -g -O0 \ +### -ffpe-trap='invalid','zero','overflow','underflow' \ +### -I$(NETCDF)/include -I$(IOAPI_ROOT)/Linux2_x86_64 +#LIBS = -L$(IOAPI_ROOT)/Linux2_x86_64 -lioapi \ +# -L$(NETCDF)/lib -lnetcdff -lnetcdf + +FC = mpifort + +#NetCDF Settings +NETCDF = /opt/sw/spack/apps/linux-centos8-cascadelake/gcc-9.3.0-openmpi-4.0.4/netcdf-c-4.7.4-vh + +#IOAPI Settings +IOAPI_ROOT = /opt/sw/other/apps/linux-centos8-cascadelake/gnu-9.3.0-openmpi-4.0.4/ioapi/3.2-spack + +#MPI Settings for parallel +MPI_ROOT = /opt/ohpc/pub/mpi/openmpi4-gnu9/4.0.4 + +FFLAGS = -g -O0 -fbacktrace -fbounds-check -I$(NETCDF)/include -I$(IOAPI_ROOT) -I$(MPI_ROOT)/include + +#Parallel +LIBS = -L$(IOAPI_ROOT) -lioapi \ + -L$(NETCDF)/lib -lnetcdf -lnetcdff -fopenmp \ + -L$(MPI_ROOT)/lib -lmpi + +/EFS = + + +MODULES =\ + const_mod.o \ + const_pbl_mod.o \ + coord_mod.o \ + ctmvars_mod.o \ + date_time_mod.o \ + date_pack_mod.o \ + files_mod.o \ + lucats_mod.o \ + mcipparm_mod.o \ + metinfo_mod.o \ + metvars_mod.o \ + netcdf_io_mod.o \ + vgrd_mod.o \ + xvars_mod.o + +OBJS =\ + mcip.o \ + alloc_ctm.o \ + alloc_met.o \ + alloc_x.o \ + bcldprc_ak.o \ + blddesc.o \ + chkwpshdr.o \ + chkwrfhdr.o \ + chkfv3hdr.o \ + close_files.o \ + collapx.o \ + comheader.o \ + comheader_lufrac.o \ + comheader_mos.o \ + comheader_soi.o \ + ctmout.o \ + ctmproc.o \ + dealloc_ctm.o \ + dealloc_met.o \ + dealloc_x.o \ + detangle_soil_px.o \ + e_aerk.o \ + dynflds.o \ + fv3mopts.o \ + fv3lammopts.o \ + getluse.o \ + getmet.o \ + getpblht.o \ + getpsih.o \ + getsdt.o \ + getxyindex.o \ + graceful_stop.o \ + gridout.o \ + gridproc.o \ + init_ctm.o \ + init_io.o \ + init_met.o \ + init_x.o \ + julian.o \ + layht.o \ + ll2xy_lam.o \ + ll2xy_lam_sec.o \ + ll2xy_lam_tan.o \ + ll2xy_merc.o \ + ll2xy_ps.o \ + locate.o \ + mapfac_lam.o \ + mapfac_merc.o \ + mapfac_ps.o \ + metgrid2ctm.o \ + metvars2ctm.o \ + myinterp.o \ + outclog.o \ + outcm3io.o \ + outglog.o \ + outgm3io.o \ + outncf.o \ + outncfbdy.o \ + outncfglobal.o \ + pblsup.o \ + ptemp.o \ + pvs.o \ + qsat.o \ + rdwrfem.o \ + rdfv3.o \ + rdfv3_lam.o \ + readnml.o \ + resistcalc.o \ + setgriddefs.o \ + setup.o \ + setup_wrfem.o \ + setup_fv3.o \ + setup_fv3_lam.o \ + sfclayer.o \ + statflds.o \ + vertarys.o \ + vertnhy_wrf.o \ + vstamp.o \ + vtemp.o \ + wind.o \ + windrotation.o \ + wrfemopts.o \ + wrgdesc.o \ + xy2ll_lam.o \ + xy2ll_merc.o \ + +all: + @$(MAKE) $(MODULES) + @$(MAKE) $(MODEL) + +$(MODEL): $(OBJS) + $(FC) -o $(MODEL) $(FFLAGS) $(OBJS) $(MODULES) $(LIBS) + +$(OBJS): $(MODULES) + +.f90.o: + $(FC) $(FFLAGS) $(INCLUDES) -c $< + +.F90.o: + $(FC) $(FFLAGS) $(INCLUDES) -c $< $(DEFS) + +clean: + rm -f *.o *.mod *.il $(MODEL) diff --git a/parallel/src/ctmproc.f90 b/parallel/src/ctmproc.f90 index a23fdeb..5c4cd34 100644 --- a/parallel/src/ctmproc.f90 +++ b/parallel/src/ctmproc.f90 @@ -581,45 +581,45 @@ END SUBROUTINE collapx ! CALL collapx (xwvapor, xx3midl, x3midl) ! CALL collapx (x3htm, xx3midl, x3midl) - CALL collapx (xrhojm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xdensam(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xpresm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xtempm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xwvapor(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (x3htm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xrhojm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xdensam(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xpresm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xtempm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xwvapor(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (x3htm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) IF ( nqspecies >= 2 ) THEN ! CALL collapx (xcldwtr, xx3midl, x3midl) ! CALL collapx (xranwtr, xx3midl, x3midl) - CALL collapx (xcldwtr(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xranwtr(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xcldwtr(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xranwtr(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) IF ( nqspecies >= 4 ) THEN ! CALL collapx (xqice, xx3midl, x3midl) ! CALL collapx (xqsnow, xx3midl, x3midl) - CALL collapx (xqice(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xqsnow(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xqice(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xqsnow(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) IF ( nqspecies == 5 ) THEN ! CALL collapx (xqgraup, xx3midl, x3midl) - CALL collapx (xqgraup(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xqgraup(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) ENDIF ENDIF ENDIF IF ( ( iftke ) .AND. ( .NOT. iftkef ) ) THEN ! TKE on half-layers ! CALL collapx (xtke, xx3midl, x3midl) - CALL collapx (xtke(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xtke(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) ENDIF IF ( lpv > 0 ) THEN ! Output potential vorticity ! CALL collapx (xpvc, xx3midl, x3midl) - CALL collapx (xpvc(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xpvc(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) ENDIF IF ( ifcld3d ) THEN ! CALL collapx (xcfrac3d, xx3midl, x3midl) - CALL collapx (xcfrac3d(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xcfrac3d(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) ENDIF ! CALL collapx (xrhojf, xx3face, x3face) @@ -627,19 +627,19 @@ END SUBROUTINE collapx ! CALL collapx (x3htf, xx3face, x3face) ! CALL collapx (xdensaf, xx3face, x3face) - CALL collapx (xrhojf(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face(0:metlay_sub)) - CALL collapx (xwhat(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face(0:metlay_sub)) - CALL collapx (x3htf(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face(0:metlay_sub)) - CALL collapx (xdensaf(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face(0:metlay_sub)) + CALL collapx (xrhojf(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face) + CALL collapx (xwhat(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face) + CALL collapx (x3htf(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face) + CALL collapx (xdensaf(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face) IF ( lwout > 0 ) THEN ! CALL collapx (xwwind, xx3face, x3face) - CALL collapx (xwwind(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face(0:metlay_sub)) + CALL collapx (xwwind(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face) ENDIF IF ( ( iftke ) .AND. ( iftkef ) ) THEN ! TKE on full-levels ! CALL collapx (xtke, xx3face, x3face) - CALL collapx (xtke(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face(0:metlay_sub)) + CALL collapx (xtke(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face) ENDIF ENDIF @@ -1224,10 +1224,10 @@ END SUBROUTINE collapx ! CALL collapx (xuu_d, xx3midl, x3midl) ! CALL collapx (xvv_d, xx3midl, x3midl) - CALL collapx (xuhat_s(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xvhat_t(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xuu_d(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xvv_d(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xuhat_s(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xvhat_t(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xuu_d(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xvv_d(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) @@ -1242,8 +1242,8 @@ END SUBROUTINE collapx ENDDO ! CALL collapx (xuu_s, xx3midl, x3midl) ! CALL collapx (xvv_t, xx3midl, x3midl) - CALL collapx (xuu_s(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xvv_t(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xuu_s(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xvv_t(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) ENDIF ENDIF diff --git a/parallel/src/metvars2ctm.f90 b/parallel/src/metvars2ctm.f90 index 143cf98..4df8f88 100644 --- a/parallel/src/metvars2ctm.f90 +++ b/parallel/src/metvars2ctm.f90 @@ -752,7 +752,7 @@ END SUBROUTINE layht xpresf(:,:,0) = xprsfc(:,:) DO k = 1, metlay - xgeof (:,:,k) = xgeof (:,:,k-1) - ((1.0/giwrf) * delz(:,:,k)) + xgeof (:,:,k) = xgeof (:,:,k-1) - ((1.0/giwrf) * delz(sc:ec,sr:er,k)) xpresf(:,:,k) = xpresf(:,:,k-1) * & EXP( (xgeof(:,:,k-1) - xgeof(:,:,k)) / & (rdwrf * xtempm(:,:,k)) ) diff --git a/serial/src/ctmproc.f90 b/serial/src/ctmproc.f90 index a23fdeb..5c4cd34 100644 --- a/serial/src/ctmproc.f90 +++ b/serial/src/ctmproc.f90 @@ -581,45 +581,45 @@ END SUBROUTINE collapx ! CALL collapx (xwvapor, xx3midl, x3midl) ! CALL collapx (x3htm, xx3midl, x3midl) - CALL collapx (xrhojm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xdensam(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xpresm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xtempm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xwvapor(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (x3htm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xrhojm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xdensam(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xpresm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xtempm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xwvapor(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (x3htm(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) IF ( nqspecies >= 2 ) THEN ! CALL collapx (xcldwtr, xx3midl, x3midl) ! CALL collapx (xranwtr, xx3midl, x3midl) - CALL collapx (xcldwtr(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xranwtr(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xcldwtr(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xranwtr(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) IF ( nqspecies >= 4 ) THEN ! CALL collapx (xqice, xx3midl, x3midl) ! CALL collapx (xqsnow, xx3midl, x3midl) - CALL collapx (xqice(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xqsnow(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xqice(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xqsnow(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) IF ( nqspecies == 5 ) THEN ! CALL collapx (xqgraup, xx3midl, x3midl) - CALL collapx (xqgraup(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xqgraup(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) ENDIF ENDIF ENDIF IF ( ( iftke ) .AND. ( .NOT. iftkef ) ) THEN ! TKE on half-layers ! CALL collapx (xtke, xx3midl, x3midl) - CALL collapx (xtke(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xtke(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) ENDIF IF ( lpv > 0 ) THEN ! Output potential vorticity ! CALL collapx (xpvc, xx3midl, x3midl) - CALL collapx (xpvc(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xpvc(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) ENDIF IF ( ifcld3d ) THEN ! CALL collapx (xcfrac3d, xx3midl, x3midl) - CALL collapx (xcfrac3d(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xcfrac3d(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) ENDIF ! CALL collapx (xrhojf, xx3face, x3face) @@ -627,19 +627,19 @@ END SUBROUTINE collapx ! CALL collapx (x3htf, xx3face, x3face) ! CALL collapx (xdensaf, xx3face, x3face) - CALL collapx (xrhojf(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face(0:metlay_sub)) - CALL collapx (xwhat(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face(0:metlay_sub)) - CALL collapx (x3htf(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face(0:metlay_sub)) - CALL collapx (xdensaf(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face(0:metlay_sub)) + CALL collapx (xrhojf(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face) + CALL collapx (xwhat(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face) + CALL collapx (x3htf(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face) + CALL collapx (xdensaf(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face) IF ( lwout > 0 ) THEN ! CALL collapx (xwwind, xx3face, x3face) - CALL collapx (xwwind(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face(0:metlay_sub)) + CALL collapx (xwwind(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face) ENDIF IF ( ( iftke ) .AND. ( iftkef ) ) THEN ! TKE on full-levels ! CALL collapx (xtke, xx3face, x3face) - CALL collapx (xtke(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face(0:metlay_sub)) + CALL collapx (xtke(:,:,0:metlay_sub), xx3face(0:metlay_sub), x3face) ENDIF ENDIF @@ -1224,10 +1224,10 @@ END SUBROUTINE collapx ! CALL collapx (xuu_d, xx3midl, x3midl) ! CALL collapx (xvv_d, xx3midl, x3midl) - CALL collapx (xuhat_s(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xvhat_t(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xuu_d(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xvv_d(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xuhat_s(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xvhat_t(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xuu_d(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xvv_d(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) @@ -1242,8 +1242,8 @@ END SUBROUTINE collapx ENDDO ! CALL collapx (xuu_s, xx3midl, x3midl) ! CALL collapx (xvv_t, xx3midl, x3midl) - CALL collapx (xuu_s(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) - CALL collapx (xvv_t(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl(1:metlay_sub)) + CALL collapx (xuu_s(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) + CALL collapx (xvv_t(:,:,1:metlay_sub), xx3midl(1:metlay_sub), x3midl) ENDIF ENDIF diff --git a/serial/src/metvars2ctm.f90 b/serial/src/metvars2ctm.f90 index 143cf98..4df8f88 100644 --- a/serial/src/metvars2ctm.f90 +++ b/serial/src/metvars2ctm.f90 @@ -752,7 +752,7 @@ END SUBROUTINE layht xpresf(:,:,0) = xprsfc(:,:) DO k = 1, metlay - xgeof (:,:,k) = xgeof (:,:,k-1) - ((1.0/giwrf) * delz(:,:,k)) + xgeof (:,:,k) = xgeof (:,:,k-1) - ((1.0/giwrf) * delz(sc:ec,sr:er,k)) xpresf(:,:,k) = xpresf(:,:,k-1) * & EXP( (xgeof(:,:,k-1) - xgeof(:,:,k)) / & (rdwrf * xtempm(:,:,k)) )