Commit 8a65cb08 authored by Espen Sollum ATMOS's avatar Espen Sollum ATMOS
Browse files

Added code, makefile for dev branch

parent 60403cdf
...@@ -43,13 +43,21 @@ program flexpart ...@@ -43,13 +43,21 @@ program flexpart
use par_mod use par_mod
use com_mod use com_mod
use conv_mod use conv_mod
use netcdf_output_mod, only: writeheader_netcdf
use random_mod, only: gasdev1
implicit none implicit none
integer :: i,j,ix,jy,inest integer :: i,j,ix,jy,inest
integer :: idummy = -320 integer :: idummy = -320
character(len=256) :: inline_options !pathfile, flexversion, arg2 character(len=256) :: inline_options !pathfile, flexversion, arg2
integer :: index_v
! Initialize arrays in com_mod
!*****************************
call com_mod_allocate(maxpart)
! Generate a large number of random numbers ! Generate a large number of random numbers
!****************************************** !******************************************
...@@ -60,30 +68,27 @@ program flexpart ...@@ -60,30 +68,27 @@ program flexpart
call gasdev1(idummy,rannumb(maxrand),rannumb(maxrand-1)) call gasdev1(idummy,rannumb(maxrand),rannumb(maxrand-1))
! FLEXPART version string ! FLEXPART version string
! flexversion='Version 9.2 beta (2014-07-01)' flexversion='Version 10.0pre (2015-03-01)'
!flexversion='Version 9.2.0.1 (2015-01-27)' verbosity=0
flexversion='Version 9.2.0.2 (2015-03-01)'
! default inlide options
inline_options='none'
!verbosity flags defined in com_mod.f90
! Read the pathnames where input/output files are stored ! Read the pathnames where input/output files are stored
!******************************************************* !*******************************************************
inline_options='none'
select case (iargc()) select case (iargc())
case (2) !2 parameters: pathfile and inline options case (2)
call getarg(1,arg1) call getarg(1,arg1)
pathfile=arg1 pathfile=arg1
call getarg(2,arg2) call getarg(2,arg2)
inline_options=arg2 inline_options=arg2
case (1) !1 parameter pathfiel or inline options case (1)
call getarg(1,arg1) call getarg(1,arg1)
pathfile=arg1 pathfile=arg1
if (arg1(1:1).eq.'-') then if (arg1(1:1).eq.'-') then
write(pathfile,'(a11)') './pathnames' write(pathfile,'(a11)') './pathnames'
inline_options=arg1 inline_options=arg1
endif endif
case (0) !default behavior case (0)
write(pathfile,'(a11)') './pathnames' write(pathfile,'(a11)') './pathnames'
end select end select
...@@ -91,112 +96,68 @@ program flexpart ...@@ -91,112 +96,68 @@ program flexpart
!******************************************************* !*******************************************************
print*,'Welcome to FLEXPART ', trim(flexversion) print*,'Welcome to FLEXPART ', trim(flexversion)
print*,'FLEXPART is free software released under the GNU General Public License.' print*,'FLEXPART is free software released under the GNU General Public License.'
! inline options allow to fine tune the verbosity during run time
! e.g.: show compilation parameters or input variables, time execution
if (inline_options(1:1).eq.'-') then
! if (index(inline_options,'v').gt.0) then
! print*, 'verbose mode'
! verbosity=1
! index_v=index(inline_options,'v')
! if (inline_options(index_v+1:index_v+1).eq.'2') then
! verbosity=2
! endif
! endif
!if (trim(inline_options).eq.'-v'.or.trim(inline_options).eq.'-v1') then if (inline_options(1:1).eq.'-') then
if (index(inline_options,'v').gt.0) then if (trim(inline_options).eq.'-v'.or.trim(inline_options).eq.'-v1') then
index_v=index(inline_options,'v') print*, 'Verbose mode 1: display detailed information during run'
print*, 'Verbose mode: display additional information during run'
verbosity=1 verbosity=1
if (inline_options(index_v+1:index_v+1).eq.'2') then endif
if (trim(inline_options).eq.'-v2') then
print*, 'Verbose mode 2: display more detailed information during run'
verbosity=2 verbosity=2
endif
print*, 'verbosity level=', verbosity !inline_options(index_v+1:index_v+1)
endif endif
!iif (trim(inline_options).eq.'-v2') then if (trim(inline_options).eq.'-i') then
! print*, 'Verbose mode 2: display more detailed information during run' print*, 'Info mode: provide detailed run specific information and stop'
! verbosity=2
!endif
if (index(inline_options,'i').gt.0) then
index_v=index(inline_options,'i')
print*, 'Info mode: provide compile and run specific information, then stop'
verbosity=1 verbosity=1
info_flag=1 info_flag=1
if (inline_options(index_v+1:index_v+1).eq.'2') then
info_flag=2
endif
endif endif
if (index(inline_options,'t').gt.0) then if (trim(inline_options).eq.'-i2') then
time_flag=1 print*, 'Info mode: provide more detailed run specific information and stop'
print*, 'timing execution activated' verbosity=2
!stop info_flag=1
endif endif
if (index(inline_options,'d').gt.0) then
debug_flag=1
print*, 'debug messages activated'
print*, 'debug_flag=', debug_flag
!these messages give additional info on top on verbose mode
endif
endif endif
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*, 'FLEXPART>******************************'
print*, 'FLEXPART>* verbosity level:', verbosity
print*, 'FLEXPART>* info only: ', info_flag
print*, 'FLEXPART>* time execution: ', time_flag
print*, 'FLEXPART>******************************'
print*, 'FLEXPART> parameters from par_mod'
print*, 'FLEXPART> nxmax= ', nxmax
print*, 'FLEXPART> nymax= ', nymax
print*, 'FLEXPART> nuvzmax=', nuvzmax
print*, 'FLEXPART> nwzmax= ', nwzmax
print*, 'FLEXPART> nzmax= ', nzmax
print*, 'FLEXPART> nxshift=', nxshift
print*, 'FLEXPART> maxpart=', maxpart
print*, 'FLEXPART> maxspec=', maxspec
if (info_flag.eq.1) stop
write(*,*) 'call readpaths' write(*,*) 'call readpaths'
endif endif
call readpaths(pathfile) call readpaths(pathfile)
!if (time_flag.gt.1) then !show clock info if (verbosity.gt.1) then !show clock info
!print*,'length(4)',length(4)
!count=0,count_rate=1000 !count=0,count_rate=1000
CALL SYSTEM_CLOCK(count_clock0, count_rate, count_max) CALL SYSTEM_CLOCK(count_clock0, count_rate, count_max)
!WRITE(*,*) 'SYSTEM_CLOCK',count, count_rate, count_max !WRITE(*,*) 'SYSTEM_CLOCK',count, count_rate, count_max
!WRITE(*,*) 'SYSTEM_CLOCK, count_clock0', count_clock0 !WRITE(*,*) 'SYSTEM_CLOCK, count_clock0', count_clock0
!WRITE(*,*) 'SYSTEM_CLOCK, count_rate', count_rate !WRITE(*,*) 'SYSTEM_CLOCK, count_rate', count_rate
!WRITE(*,*) 'SYSTEM_CLOCK, count_max', count_max !WRITE(*,*) 'SYSTEM_CLOCK, count_max', count_max
!endif endif
! Read the user specifications for the current model run ! Read the user specifications for the current model run
!******************************************************* !*******************************************************
if (verbosity.gt.0) then if (verbosity.gt.0) then
write(*,*) 'FLEXPART> call readcommand' write(*,*) 'call readcommand'
endif endif
call readcommand call readcommand
if (verbosity.gt.0) then if (verbosity.gt.0) then
write(*,*) ' ldirect =', ldirect write(*,*) ' ldirect=', ldirect
write(*,*) ' ibdate,ibtime=', ibdate,ibtime write(*,*) ' ibdate,ibtime=',ibdate,ibtime
write(*,*) ' iedate,ietime=', iedate,ietime write(*,*) ' iedate,ietime=', iedate,ietime
endif if (verbosity.gt.1) then
if (time_flag.gt.0) then
CALL SYSTEM_CLOCK(count_clock, count_rate, count_max) CALL SYSTEM_CLOCK(count_clock, count_rate, count_max)
write(*,*) 'SYSTEM_CLOCK',(count_clock - count_clock0)/real(count_rate) !, count_rate, count_max write(*,*) 'SYSTEM_CLOCK',(count_clock - count_clock0)/real(count_rate) !, count_rate, count_max
endif endif
endif
! Read the age classes to be used ! Read the age classes to be used
!******************************** !********************************
if (verbosity.gt.0) then if (verbosity.gt.0) then
write(*,*) 'FLEXPART> call readageclasses' write(*,*) 'call readageclasses'
endif endif
call readageclasses call readageclasses
if (time_flag.gt.1) then if (verbosity.gt.1) then
CALL SYSTEM_CLOCK(count_clock, count_rate, count_max) CALL SYSTEM_CLOCK(count_clock, count_rate, count_max)
write(*,*) 'SYSTEM_CLOCK',(count_clock - count_clock0)/real(count_rate) !, count_rate, count_max write(*,*) 'SYSTEM_CLOCK',(count_clock - count_clock0)/real(count_rate) !, count_rate, count_max
endif endif
...@@ -205,7 +166,7 @@ program flexpart ...@@ -205,7 +166,7 @@ program flexpart
!****************************************************************** !******************************************************************
if (verbosity.gt.0) then if (verbosity.gt.0) then
write(*,*) 'FLEXPART> call readavailable' write(*,*) 'call readavailable'
endif endif
call readavailable call readavailable
...@@ -214,17 +175,18 @@ program flexpart ...@@ -214,17 +175,18 @@ program flexpart
!********************************************** !**********************************************
if (verbosity.gt.0) then if (verbosity.gt.0) then
write(*,*) 'FLEXPART> call gridcheck' write(*,*) 'call gridcheck'
endif endif
call gridcheck call gridcheck
if (time_flag.gt.0) then if (verbosity.gt.1) then
CALL SYSTEM_CLOCK(count_clock, count_rate, count_max) CALL SYSTEM_CLOCK(count_clock, count_rate, count_max)
write(*,*) 'SYSTEM_CLOCK',(count_clock - count_clock0)/real(count_rate) !, count_rate, count_max write(*,*) 'SYSTEM_CLOCK',(count_clock - count_clock0)/real(count_rate) !, count_rate, count_max
endif endif
if (verbosity.gt.0) then if (verbosity.gt.0) then
write(*,*) 'FLEXPART> call gridcheck_nests' write(*,*) 'call gridcheck_nests'
endif endif
call gridcheck_nests call gridcheck_nests
...@@ -232,7 +194,7 @@ program flexpart ...@@ -232,7 +194,7 @@ program flexpart
!************************************ !************************************
if (verbosity.gt.0) then if (verbosity.gt.0) then
write(*,*) 'FLEXPART> call readoutgrid' write(*,*) 'call readoutgrid'
endif endif
call readoutgrid call readoutgrid
...@@ -240,7 +202,7 @@ program flexpart ...@@ -240,7 +202,7 @@ program flexpart
if (nested_output.eq.1) then if (nested_output.eq.1) then
call readoutgrid_nest call readoutgrid_nest
if (verbosity.gt.0) then if (verbosity.gt.0) then
write(*,*) 'FLEXPART> readoutgrid_nest' write(*,*) '# readoutgrid_nest'
endif endif
endif endif
...@@ -248,7 +210,7 @@ program flexpart ...@@ -248,7 +210,7 @@ program flexpart
!***************************************************************************** !*****************************************************************************
if (verbosity.eq.1) then if (verbosity.eq.1) then
print*,'FLEXPART> call readreceptors' print*,'call readreceptors'
endif endif
call readreceptors call readreceptors
...@@ -262,7 +224,7 @@ program flexpart ...@@ -262,7 +224,7 @@ program flexpart
!*************************** !***************************
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> call readlanduse' print*,'call readlanduse'
endif endif
call readlanduse call readlanduse
...@@ -270,7 +232,7 @@ program flexpart ...@@ -270,7 +232,7 @@ program flexpart
!******************************************************************** !********************************************************************
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> call assignland' print*,'call assignland'
endif endif
call assignland call assignland
...@@ -278,7 +240,7 @@ program flexpart ...@@ -278,7 +240,7 @@ program flexpart
!********************************************** !**********************************************
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> call readreleases' print*,'call readreleases'
endif endif
call readreleases call readreleases
...@@ -286,7 +248,7 @@ program flexpart ...@@ -286,7 +248,7 @@ program flexpart
!**************************************************************** !****************************************************************
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> call readdepo' print*,'call readdepo'
endif endif
call readdepo call readdepo
...@@ -295,14 +257,14 @@ program flexpart ...@@ -295,14 +257,14 @@ program flexpart
call coordtrafo call coordtrafo
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> call coordtrafo' print*,'call coordtrafo'
endif endif
! Initialize all particles to non-existent ! Initialize all particles to non-existent
!***************************************** !*****************************************
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> Initialize all particles to non-existent' print*,'Initialize all particles to non-existent'
endif endif
do j=1,maxpart do j=1,maxpart
itra1(j)=-999999999 itra1(j)=-999999999
...@@ -313,12 +275,12 @@ program flexpart ...@@ -313,12 +275,12 @@ program flexpart
if (ipin.eq.1) then if (ipin.eq.1) then
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> call readpartpositions' print*,'call readpartpositions'
endif endif
call readpartpositions call readpartpositions
else else
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> set numpart=0, numparticlecount=0' print*,'numpart=0, numparticlecount=0'
endif endif
numpart=0 numpart=0
numparticlecount=0 numparticlecount=0
...@@ -329,7 +291,7 @@ program flexpart ...@@ -329,7 +291,7 @@ program flexpart
!*************************************************************** !***************************************************************
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> call outgrid_init' print*,'call outgrid_init'
endif endif
call outgrid_init call outgrid_init
if (nested_output.eq.1) call outgrid_init_nest if (nested_output.eq.1) call outgrid_init_nest
...@@ -339,21 +301,40 @@ program flexpart ...@@ -339,21 +301,40 @@ program flexpart
if (OHREA.eqv..TRUE.) then if (OHREA.eqv..TRUE.) then
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> call readOHfield' print*,'call readOHfield'
endif endif
call readOHfield call readOHfield
endif endif
!! testing !!
! open(999,file=trim(path(1))//'OH_FIELDS/jscalar_50N.txt',action='write',status='new')
! open(998,file=trim(path(1))//'OH_FIELDS/jscalar_50S.txt',action='write',status='new')
! Write basic information on the simulation to a file "header" ! Write basic information on the simulation to a file "header"
! and open files that are to be kept open throughout the simulation ! and open files that are to be kept open throughout the simulation
!****************************************************************** !******************************************************************
if (lnetcdfout.eq.1) then
call writeheader_netcdf(lnest=.false.)
else
call writeheader
end if
if (nested_output.eq.1) then
if (lnetcdfout.eq.1) then
call writeheader_netcdf(lnest=.true.)
else
call writeheader_nest
endif
endif
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> call variuos writeheader routines' print*,'call writeheader'
endif endif
call writeheader call writeheader
! write header in ASCII format ! FLEXPART 9.2 ticket ?? write header in ASCII format
call writeheader_txt call writeheader_txt
!if (nested_output.eq.1) call writeheader_nest !if (nested_output.eq.1) call writeheader_nest
if (nested_output.eq.1.and.surf_only.ne.1) call writeheader_nest if (nested_output.eq.1.and.surf_only.ne.1) call writeheader_nest
...@@ -363,7 +344,7 @@ program flexpart ...@@ -363,7 +344,7 @@ program flexpart
!open(unitdates,file=path(2)(1:length(2))//'dates') !open(unitdates,file=path(2)(1:length(2))//'dates')
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> call openreceptors' print*,'call openreceptors'
endif endif
call openreceptors call openreceptors
if ((iout.eq.4).or.(iout.eq.5)) call openouttraj if ((iout.eq.4).or.(iout.eq.5)) call openouttraj
...@@ -372,7 +353,7 @@ program flexpart ...@@ -372,7 +353,7 @@ program flexpart
!*************************************************************************** !***************************************************************************
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> discretize release times' print*,'discretize release times'
endif endif
do i=1,numpoint do i=1,numpoint
ireleasestart(i)=nint(real(ireleasestart(i))/real(lsynctime))*lsynctime ireleasestart(i)=nint(real(ireleasestart(i))/real(lsynctime))*lsynctime
...@@ -383,7 +364,7 @@ program flexpart ...@@ -383,7 +364,7 @@ program flexpart
!************************************************************ !************************************************************
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> Initialize cloud-base mass fluxes for the convection scheme' print*,'Initialize cloud-base mass fluxes for the convection scheme'
endif endif
do jy=0,nymin1 do jy=0,nymin1
...@@ -402,20 +383,27 @@ program flexpart ...@@ -402,20 +383,27 @@ program flexpart
! Calculate particle trajectories ! Calculate particle trajectories
!******************************** !********************************
if (time_flag.gt.0) then
CALL SYSTEM_CLOCK(count_clock, count_rate, count_max)
write(*,*) 'SYSTEM_CLOCK',(count_clock - count_clock0)/real(count_rate) !, count_rate, count_max
endif
if (info_flag.eq.2) then
print*, 'FLEXPART> info only mode (stop before call timemanager)'
stop
endif
if (verbosity.gt.0) then if (verbosity.gt.0) then
print*,'FLEXPART> call timemanager' if (verbosity.gt.1) then
CALL SYSTEM_CLOCK(count_clock, count_rate, count_max)
write(*,*) 'SYSTEM_CLOCK',(count_clock - count_clock0)/real(count_rate) !, count_rate, count_max
endif
if (info_flag.eq.1) then
print*, 'info only mode (stop)'
stop
endif
print*,'call timemanager'
endif endif
call timemanager call timemanager
write(*,*) 'CONGRATULATIONS: YOU HAVE SUCCESSFULLY COMPLETED A FLEXPART MODEL RUN!' ! NIK 16.02.2005
write(*,*) '**********************************************'
write(*,*) 'Total number of occurences of below-cloud scavenging', tot_blc_count
write(*,*) 'Total number of occurences of in-cloud scavenging', tot_inc_count
write(*,*) '**********************************************'
write(*,*) 'CONGRATULATIONS: YOU HAVE SUCCESSFULLY COMPLETED A FLE&
&XPART MODEL RUN!'
end program flexpart end program flexpart
!**********************************************************************
! Copyright 1998,1999,2000,2001,2002,2005,2007,2008,2009,2010 *
! Andreas Stohl, Petra Seibert, A. Frank, Gerhard Wotawa, *
! Caroline Forster, Sabine Eckhardt, John Burkhart, Harald Sodemann *
! *
! This file is part of FLEXPART. *
! *
! FLEXPART is free software: you can redistribute it and/or modify *
! it under the terms of the GNU General Public License as published by*
! the Free Software Foundation, either version 3 of the License, or *
! (at your option) any later version. *
! *
! FLEXPART is distributed in the hope that it will be useful, *
! but WITHOUT ANY WARRANTY; without even the implied warranty of *
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
! GNU General Public License for more details. *
! *
! You should have received a copy of the GNU General Public License *
! along with FLEXPART. If not, see <http://www.gnu.org/licenses/>. *
!**********************************************************************
program flexpart