diff --git a/prep_flexpart/main.f90 b/prep_flexpart/main.f90 index 475d20ace5a31e592c58f81f485185b8709a9d7d..f48a0c267f52b512a5af8b500d0df4a1978d5844 100644 --- a/prep_flexpart/main.f90 +++ b/prep_flexpart/main.f90 @@ -127,7 +127,13 @@ program main call prep_outgrid(settings, jd, nr) ! write AGECLASS - call prep_ageclass(settings, jd, nr) + if ( settings%lFPversion.eq.0 ) then + write(*,*) 'Preparing ageclass for FP10', settings%lFPversion + call prep_ageclass_FP10(settings, jd, nr) + else + write(*,*) 'Preparing ageclass for FP11', settings%lFPversion + call prep_ageclass(settings, jd, nr) + endif ! read and process observations if ( settings%obsformat.eq.'obspack' ) then diff --git a/prep_flexpart/makefile b/prep_flexpart/makefile index cabcc3ca5da1f447b65f3b655f9b17ae145d10fb..a3a0e4bc6acaa7f2114e9c55ffb63d998cd8a744 100644 --- a/prep_flexpart/makefile +++ b/prep_flexpart/makefile @@ -1,45 +1,52 @@ -F90 = gfortran -LIBPATH = /usr/lib/ -INCPATH = /usr/include/ -LNK = -o -CMPL = -c -LIBS = -lnetcdf -lnetcdff -llapack -#FFLAGS = -O2 -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -ffree-form -FFLAGS = -O0 -g -m64 -fbounds-check -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -ffree-form \ - -fbacktrace -LDFLAGS = $(FFLAGS) -L$(LIBPATH) -I$(INCPATH) $(LIBS) +F90 = /apps/sw/ubuntu22.04/gcc-11.4.0/gcc-13.2.0-tkesyophy2o6rjlzknndu3b4oyasvuqm/bin/gfortran +LIBPATH1 = /apps/sw/ubuntu22.04/gcc-13.2.0/netcdf-fortran-4.6.1-ubcs4l6pjwpgoeyvz32wpzyzykib6bwm/lib/ +INCPATH1 = /apps/sw/ubuntu22.04/gcc-13.2.0/netcdf-fortran-4.6.1-ubcs4l6pjwpgoeyvz32wpzyzykib6bwm/include/ + +# OPTIMIZATION LEVEL +O_LEV = 0 # [0,1,2,3,g,s,fast] + +LIBS = -lm -DUSE_NCF -lnetcdff + +FFLAGS = -I$(INCPATH1) -O$(O_LEV) -g -cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) -DUSE_NCF -lnetcdff -fbacktrace -Warray-bounds -fcheck=all # -march=native + +LDFLAGS = $(FFLAGS) -L$(LIBPATH1) -Wl,-rpath,$(LIBPATH1) $(LIBS) MAIN = prep_flexpart -SRCS = mod_var.f90 \ - mod_settings.f90 \ - mod_dates.f90 \ - mod_tools.f90 \ - mod_obs.f90 \ - mod_strings.f90 \ - read_reclist.f90 \ - list_obsfiles.f90 \ - prep_pathnames.f90 \ - prep_command.f90 \ - prep_outgrid.f90 \ - prep_ageclass.f90 \ - prep_releases.f90 \ - prep_releases_reg.f90 \ - process_obs.f90 \ - read_obspack.f90 \ - read_wdcgg.f90 \ - read_noaa.f90 \ - read_icos.f90 \ - read_basic.f90 \ - main.f90 - - -OBJECTS = $(SRCS:.f90=.o) -$(MAIN): $(OBJECTS) $(MODULES) - $(F90) $(LNK) $(MAIN) $(OBJECTS) $(LIBS) +MODULES = mod_var.o \ + mod_settings.o \ + mod_dates.o \ + mod_tools.o \ + mod_obs.o \ + mod_strings.o + +OBJECTS = read_reclist.o \ + list_obsfiles.o \ + prep_pathnames.o \ + prep_command.o \ + prep_outgrid.o \ + prep_ageclass.o \ + prep_ageclass_FP10.o \ + prep_releases.o \ + prep_releases_reg.o \ + process_obs.o \ + read_obspack.o \ + read_wdcgg.o \ + read_noaa.o \ + read_icos.o \ + read_basic.o \ + main.o + +%.o: %.mod + +$(MAIN): $(MODULES) $(OBJECTS) + +$(F90) -o $@ $(MODULES) $(OBJECTS) $(LDFLAGS) + %.o : %.f90 - $(F90) $(LDFLAGS) $(CMPL) $< -o $@ + +$(F90) -c $(FFLAGS) $< clean: - rm -f $(OBJECTS) $(MODULES) + rm -f *.o *.mod + +.SUFFIXES = $(SUFFIXES) .f90 diff --git a/prep_flexpart/mod_settings.f90 b/prep_flexpart/mod_settings.f90 index 5b740c57ed8dbfbe40f1ae5d69f87f17b51134ba..beb460e9079a4b3da1817a279ce225a8533a3d00 100644 --- a/prep_flexpart/mod_settings.f90 +++ b/prep_flexpart/mod_settings.f90 @@ -49,6 +49,7 @@ module mod_settings character(len=max_name_len) :: obsformat character(len=max_name_len) :: suffix + integer :: lFPversion integer :: lselect integer :: lrelease real :: relfreq @@ -350,6 +351,9 @@ module mod_settings if ( match ) settings%windfield = cc ! General settings + identifier = "lFPversion:" + call read_content (line, identifier, cc, cn, cl, match) + if ( match ) settings%lFPversion = int(cn) identifier = "lselect:" call read_content (line, identifier, cc, cn, cl, match) if ( match ) settings%lselect = int(cn) diff --git a/prep_flexpart/prep_ageclass.f90 b/prep_flexpart/prep_ageclass.f90 index 6bd7f22285a43324a1bba4a532b5a81e2a5865ae..fbeac579048cdb7da874f9201c7d0c27deef156f 100644 --- a/prep_flexpart/prep_ageclass.f90 +++ b/prep_flexpart/prep_ageclass.f90 @@ -52,9 +52,14 @@ subroutine prep_ageclass(settings, jd, nr) integer :: ierr integer :: nageclass, lage + + ! FP 11 + namelist /nage/ & + nageclass namelist /ageclass/ & - nageclass, & - lage + lage + + ! preset namelist variables nageclass = 1 @@ -67,7 +72,8 @@ subroutine prep_ageclass(settings, jd, nr) open(100,file=trim(filename),status='replace',action='write',iostat=ierr) if( settings%lnamelist.eq.1 ) then - ! use namelist file format + ! use namelist file format, FP11 + write(100,nml=nage) write(100,nml=ageclass) else ! use old file format diff --git a/prep_flexpart/prep_command.f90 b/prep_flexpart/prep_command.f90 index 21cdd08260fc0ea11f17e5da22c8d15958a793e6..9a310e988fec1e08bfdda807033f19c3cf2c396a 100644 --- a/prep_flexpart/prep_command.f90 +++ b/prep_flexpart/prep_command.f90 @@ -57,11 +57,12 @@ subroutine prep_command(settings, jd, nr) integer :: ldirect ! runtime mode (currently only backwards: ldirect = -1) integer :: ibdate, ibtime integer :: iedate, ietime - integer :: partsplit +! integer :: partsplit integer :: loutstep integer :: loutaver integer :: loutsample - integer :: itsplit ! time constant for particle splitting (secs) + integer :: loutrestart +! integer :: itsplit ! time constant for particle splitting (secs) integer :: lsynctime ! synchronisation interval of flexpart (secs) real :: ctl ! factor by which time step must be smaller than tl integer :: ifine ! factor by which to decrease time step for vertical motion @@ -69,12 +70,19 @@ subroutine prep_command(settings, jd, nr) integer :: ipout ! particle dump (0 = never, 1 = every output interval, 2 = only at end) integer :: lsubgrid ! use subgrid terrain effect parameterization (0 = no, 1 = yes) integer :: lconvection ! use convection (0 = no, 1 = yes) + integer :: lturbulence ! FP11 + integer :: lturbulence_meso ! FP11 + integer :: nxshift ! FP11 + integer :: maxthreadgrid ! FP11 + integer :: maxfilesize ! FP11 + integer :: logvertinterp ! FP11 + integer :: bcscheme ! FP11 integer :: lagespectra ! calculate age spectra (0 = no, 1 = yes) integer :: ipin ! continue simulation with dumped particle data (0 = no, 1 = yes) integer :: ioutputforeachrelease ! create output file for each release location (0 = no, 1 = yes) integer :: mdomainfill ! domain filling option (0 = no, 1 = yes) integer :: mquasilag ! quasilagrangian mode to track particles (0 = no, 1 = yes) - integer :: surf_only ! save only surface layer in grid_time files = 1, full resolution = 0 + integer :: sfc_only ! save only surface layer in grid_time files = 1, full resolution = 0 integer :: lnetcdfout ! netcdf output (0 = no, 1 = yes) integer :: cblflag ! integer :: linversionout ! one grid_time file per release = 1, or per timestep (original format) = 0 @@ -92,7 +100,7 @@ subroutine prep_command(settings, jd, nr) loutstep, & loutaver, & loutsample, & - itsplit, & +! itsplit, & lsynctime, & ctl, & ifine, & @@ -100,6 +108,14 @@ subroutine prep_command(settings, jd, nr) ipout, & lsubgrid, & lconvection, & + lturbulence, & + lturbulence_meso, & + nxshift, & + maxthreadgrid, & + maxfilesize, & + logvertinterp, & + bcscheme, & + loutrestart, & lagespectra, & ipin, & ioutputforeachrelease, & @@ -111,7 +127,7 @@ subroutine prep_command(settings, jd, nr) nested_output, & linit_cond, & lnetcdfout, & - surf_only, & + sfc_only, & cblflag, & linversionout, & ohfields_path @@ -144,14 +160,23 @@ subroutine prep_command(settings, jd, nr) loutstep = settings%outrate loutaver = settings%outaverage loutsample = settings%outsample - itsplit = 999999999 +! itsplit = 999999999 lsynctime = lsync ctl = -5 ifine = 4 iout = 1 - ipout = 2 + ipout = 0 lsubgrid = 1 lconvection = 1 + lturbulence = 1 + lturbulence_meso = 0 + lnetcdfout = 0 + nxshift = 1 + maxthreadgrid = 1 + maxfilesize = 10000 + logvertinterp = 0 + bcscheme = 1 + loutrestart = -1 lagespectra = 1 ipin = 0 ioutputforeachrelease = 1 @@ -162,8 +187,7 @@ subroutine prep_command(settings, jd, nr) mquasilag = 0 nested_output = settings%lnested linit_cond = settings%linit_cond - lnetcdfout = 0 - surf_only = 1 + sfc_only = 1 cblflag = 0 linversionout = 1 ohfields_path = trim(settings%path_ohfield) @@ -189,7 +213,7 @@ subroutine prep_command(settings, jd, nr) write(100,fmt='(I5)') settings%outrate write(100,fmt='(I5)') settings%outaverage write(100,fmt='(I5)') settings%outsample - write(100,fmt='(I9)') itsplit +! write(100,fmt='(I9)') itsplit write(100,fmt='(I3,3X,A14)') lsynctime,'SYNC' write(100,fmt='(F5.2,1X,A10)') ctl,'CTL' write(100,fmt='(I3,3X,A14)') ifine,'IFINE' @@ -207,7 +231,7 @@ subroutine prep_command(settings, jd, nr) write(100,fmt='(I1,5X,A14)') mquasilag,'MQUASILAG' write(100,fmt='(I1,5X,A14)') settings%lnested,'NESTED_OUTPUT' write(100,fmt='(I1,5X,A14)') settings%linit_cond,'LINIT_COND' - write(100,fmt='(I1,5X,A14)') surf_only,'SURF_ONLY' + write(100,fmt='(I1,5X,A14)') sfc_only,'SURF_ONLY' write(100,fmt='(I1,5X,A14)') linversionout,'LINVERSIONOUT' endif diff --git a/prep_flexpart/prep_releases.f90 b/prep_flexpart/prep_releases.f90 index 350ee58408fe9a65d78e1d71ac53c5af643de7c5..a015180e86254e14287ed46808a39712e38da6f5 100644 --- a/prep_flexpart/prep_releases.f90 +++ b/prep_flexpart/prep_releases.f90 @@ -94,9 +94,11 @@ subroutine prep_releases(settings, jd, nr, nobs, obs) nchar = len_trim(settings%species) do while ( ierr.eq.0 ) read (100, fmt='(A)', iostat=ierr) line - if ( line(len_trim(line)-nchar+1:len_trim(line)) == trim(settings%species) ) ierr = 1 +! sec - reads the last char if ( line(len_trim(line)-nchar+1:len_trim(line)) == trim(settings%species) ) ierr = 1 + if ( line(5:5+nchar-1) == trim(settings%species) ) ierr = 1 end do - read(line(9:11),*) spec +! sec - read(line(9:11),*) spec + read(line(1:3),*) spec write(aspec,fmt='(I3.3)') spec ! preset namelist variables releases_ctrl diff --git a/prep_flexpart/read_basic.f90 b/prep_flexpart/read_basic.f90 index fc0c5a217a9bcfb41791ce0a6489f8c2b1dacd63..9f29efa2fbf7a80e92aa532a66bd696f6f724816 100644 --- a/prep_flexpart/read_basic.f90 +++ b/prep_flexpart/read_basic.f90 @@ -181,7 +181,7 @@ subroutine read_basic(settings, jd, nr, nobs, obs) if ( nobs.eq.0 ) go to 20 ! write formatted obs to file - file_out = trim(settings%path_obsout)//trim(recname(nr))//'_'//trim(settings%species)//'.txt' + file_out = trim(settings%path_obsout)//trim(recname(nr))//'_'//trim(settings%species)//'.gob' inquire(file=trim(file_out),exist=lexist) if( lexist ) then ! append to existing diff --git a/prep_regions/makefile b/prep_regions/makefile index eec17b9bd3c83cf85956beb6b473cc29cb8b553d..d9e772a5c3f397aa318cb1f2e44e33d6356873e1 100644 --- a/prep_regions/makefile +++ b/prep_regions/makefile @@ -1,37 +1,44 @@ -F90 = gfortran -LIBPATH = /usr/lib/ -INCPATH = /usr/include/ -LNK = -o -CMPL = -c -LIBS = -lnetcdf -lnetcdff -llapack -#FFLAGS = -O2 -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -ffree-form -FFLAGS = -O0 -g -m64 -fbounds-check -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -ffree-form \ - -fbacktrace -LDFLAGS = $(FFLAGS) -L$(LIBPATH) -I$(INCPATH) $(LIBS) +F90 = /apps/sw/ubuntu22.04/gcc-11.4.0/gcc-13.2.0-tkesyophy2o6rjlzknndu3b4oyasvuqm/bin/gfortran +LIBPATH1 = /apps/sw/ubuntu22.04/gcc-13.2.0/netcdf-fortran-4.6.1-ubcs4l6pjwpgoeyvz32wpzyzykib6bwm/lib/ +INCPATH1 = /apps/sw/ubuntu22.04/gcc-13.2.0/netcdf-fortran-4.6.1-ubcs4l6pjwpgoeyvz32wpzyzykib6bwm/include/ + +# OPTIMIZATION LEVEL +O_LEV = 0 # [0,1,2,3,g,s,fast] + +LIBS = -lm -DUSE_NCF -lnetcdff + +FFLAGS = -I$(INCPATH1) -O$(O_LEV) -g -cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) -DUSE_NCF -lnetcdff -fbacktrace -Warray-bounds -fcheck=all # -march=native + +LDFLAGS = $(FFLAGS) -L$(LIBPATH1) -Wl,-rpath,$(LIBPATH1) $(LIBS) MAIN = prep_regions -SRCS = mod_var.f90 \ - mod_settings.f90 \ - mod_strings.f90 \ - mod_dates.f90 \ - mod_ncdf.f90 \ - mod_flexpart.f90 \ - sort.f90 \ - read_reclist.f90 \ - initialize.f90 \ - read_lsm.f90 \ - read_obs.f90 \ - get_surfinf.f90 \ - map_grid.f90 \ - prep_regions.f90 - -OBJECTS = $(SRCS:.f90=.o) -$(MAIN): $(OBJECTS) $(MODULES) - $(F90) $(LNK) $(MAIN) $(OBJECTS) $(LIBS) +MODULES = mod_var.o \ + mod_settings.o \ + mod_strings.o \ + mod_dates.o \ + mod_ncdf.o \ + mod_flexpart.o + +OBJECTS = sort.o \ + read_reclist.o \ + initialize.o \ + read_lsm.o \ + read_obs.o \ + get_surfinf.o \ + map_grid.o \ + prep_regions.o + +%.o: %.mod + +$(MAIN): $(MODULES) $(OBJECTS) + +$(F90) -o $@ $(MODULES) $(OBJECTS) $(LDFLAGS) + %.o : %.f90 - $(F90) $(LDFLAGS) $(CMPL) $< -o $@ + +$(F90) -c $(FFLAGS) $< clean: - rm -f $(OBJECTS) $(MODULES) + rm -f *.o *.mod + +.SUFFIXES = $(SUFFIXES) .f90 diff --git a/prep_regions/prep_regions.f90 b/prep_regions/prep_regions.f90 index ad66a6db95d5bb90d1e5b885e5f00636d3a979f1..1aa8d19baaf8ec0ed01232ac3757c0f168429491 100644 --- a/prep_regions/prep_regions.f90 +++ b/prep_regions/prep_regions.f90 @@ -130,6 +130,15 @@ program prep_regions varname = 'regions' call write_ncdf(files, filename, varname, nbox_xy) + ! write the average fooptrint for all receptors + open(50,file=trim(files%path_output)//'all_footprint_average.txt') + do ix=1,nxregrid + do jy=1,nyregrid + write(50,*) reg_lon(ix), reg_lat(jy), surfinf(ix,jy) + end do + end do + close(50) + ! write lsm allocate( mask(nxregrid,nyregrid), stat=ierr) mask=lsm diff --git a/source/calc_conc.f90 b/source/calc_conc.f90 index d08fdd0891315ee1338b1e8fdb78b01653e44903..c3e1a0f67356291f089140b305a536ae6975883a 100644 --- a/source/calc_conc.f90 +++ b/source/calc_conc.f90 @@ -76,8 +76,8 @@ subroutine calc_conc(config, fluxes, obs, ngrid, gtime, hnest, hbkg, iobs, ix1, flxbg = fluxes%flxnee(:,:,ind) + & fluxes%flxff(:,:,ind) + & fluxes%flxocn(:,:,ind) - else if ( trim(config%spec).eq.'ghg' ) then - ! GHG species + else if (( trim(config%spec).eq.'ghg' ) .or. ( trim(config%spec).eq.'bca' )) then + ! GHG or BC aerosol species flxbg = fluxes%flx(:,:,ind) endif diff --git a/source/error_cov.f90 b/source/error_cov.f90 index 7d9105d4c7357d99611fee4f0d68e6db2b683826..2ab3dc6b59642318dd3ad438c79e20268fc84f59 100644 --- a/source/error_cov.f90 +++ b/source/error_cov.f90 @@ -192,7 +192,7 @@ subroutine error_cov(config, files, states, covar, corr, xerr) call alloc_covar(covar) ! eigenvalues in ascending order -! covar%evals = evals(ind:ndvar) + ! covar%evals = evals(ind:ndvar) covar%evals = evals(1:neig) ! calculated eigenvectors in columns 1:neig covar%evecs = evecs(:,1:neig) diff --git a/source/init_ghg.f90 b/source/init_ghg.f90 index 63cb9257430f187ae448f95687a24ffed6f485e3..15ab15915b5461ce63ee690aad8850160ad65585 100644 --- a/source/init_ghg.f90 +++ b/source/init_ghg.f90 @@ -481,7 +481,7 @@ subroutine init_ghg(files, config, fluxes, obs, states, covar) ! initial concentrations from termination of trajectories ! only do for a fresh run - if ( config%restart.eq.0 ) then + if ( ( config%restart.eq.0 ).and.( config%spec.ne.'bca') ) then if ( files%init_type.lt.5 ) then ! daily or higher frequency call init_cini(files, config, obs) diff --git a/source/main.f90 b/source/main.f90 index 232cca8e1cbe22cc47b07c2b8f7483421d9e49d7..d5e99710bb04a63a2d073046a1a2c72b3c246838 100644 --- a/source/main.f90 +++ b/source/main.f90 @@ -89,7 +89,7 @@ program main if ( config%spec.eq.'co2' ) then call init_co2(files, config, fluxes, obs, states, covar) - else if (config%spec.eq.'ghg') then + else if ((config%spec.eq.'ghg').or.(config%spec.eq.'bca')) then call init_ghg(files, config, fluxes, obs, states, covar) else write(logid,*) 'ERROR: spec must be one of co2 or ghg' diff --git a/source/makefile b/source/makefile index 9e9e29fe8e762d223dcc280ed33190f8910c0150..4f2c631185349124d609c532fc833bb0b473e394 100644 --- a/source/makefile +++ b/source/makefile @@ -1,63 +1,68 @@ -F90 = gfortran -LIBPATH = /usr/lib/ -INCPATH = /usr/include/ -LNK = -o -CMPL = -c -LIBS = -lnetcdf -lnetcdff -llapack -#FFLAGS = -O2 -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -ffree-form -ffree-line-length-0 -FFLAGS = -O0 -g -m64 -fbounds-check -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -ffree-form \ - -fbacktrace -ffree-line-length-0 -fcheck=all -Wall -LDFLAGS = $(FFLAGS) -L$(LIBPATH) -I$(INCPATH) $(LIBS) +F90 = /apps/sw/ubuntu22.04/gcc-11.4.0/gcc-13.2.0-tkesyophy2o6rjlzknndu3b4oyasvuqm/bin/gfortran +LIBPATH1 = /apps/sw/ubuntu22.04/gcc-13.2.0/netcdf-fortran-4.6.1-ubcs4l6pjwpgoeyvz32wpzyzykib6bwm/lib/ +INCPATH1 = /apps/sw/ubuntu22.04/gcc-13.2.0/netcdf-fortran-4.6.1-ubcs4l6pjwpgoeyvz32wpzyzykib6bwm/include/ + +# OPTIMIZATION LEVEL +O_LEV = 0 # [0,1,2,3,g,s,fast] + +LIBS = -llapack -lm -DUSE_NCF -lnetcdff + +FFLAGS = -I$(INCPATH1) -O$(O_LEV) -g -cpp -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -fmessage-length=0 -flto=jobserver -O$(O_LEV) -DUSE_NCF -lnetcdff -fbacktrace -Warray-bounds -fcheck=all -ffree-form -ffree-line-length-0 # -march=native + +LDFLAGS = $(FFLAGS) -L$(LIBPATH1) -Wl,-rpath,$(LIBPATH1) $(LIBS) MAIN = main -SRCS = mod_var.f90 \ - mod_settings.f90 \ - mod_dates.f90 \ - mod_strings.f90 \ - mod_tools.f90 \ - mod_fluxes.f90 \ - mod_obs.f90 \ - mod_states.f90 \ - mod_covar.f90 \ - mod_save.f90 \ - mod_flexpart.f90 \ - mod_transform.f90 \ - mod_perturb.f90 \ - read_reclist.f90 \ - read_ncdf.f90 \ - read_obs.f90 \ - read_bg.f90 \ - initialize.f90 \ - correl.f90 \ - error_cov.f90 \ - read_lsm.f90 \ - read_orog.f90 \ - mod_regions.f90 \ - interpz.f90 \ - convertgrid.f90 \ - get_initconc.f90 \ - init_cini.f90 \ - init_cini_month.f90 \ - init_co2.f90 \ - init_ghg.f90 \ - calc_conc.f90 \ - simulate.f90 \ - average_fp.f90 \ - congrad.f90 \ - mod_analytic.f90 \ - mod_m1qn3.f90 \ - m1qn3_interface.f90 \ - retrieval.f90 \ - main.f90 - -OBJECTS = $(SRCS:.f90=.o) -$(MAIN): $(OBJECTS) $(MODULES) - $(F90) $(LNK) $(MAIN) $(OBJECTS) $(LIBS) +MODULES = mod_var.o \ + mod_settings.o \ + mod_dates.o \ + mod_strings.o \ + mod_tools.o \ + mod_fluxes.o \ + mod_obs.o \ + mod_states.o \ + mod_covar.o \ + mod_save.o \ + mod_flexpart.o \ + mod_transform.o \ + mod_regions.o \ + mod_analytic.o \ + mod_m1qn3.o \ + mod_perturb.o + +OBJECTS = read_reclist.o \ + read_ncdf.o \ + read_obs.o \ + read_bg.o \ + initialize.o \ + correl.o \ + error_cov.o \ + read_lsm.o \ + read_orog.o \ + interpz.o \ + convertgrid.o \ + get_initconc.o \ + init_cini.o \ + init_cini_month.o \ + init_co2.o \ + init_ghg.o \ + calc_conc.o \ + simulate.o \ + average_fp.o \ + congrad.o \ + m1qn3_interface.o \ + retrieval.o \ + main.o + +%.o: %.mod + +$(MAIN): $(MODULES) $(OBJECTS) + +$(F90) -o $@ $(MODULES) $(OBJECTS) $(LDFLAGS) + %.o : %.f90 - $(F90) $(LDFLAGS) $(CMPL) $< -o $@ + +$(F90) -c $(FFLAGS) $< clean: - rm -f $(OBJECTS) $(MODULES) - + rm -f *.o *.mod +.SUFFIXES = $(SUFFIXES) .f90 diff --git a/source/mod_settings.f90 b/source/mod_settings.f90 index 7f847fda697d382e65ada0505ed9369175c4c222..4b54e1c36acd98bb19e52a3bfcef9577bab6446b 100644 --- a/source/mod_settings.f90 +++ b/source/mod_settings.f90 @@ -117,7 +117,7 @@ module mod_settings integer :: datei ! start date (yyyymmdd) integer :: datef ! end date (yyyymmdd) logical :: average_fp ! average footprints to match observation (true or false) - character(len=3) :: spec ! species ('co2' or 'ghg') + character(len=3) :: spec ! species ('co2', 'bca' or 'ghg') character(len=max_name_len) :: method ! inversion method ('analytic' or 'congrad' or 'm1qn3') logical :: lognormal ! use log-normal distribution in state space real :: trunc ! truncation factor for eigenvalues of B diff --git a/source/read_obs.f90 b/source/read_obs.f90 index a2377047c6733c91442c50dca8b2eb94b9484792..d987322ac3b4ebb4029352e7f9ba6d6e4f760232 100755 --- a/source/read_obs.f90 +++ b/source/read_obs.f90 @@ -258,9 +258,9 @@ subroutine read_obs(config, files) hl = hl - 24 endif if ( alt.le.1000. ) then - if ( (hl.lt.11).or.(hl.gt.15) ) cycle read_loop +! if ( (hl.lt.11).or.(hl.gt.15) ) cycle read_loop else - if ( (hl.gt.3).and.(hl.lt.23) ) cycle read_loop +! if ( (hl.gt.3).and.(hl.lt.23) ) cycle read_loop endif if ( conc.le.-999. ) cycle read_loop measerr = max(config%measerr, err) diff --git a/source/simulate.f90 b/source/simulate.f90 index be349b70e19038d4053dc0beb37ce830a7ba8068..999c53244f8aca7b04b6e5318d482c88c5a837f5 100644 --- a/source/simulate.f90 +++ b/source/simulate.f90 @@ -151,7 +151,7 @@ subroutine simulate(iter, files, config, fluxes, obs, states, grad_o, cost_o) else lsatellite = .false. endif - print*, 'simulate: lsatellite = ',lsatellite +! print*, 'simulate: lsatellite = ',lsatellite ! read correction factor for dry dir (ratio rho_wet/rho_dry) if ( month.ne.prevmonth ) then @@ -173,12 +173,14 @@ subroutine simulate(iter, files, config, fluxes, obs, states, grad_o, cost_o) ftime(n) = juldate(int(dates(n)/1d6),int(dates(n)-floor(dates(n)/1d6)*1d6)) end do factor(:,:,:) = 1. - filefactor = trim(path_flexrec)//'factor_drygrid' - inquire ( file=trim(filefactor),exist=lexist ) - if ( lexist ) then - write(logid,*) 'Reading correction factor :'//trim(filefactor) - call read_factor(filefactor, nread, nxgrid, nygrid, nxshift, factor) - endif + if ( config%spec.ne.'bca' ) then + filefactor = trim(path_flexrec)//'factor_drygrid' + inquire ( file=trim(filefactor),exist=lexist ) + if ( lexist ) then + write(logid,*) 'Reading correction factor :'//trim(filefactor) + call read_factor(filefactor, nread, nxgrid, nygrid, nxshift, factor) + endif + endif endif ! read flexpart footprints @@ -238,7 +240,13 @@ subroutine simulate(iter, files, config, fluxes, obs, states, grad_o, cost_o) ! convert s.m3/kg to s.m2/kg grid = grid/outheight(1) ! convert from equivalent ppt to observation units (e.g. ppmv) - grid = grid*config%coeff*mmair/config%molarmass + ! sec not do it for bca + if ( config%spec.eq.'bca' ) then + grid = grid*config%coeff + else + grid = grid*config%coeff*mmair/config%molarmass + endif + ! apply numerical scaling grid = grid/numscale ! if ( lsatellite ) then @@ -254,11 +262,13 @@ subroutine simulate(iter, files, config, fluxes, obs, states, grad_o, cost_o) if ( allocated(factor_nest) ) deallocate(factor_nest) allocate ( factor_nest(nnxgrid,nnygrid,nread) ) factor(:,:,:) = 1. - filefactor = trim(path_flexrec)//'factor_drygrid_nest' - inquire ( file=trim(filefactor),exist=lexist ) - if ( lexist ) then - write(logid,*) 'Reading correction factor for nest :'//trim(filefactor) - call read_factor(filefactor, nread, nnxgrid, nnygrid, nnxshift, factor_nest) + if ( config%spec.ne.'bca' ) then + filefactor = trim(path_flexrec)//'factor_drygrid_nest' + inquire ( file=trim(filefactor),exist=lexist ) + if ( lexist ) then + write(logid,*) 'Reading correction factor for nest :'//trim(filefactor) + call read_factor(filefactor, nread, nnxgrid, nnygrid, nnxshift, factor_nest) + endif endif endif if ( lsatellite ) then @@ -306,7 +316,13 @@ subroutine simulate(iter, files, config, fluxes, obs, states, grad_o, cost_o) ! convert s.m3/kg to s.m2/kg gridnest = gridnest/outheight(1) ! convert from equivalent ppt to observation units (e.g. ppmv) - gridnest = gridnest*config%coeff*mmair/config%molarmass + ! sec not do it for bca + if ( config%spec.eq.'bca' ) then + gridnest = gridnest*config%coeff + else + gridnest = gridnest*config%coeff*mmair/config%molarmass + endif + ! apply numerical scaling gridnest = gridnest/numscale ! if ( lsatellite ) then