- Timestamp:
- Sep 25, 2024, 4:43:31 PM (3 months ago)
- Location:
- trunk/LMDZ.PLUTO
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.PLUTO/libf/dynphy_lonlat/phypluto/newstart.F
r3390 r3438 1454 1454 & (lonfi(ig)*180./pi.ge.val4) .and. 1455 1455 & (lonfi(ig)*180./pi.lt.val5) .and. 1456 & (qsurf(ig,igcm_n2). lt.val7)) then1456 & (qsurf(ig,igcm_n2).gt.val7)) then 1457 1457 qsurf(ig,igcm_co_ice)=qsurf(ig,igcm_co_ice)*val3 1458 1458 qsurf(ig,igcm_co_ice)=qsurf(ig,igcm_co_ice)+val6 -
trunk/LMDZ.PLUTO/libf/phypluto/condense_n2.F90
r3421 r3438 171 171 172 172 ! calculate global mean surface pressure for the fast mode 173 IF (.not. ALLOCATED(kp)) ALLOCATE(kp(klon)) 174 DO ig=1,klon 175 kp(ig) = exp(-phisfi(ig)/(r*38.)) 176 ENDDO 173 177 IF (fast) THEN 174 IF (.not. ALLOCATED(kp)) ALLOCATE(kp(klon))175 DO ig=1,klon176 kp(ig) = exp(-phisfi(ig)/(r*38.))177 ENDDO178 178 p00=glob_average2d(kp) ! mean pres at ref level 179 179 ENDIF … … 382 382 pdpsrf(ig) = -pdicen2(ig)*g 383 383 ! pdpsrf(ig) = 0. ! OPTION to check impact N2 sub/cond 384 IF ( zplev(ig)+pdpsrf(ig)*subtimestep.le.0.0000001) then384 IF (fast.and.(zplev(ig)+pdpsrf(ig)*subtimestep.le.0.0000001)) then 385 385 pdpsrf(ig)=(0.0000001*kp(ig)/p00-zplev(ig))/subtimestep 386 386 pdicen2(ig)=-pdpsrf(ig)/g … … 855 855 Mtot = masse(m) 856 856 MQtot = masse(m)*q(m) 857 !if (m.lt.klev) then ! because some compilers will have problems858 !! evaluating masse(klev+1)857 if (m.lt.klev) then ! because some compilers will have problems 858 ! evaluating masse(klev+1) 859 859 do while ((m.lt.klev).and.(w(l+1).gt.(Mtot+masse(m+1)))) 860 860 m=m+1 861 861 Mtot = Mtot + masse(m) 862 862 MQtot = MQtot + masse(m)*q(m) 863 !if (m.eq.klev) exit863 if (m.eq.klev) exit 864 864 end do 865 !endif865 endif 866 866 if (m.lt.klev) then 867 867 sigw=(w(l+1)-Mtot)/masse(m+1) -
trunk/LMDZ.PLUTO/util/zrecast_plut.F90
r3353 r3438 40 40 ! 'phisinit.nc') 41 41 ! EM 02/2007 : Changed behavior for "altitude above surface" case 42 ! (for MCD RMS computation). Number of levels is then set as 42 ! (for MCD RMS computation). Number of levels is then set as 43 43 ! number of levels in initial file, 44 44 ! and the new set of above surface levels follow a more elaborate … … 99 99 real,dimension(:,:),allocatable :: phisinit ! Ground geopotential 100 100 real,dimension(:,:,:),allocatable :: ps ! GCM surface pressure 101 real,dimension(:,:,:,:),allocatable :: press ! GCM atmospheric pressure 101 real,dimension(:,:,:,:),allocatable :: press ! GCM atmospheric pressure 102 102 real,dimension(:,:,:,:),allocatable :: temp ! GCM atmospheric temperature 103 103 real,dimension(:,:,:,:),allocatable :: rho ! GCM atmospheric density … … 195 195 if (tmpndims.eq.4) then 196 196 nbvar=nbvar+1 197 var(nbvar)=tmpvarname 197 var(nbvar)=tmpvarname 198 198 else 199 199 write(*,*) 'Error: ',trim(tmpvarname),' is not a 4D variable' … … 490 490 endif 491 491 ! look for 'phisinit' in current file 492 ierr=NF_INQ_VARID(infid,"phisinit",tmpvarid) 492 ierr=NF_INQ_VARID(infid,"phisinit",tmpvarid) 493 493 if (ierr.ne.NF_NOERR) then 494 494 write(*,*) "Warning: Failed to get phisinit ID from file ",trim(infile) … … 598 598 if (nblev.eq.1) then ! in case only one level is asked for 599 599 zareoid(nblev)=zamin 600 else 600 else 601 601 do i=1,nblev 602 602 zareoid(i)=zamin+(real(i)-1.0)*((zamax-zamin)/(real(nblev)-1.0)) … … 625 625 if (nblev.eq.1) then ! in case only one level is asked for 626 626 zradius(nblev)=zamin 627 else 627 else 628 628 do i=1,nblev 629 629 zradius(i)=zamin+(real(i)-1.0)*((zamax-zamin)/(real(nblev)-1.0)) … … 977 977 ! 3.3.1 Define 1D variables 978 978 979 ! longitude 979 ! longitude 980 980 datashape(1)=lon_dimid 981 981 ierr=NF_DEF_VAR(outfid,"longitude",NF_REAL,1,datashape(1),lon_varid) … … 1156 1156 stop "Error: Problem writing long_name for Time" 1157 1157 endif 1158 text='days since 0000-01-1 00:00:00' 1158 !text='days since 0000-01-1 00:00:00' 1159 text='days since 00000' 1159 1160 ierr=NF_PUT_ATT_TEXT(outfid,time_varid,'units',len_trim(text),text) 1160 1161 if (ierr.ne.NF_NOERR) then … … 1259 1260 write(*,*) 'Error, could not define variable ',trim(var(i)) 1260 1261 write(*,*) NF_STRERROR(ierr) 1261 stop 1262 stop 1262 1263 endif 1263 1264 … … 1320 1321 endif 1321 1322 endif 1322 1323 1323 1324 ! look for a "units" attribute 1324 1325 text=' ' … … 1334 1335 endif 1335 1336 endif 1336 1337 1337 1338 ! look for a "missing_value" attribute 1338 1339 ierr=NF_GET_ATT_REAL(infid,tmpvarid,"missing_value",miss_val) … … 1343 1344 miss_val=miss_val_def 1344 1345 endif 1345 1346 1346 1347 ! write the missing_value attribute to output 1347 1348 ierr=NF_PUT_ATT_REAL(outfid,var_id(i),'missing_value',NF_REAL,1,miss_val) … … 1356 1357 write(*,*)'nbattr:',nbattr,' j:',j 1357 1358 endif 1358 1359 1359 1360 enddo ! of do=1,nbvar 1360 1361 … … 1499 1500 stop 1500 1501 endif 1501 1502 1502 1503 ! interpolate dataset onto new grid 1503 1504 call p_coord_interp(lonlength,latlength,altlength,timelength,nblev, & 1504 1505 miss_val,ps,press,indata,plevel,outdata) 1505 1506 1506 1507 ! write new dataset to output file 1507 1508 ierr=NF_PUT_VAR_REAL(outfid,var_id(i),outdata) … … 1511 1512 stop 1512 1513 endif 1513 1514 1514 1515 enddo ! of do i=1,nbvar 1515 1516 1516 1517 ! interpolate zareoid onto new grid 1517 1518 call p_coord_interp(lonlength,latlength,altlength,timelength,nblev, & … … 1540 1541 stop 1541 1542 endif 1542 1543 1543 1544 ! interpolate dataset onto new grid 1544 1545 ! check if variable is "rho" (to set flag for interpolation below) … … 1548 1549 j=0 1549 1550 endif 1550 1551 1551 1552 call z_coord_interp(lonlength,latlength,altlength,timelength,nblev, & 1552 1553 miss_val,za_gcm,indata,j,zareoid,outdata) … … 1561 1562 1562 1563 enddo ! of do i=1,nbvar 1563 1564 1564 1565 ! interpolate pressure onto new grid 1565 1566 write(*,*) "" … … 1593 1594 stop 1594 1595 endif 1595 1596 1596 1597 ! interpolate dataset onto new grid 1597 1598 ! check if variable is "rho" (to set flag for interpolation below) … … 1601 1602 j=0 1602 1603 endif 1603 1604 1604 1605 call zs_coord_interp(lonlength,latlength,altlength,timelength,nblev, & 1605 1606 miss_val,zs_gcm,indata,phisinit,press,temp,rho,& … … 1614 1615 endif 1615 1616 enddo ! of do i=1,nbvar 1616 1617 1617 1618 ! interpolate pressure onto new grid 1618 1619 write(*,*) "" … … 1646 1647 stop 1647 1648 endif 1648 1649 1649 1650 ! interpolate dataset onto new grid 1650 1651 ! check if variable is "rho" (to set flag for interpolation below) … … 1654 1655 j=0 1655 1656 endif 1656 1657 1657 1658 call z_coord_interp(lonlength,latlength,altlength,timelength,nblev, & 1658 1659 miss_val,ra_gcm,indata,j,zradius,outdata) … … 1667 1668 1668 1669 enddo ! of do i=1,nbvar 1669 1670 1670 1671 ! interpolate pressure onto new grid 1671 1672 write(*,*) "" … … 1734 1735 1735 1736 ! Parameters needed to integrate hydrostatic equation: 1736 real,parameter :: g0=0.6 21737 real,parameter :: g0=0.6198 1737 1738 !g0: exact mean gravity at radius=3396.km (Lemoine et al. 2001) 1738 real,parameter :: a0=118 7.E31739 real,parameter :: a0=1188.E3 1739 1740 !a0: 'mean' Mars radius=3396.km 1740 real :: gz 1741 real :: gz 1741 1742 ! gz: gravitational acceleration at a given (zareoid) altitude 1742 1743 … … 1749 1750 1750 1751 !============================================================================== 1751 ! 2. Compute Molecular Gas Constant (J kg-1 K-1) at every grid point 1752 ! 2. Compute Molecular Gas Constant (J kg-1 K-1) at every grid point 1752 1753 ! --later used to integrate the hydrostatic equation-- 1753 1754 !============================================================================== … … 1779 1780 ! compute sigma level of layer 1780 1781 sigma(kloop)=press(iloop,jloop,kloop,tloop)/ps(iloop,jloop,tloop) 1781 1782 1782 1783 ! compute "mean" temperature of the layer 1783 1784 if(temp(iloop,jloop,kloop,tloop).eq. & … … 1790 1791 temp(iloop,jloop,kloop-1,tloop)) 1791 1792 endif 1792 1793 1793 1794 ! compute mean value of R of the layer 1794 1795 Rmean=0.5*(R(iloop,jloop,kloop,tloop)+R(iloop,jloop,kloop-1,tloop)) 1795 1796 1796 1797 ! compute gravitational acceleration (at altitude zaeroid(kloop-1)) 1797 1798 ! NB: zareoid=zsurface+phis/g0 1798 1799 gz=g0*(a0**2)/ & 1799 1800 (a0+zs_gcm(iloop,jloop,kloop-1,tloop)+phis(iloop,jloop)/g0)**2 1800 1801 1801 1802 ! compute zs_gcm(iloop,jloop,kloop,tloop) 1802 1803 zs_gcm(iloop,jloop,kloop,tloop)=zs_gcm(iloop,jloop,kloop-1,tloop)- & 1803 1804 log(sigma(kloop)/sigma(kloop-1))*Rmean*Tmean/gz 1804 1805 1805 1806 ! compute za_gcm(kloop) 1806 1807 ! za_gcm(iloop,jloop,kloop,tloop)=zlocal(iloop,jloop,kloop,tloop)+ & … … 1860 1861 1861 1862 ! Parameters needed to integrate hydrostatic equation: 1862 real,parameter :: g0=0.6 21863 real,parameter :: g0=0.6198 1863 1864 !g0: exact mean gravity 1864 real,parameter :: a0=118 7.E31865 real,parameter :: a0=1188.E3 1865 1866 !a0: 'mean' radius 1866 real :: gz 1867 real :: gz 1867 1868 ! gz: gravitational acceleration at a given (zareoid) altitude 1868 1869 … … 1875 1876 1876 1877 !============================================================================== 1877 ! 2. Compute Molecular Gas Constant (J kg-1 K-1) at every grid point 1878 ! 2. Compute Molecular Gas Constant (J kg-1 K-1) at every grid point 1878 1879 ! --later used to integrate the hydrostatic equation-- 1879 1880 !============================================================================== … … 1905 1906 ! compute sigma level of layer 1906 1907 sigma(kloop)=press(iloop,jloop,kloop,tloop)/ps(iloop,jloop,tloop) 1907 1908 1908 1909 ! compute "mean" temperature of the layer 1909 1910 if(temp(iloop,jloop,kloop,tloop).eq. & … … 1916 1917 temp(iloop,jloop,kloop-1,tloop)) 1917 1918 endif 1918 1919 1919 1920 ! compute mean value of R of the layer 1920 1921 Rmean=0.5*(R(iloop,jloop,kloop,tloop)+R(iloop,jloop,kloop-1,tloop)) 1921 1922 1922 1923 ! compute gravitational acceleration (at altitude zaeroid(kloop-1)) 1923 1924 gz=g0*(a0**2)/(a0+za_gcm(iloop,jloop,kloop-1,tloop))**2 1924 1925 1925 1926 ! compute zlocal(kloop) 1926 1927 zlocal(iloop,jloop,kloop,tloop)=zlocal(iloop,jloop,kloop-1,tloop)- & 1927 1928 log(sigma(kloop)/sigma(kloop-1))*Rmean*Tmean/gz 1928 1929 1929 1930 ! compute za_gcm(kloop) 1930 1931 za_gcm(iloop,jloop,kloop,tloop)=zlocal(iloop,jloop,kloop,tloop)+ & … … 1979 1980 1980 1981 real,parameter :: P_ref=1 ! reference surface pressure used to build zsurface 1981 integer i 1982 integer i 1982 1983 1983 1984 ! 1. Build scale heights … … 2041 2042 2042 2043 ! Parameters needed to integrate hydrostatic equation: 2043 real,parameter :: g0=0.6 22044 real,parameter :: g0=0.6198 2044 2045 !g0: exact mean gravity at radius=3396.km (Lemoine et al. 2001) 2045 real,parameter :: a0=118 7.E32046 real,parameter :: a0=1188.E3 2046 2047 !a0: 'mean' Mars radius=3396.km 2047 real :: gz 2048 real :: gz 2048 2049 ! gz: gravitational acceleration at a given (zareoid) altitude 2049 2050 … … 2069 2070 ! compute sigma level of layer 2070 2071 sigma(kloop)=press(iloop,jloop,kloop,tloop)/ps(iloop,jloop,tloop) 2071 2072 2072 2073 ! compute "mean" temperature of the layer 2073 2074 if(temp(iloop,jloop,kloop,tloop).eq. & … … 2080 2081 temp(iloop,jloop,kloop-1,tloop)) 2081 2082 endif 2082 2083 2083 2084 ! compute gravitational acceleration (at altitude zaeroid(kloop-1)) 2084 2085 ! NB: zareoid=zsurface+phis/g0 2085 2086 gz=g0*(a0**2)/ & 2086 2087 (a0+zs_gcm(iloop,jloop,kloop-1,tloop)+phis(iloop,jloop)/g0)**2 2087 2088 2088 2089 ! compute zs_gcm(iloop,jloop,kloop,tloop) 2089 2090 zs_gcm(iloop,jloop,kloop,tloop)=zs_gcm(iloop,jloop,kloop-1,tloop)- & 2090 2091 log(sigma(kloop)/sigma(kloop-1))*R*Tmean/gz 2091 2092 2092 2093 ! compute za_gcm(kloop) 2093 2094 ! za_gcm(iloop,jloop,kloop,tloop)=zlocal(iloop,jloop,kloop,tloop)+ & … … 2143 2144 2144 2145 ! Parameters needed to integrate hydrostatic equation: 2145 real,parameter :: g0=0.6 22146 real,parameter :: g0=0.6198 2146 2147 !g0: exact mean gravity at radius=3396.km (Lemoine et al. 2001) 2147 real,parameter :: a0=118 7.E32148 real,parameter :: a0=1188.E3 2148 2149 !a0: 'mean' Mars radius=3396.km 2149 real :: gz 2150 real :: gz 2150 2151 ! gz: gravitational acceleration at a given (zareoid) altitude 2151 2152 … … 2171 2172 ! compute sigma level of layer 2172 2173 sigma(kloop)=press(iloop,jloop,kloop,tloop)/ps(iloop,jloop,tloop) 2173 2174 2174 2175 ! compute "mean" temperature of the layer 2175 2176 if(temp(iloop,jloop,kloop,tloop).eq. & … … 2182 2183 temp(iloop,jloop,kloop-1,tloop)) 2183 2184 endif 2184 2185 2185 2186 ! compute gravitational acceleration (at altitude zaeroid(kloop-1)) 2186 2187 gz=g0*(a0**2)/(a0+za_gcm(iloop,jloop,kloop-1,tloop))**2 2187 2188 2188 2189 ! compute zlocal(kloop) 2189 2190 zlocal(iloop,jloop,kloop,tloop)=zlocal(iloop,jloop,kloop-1,tloop)- & 2190 2191 log(sigma(kloop)/sigma(kloop-1))*R*Tmean/gz 2191 2192 2192 2193 ! compute za_gcm(kloop) 2193 2194 za_gcm(iloop,jloop,kloop,tloop)=zlocal(iloop,jloop,kloop,tloop)+ & … … 2254 2255 q(kloop)=gcmdata(iloop,jloop,kloop,tloop) 2255 2256 enddo 2256 2257 ! Interpolation 2257 2258 ! Interpolation 2258 2259 do kloop=1,newaltlen 2259 2260 ! compute, by interpolation, value at pressure level plevels(kloop) … … 2268 2269 endif 2269 2270 enddo 2270 2271 2271 2272 enddo !iloop 2272 2273 enddo !jloop … … 2339 2340 q(kloop)=gcmdata(iloop,jloop,kloop,tloop) 2340 2341 enddo !kloop 2341 2342 2342 2343 ! Interpolation 2343 2344 do kloop=1,newaltlen … … 2351 2352 else ! z_new(kloop) is out of range 2352 2353 newdata(iloop,jloop,kloop,tloop)=missing 2353 endif 2354 endif 2354 2355 enddo !kloop 2355 2356 enddo !iloop 2356 2357 enddo !jloop 2357 enddo !tloop 2358 enddo !tloop 2358 2359 else ! case when flag=1 (i.e.: rho) 2359 2360 do tloop=1,tlen … … 2361 2362 do iloop=1,lonlen 2362 2363 do kloop=1,altlen 2363 ! extract the vertical coordinates 2364 ! extract the vertical coordinates 2364 2365 za(kloop)=z_gcm(iloop,jloop,kloop,tloop) 2365 2366 ! store log values along altitude 2366 2367 logq(kloop)=log(gcmdata(iloop,jloop,kloop,tloop)) 2367 2368 enddo !kloop 2368 2369 2369 2370 ! Interpolation 2370 2371 do kloop=1,newaltlen … … 2382 2383 enddo !iloop 2383 2384 enddo !jloop 2384 enddo !tloop 2385 enddo !tloop 2385 2386 endif 2386 2387 … … 2402 2403 ! grid values of altitude are known 'z_gcm', onto a new altitude grid 'z_new'. 2403 2404 ! "Altitudes" must be above local surface altitudes. 2404 ! Notes: 2405 ! Notes: 2405 2406 ! 'z_gcm' and 'znew' altitudes must be monotone increasing sequences. 2406 2407 ! If altitudes in 'znew(i)' fall below those in 'z_gcm(:,:,1,:)', then … … 2408 2409 ! flag=0, and extrapolated (exponentially) if flag=1. 2409 2410 ! If altitudes in 'znew(i)' are above those in 'z_gcm(:,:,altlen,:)', then 2410 ! 'newdata(:,:,i,:)' is set to constant value 'gcmdata(:,:,altlen,:)' 2411 ! 'newdata(:,:,i,:)' is set to constant value 'gcmdata(:,:,altlen,:)' 2411 2412 ! if flag=0, and extrapolated (exponentially) if flag=1. 2412 2413 !============================================================================== … … 2452 2453 real :: x,y ! temporary variables 2453 2454 integer :: iloop,jloop,kloop,tloop 2454 real,parameter :: g0=0.6 22455 real,parameter :: g0=0.6198 2455 2456 !g0: exact mean gravity at radius=3396.km (Lemoine et al. 2001) 2456 real,parameter :: a0=118 7.E32457 real,parameter :: a0=1188.E3 2457 2458 !a0: 'mean' Mars radius=3396.km 2458 2459 real,parameter :: Rmean=296.9 ! molecular gas constant 2459 real :: gz 2460 real :: gz 2460 2461 ! gz: gravitational acceleration at a given (above areoid) altitude 2461 2462 … … 2499 2500 q(kloop)=gcmdata(iloop,jloop,kloop,tloop) 2500 2501 enddo !kloop 2501 2502 2502 2503 ! Interpolation 2503 2504 do kloop=1,newaltlen … … 2516 2517 enddo !iloop 2517 2518 enddo !jloop 2518 enddo !tloop 2519 enddo !tloop 2519 2520 else ! case when flag=1 (i.e.: rho or pressure) 2520 2521 do tloop=1,tlen … … 2523 2524 ! preliminary stuff 2524 2525 do kloop=1,altlen 2525 ! extract the vertical coordinates 2526 ! extract the vertical coordinates 2526 2527 z(kloop)=z_gcm(iloop,jloop,kloop,tloop) 2527 2528 ! store log values along altitude 2528 2529 logq(kloop)=log(gcmdata(iloop,jloop,kloop,tloop)) 2529 2530 enddo !kloop 2530 2531 2531 2532 ! Interpolation 2532 2533 do kloop=1,newaltlen … … 2553 2554 enddo !iloop 2554 2555 enddo !jloop 2555 enddo !tloop 2556 enddo !tloop 2556 2557 endif 2557 2558 … … 2714 2715 double precision x,xi,sum 2715 2716 2716 ae= 118 7000.d02717 ae= 1188000.d0 2717 2718 gm =869.6 !stern et al 2015 gravitational parameter mu (km3/s-2) = G*M 2718 2719 omega=1.138594423d-5 ! Pluto = 2*pi / P rad/s … … 9296 9297 enddo 9297 9298 sum = sum+1. 9298 ! centrifugal potential 9299 ! centrifugal potential 9299 9300 v0=(gm*sum/r + 0.5*omega**2 * r**2) 9300 9301 ! write(out,*)'v0=', v0 … … 9317 9318 double precision dlon,dlat 9318 9319 double precision rg 9319 9320 9320 9321 double precision pi,d2r 9321 9322 parameter (pi=3.141592653589792D0, d2r=pi/180.d0) … … 9358 9359 enddo 9359 9360 sum=sum+1. 9360 ! centrifugal potential 9361 ! centrifugal potential 9361 9362 rg=(gm*sum+0.5*(omega**2)*(r**3)*(cslt**2))/v0 9362 9363 ! write(out,*) i,r,rg
Note: See TracChangeset
for help on using the changeset viewer.