Changeset 8a65cb0 in flexpart.git for src/outgrid_init_nest.f90
- Timestamp:
- Mar 2, 2015, 3:11:55 PM (9 years ago)
- Branches:
- master, 10.4.1_pesei, GFS_025, bugfixes+enhancements, dev, release-10, release-10.4.1, scaling-bug, univie
- Children:
- 1d207bb
- Parents:
- 60403cd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/outgrid_init_nest.f90
re200b7a r8a65cb0 22 22 subroutine outgrid_init_nest 23 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 24 !***************************************************************************** 25 ! * 26 ! This routine calculates, for each grid cell of the output nest, the * 27 ! volume and the surface area. * 28 ! * 29 ! Author: A. Stohl * 30 ! * 31 ! 30 August 2004 * 32 ! * 33 !***************************************************************************** 34 ! * 35 ! Variables: * 36 ! * 37 ! arean surface area of all output nest cells * 38 ! volumen volumes of all output nest cells * 39 ! * 40 !***************************************************************************** 41 41 42 42 use unc_mod … … 55 55 56 56 57 57 ! gridunc,griduncn uncertainty of outputted concentrations 58 58 allocate(griduncn(0:numxgridn-1,0:numygridn-1,numzgrid,maxspec, & 59 59 maxpointspec_act,nclassunc,maxageclass),stat=stat) … … 61 61 62 62 if (ldirect.gt.0) then 63 allocate(wetgriduncn(0:numxgridn-1,0:numygridn-1,maxspec, &64 maxpointspec_act,nclassunc,maxageclass),stat=stat)65 if (stat.ne.0) write(*,*)'ERROR:could not allocate nested gridunc'66 allocate(drygriduncn(0:numxgridn-1,0:numygridn-1,maxspec, &67 maxpointspec_act,nclassunc,maxageclass),stat=stat)68 if (stat.ne.0) write(*,*)'ERROR:could not allocate nested gridunc'63 allocate(wetgriduncn(0:numxgridn-1,0:numygridn-1,maxspec, & 64 maxpointspec_act,nclassunc,maxageclass),stat=stat) 65 if (stat.ne.0) write(*,*)'ERROR:could not allocate nested gridunc' 66 allocate(drygriduncn(0:numxgridn-1,0:numygridn-1,maxspec, & 67 maxpointspec_act,nclassunc,maxageclass),stat=stat) 68 if (stat.ne.0) write(*,*)'ERROR:could not allocate nested gridunc' 69 69 endif 70 70 71 ! Compute surface area and volume of each grid cell: area, volume; 72 ! and the areas of the northward and eastward facing walls: areaeast, areanorth 73 !*********************************************************************** 71 ! Extra field for totals at MPI root process 72 if (lroot.and.mpi_mode.gt.0) then 73 ! allocate(griduncn0(0:numxgridn-1,0:numygridn-1,numzgrid,maxspec, & 74 ! maxpointspec_act,nclassunc,maxageclass),stat=stat) 75 ! if (stat.ne.0) write(*,*)'ERROR:could not allocate nested gridunc' 76 77 if (ldirect.gt.0) then 78 allocate(wetgriduncn0(0:numxgridn-1,0:numygridn-1,maxspec, & 79 maxpointspec_act,nclassunc,maxageclass),stat=stat) 80 if (stat.ne.0) write(*,*)'ERROR:could not allocate nested gridunc' 81 allocate(drygriduncn0(0:numxgridn-1,0:numygridn-1,maxspec, & 82 maxpointspec_act,nclassunc,maxageclass),stat=stat) 83 if (stat.ne.0) write(*,*)'ERROR:could not allocate nested gridunc' 84 endif 85 ! allocate a dummy to avoid compilator complaints 86 else if (.not.lroot.and.mpi_mode.gt.0) then 87 allocate(wetgriduncn0(1,1,1,1,1,1),stat=stat) 88 allocate(drygriduncn0(1,1,1,1,1,1),stat=stat) 89 end if 90 91 ! Compute surface area and volume of each grid cell: area, volume; 92 ! and the areas of the northward and eastward facing walls: areaeast, areanorth 93 !*********************************************************************** 74 94 75 95 do jy=0,numygridn-1 … … 81 101 else 82 102 83 84 85 103 ! Calculate area of grid cell with formula M=2*pi*R*h*dx/360, 104 ! see Netz, Formeln der Mathematik, 5. Auflage (1983), p.90 105 !************************************************************ 86 106 87 107 cosfactp=cos(ylatp*pi180) … … 100 120 101 121 102 103 122 ! Surface are of a grid cell at a latitude ylat 123 !********************************************** 104 124 105 125 gridarea=2.*pi*r_earth*hzone*dxoutn/360. … … 108 128 arean(ix,jy)=gridarea 109 129 110 111 130 ! Volume = area x box height 131 !*************************** 112 132 113 133 volumen(ix,jy,1)=arean(ix,jy)*outheight(1) … … 119 139 120 140 121 122 123 124 125 126 141 !************************************************************************** 142 ! Determine average height of model topography in nesteed output grid cells 143 !************************************************************************** 144 145 ! Loop over all output grid cells 146 !******************************** 127 147 128 148 do jjy=0,numygridn-1 … … 130 150 oroh=0. 131 151 132 133 152 ! Take 100 samples of the topography in every grid cell 153 !****************************************************** 134 154 135 155 do j1=1,10 … … 140 160 xl=(xlon-xlon0)/dx 141 161 142 143 162 ! Determine the nest we are in 163 !***************************** 144 164 145 165 ngrid=0 … … 153 173 43 continue 154 174 155 156 175 ! Determine (nested) grid coordinates and auxiliary parameters used for interpolation 176 !***************************************************************************** 157 177 158 178 if (ngrid.gt.0) then … … 192 212 end do 193 213 194 195 214 ! Divide by the number of samples taken 215 !************************************** 196 216 197 217 orooutn(iix,jjy)=oroh/100. … … 201 221 202 222 203 204 205 223 !******************************* 224 ! Initialization of output grids 225 !******************************* 206 226 207 227 do kp=1,maxpointspec_act 208 do ks=1,nspec 209 do nage=1,nageclass 210 do jy=0,numygridn-1 211 do ix=0,numxgridn-1 212 do l=1,nclassunc 213 ! Deposition fields 214 if (ldirect.gt.0) then 215 wetgriduncn(ix,jy,ks,kp,l,nage)=0. 216 drygriduncn(ix,jy,ks,kp,l,nage)=0. 217 endif 218 ! Concentration fields 219 do kz=1,numzgrid 220 griduncn(ix,jy,kz,ks,kp,l,nage)=0. 228 do ks=1,nspec 229 do nage=1,nageclass 230 do jy=0,numygridn-1 231 do ix=0,numxgridn-1 232 do l=1,nclassunc 233 ! Deposition fields 234 if (ldirect.gt.0) then 235 wetgriduncn(ix,jy,ks,kp,l,nage)=0. 236 drygriduncn(ix,jy,ks,kp,l,nage)=0. 237 endif 238 ! Concentration fields 239 do kz=1,numzgrid 240 griduncn(ix,jy,kz,ks,kp,l,nage)=0. 241 end do 221 242 end do 222 243 end do … … 225 246 end do 226 247 end do 227 end do228 248 229 249
Note: See TracChangeset
for help on using the changeset viewer.