Changeset d7935de in flexpart.git for src/readoutgrid_nest.f90
- Timestamp:
- Sep 11, 2018, 6:06:31 PM (6 years ago)
- Branches:
- univie
- Children:
- 93786a1
- Parents:
- 34f1452
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/readoutgrid_nest.f90
r8a65cb0 rd7935de 29 29 ! * 30 30 ! 4 June 1996 * 31 ! HSO, 1 July 2014: Add optional namelist input * 32 ! PS, 6/2015-9/2018: read regular input with free format * 33 ! and rename some variables * 31 34 ! * 32 35 !***************************************************************************** … … 53 56 real,parameter :: eps=1.e-4 54 57 55 integer :: readerror58 integer :: ios 56 59 57 ! declare namelist 58 namelist /outgridn/ & 59 outlon0n,outlat0n, & 60 numxgridn,numygridn, & 61 dxoutn,dyoutn 60 ! declare namelist 61 namelist /nml_outgridn/ & 62 outlon0n,outlat0n,numxgridn,numygridn,dxoutn,dyoutn 62 63 63 64 ! helps identifying failed namelist input … … 67 68 !********************************************************** 68 69 69 open(unitoutgrid,file=path(1)(1:length(1))//'OUTGRID_NEST',form='formatted',status='old',err=999) 70 open(unitoutgrid,file=path(1)(1:length(1))//'OUTGRID_NEST',form='formatted',& 71 status='old',err=999) 70 72 71 73 ! try namelist input 72 read(unitoutgrid, outgridn,iostat=readerror)74 read(unitoutgrid,nml_outgridn,iostat=ios) 73 75 close(unitoutgrid) 74 76 75 if ( (dxoutn.le.0).or.(readerror.ne.0)) then77 if (dxoutn.le.0 .or.ios.ne.0) then 76 78 77 open(unitoutgrid,file=path(1)(1:length(1))//'OUTGRID_NEST',status='old',err=999) 79 open(unitoutgrid,file=path(1)(1:length(1))//'OUTGRID_NEST',status='old',& 80 err=999) 78 81 call skplin(5,unitoutgrid) 79 82 80 ! 1.Read horizontal grid specifications81 !****************************************83 ! Read horizontal grid specifications 84 ! *********************************** 82 85 83 86 call skplin(3,unitoutgrid) 84 read(unitoutgrid, '(4x,f11.4)') outlon0n87 read(unitoutgrid,*) outlon0n 85 88 call skplin(3,unitoutgrid) 86 read(unitoutgrid, '(4x,f11.4)') outlat0n89 read(unitoutgrid,*) outlat0n 87 90 call skplin(3,unitoutgrid) 88 read(unitoutgrid, '(4x,i5)') numxgridn91 read(unitoutgrid,*) numxgridn 89 92 call skplin(3,unitoutgrid) 90 read(unitoutgrid, '(4x,i5)') numygridn93 read(unitoutgrid,*) numygridn 91 94 call skplin(3,unitoutgrid) 92 read(unitoutgrid, '(4x,f12.5)') dxoutn95 read(unitoutgrid,*) dxoutn 93 96 call skplin(3,unitoutgrid) 94 read(unitoutgrid, '(4x,f12.5)') dyoutn97 read(unitoutgrid,*) dyoutn 95 98 96 99 close(unitoutgrid) … … 99 102 ! write outgrid_nest file in namelist format to output directory if requested 100 103 if (nmlout.and.lroot) then 101 open(unitoutgrid,file=path(2)(1:length(2))//'OUTGRID_NEST.namelist',err=1000) 102 write(unitoutgrid,nml=outgridn) 104 open(unitoutgrid,file=path(2)(1:length(2))//'OUTGRID_NEST.namelist',& 105 err=1000) 106 write(unitoutgrid,nml=nml_outgridn) 103 107 close(unitoutgrid) 104 108 endif 105 109 106 allocate(orooutn(0:numxgridn-1,0:numygridn-1),stat= stat)107 if ( stat.ne.0) write(*,*)'ERROR: could not allocate orooutn'108 allocate(arean(0:numxgridn-1,0:numygridn-1),stat= stat)109 if ( stat.ne.0) write(*,*)'ERROR: could not allocate arean'110 allocate(volumen(0:numxgridn-1,0:numygridn-1,numzgrid),stat= stat)111 if ( stat.ne.0) write(*,*)'ERROR: could not allocate volumen'110 allocate(orooutn(0:numxgridn-1,0:numygridn-1),stat=ios) 111 if (ios.ne.0) write(*,*)'ERROR: could not allocate orooutn' 112 allocate(arean(0:numxgridn-1,0:numygridn-1),stat=ios) 113 if (ios.ne.0) write(*,*)'ERROR: could not allocate arean' 114 allocate(volumen(0:numxgridn-1,0:numygridn-1,numzgrid),stat=ios) 115 if (ios.ne.0) write(*,*)'ERROR: could not allocate volumen' 112 116 113 117 ! Check validity of output grid (shall be within model domain) … … 118 122 xr1=xlon0+real(nxmin1)*dx 119 123 yr1=ylat0+real(nymin1)*dy 120 if ( (outlon0n+eps.lt.xlon0).or.(outlat0n+eps.lt.ylat0)&121 .or.(xr.gt.xr1+eps).or.(yr.gt.yr1+eps)) then124 if (outlon0n+eps.lt.xlon0 .or. outlat0n+eps.lt.ylat0 & 125 .or. xr.gt.xr1+eps .or. yr.gt.yr1+eps) then 122 126 write(*,*) ' #### FLEXPART MODEL ERROR! PART OF OUTPUT ####' 123 127 write(*,*) ' #### NEST IS OUTSIDE MODEL DOMAIN. CHANGE ####' 124 128 write(*,*) ' #### FILE OUTGRID IN DIRECTORY ####' 125 write(*,'(a)') path(1)(1:length(1))129 write(*,'(a)') trim(path(1)) 126 130 stop 127 131 endif … … 133 137 999 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "OUTGRID" #### ' 134 138 write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY #### ' 135 write(*,'(a)') path(1)(1:length(1))139 write(*,'(a)') trim(path(1)) 136 140 stop 137 141 138 142 1000 write(*,*) ' #### FLEXPART MODEL ERROR! FILE "OUTGRID" #### ' 139 143 write(*,*) ' #### CANNOT BE OPENED IN THE DIRECTORY #### ' 140 write(*,'(a)') path(2)(1:length(2))144 write(*,'(a)') trim(path(2)) 141 145 stop 142 146
Note: See TracChangeset
for help on using the changeset viewer.