From 4a136e2280125505eaa31e3557e5c7082339ba79 Mon Sep 17 00:00:00 2001 From: Lucie Bakels <lbakels@jet01.img.univie.ac.at> Date: Mon, 1 Jul 2024 18:10:25 +0200 Subject: [PATCH] Small bug fixes: nested domain allocation error and ithread not set private in conv_mod --- src/conv_mod.f90 | 2 +- src/drydepo_mod.f90 | 15 +++++++++++---- src/make_command.sh | 23 ----------------------- src/windfields_mod.f90 | 11 +++-------- 4 files changed, 15 insertions(+), 36 deletions(-) delete mode 100755 src/make_command.sh diff --git a/src/conv_mod.f90 b/src/conv_mod.f90 index b2c7efcf..76a639c3 100644 --- a/src/conv_mod.f90 +++ b/src/conv_mod.f90 @@ -438,7 +438,7 @@ subroutine convmix(itime) ! Now visit all grid columns where particles are present ! by going through the sorted particles !$OMP PARALLEL PRIVATE (igrold,kpart,ipart,igr,jy,ix,kz,lconv, & -!$OMP ktop,ztold,nage,ipconv,itage,lcalcflux) +!$OMP ktop,ztold,nage,ipconv,itage,lcalcflux,ithread) igrold = -1 #if (defined _OPENMP) ithread = OMP_GET_THREAD_NUM()+1 ! Starts at 1 diff --git a/src/drydepo_mod.f90 b/src/drydepo_mod.f90 index 98bf7c65..9bd0ee83 100644 --- a/src/drydepo_mod.f90 +++ b/src/drydepo_mod.f90 @@ -38,18 +38,25 @@ subroutine alloc_drydepo if (.not. drydep) return write(*,*) 'allocate drydepo fields' allocate(xlanduse(0:nxmax-1,0:nymax-1,numclass), & - xlandusen(0:nxmaxn-1,0:nymaxn-1,numclass,numbnests), & vdep(0:nxmax-1,0:nymax-1,maxspec,numwfmem), & - z0_drydep(0:nxmax-1,0:nymax-1), & - z0_drydepn(0:nxmax-1,0:nymax-1,numbnests), stat=stat) + z0_drydep(0:nxmax-1,0:nymax-1), stat=stat) if (stat.ne.0) error stop "Could not allocate drydepo fields" + if (numbnests.ge.1) then + allocate(xlandusen(0:nxmaxn-1,0:nymaxn-1,numclass,numbnests), & + vdepn(0:nxmaxn-1,0:nymaxn-1,maxspec,numwfmem,numbnests), & + z0_drydepn(0:nxmaxn-1,0:nymaxn-1,numbnests), stat=stat) + if (stat.ne.0) error stop "Could not allocate drydepo fields" + endif end subroutine alloc_drydepo subroutine dealloc_drydepo if (.not. drydep) return - deallocate(xlanduse,xlandusen,vdep,z0_drydep,z0_drydepn) + deallocate(xlanduse,vdep,z0_drydep) + if (numbnests.ge.1) then + deallocate(xlandusen,vdepn,z0_drydepn) + endif end subroutine dealloc_drydepo diff --git a/src/make_command.sh b/src/make_command.sh deleted file mode 100755 index deb0e704..00000000 --- a/src/make_command.sh +++ /dev/null @@ -1,23 +0,0 @@ - -module purge -module load eccodes -export CPATH=/opt/tools/eccodes/2.28.0-gcc9.4/include:/opt/tools/netcdf-fortran/4.6.0-gcc9.4/include -export LIBRARY_PATH=$LIBRARY_PATH:/opt/tools/eccodes/2.28.0-gcc9.4/lib - -rm -f *.o *.mod - -# eta ncf - new default FLEXPART_ETA -FC=/opt/tools/gcc/9.4.0/bin/gfortran make -f makefile_gfortran -#executable: FLEXPART_ETA - -# meter bin - classic -#FC=/opt/tools/gcc/9.4.0/bin/gfortran make -f makefile_gfortran eta=no ncf=no -# executable: FLEXPART_BIN - -# meter ncf: -#FC=/opt/tools/gcc/9.4.0/bin/gfortran make -f makefile_gfortran eta=no -# executable: FLEXPART - -# eta/bin -#FC=/opt/tools/gcc/9.4.0/bin/gfortran make -f makefile_gfortran ncf=no -# executable: FLEXPART_ETA_BIN diff --git a/src/windfields_mod.f90 b/src/windfields_mod.f90 index 1168c929..e2e7dac3 100644 --- a/src/windfields_mod.f90 +++ b/src/windfields_mod.f90 @@ -1882,11 +1882,8 @@ subroutine gridcheck_nest ! Allocate memory for windfields using nxmax, nymaxn, numbnest !************************************************************* - if (numbnests.ge.1) then - ! If nested wind fields are used, allocate arrays - !************************************************ - call alloc_windfields_nest - endif + call alloc_windfields_nest + return @@ -4303,8 +4300,6 @@ subroutine alloc_windfields_nest if (stat.ne.0) error stop "Could not allocate tropopausen" allocate(olin(0:nxmaxn-1,0:nymaxn-1,1,numwfmem,numbnests),stat=stat) if (stat.ne.0) error stop "Could not allocate olin" - allocate(vdepn(0:nxmaxn-1,0:nymaxn-1,maxspec,numwfmem,numbnests),stat=stat) - if (stat.ne.0) error stop "Could not allocate vdepn" ! Initialise !************ @@ -4362,7 +4357,7 @@ subroutine dealloc_windfields_nest #endif deallocate(psn,sdn,msln,tccn,u10n,v10n,tt2n,td2n,lsprecn,convprecn, & - sshfn,ssrn,sfcstressn,ustarn,wstarn,hmixn,tropopausen,olin,vdepn) + sshfn,ssrn,sfcstressn,ustarn,wstarn,hmixn,tropopausen,olin) deallocate(xresoln,yresoln,xln,yln,xrn,yrn) end subroutine dealloc_windfields_nest -- GitLab