Changeset 3526 for trunk/LMDZ.COMMON/libf/evolution/NS_fast_subs_univ.F90
- Timestamp:
- Nov 19, 2024, 5:54:18 PM (2 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.COMMON/libf/evolution/NS_fast_subs_univ.F90
r3493 r3526 55 55 !*********************************************************************** 56 56 use allinterfaces, except_this_one => depths_avmeth 57 use math_mod, only: deriv2_simple, deriv1_onesided, deriv1, colint 57 58 implicit none 58 59 integer, intent(IN) :: nz, typeT … … 118 119 call deriv1(z,nz,eta(:),1.d0,eta(nz-1),ap) 119 120 if (typeP>0 .and. typeP<nz-2) then 120 ap_one=deriv1_onesided(typeP,z,nz,eta(:))121 call deriv1_onesided(typeP,z,nz,eta(:),ap_one) 121 122 ! print *,typeP,ap(typeP),ap_one 122 123 ap(typeP)=ap_one … … 151 152 endif 152 153 if (typeG>0 .and. typeT<0) then 153 c umfillabove = colint(porefill(:)/eta(:),z,nz,typeG-1,nz)154 call colint(porefill(:)/eta(:),z,nz,typeG-1,nz,cumfillabove) 154 155 newtypeG = -9 155 156 do i=typeG,nz 156 157 if (minval(eta(i:nz))<=0.) cycle ! eta=0 means completely full 157 c umfill=colint(porefill(:)/eta(:),z,nz,i,nz)158 call colint(porefill(:)/eta(:),z,nz,i,nz,cumfill) 158 159 if (cumfill<yp(i)*18./8314.*B) then ! usually executes on i=typeG 159 160 if (i>typeG) then … … 194 195 195 196 196 pure subroutine icechanges_poreonly(nz,z,typeF,typeG,avdrhoP,ypp,B,porefill)197 use allinterfaces, except_this_one => icechanges_poreonly198 implicit none199 integer, intent(IN) :: nz, typeF, typeG200 real(8), intent(IN) :: z(nz), ypp(nz), avdrhoP, B201 real(8), intent(INOUT) :: porefill(nz)202 integer j, erase, newtypeP, ub203 real(8) integ204 205 !----retreat206 ! avdrhoP>0 is outward loss from zdepthP207 ! avdrhoP<0 means gain at zdepthP or no ice anywhere208 if (avdrhoP>0.) then209 erase=0210 do j=1,nz211 if (typeF>0 .and. j>=typeF) exit ! don't retreat beyond typeF212 integ = colint(porefill(1:nz)*z(1:nz),z(1:nz),nz,1,j)213 erase = j214 if (integ>B*avdrhoP*18./8314.) exit215 end do216 if (erase>0) porefill(1:erase)=0.217 endif218 219 ! new depth220 newtypeP = -9221 do j=1,nz222 if (porefill(j)>0.) then223 newtypeP = j ! first point with ice224 exit225 endif226 enddo227 228 !----diffusive filling229 ub = typeF230 if (newtypeP>0 .and. typeF>0 .and. newtypeP<ub) ub=newtypeP231 if (ub>0) then232 do j=ub,nz233 ! B=Diff/(porosity*icedensity)*86400*365.24*bigstep234 porefill(j) = porefill(j) + B*ypp(j)235 if (porefill(j)<0.) porefill(j)=0.236 if (porefill(j)>1.) porefill(j)=1.237 enddo238 end if239 240 !----enact bottom boundary241 if (typeG>0) porefill(typeG:nz)=0.242 243 end subroutine icechanges_poreonly244 245 246 247 197 pure subroutine icechanges(nz,z,typeF,avdrho,avdrhoP,ypp, & 248 198 & Diff,porosity,icefrac,bigstep,zdepthT,porefill,typeG) … … 254 204 use miscparameters, only : icedensity 255 205 use allinterfaces, except_this_one => icechanges 206 use math_mod, only: colint 256 207 implicit none 257 208 integer, intent(IN) :: nz, typeF, typeG … … 293 244 if (typeF>0 .and. j>=typeF) exit ! don't retreat beyond typeF 294 245 if (zdepthT>=0. .and. z(j)>zdepthT) exit 295 integ = colint(porefill(1:nz)*z(1:nz),z(1:nz),nz,1,j)246 call colint(porefill(1:nz)*z(1:nz),z(1:nz),nz,1,j,integ) 296 247 erase = j 297 248 if (integ>B*avdrhoP*18./8314.) exit … … 332 283 end if 333 284 end subroutine icechanges 334 335 336 subroutine assignthermalproperties(nz,thIn,rhoc, &337 & ti,rhocv,typeT,icefrac,porosity,porefill)338 !*********************************************************339 ! assign thermal properties of soil340 !*********************************************************341 implicit none342 integer, intent(IN) :: nz343 integer, intent(IN), optional :: typeT344 real(8), intent(IN), optional :: icefrac345 real(8), intent(IN) :: thIn, rhoc346 real(8), intent(IN), optional :: porosity, porefill(nz)347 real(8), intent(OUT) :: ti(nz), rhocv(nz)348 integer j349 real(8) newrhoc, newti, fill350 real(8), parameter :: NULL=0.351 352 ti(1:nz) = thIn353 rhocv(1:nz) = rhoc354 if (typeT>0) then355 call soilthprop(porosity,NULL,rhoc,thIn,2,newrhoc,newti,icefrac)356 rhocv(typeT:nz) = newrhoc357 ti(typeT:nz) = newti358 endif359 do j=1,nz360 fill = porefill(j) ! off by half point361 if (fill>0. .and. (typeT<0 .or. (typeT>0 .and. j<typeT))) then362 call soilthprop(porosity,fill,rhoc,thIn,1,rhocv(j),ti(j),NULL)363 endif364 enddo365 end subroutine assignthermalproperties366 367 368 369 subroutine compactoutput(unit,porefill,nz)370 implicit none371 integer, intent(IN) :: unit,nz372 real(8), intent(IN) :: porefill(nz)373 integer j374 do j=1,nz375 if (porefill(j)==0.) then376 write(unit,'(1x,f2.0)',advance='no') porefill(j)377 else378 write(unit,'(1x,f7.5)',advance='no') porefill(j)379 endif380 enddo381 write(unit,"('')")382 end subroutine compactoutput383
Note: See TracChangeset
for help on using the changeset viewer.