From 91c374e6c8ef078aac9595935c277daa30e2cdb5 Mon Sep 17 00:00:00 2001 From: ronesy <rlt@nilu.no> Date: Tue, 4 Mar 2025 09:36:21 +0100 Subject: [PATCH] Small bug fix to prep_flexpart for using FPv11 when there are no reactive species --- prep_flexpart/mod_prep_command.f90 | 2 +- prep_flexpart/prep_outgrid.f90 | 2 +- prep_flexpart/prep_releases.f90 | 39 ++++++++++++++++------------- prep_flexpart/prep_releases_reg.f90 | 39 ++++++++++++++++------------- 4 files changed, 44 insertions(+), 38 deletions(-) diff --git a/prep_flexpart/mod_prep_command.f90 b/prep_flexpart/mod_prep_command.f90 index 7020fc5..52451e8 100644 --- a/prep_flexpart/mod_prep_command.f90 +++ b/prep_flexpart/mod_prep_command.f90 @@ -183,7 +183,7 @@ module mod_prep_command lturbulence = 1 lturbulence_meso = 0 lnetcdfout = 0 - nxshift = 1 + nxshift = 0 maxthreadgrid = 1 maxfilesize = 10000 logvertinterp = 0 diff --git a/prep_flexpart/prep_outgrid.f90 b/prep_flexpart/prep_outgrid.f90 index 8d55f9f..4be6291 100644 --- a/prep_flexpart/prep_outgrid.f90 +++ b/prep_flexpart/prep_outgrid.f90 @@ -84,7 +84,7 @@ subroutine prep_outgrid(settings, jd, nr) if ( settings%windfield.eq.'oper' ) then outlon0 = -179. else if ( settings%windfield.eq.'era5' ) then - outlon0 = -179. + outlon0 = -179.5 else write(*,*) 'ERROR: prep_outgrid: unknown windfield type' stop diff --git a/prep_flexpart/prep_releases.f90 b/prep_flexpart/prep_releases.f90 index 2dd83d1..2cd520c 100644 --- a/prep_flexpart/prep_releases.f90 +++ b/prep_flexpart/prep_releases.f90 @@ -121,7 +121,7 @@ subroutine prep_releases(settings, jd, nr, nobs, obs) if ( settings%FPversion.eq.10 ) then inquire(file=trim(settings%path_flexpart)//'options/SPECIES/spec_overview',exist=lexist) if ( .not.lexist ) then - write(*,*) 'ERROR: cannot find file /options/SPECIES/spec_overview' + write(*,*) 'ERROR: cannot find file '//trim(settings%path_flexpart)//'options/SPECIES/spec_overview' stop endif open(100,file=trim(settings%path_flexpart)//'options/SPECIES/spec_overview',status='old',action='read',iostat=ierr) @@ -138,29 +138,32 @@ subroutine prep_releases(settings, jd, nr, nobs, obs) inquire(file=trim(settings%path_flexpart)//'options/SPECIES/SPECIES_'//to_upper(trim(settings%species)),& exist=lexist) if ( .not.lexist ) then - write(*,*) 'ERROR: cannot find file /options/SPECIES/SPECIES_'//to_upper(trim(settings%species)) + write(*,*) 'ERROR: cannot find file '& + //trim(settings%path_flexpart)//'options/SPECIES/SPECIES_'//to_upper(trim(settings%species)) stop endif write(aspec,fmt='(I3.3)') spec call system('cp '//trim(settings%path_flexpart)//'options/SPECIES/SPECIES_'//to_upper(trim(settings%species))//& ' '//trim(settings%path_flexpart)//'options/SPECIES/SPECIES_'//aspec) write(aspec,fmt='(I3.3)') spec - ! read SPECIES file for reagents info - allocate(preactions(nreagent)) - allocate(pcconst(nreagent)) - allocate(pdconst(nreagent)) - allocate(pnconst(nreagent)) - open(100,file=trim(settings%path_flexpart)//'options/SPECIES/SPECIES_'//to_upper(trim(settings%species)),& - action='read',iostat=ierr) - read(100,species_params,iostat=ierr) - if ( ierr.ne.0 ) then - write(*,*) 'ERROR: reading SPECIES_'//to_upper(trim(settings%species)) - stop - endif - write(*,*) 'Chemical reactions: ',preactions - if (any(preactions.ne."")) then - ! write reagents file - call prep_reagents(settings,preactions,nr,jd) + if (nreagent.gt.0) then + ! read SPECIES file for reagents info + allocate(preactions(nreagent)) + allocate(pcconst(nreagent)) + allocate(pdconst(nreagent)) + allocate(pnconst(nreagent)) + open(100,file=trim(settings%path_flexpart)//'options/SPECIES/SPECIES_'//to_upper(trim(settings%species)),& + action='read',iostat=ierr) + read(100,species_params,iostat=ierr) + if ( ierr.ne.0 ) then + write(*,*) 'ERROR: reading SPECIES_'//to_upper(trim(settings%species)) + stop + endif + write(*,*) 'Chemical reactions: ',preactions + if (any(preactions.ne."")) then + ! write reagents file + call prep_reagents(settings,preactions,nr,jd) + endif endif endif diff --git a/prep_flexpart/prep_releases_reg.f90 b/prep_flexpart/prep_releases_reg.f90 index 1b2f182..87b7b4e 100644 --- a/prep_flexpart/prep_releases_reg.f90 +++ b/prep_flexpart/prep_releases_reg.f90 @@ -130,7 +130,7 @@ subroutine prep_releases_reg(settings, jd, nr) if ( settings%FPversion.eq.10 ) then inquire(file=trim(settings%path_flexpart)//'options/SPECIES/spec_overview',exist=lexist) if ( .not.lexist ) then - write(*,*) 'ERROR: cannot fine file /options/SPECIES/spec_overview' + write(*,*) 'ERROR: cannot find file '//trim(settings%path_flexpart)//'options/SPECIES/spec_overview' stop endif open(100,file=trim(settings%path_flexpart)//'options/SPECIES/spec_overview',status='old',action='read',iostat=ierr) @@ -147,29 +147,32 @@ subroutine prep_releases_reg(settings, jd, nr) inquire(file=trim(settings%path_flexpart)//'options/SPECIES/SPECIES_'//to_upper(trim(settings%species)),& exist=lexist) if ( .not.lexist ) then - write(*,*) 'ERROR: cannot find file /options/SPECIES/SPECIES_'//to_upper(trim(settings%species)) + write(*,*) 'ERROR: cannot find file '& + //trim(settings%path_flexpart)//'options/SPECIES/SPECIES_'//to_upper(trim(settings%species)) stop endif write(aspec,fmt='(I3.3)') spec call system('cp '//trim(settings%path_flexpart)//'options/SPECIES/SPECIES_'//to_upper(trim(settings%species))//& ' '//trim(settings%path_flexpart)//'options/SPECIES/SPECIES_'//aspec) write(aspec,fmt='(I3.3)') spec - ! read SPECIES file for reagents info - allocate(preactions(nreagent)) - allocate(pcconst(nreagent)) - allocate(pdconst(nreagent)) - allocate(pnconst(nreagent)) - open(100,file=trim(settings%path_flexpart)//'options/SPECIES/SPECIES_'//to_upper(trim(settings%species)),& - action='read',iostat=ierr) - read(100,species_params,iostat=ierr) - if ( ierr.ne.0 ) then - write(*,*) 'ERROR: reading SPECIES_'//to_upper(trim(settings%species)) - stop - endif - write(*,*) 'Chemical reactions: ',preactions - if (any(preactions.ne."")) then - ! write reagents file - call prep_reagents(settings,preactions,nr,jd) + if (nreagent.gt.0) then + ! read SPECIES file for reagents info + allocate(preactions(nreagent)) + allocate(pcconst(nreagent)) + allocate(pdconst(nreagent)) + allocate(pnconst(nreagent)) + open(100,file=trim(settings%path_flexpart)//'options/SPECIES/SPECIES_'//to_upper(trim(settings%species)),& + action='read',iostat=ierr) + read(100,species_params,iostat=ierr) + if ( ierr.ne.0 ) then + write(*,*) 'ERROR: reading SPECIES_'//to_upper(trim(settings%species)) + stop + endif + write(*,*) 'Chemical reactions: ',preactions + if (any(preactions.ne."")) then + ! write reagents file + call prep_reagents(settings,preactions,nr,jd) + endif endif endif -- GitLab