Changeset 1047 for trunk/LMDZ.MARS/libf/aeronomars
- Timestamp:
- Sep 23, 2013, 9:56:47 AM (11 years ago)
- Location:
- trunk/LMDZ.MARS/libf/aeronomars
- Files:
-
- 1 added
- 1 deleted
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/aeronomars/calchim.F90
r1036 r1047 1 subroutine calchim(n q,&1 subroutine calchim(ngrid,nlayer,nq, & 2 2 ptimestep,pplay,pplev,pt,pdt,dist_sol,mu0, & 3 3 zzlev,zzlay,zday,pq,pdq,dqchim,dqschim,dqcloud, & … … 13 13 igcm_noplus, igcm_n2plus, igcm_hplus, & 14 14 igcm_hco2plus, igcm_elec, mmol 15 use conc_mod, only: mmean ! mean molecular mass of the atmosphere 16 15 17 implicit none 16 18 … … 38 40 ! 39 41 ! ptimestep timestep (s) 40 ! pplay(ngrid mx,nlayermx) Pressure at the middle of the layers (Pa)41 ! pplev(ngrid mx,nlayermx+1) Intermediate pressure levels (Pa)42 ! pt(ngrid mx,nlayermx) Temperature (K)43 ! pdt(ngrid mx,nlayermx) Temperature tendency (K)44 ! pu(ngrid mx,nlayermx) u component of the wind (ms-1)45 ! pdu(ngrid mx,nlayermx) u component tendency (K)46 ! pv(ngrid mx,nlayermx) v component of the wind (ms-1)47 ! pdv(ngrid mx,nlayermx) v component tendency (K)42 ! pplay(ngrid,nlayer) Pressure at the middle of the layers (Pa) 43 ! pplev(ngrid,nlayer+1) Intermediate pressure levels (Pa) 44 ! pt(ngrid,nlayer) Temperature (K) 45 ! pdt(ngrid,nlayer) Temperature tendency (K) 46 ! pu(ngrid,nlayer) u component of the wind (ms-1) 47 ! pdu(ngrid,nlayer) u component tendency (K) 48 ! pv(ngrid,nlayer) v component of the wind (ms-1) 49 ! pdv(ngrid,nlayer) v component tendency (K) 48 50 ! dist_sol distance of the sun (AU) 49 ! mu0(ngrid mx) cos of solar zenith angle (=1 when sun at zenith)50 ! pq(ngrid mx,nlayermx,nqmx) Advected fields, ie chemical species here51 ! pdq(ngrid mx,nlayermx,nqmx) Previous tendencies on pq52 ! tauref(ngrid mx) Optical depth at 7 hPa53 ! co2ice(ngrid mx) co2 ice surface layer (kg.m-2)54 ! surfdust(ngrid mx,nlayermx) dust surface area (m2/m3)55 ! surfice(ngrid mx,nlayermx) ice surface area (m2/m3)51 ! mu0(ngrid) cos of solar zenith angle (=1 when sun at zenith) 52 ! pq(ngrid,nlayer,nq) Advected fields, ie chemical species here 53 ! pdq(ngrid,nlayer,nq) Previous tendencies on pq 54 ! tauref(ngrid) Optical depth at 7 hPa 55 ! co2ice(ngrid) co2 ice surface layer (kg.m-2) 56 ! surfdust(ngrid,nlayer) dust surface area (m2/m3) 57 ! surfice(ngrid,nlayer) ice surface area (m2/m3) 56 58 ! 57 59 ! Output: 58 60 ! 59 ! dqchim(ngrid mx,nlayermx,nqmx) ! tendencies on pq due to chemistry60 ! dqschim(ngrid mx,nqmx) ! tendencies on qsurf61 ! 62 !======================================================================= 63 64 #include "dimensions.h"65 #include "dimphys.h"61 ! dqchim(ngrid,nlayer,nq) ! tendencies on pq due to chemistry 62 ! dqschim(ngrid,nq) ! tendencies on qsurf 63 ! 64 !======================================================================= 65 66 !#include "dimensions.h" 67 !#include "dimphys.h" 66 68 #include "chimiedata.h" 67 69 !#include "tracer.h" 68 70 #include "comcstfi.h" 69 71 #include "callkeys.h" 70 #include "conc.h"72 !#include "conc.h" 71 73 72 74 ! input: 73 75 76 integer,intent(in) :: ngrid ! number of atmospheric columns 77 integer,intent(in) :: nlayer ! number of atmospheric layers 74 78 integer,intent(in) :: nq ! number of tracers 75 79 real :: ptimestep 76 real :: pplay(ngrid mx,nlayermx) ! pressure at the middle of the layers77 real :: zzlay(ngrid mx,nlayermx) ! pressure at the middle of the layers78 real :: pplev(ngrid mx,nlayermx+1) ! intermediate pressure levels79 real :: zzlev(ngrid mx,nlayermx+1) ! altitude at layer boundaries80 real :: pt(ngrid mx,nlayermx) ! temperature81 real :: pdt(ngrid mx,nlayermx) ! temperature tendency82 real :: pu(ngrid mx,nlayermx) ! u component of the wind (m.s-1)83 real :: pdu(ngrid mx,nlayermx) ! u component tendency84 real :: pv(ngrid mx,nlayermx) ! v component of the wind (m.s-1)85 real :: pdv(ngrid mx,nlayermx) ! v component tendency80 real :: pplay(ngrid,nlayer) ! pressure at the middle of the layers 81 real :: zzlay(ngrid,nlayer) ! pressure at the middle of the layers 82 real :: pplev(ngrid,nlayer+1) ! intermediate pressure levels 83 real :: zzlev(ngrid,nlayer+1) ! altitude at layer boundaries 84 real :: pt(ngrid,nlayer) ! temperature 85 real :: pdt(ngrid,nlayer) ! temperature tendency 86 real :: pu(ngrid,nlayer) ! u component of the wind (m.s-1) 87 real :: pdu(ngrid,nlayer) ! u component tendency 88 real :: pv(ngrid,nlayer) ! v component of the wind (m.s-1) 89 real :: pdv(ngrid,nlayer) ! v component tendency 86 90 real :: dist_sol ! distance of the sun (AU) 87 real :: mu0(ngrid mx) ! cos of solar zenith angle (=1 when sun at zenith)88 real :: pq(ngrid mx,nlayermx,nq) ! tracers mass mixing ratio89 real :: pdq(ngrid mx,nlayermx,nq) ! previous tendencies91 real :: mu0(ngrid) ! cos of solar zenith angle (=1 when sun at zenith) 92 real :: pq(ngrid,nlayer,nq) ! tracers mass mixing ratio 93 real :: pdq(ngrid,nlayer,nq) ! previous tendencies 90 94 real :: zday ! date (time since Ls=0, in martian days) 91 real :: tauref(ngrid mx) ! optical depth at 7 hPa92 real :: co2ice(ngrid mx) ! co2 ice surface layer (kg.m-2)93 real :: surfdust(ngrid mx,nlayermx) ! dust surface area (m2/m3)94 real :: surfice(ngrid mx,nlayermx) ! ice surface area (m2/m3)95 real :: tauref(ngrid) ! optical depth at 7 hPa 96 real :: co2ice(ngrid) ! co2 ice surface layer (kg.m-2) 97 real :: surfdust(ngrid,nlayer) ! dust surface area (m2/m3) 98 real :: surfice(ngrid,nlayer) ! ice surface area (m2/m3) 95 99 96 100 ! output: 97 101 98 real :: dqchim(ngrid mx,nlayermx,nq) ! tendencies on pq due to chemistry99 real :: dqschim(ngrid mx,nq) ! tendencies on qsurf100 real :: dqcloud(ngrid mx,nlayermx,nq)! tendencies on pq due to condensation101 real :: dqscloud(ngrid mx,nq) ! tendencies on qsurf102 real :: dqchim(ngrid,nlayer,nq) ! tendencies on pq due to chemistry 103 real :: dqschim(ngrid,nq) ! tendencies on qsurf 104 real :: dqcloud(ngrid,nlayer,nq)! tendencies on pq due to condensation 105 real :: dqscloud(ngrid,nq) ! tendencies on qsurf 102 106 103 107 ! local variables: … … 143 147 144 148 real :: latvl1, lonvl1 145 real :: zq(ngrid mx,nlayermx,nq) ! pq+pdq*ptimestep before chemistry149 real :: zq(ngrid,nlayer,nq) ! pq+pdq*ptimestep before chemistry 146 150 ! new mole fraction after 147 real :: zt(ngrid mx,nlayermx) ! temperature148 real :: zu(ngrid mx,nlayermx) ! u component of the wind149 real :: zv(ngrid mx,nlayermx) ! v component of the wind151 real :: zt(ngrid,nlayer) ! temperature 152 real :: zu(ngrid,nlayer) ! u component of the wind 153 real :: zv(ngrid,nlayer) ! v component of the wind 150 154 real :: taucol ! optical depth at 7 hPa 151 155 … … 155 159 ! for each column of atmosphere: 156 160 157 real :: zpress(nlayer mx) ! Pressure (mbar)158 real :: zdens(nlayer mx) ! Density (cm-3)159 real :: ztemp(nlayer mx) ! Temperature (K)160 real :: zlocal(nlayer mx) ! Altitude (km)161 real :: zycol(nlayer mx,nq) ! Composition (mole fractions)161 real :: zpress(nlayer) ! Pressure (mbar) 162 real :: zdens(nlayer) ! Density (cm-3) 163 real :: ztemp(nlayer) ! Temperature (K) 164 real :: zlocal(nlayer) ! Altitude (km) 165 real :: zycol(nlayer,nq) ! Composition (mole fractions) 162 166 real :: szacol ! Solar zenith angle 163 real :: surfice1d(nlayer mx) ! Ice surface area (cm2/cm3)164 real :: surfdust1d(nlayer mx) ! Dust surface area (cm2/cm3)165 real :: jo3(nlayer mx) ! Photodissociation rate O3->O1D (s-1)167 real :: surfice1d(nlayer) ! Ice surface area (cm2/cm3) 168 real :: surfdust1d(nlayer) ! Dust surface area (cm2/cm3) 169 real :: jo3(nlayer) ! Photodissociation rate O3->O1D (s-1) 166 170 167 171 ! for output: … … 169 173 logical :: output ! to issue calls to writediagfi and stats 170 174 parameter (output = .true.) 171 real :: jo3_3d(ngrid mx,nlayermx) ! Photodissociation rate O3->O1D (s-1)175 real :: jo3_3d(ngrid,nlayer) ! Photodissociation rate O3->O1D (s-1) 172 176 173 177 !======================================================================= … … 592 596 !======================================================================= 593 597 594 do ig = 1,ngrid mx598 do ig = 1,ngrid 595 599 596 600 foundswitch = 0 597 do l = 1,nlayer mx601 do l = 1,nlayer 598 602 do i = 1,nbq 599 603 iq = niq(i) ! get tracer index … … 626 630 end if 627 631 if (.not. thermochem) then 628 lswitch = min(50,nlayer mx+1)632 lswitch = min(50,nlayer+1) 629 633 end if 630 634 631 end do ! of do l=1,nlayer mx635 end do ! of do l=1,nlayer 632 636 633 637 szacol = acos(mu0(ig))*180./pi … … 647 651 ! ozone photolysis, for output 648 652 649 do l = 1,nlayer mx653 do l = 1,nlayer 650 654 jo3_3d(ig,l) = jo3(l) 651 655 end do … … 653 657 ! condensation of h2o2 654 658 655 call perosat(ig,ptimestep,pplev,pplay, & 659 call perosat(ngrid, nlayer, nq, & 660 ig,ptimestep,pplev,pplay, & 656 661 ztemp,zycol,dqcloud,dqscloud) 657 662 end if … … 667 672 668 673 if (depos) then 669 call deposition(ig, ig_vl1, pplay, pplev, zzlay, zzlev,& 674 call deposition(ngrid, nlayer, nq, & 675 ig, ig_vl1, pplay, pplev, zzlay, zzlev, & 670 676 zu, zv, zt, zycol, ptimestep, co2ice) 671 677 end if … … 679 685 680 686 ! tendency for the most abundant species = - sum of others 681 do l = 1,nlayer mx687 do l = 1,nlayer 682 688 iloc=maxloc(zycol(l,:)) 683 689 iqmax=iloc(1) … … 691 697 end if 692 698 end do 693 end do ! of do l = 1,nlayer mx699 end do ! of do l = 1,nlayer 694 700 695 701 !======================================================================= … … 697 703 !======================================================================= 698 704 699 end do ! of do ig=1,ngrid mx705 end do ! of do ig=1,ngrid 700 706 701 707 !======================================================================= … … 707 713 708 714 if (photochem .and. output) then 709 if (ngrid mx> 1) then710 call writediagfi(ngrid mx,'jo3','j o3->o1d', &715 if (ngrid > 1) then 716 call writediagfi(ngrid,'jo3','j o3->o1d', & 711 717 's-1',3,jo3_3d(1,1)) 712 718 if (callstats) then 713 call wstats(ngrid mx,'jo3','j o3->o1d', &719 call wstats(ngrid,'jo3','j o3->o1d', & 714 720 's-1',3,jo3_3d(1,1)) 715 721 endif 716 end if ! of if (ngrid mx.gt.1)722 end if ! of if (ngrid.gt.1) 717 723 end if ! of if (output) 718 724 -
trunk/LMDZ.MARS/libf/aeronomars/chemthermos.F90
r1036 r1047 33 33 #include "comcstfi.h" 34 34 #include "callkeys.h" 35 #include "comdiurn.h"35 !#include "comdiurn.h" 36 36 #include "param.h" 37 37 #include "param_v4.h" -
trunk/LMDZ.MARS/libf/aeronomars/concentrations.F
r1036 r1047 1 SUBROUTINE concentrations(nq,pplay,pt,pdt,pq,pdq,ptimestep) 1 SUBROUTINE concentrations(ngrid,nlayer,nq, 2 & pplay,pt,pdt,pq,pdq,ptimestep) 2 3 3 4 use tracer_mod, only: igcm_co2, igcm_co, igcm_o, igcm_o1d, … … 9 10 & igcm_nplus, igcm_noplus, igcm_n2plus, 10 11 & igcm_hplus, igcm_hco2plus, mmol 12 use conc_mod, only: mmean, Akknew, rnew, cpnew 13 11 14 implicit none 12 15 … … 14 17 ! CALCULATION OF MEAN MOLECULAR MASS, Cp, Akk and R 15 18 ! 16 ! mmean(ngrid mx,nlayermx) amu17 ! cpnew(ngrid mx,nlayermx) J/kg/K18 ! rnew(ngrid mx,nlayermx) J/kg/K19 ! akknew(ngrid mx,nlayermx) coefficient of thermal concduction19 ! mmean(ngrid,nlayer) amu 20 ! cpnew(ngrid,nlayer) J/kg/K 21 ! rnew(ngrid,nlayer) J/kg/K 22 ! akknew(ngrid,nlayer) coefficient of thermal concduction 20 23 ! 21 24 ! version: April 2012 - Franck Lefevre … … 24 27 ! declarations 25 28 26 #include "dimensions.h"27 #include "dimphys.h"29 !#include "dimensions.h" 30 !#include "dimphys.h" 28 31 #include "comcstfi.h" 29 32 #include "callkeys.h" 30 #include "comdiurn.h"33 !#include "comdiurn.h" 31 34 #include "chimiedata.h" 32 35 !#include "tracer.h" 33 #include "conc.h"36 !#include "conc.h" 34 37 35 38 ! input/output 36 39 40 integer,intent(in) :: ngrid ! number of atmospheric columns 41 integer,intent(in) :: nlayer ! number of atmospheric layers 37 42 integer,intent(in) :: nq ! number of tracers 38 real,intent(in) :: pplay(ngrid mx,nlayermx)39 real,intent(in) :: pt(ngrid mx,nlayermx)40 real,intent(in) :: pdt(ngrid mx,nlayermx)41 real,intent(in) :: pq(ngrid mx,nlayermx,nq)42 real,intent(in) :: pdq(ngrid mx,nlayermx,nq)43 real,intent(in) :: pplay(ngrid,nlayer) 44 real,intent(in) :: pt(ngrid,nlayer) 45 real,intent(in) :: pdt(ngrid,nlayer) 46 real,intent(in) :: pq(ngrid,nlayer,nq) 47 real,intent(in) :: pdq(ngrid,nlayer,nq) 43 48 real,intent(in) :: ptimestep 44 49 … … 49 54 integer,allocatable,save :: niq(:) 50 55 real :: ni(nq), ntot 51 real :: zq(ngrid mx, nlayermx, nq)52 real :: zt(ngrid mx, nlayermx)56 real :: zq(ngrid, nlayer, nq) 57 real :: zt(ngrid, nlayer) 53 58 real,allocatable,save :: aki(:) 54 59 real,allocatable,save :: cpi(:) … … 243 248 ! update temperature 244 249 245 do l = 1,nlayer mx246 do ig = 1,ngrid mx250 do l = 1,nlayer 251 do ig = 1,ngrid 247 252 zt(ig,l) = pt(ig,l) + pdt(ig,l)*ptimestep 248 253 end do … … 251 256 ! update tracers 252 257 253 do l = 1,nlayer mx254 do ig = 1,ngrid mx258 do l = 1,nlayer 259 do ig = 1,ngrid 255 260 do i = 1,nbq 256 261 iq = niq(i) … … 266 271 mmean(:,:) = 0. 267 272 268 do l = 1,nlayer mx269 do ig = 1,ngrid mx273 do l = 1,nlayer 274 do ig = 1,ngrid 270 275 do i = 1,nbq 271 276 iq = niq(i) … … 283 288 akknew(:,:) = 0. 284 289 285 do l = 1,nlayer mx286 do ig = 1,ngrid mx290 do l = 1,nlayer 291 do ig = 1,ngrid 287 292 ntot = pplay(ig,l)/(1.381e-23*zt(ig,l))*1.e-6 ! in #/cm3 288 293 do i = 1,nbq -
trunk/LMDZ.MARS/libf/aeronomars/conduction.F
r38 r1047 1 SUBROUTINE conduction( ptimestep,pplay,pplev,pt,pdt,1 SUBROUTINE conduction(ngrid,nlayer,ptimestep,pplay,pplev,pt,pdt, 2 2 $ tsurf,zzlev,zzlay,zdtconduc) 3 3 4 use conc_mod, only: Akknew, rnew, cpnew 4 5 IMPLICIT NONE 5 6 … … 16 17 c----------------------------------------------------------------------- 17 18 18 #include "dimensions.h"19 #include "dimphys.h"20 #include "comcstfi.h"21 #include "surfdat.h"22 #include "chimiedata.h"23 #include "conc.h"19 !#include "dimensions.h" 20 !#include "dimphys.h" 21 !#include "comcstfi.h" 22 !#include "surfdat.h" 23 !#include "chimiedata.h" 24 !#include "conc.h" 24 25 25 26 c arguments: 26 27 c ---------- 27 28 28 REAL ptimestep 29 REAL pplay(ngridmx,nlayermx) 30 real pplev(ngridmx,nlayermx+1) 31 REAL zzlay(ngridmx,nlayermx) 32 real zzlev(ngridmx,nlayermx+1) 33 REAL pt(ngridmx,nlayermx) 34 real pdt(ngridmx,nlayermx) 35 real tsurf(ngridmx) 29 integer,intent(in) :: ngrid ! number of atmospheric columns 30 integer,intent(in) :: nlayer ! number of atmospheric layers 31 real,intent(in) :: ptimestep 32 REAL,intent(in) :: pplay(ngrid,nlayer) 33 real,intent(in) :: pplev(ngrid,nlayer+1) 34 REAL,intent(in) :: zzlay(ngrid,nlayer) 35 real,intent(in) :: zzlev(ngrid,nlayer+1) 36 REAL,intent(in) :: pt(ngrid,nlayer) 37 real,intent(in) :: pdt(ngrid,nlayer) 38 real,intent(in) :: tsurf(ngrid) 36 39 37 real zdtconduc(ngridmx,nlayermx)40 real,intent(out) :: zdtconduc(ngrid,nlayer) 38 41 39 42 c local: … … 41 44 42 45 INTEGER i,ig,l 43 INTEGER,SAVE :: ngrid, nz44 46 real Akk 45 47 real,save :: phitop 46 48 real m,tmean 47 REAL alpha(nlayer mx)48 real zt(nlayer mx)49 REAL lambda(nlayer mx)50 real muvol(nlayer mx)51 REAL C(nlayer mx)52 real D(nlayer mx)53 real den(nlayer mx)54 REAL pdtc(nlayer mx)55 real zlay(nlayer mx)56 real zlev(nlayer mx+1)49 REAL alpha(nlayer) 50 real zt(nlayer) 51 REAL lambda(nlayer) 52 real muvol(nlayer) 53 REAL C(nlayer) 54 real D(nlayer) 55 real den(nlayer) 56 REAL pdtc(nlayer) 57 real zlay(nlayer) 58 real zlev(nlayer+1) 57 59 58 60 c constants used locally … … 78 80 ! Initialize phitop 79 81 phitop=0.0 80 ! Initialize ngrid and nz81 ngrid=ngridmx82 nz=nlayermx83 82 84 83 firstcall = .false. … … 93 92 zlev(1)=zzlev(ig,1) 94 93 95 do i=2,n z94 do i=2,nlayer 96 95 97 96 zt(i)=pt(ig,i)+pdt(ig,i)*ptimestep … … 107 106 enddo 108 107 109 c zlev(n z+1)= zlev(nz)110 c & -log(max(pplev(ig,n z+1),1.e-30)/pplev(ig,nz))111 c & *Rnew(ig,n z)*tmean/g112 c if(pplev(ig,n z+1).eq.0.)113 c & zlev(n z+1)=zlev(nz)+(zlay(nz)-zlay(nz-1))108 c zlev(nlayer+1)= zlev(nlayer) 109 c & -log(max(pplev(ig,nlayer+1),1.e-30)/pplev(ig,nlayer)) 110 c & *Rnew(ig,nlayer)*tmean/g 111 c if(pplev(ig,nlayer+1).eq.0.) 112 c & zlev(nlayer+1)=zlev(nlayer)+(zlay(nlayer)-zlay(nlayer-1)) 114 113 115 zlev(n z+1)= zlev(nz)+10000.114 zlev(nlayer+1)= zlev(nlayer)+10000. 116 115 117 116 Akk=Akknew(ig,1) 118 117 lambda(1) = Akk*tsurf(ig)**skk/zlay(1) 119 118 120 DO i = 2 , n z119 DO i = 2 , nlayer 121 120 Akk=Akknew(ig,i) 122 121 lambda(i)=Akk*zt(i)**skk/(zlay(i)-zlay(i-1)) 123 122 ENDDO 124 DO i=1,n z-1123 DO i=1,nlayer-1 125 124 muvol(i)=pplay(ig,i)/(rnew(ig,i)*zt(i)) 126 125 alpha(i)=cpnew(ig,i)*(muvol(i)/ptimestep) … … 128 127 ENDDO 129 128 130 muvol(n z)=pplay(ig,nz)/(rnew(ig,nz)*zt(nz))131 alpha(n z)=cpnew(ig,i)*(muvol(nz)/ptimestep)132 $ *(zlev(n z+1)-zlev(nz))129 muvol(nlayer)=pplay(ig,nlayer)/(rnew(ig,nlayer)*zt(nlayer)) 130 alpha(nlayer)=cpnew(ig,i)*(muvol(nlayer)/ptimestep) 131 $ *(zlev(nlayer+1)-zlev(nlayer)) 133 132 134 133 c-------------------------------------------------------------------- … … 143 142 D(1)=lambda(2)/den(1) 144 143 145 DO i = 2,n z-1144 DO i = 2,nlayer-1 146 145 den(i)=alpha(i)+lambda(i+1) 147 146 den(i)=den(i)+lambda(i)*(1-D(i-1)) … … 154 153 ENDDO 155 154 156 den(n z)=alpha(nz) + lambda(nz) * (1-D(nz-1))157 C(n z)=C(nz-1)+zt(nz-1)-zt(nz)158 C(n z)=(C(nz)*lambda(nz)+phitop) / den(nz)155 den(nlayer)=alpha(nlayer) + lambda(nlayer) * (1-D(nlayer-1)) 156 C(nlayer)=C(nlayer-1)+zt(nlayer-1)-zt(nlayer) 157 C(nlayer)=(C(nlayer)*lambda(nlayer)+phitop) / den(nlayer) 159 158 160 159 c---------------------------------------------------------------------- … … 164 163 c---------------------------------------------------------------------- 165 164 166 DO i=1,n z165 DO i=1,nlayer 167 166 pdtc(i)=0. 168 167 ENDDO 169 pdtc(n z)=C(nz)170 DO i=n z-1,1,-1168 pdtc(nlayer)=C(nlayer) 169 DO i=nlayer-1,1,-1 171 170 pdtc(i)=C(i)+D(i)*pdtc(i+1) 172 171 ENDDO … … 177 176 c----------------------------------------------------------------------- 178 177 179 DO i=1,n z178 DO i=1,nlayer 180 179 zdtconduc(ig,i)=pdtc(i)/ptimestep 181 180 ENDDO -
trunk/LMDZ.MARS/libf/aeronomars/deposition.F
r1036 r1047 1 subroutine deposition(ig, ig_vl1, pplay, pplev, zzlay, zzlev, 1 subroutine deposition(ngrid, nlayer, nq, 2 & ig, ig_vl1, pplay, pplev, zzlay, zzlev, 2 3 $ zu, zv, zt, zycol, ptimestep, co2ice) 3 4 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc … … 7 8 cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc 8 9 c 9 use tracer_mod, only: nqmx 10 use surfdat_h, only: z0 ! surface roughness 11 use conc_mod, only: rnew ! specific gas constant 10 12 implicit none 11 13 c 12 #include "dimensions.h"13 #include "dimphys.h"14 #include "planete.h"15 #include "chimiedata.h"16 #include "conc.h"17 #include "surfdat.h"14 !#include "dimensions.h" 15 !#include "dimphys.h" 16 !#include "planete.h" 17 !#include "chimiedata.h" 18 !#include "conc.h" 19 !#include "surfdat.h" 18 20 c 19 21 c input 20 22 c 21 integer ig ! grid point index 22 integer ig_vl1 ! viking 1 grid point 23 real pplay(ngridmx,nlayermx) ! pressure at the middle of the layers (pa) 24 real pplev(ngridmx,nlayermx+1) ! pressure at layer boundaries (pa) 25 real zzlay(ngridmx,nlayermx) ! altitude at the middle of the layers (m) 26 real zzlev(ngridmx,nlayermx+1) ! altitude at layer boundaries (m) 27 real zu(ngridmx,nlayermx) ! u component of the wind (m.s-1) 28 real zv(ngridmx,nlayermx) ! v component of the wind (m.s-1) 29 real zt(ngridmx,nlayermx) ! temperature (k) 30 real zycol(nlayermx,nqmx) ! composition (volume mixing ratio) 31 real ptimestep ! physical timestep (s) 32 real co2ice(ngridmx) ! co2 ice surface layer (kg.m-2) 23 integer,intent(in) :: ngrid ! number of atmospheric columns 24 integer,intent(in) :: nlayer ! number of atmospheric layers 25 integer,intent(in) :: nq ! number of tracers 26 integer ig ! grid point index 27 integer ig_vl1 ! viking 1 grid point 28 real pplay(ngrid,nlayer) ! pressure at the middle of the layers (pa) 29 real pplev(ngrid,nlayer+1) ! pressure at layer boundaries (pa) 30 real zzlay(ngrid,nlayer) ! altitude at the middle of the layers (m) 31 real zzlev(ngrid,nlayer+1) ! altitude at layer boundaries (m) 32 real zu(ngrid,nlayer) ! u component of the wind (m.s-1) 33 real zv(ngrid,nlayer) ! v component of the wind (m.s-1) 34 real zt(ngrid,nlayer) ! temperature (k) 35 real zycol(nlayer,nq) ! composition (volume mixing ratio) 36 real ptimestep ! physical timestep (s) 37 real co2ice(ngrid) ! co2 ice surface layer (kg.m-2) 33 38 c 34 39 c local -
trunk/LMDZ.MARS/libf/aeronomars/euvheat.F90
r1036 r1047 1 SUBROUTINE euvheat( pt,pdt,pplev,pplay,zzlay, &1 SUBROUTINE euvheat(ngrid,nlayer,nq,pt,pdt,pplev,pplay,zzlay, & 2 2 mu0,ptimestep,ptime,zday,pq,pdq,pdteuv) 3 3 4 use tracer_mod, only: nqmx, igcm_co2, igcm_co, igcm_o, igcm_o1d,&5 igcm_o2, igcm_h, igcm_h2, igcm_oh, igcm_ho2, &6 igcm_h2o2, igcm_h2o_vap, igcm_o3, igcm_n2, &4 use tracer_mod, only: igcm_co2, igcm_co, igcm_o, igcm_o1d, & 5 igcm_o2, igcm_h, igcm_h2, igcm_oh, igcm_ho2, & 6 igcm_h2o2, igcm_h2o_vap, igcm_o3, igcm_n2, & 7 7 igcm_n, igcm_no, igcm_no2, igcm_n2d, mmol 8 use conc_mod, only: rnew, cpnew 8 9 IMPLICIT NONE 9 10 !======================================================================= … … 17 18 ! input: 18 19 ! ----- 19 ! mu0(ngrid mx)20 ! mu0(ngrid) 20 21 ! pplay(ngrid,nlayer) pressure at middle of layers (Pa) 21 22 ! … … 30 31 ! ------------------ 31 32 ! 32 #include "dimensions.h"33 #include "dimphys.h"34 #include "comcstfi.h"33 !#include "dimensions.h" 34 !#include "dimphys.h" 35 !#include "comcstfi.h" 35 36 #include "callkeys.h" 36 #include "comdiurn.h"37 #include "param.h"38 #include "param_v4.h"39 #include "chimiedata.h"37 !#include "comdiurn.h" 38 !#include "param.h" 39 !#include "param_v4.h" 40 !#include "chimiedata.h" 40 41 !#include "tracer.h" 41 #include "conc.h"42 !#include "conc.h" 42 43 !----------------------------------------------------------------------- 43 44 ! Input/Output 44 45 ! ------------ 45 46 46 real :: pt(ngridmx,nlayermx) 47 real :: pdt(ngridmx,nlayermx) 48 real :: pplev(ngridmx,nlayermx+1) 49 real :: pplay(ngridmx,nlayermx) 50 real :: zzlay(ngridmx,nlayermx) 51 real :: mu0(ngridmx) 47 integer,intent(in) :: ngrid ! number of atmospheric columns 48 integer,intent(in) :: nlayer ! number of atmospheric layers 49 integer,intent(in) :: nq ! number of advected tracers 50 real :: pt(ngrid,nlayer) 51 real :: pdt(ngrid,nlayer) 52 real :: pplev(ngrid,nlayer+1) 53 real :: pplay(ngrid,nlayer) 54 real :: zzlay(ngrid,nlayer) 55 real :: mu0(ngrid) 52 56 real :: ptimestep,ptime 53 57 real :: zday 54 real :: pq(ngrid mx,nlayermx,nqmx)55 real :: pdq(ngrid mx,nlayermx,nqmx)56 57 real :: pdteuv(ngrid mx,nlayermx)58 real :: pq(ngrid,nlayer,nq) 59 real :: pdq(ngrid,nlayer,nq) 60 61 real :: pdteuv(ngrid,nlayer) 58 62 ! 59 63 ! Local variables : … … 63 67 INTEGER :: l,ig,n 64 68 integer,save :: euvmod 65 real, allocatable :: rm(:,:) ! number density (cm-3)66 real :: zq(ngrid mx,nlayermx,nqmx) ! local updated tracer quantity67 real :: zt(ngrid mx,nlayermx) ! local updated atmospheric temperature68 real :: zlocal(nlayer mx)69 real, allocatable, save :: rm(:,:) ! number density (cm-3) 70 real :: zq(ngrid,nlayer,nq) ! local updated tracer quantity 71 real :: zt(ngrid,nlayer) ! local updated atmospheric temperature 72 real :: zlocal(nlayer) 69 73 real :: zenit 70 real :: jtot(nlayer mx)74 real :: jtot(nlayer) 71 75 real :: dens ! amu/cm-3 72 real :: tx(nlayer mx)76 real :: tx(nlayer) 73 77 ! real euveff !UV heating efficiency 74 78 … … 326 330 end select 327 331 332 !Allocate density vector 333 allocate(rm(nlayer,nespeuv)) 334 328 335 firstcall= .false. 329 336 endif ! of if (firstcall) … … 331 338 !cccccccccccccccccccccccccccccccccccccccccccccccccccccccc 332 339 333 !Number of species if not firstcall 334 335 336 !Allocate density vector 337 allocate(rm(nlayermx,nespeuv)) 340 338 341 ! build local updated values of tracers and temperature 339 do l=1,nlayer mx340 do ig=1,ngrid mx342 do l=1,nlayer 343 do ig=1,ngrid 341 344 ! chemical species 342 345 zq(ig,l,g_co2)=pq(ig,l,g_co2)+pdq(ig,l,g_co2)*ptimestep … … 374 377 ! set 375 378 376 do ig=1,ngrid mx379 do ig=1,ngrid 377 380 zenit=acos(mu0(ig))*180./acos(-1.) 378 381 379 do l=1,nlayer mx382 do l=1,nlayer 380 383 !Conversion to number density 381 384 dens=pplay(ig,l)/(rnew(ig,l)*zt(ig,l)) / 1.66e-21 … … 406 409 tx(1)=zt(ig,1) 407 410 408 do l=2,nlayer mx411 do l=2,nlayer 409 412 tx(l)=zt(ig,l) 410 413 zlocal(l)=zzlay(ig,l)/1000. … … 419 422 !Gonzalez-Galindo et al. JGR 2009) for details 420 423 !Calculates the UV heating from the total photoabsorption coefficient 421 do l=1,nlayer mx424 do l=1,nlayer 422 425 pdteuv(ig,l)=euveff*jtot(l)/10. & 423 426 /(cpnew(ig,l)*pplay(ig,l)/(rnew(ig,l)*zt(ig,l))) … … 426 429 !the actual Mars-Sun distance 427 430 enddo 428 enddo ! of do ig=1,ngrid mx431 enddo ! of do ig=1,ngrid 429 432 !Deallocations 430 deallocate(rm)433 ! deallocate(rm) 431 434 432 435 return -
trunk/LMDZ.MARS/libf/aeronomars/inichim_newstart.F90
r1036 r1047 1 subroutine inichim_newstart(nq, pq, qsurf, ps, flagh2o, flagthermo) 1 subroutine inichim_newstart(ngrid, nq, pq, qsurf, ps, & 2 flagh2o, flagthermo) 2 3 3 4 use tracer_mod … … 25 26 ! 26 27 ! pq(iip1,jjp1,llm,nq) Advected fields, ie chemical species here 27 ! qsurf(ngrid mx,nq) Amount of tracer on the surface (kg/m2)28 ! qsurf(ngrid,nq) Amount of tracer on the surface (kg/m2) 28 29 ! ps(iip1,jjp1) Surface pressure (Pa) 29 30 ! flagh2o flag for initialisation of h2o (1: yes / 0: no) … … 33 34 34 35 #include "dimensions.h" 35 #include "dimphys.h"36 !#include "dimphys.h" 36 37 #include "paramet.h" 37 38 !#include "tracer.h" … … 42 43 ! inputs : 43 44 45 integer,intent(in) :: ngrid ! number of atmospheric columns in the physics 44 46 integer,intent(in) :: nq ! number of tracers 45 47 real,intent(in) :: ps(iip1,jjp1) ! surface pressure in the gcm (Pa) … … 50 52 51 53 real,intent(out) :: pq(iip1,jjp1,llm,nq) ! advected fields, ie chemical species 52 real,intent(out) :: qsurf(ngrid mx,nq) ! surface values (kg/m2) of tracers54 real,intent(out) :: qsurf(ngrid,nq) ! surface values (kg/m2) of tracers 53 55 54 56 ! local : … … 586 588 do n = 1,nspe 587 589 iq = niq(n) 588 qsurf(1:ngrid mx,iq) = 0.590 qsurf(1:ngrid,iq) = 0. 589 591 end do 590 592 end if … … 604 606 end do 605 607 ! set surface value to zero 606 qsurf(1:ngrid mx,igcm_ch4) = 0.608 qsurf(1:ngrid,igcm_ch4) = 0. 607 609 end if 608 610 … … 644 646 ! surface value to 0 645 647 646 qsurf(1:ngrid mx,igcm_co2plus) = 0.647 qsurf(1:ngrid mx,igcm_o2plus) = 0.648 qsurf(1:ngrid mx,igcm_oplus) = 0.649 qsurf(1:ngrid mx,igcm_coplus) = 0.650 qsurf(1:ngrid mx,igcm_cplus) = 0.651 qsurf(1:ngrid mx,igcm_nplus) = 0.652 qsurf(1:ngrid mx,igcm_noplus) = 0.653 qsurf(1:ngrid mx,igcm_n2plus) = 0.654 qsurf(1:ngrid mx,igcm_hplus) = 0.655 qsurf(1:ngrid mx,igcm_hco2plus) = 0.656 qsurf(1:ngrid mx,igcm_elec) = 0.648 qsurf(1:ngrid,igcm_co2plus) = 0. 649 qsurf(1:ngrid,igcm_o2plus) = 0. 650 qsurf(1:ngrid,igcm_oplus) = 0. 651 qsurf(1:ngrid,igcm_coplus) = 0. 652 qsurf(1:ngrid,igcm_cplus) = 0. 653 qsurf(1:ngrid,igcm_nplus) = 0. 654 qsurf(1:ngrid,igcm_noplus) = 0. 655 qsurf(1:ngrid,igcm_n2plus) = 0. 656 qsurf(1:ngrid,igcm_hplus) = 0. 657 qsurf(1:ngrid,igcm_hco2plus) = 0. 658 qsurf(1:ngrid,igcm_elec) = 0. 657 659 658 660 else -
trunk/LMDZ.MARS/libf/aeronomars/jthermcalc.F
r1036 r1047 1680 1680 !c*************************************************** 1681 1681 1682 use comsaison_h, only: dist_sol 1682 1683 implicit none 1683 1684 … … 1686 1687 include "dimensions.h" 1687 1688 include "dimphys.h" 1688 include "comsaison.h"1689 ! include "comsaison.h" 1689 1690 include 'param.h' 1690 1691 include 'param_v4.h' -
trunk/LMDZ.MARS/libf/aeronomars/moldiff.F
r1036 r1047 1 subroutine moldiff(pplay,pplev,pt,pdt,pq,pdq,ptimestep, 1 subroutine moldiff(ngrid,nlayer,nq, 2 & pplay,pplev,pt,pdt,pq,pdq,ptimestep, 2 3 & zzlay,pdteuv,pdtconduc,pdqdiff) 3 4 4 use tracer_mod, only: nqmx,igcm_co2, igcm_co, igcm_o, igcm_o1d,5 use tracer_mod, only: igcm_co2, igcm_co, igcm_o, igcm_o1d, 5 6 & igcm_o2, igcm_o3, igcm_h, igcm_h2, igcm_oh, 6 7 & igcm_ho2, igcm_h2o2, igcm_n2, igcm_ar, 7 8 & igcm_h2o_vap, mmol 9 use conc_mod, only: rnew, mmean 8 10 implicit none 9 11 10 #include "dimensions.h"11 #include "dimphys.h"12 !#include "dimensions.h" 13 !#include "dimphys.h" 12 14 #include "comcstfi.h" 13 #include "callkeys.h"14 #include "comdiurn.h"15 #include "chimiedata.h"15 !#include "callkeys.h" 16 !#include "comdiurn.h" 17 !#include "chimiedata.h" 16 18 !#include "tracer.h" 17 #include "conc.h"19 !#include "conc.h" 18 20 19 21 … … 21 23 c Input/Output 22 24 c 25 integer,intent(in) :: ngrid ! number of atmospheric columns 26 integer,intent(in) :: nlayer ! number of atmospheric layers 27 integer,intent(in) :: nq ! number of advected tracers 23 28 real ptimestep 24 real pplay(ngrid mx,nlayermx)25 real zzlay(ngrid mx,nlayermx)26 real pplev(ngrid mx,nlayermx+1)27 real pq(ngrid mx,nlayermx,nqmx)28 real pdq(ngrid mx,nlayermx,nqmx)29 real pt(ngrid mx,nlayermx)30 real pdt(ngrid mx,nlayermx)31 real pdteuv(ngrid mx,nlayermx)32 real pdtconduc(ngrid mx,nlayermx)33 real pdqdiff(ngrid mx,nlayermx,nqmx)29 real pplay(ngrid,nlayer) 30 real zzlay(ngrid,nlayer) 31 real pplev(ngrid,nlayer+1) 32 real pq(ngrid,nlayer,nq) 33 real pdq(ngrid,nlayer,nq) 34 real pt(ngrid,nlayer) 35 real pdt(ngrid,nlayer) 36 real pdteuv(ngrid,nlayer) 37 real pdtconduc(ngrid,nlayer) 38 real pdqdiff(ngrid,nlayer,nq) 34 39 c 35 40 c Local … … 42 47 real del1,del2, tmean ,dalfinvdz, d 43 48 real hh,dcoef,dcoef1,ptfac, ntot, dens, dens2, dens3 44 real hp(nlayer mx)45 real tt(nlayer mx)46 real qq(nlayer mx,ncompmoldiff)47 real dmmeandz(nlayer mx)48 real qnew(nlayer mx,ncompmoldiff)49 real zlocal(nlayer mx)49 real hp(nlayer) 50 real tt(nlayer) 51 real qq(nlayer,ncompmoldiff) 52 real dmmeandz(nlayer) 53 real qnew(nlayer,ncompmoldiff) 54 real zlocal(nlayer) 50 55 real alf(ncompmoldiff-1,ncompmoldiff-1) 51 real alfinv(nlayer mx,ncompmoldiff-1,ncompmoldiff-1)56 real alfinv(nlayer,ncompmoldiff-1,ncompmoldiff-1) 52 57 real indx(ncompmoldiff-1) 53 real b(nlayer mx,ncompmoldiff-1)58 real b(nlayer,ncompmoldiff-1) 54 59 real y(ncompmoldiff-1,ncompmoldiff-1) 55 real aa(nlayer mx,ncompmoldiff-1,ncompmoldiff-1)56 real bb(nlayer mx,ncompmoldiff-1,ncompmoldiff-1)57 real cc(nlayer mx,ncompmoldiff-1,ncompmoldiff-1)58 real atri(nlayer mx-2)59 real btri(nlayer mx-2)60 real ctri(nlayer mx-2)61 real rtri(nlayer mx-2)62 real qtri(nlayer mx-2)60 real aa(nlayer,ncompmoldiff-1,ncompmoldiff-1) 61 real bb(nlayer,ncompmoldiff-1,ncompmoldiff-1) 62 real cc(nlayer,ncompmoldiff-1,ncompmoldiff-1) 63 real atri(nlayer-2) 64 real btri(nlayer-2) 65 real ctri(nlayer-2) 66 real rtri(nlayer-2) 67 real qtri(nlayer-2) 63 68 real alfdiag(ncompmoldiff-1) 64 69 real wi(ncompmoldiff), flux(ncompmoldiff), pote … … 211 216 cccccccccccccccccccccccccccccccccccccccccccccccccccccccc 212 217 213 nz=nlayer mx214 215 do ig=1,ngrid mx218 nz=nlayer 219 220 do ig=1,ngrid 216 221 217 222 do l=2,nz-1 … … 291 296 write(*,*) 'ig, l=',ig, l 292 297 write(*,*) 'No molecular diffusion this time !' 293 call zerophys(ngridmx*nlayermx*nqmx,pdqdiff)298 pdqdiff(1:ngrid,1:nlayer,1:nq)=0 294 299 return 295 300 c stop -
trunk/LMDZ.MARS/libf/aeronomars/moldiff_red.F90
r1036 r1047 1 subroutine moldiff_red(pplay,pplev,pt,pdt,pq,pdq,ptimestep,zzlay,pdteuv,pdtconduc,pdqdiff) 2 3 use tracer_mod, only: nqmx, noms, mmol 1 subroutine moldiff_red(ngrid,nlayer,nq,pplay,pplev,pt,pdt,pq,pdq,& 2 ptimestep,zzlay,pdteuv,pdtconduc,pdqdiff) 3 4 use tracer_mod, only: noms, mmol 4 5 5 6 implicit none 6 7 7 #include "dimensions.h"8 #include "dimphys.h"8 !#include "dimensions.h" 9 !#include "dimphys.h" 9 10 #include "comcstfi.h" 10 #include "callkeys.h"11 #include "comdiurn.h"12 #include "chimiedata.h"11 !#include "callkeys.h" 12 !#include "comdiurn.h" 13 !#include "chimiedata.h" 13 14 !#include "tracer.h" 14 #include "conc.h"15 !#include "conc.h" 15 16 #include "diffusion.h" 16 17 … … 19 20 ! Input/Output 20 21 ! 22 integer,intent(in) :: ngrid ! number of atmospheric columns 23 integer,intent(in) :: nlayer ! number of atmospheric layers 24 integer,intent(in) :: nq ! number of advected tracers 21 25 real ptimestep 22 real pplay(ngrid mx,nlayermx)23 real zzlay(ngrid mx,nlayermx)24 real pplev(ngrid mx,nlayermx+1)25 real pq(ngrid mx,nlayermx,nqmx)26 real pdq(ngrid mx,nlayermx,nqmx)27 real pt(ngrid mx,nlayermx)28 real pdt(ngrid mx,nlayermx)29 real pdteuv(ngrid mx,nlayermx)30 real pdtconduc(ngrid mx,nlayermx)31 real pdqdiff(ngrid mx,nlayermx,nqmx)26 real pplay(ngrid,nlayer) 27 real zzlay(ngrid,nlayer) 28 real pplev(ngrid,nlayer+1) 29 real pq(ngrid,nlayer,nq) 30 real pdq(ngrid,nlayer,nq) 31 real pt(ngrid,nlayer) 32 real pdt(ngrid,nlayer) 33 real pdteuv(ngrid,nlayer) 34 real pdtconduc(ngrid,nlayer) 35 real pdqdiff(ngrid,nlayer,nq) 32 36 ! 33 37 ! Local … … 37 41 ! real hco2(ncompdiff),ho 38 42 39 integer,dimension(nq mx) :: indic_diff43 integer,dimension(nq) :: indic_diff 40 44 integer ig,iq,nz,l,k,n,nn,p,ij0 41 45 integer istep,il,gcn,ntime,nlraf … … 44 48 real*8 rho0,D0,T0,H0,time0,dZ,time,dZraf,tdiff,Zmin,Zmax 45 49 real*8 FacEsc,invsgmu 46 real*8 hp(nlayer mx)47 real*8 pp(nlayer mx)48 real*8 pint(nlayer mx)49 real*8 tt(nlayer mx),tnew(nlayermx),tint(nlayermx)50 real*8 zz(nlayer mx)50 real*8 hp(nlayer) 51 real*8 pp(nlayer) 52 real*8 pint(nlayer) 53 real*8 tt(nlayer),tnew(nlayer),tint(nlayer) 54 real*8 zz(nlayer) 51 55 real*8,dimension(:,:),allocatable,save :: qq,qnew,qint,FacMass 52 56 real*8,dimension(:,:),allocatable,save :: rhoK,rhokinit 53 real*8 rhoT(nlayer mx)54 real*8 dmmeandz(nlayer mx)55 real*8 massemoy(nlayer mx)57 real*8 rhoT(nlayer) 58 real*8 dmmeandz(nlayer) 59 real*8 massemoy(nlayer) 56 60 real*8,dimension(:),allocatable :: Praf,Traf,Rraf,Mraf,Nraf,Draf,Hraf,Wraf 57 61 real*8,dimension(:),allocatable :: Zraf,Tdiffraf … … 130 134 131 135 ncompdiff=0 132 indic_diff(1:nq mx)=0136 indic_diff(1:nq)=0 133 137 134 do nn=1,nq mx138 do nn=1,nq 135 139 do n=1,14 136 140 if (ListeDiff(n) .eq. noms(nn)) then … … 151 155 ! Store gcm indexes in gcmind 152 156 n=0 153 do nn=1,nq mx157 do nn=1,nq 154 158 if (indic_diff(nn) .eq. 1) then 155 159 n=n+1 … … 162 166 ! find vertical index above which diffusion is computed 163 167 164 do l=1,nlayer mx168 do l=1,nlayer 165 169 if (pplay(1,l) .gt. Pdiff) then 166 170 il0=l … … 176 180 177 181 ! allocatation des tableaux dependants du nombre d especes diffusees 178 allocate(qq(nlayer mx,ncompdiff))179 allocate(qnew(nlayer mx,ncompdiff))180 allocate(qint(nlayer mx,ncompdiff))181 allocate(FacMass(nlayer mx,ncompdiff))182 allocate(rhok(nlayer mx,ncompdiff))183 allocate(rhokinit(nlayer mx,ncompdiff))182 allocate(qq(nlayer,ncompdiff)) 183 allocate(qnew(nlayer,ncompdiff)) 184 allocate(qint(nlayer,ncompdiff)) 185 allocate(FacMass(nlayer,ncompdiff)) 186 allocate(rhok(nlayer,ncompdiff)) 187 allocate(rhokinit(nlayer,ncompdiff)) 184 188 185 189 allocate(wi(ncompdiff)) … … 212 216 213 217 ! print*,'moldiff',i_h2,i_h,ncompdiff 214 do ig=1,ngrid mx218 do ig=1,ngrid 215 219 pp=dble(pplay(ig,:)) 216 220 … … 218 222 219 223 ! CALL TMNEW(pt(ig,:),pdt(ig,:),pdtconduc(ig,:),pdteuv(ig,:) & 220 ! & ,tt,ptimestep,nlayer mx,ig)221 do l=1,nlayer mx224 ! & ,tt,ptimestep,nlayer,ig) 225 do l=1,nlayer 222 226 tt(l)=pt(ig,l)*1D0+(pdt(ig,l)*dble(ptimestep)+ & 223 227 pdtconduc(ig,l)*dble(ptimestep)+ & … … 228 232 pdt(ig,l),pdtconduc(ig,l),pdteuv(ig,l),dble(ptimestep) 229 233 endif 230 enddo ! of do l=1,nlayer mx234 enddo ! of do l=1,nlayer 231 235 232 236 ! Update the mass mixing ratios modified by other processes 233 237 234 ! CALL QMNEW(pq(ig,:,:),pdq(ig,:,:),qq,ptimestep,nlayer mx, &238 ! CALL QMNEW(pq(ig,:,:),pdq(ig,:,:),qq,ptimestep,nlayer, & 235 239 ! & ncompdiff,gcmind,ig) 236 240 do iq=1,ncompdiff 237 do l=1,nlayer mx241 do l=1,nlayer 238 242 qq(l,iq)=pq(ig,l,gcmind(iq))*1D0+( & 239 243 pdq(ig,l,gcmind(iq))*dble(ptimestep)) 240 244 qq(l,iq)=max(qq(l,iq),1d-30) 241 enddo ! of do l=1,nlayer mx245 enddo ! of do l=1,nlayer 242 246 enddo ! of do iq=1,ncompdiff 243 247 244 248 ! Compute the Pressure scale height 245 249 246 CALL HSCALE(pp,hp,nlayer mx)250 CALL HSCALE(pp,hp,nlayer) 247 251 248 252 ! Compute the atmospheric mass (in Dalton) 249 253 250 CALL MMOY(massemoy,mmol,qq,gcmind,nlayer mx,ncompdiff)254 CALL MMOY(massemoy,mmol,qq,gcmind,nlayer,ncompdiff) 251 255 252 256 ! Compute the vertical gradient of atmospheric mass 253 257 254 CALL DMMOY(massemoy,hp,dmmeandz,nlayer mx)258 CALL DMMOY(massemoy,hp,dmmeandz,nlayer) 255 259 256 260 ! Compute the altitude of each layer 257 261 258 CALL ZVERT(pp,tt,massemoy,zz,nlayer mx,ig)262 CALL ZVERT(pp,tt,massemoy,zz,nlayer,ig) 259 263 260 264 ! Compute the total mass density (kg/m3) 261 265 262 CALL RHOTOT(pp,tt,massemoy,qq,RHOT,RHOK,nlayer mx,ncompdiff)266 CALL RHOTOT(pp,tt,massemoy,qq,RHOT,RHOK,nlayer,ncompdiff) 263 267 RHOKINIT=RHOK 264 268 … … 271 275 Mtot1(1:ncompdiff)=0d0 272 276 273 do l=il0,nlayer mx277 do l=il0,nlayer 274 278 do nn=1,ncompdiff 275 279 Mtot1(nn)=Mtot1(nn)+1d0/g*qq(l,nn)* & … … 279 283 280 284 Zmin=zz(il0) 281 Zmax=zz(nlayer mx)285 Zmax=zz(nlayer) 282 286 283 287 … … 286 290 if (Zmax .gt. 4000000.) then 287 291 Print*,'Zmax too high',ig,zmax,zmin 288 do l=1,nlayer mx292 do l=1,nlayer 289 293 print*,'old',zz(l),pt(ig,l),pdteuv(ig,l),pdq(ig,l,:) 290 294 print*,'l',l,rhot(l),tt(l),pp(l),massemoy(l),qq(l,:) … … 321 325 CALL UPPER_RESOL(pp,tt,zz,massemoy,RHOT,RHOK, & 322 326 & qq,mmol,gcmind,Praf,Traf,Qraf,Mraf,Zraf, & 323 & Nraf,Nrafk,Rraf,Rrafk,il0,nlraf,ncompdiff,nlayer mx,ig)327 & Nraf,Nrafk,Rraf,Rrafk,il0,nlraf,ncompdiff,nlayer,ig) 324 328 325 329 Prafold=Praf … … 330 334 331 335 CALL GCMGRID_P(Zraf,Praf,Qraf,Traf,Nrafk,Rrafk,qq,qint,tt,tint & 332 & ,pp,mmol,gcmind,nlraf,ncompdiff,nlayer mx,ig)336 & ,pp,mmol,gcmind,nlraf,ncompdiff,nlayer,ig) 333 337 334 338 ! We compute the mass correction factor of each specie at each pressure level 335 339 336 CALL CORRMASS(qq,qint,FacMass,nlayer mx,ncompdiff)340 CALL CORRMASS(qq,qint,FacMass,nlayer,ncompdiff) 337 341 338 342 ! Altitude step … … 367 371 ! enddo 368 372 369 ! do l=1,nlayer mx373 ! do l=1,nlayer 370 374 ! print*,'l',l,zz(l),pp(l),tt(l),sum(qq(l,:)),massemoy(l) 371 375 ! enddo … … 374 378 ! No change below il0 375 379 376 do l=1,nlayer mx380 do l=1,nlayer 377 381 qnew(l,:)=qq(l,:) ! No effet below il0 378 382 enddo … … 527 531 print*,'Mraf',Mraf 528 532 stop 529 ! pdqdiff(1:ngrid mx,1:nlayermx,1:nqmx)=0.533 ! pdqdiff(1:ngrid,1:nlayer,1:nq)=0. 530 534 ! return 531 535 ! Rrafk(l,nn)=1D-30*Rraf(l) … … 572 576 573 577 CALL GCMGRID_P2(Zraf,Praf,Qraf,Traf,Nrafk,Rrafk,qq,qnew,tt,tnew,& 574 & pp,mmol,gcmind,nlraf,ncompdiff,nlayer mx,FacMass,ig)575 576 CALL RHOTOT(pp,tt,massemoy,qnew,RHOT,RHOK,nlayer mx,ncompdiff)578 & pp,mmol,gcmind,nlraf,ncompdiff,nlayer,FacMass,ig) 579 580 CALL RHOTOT(pp,tt,massemoy,qnew,RHOT,RHOK,nlayer,ncompdiff) 577 581 578 582 if (ig .eq. ij0) then 579 do l=il0,nlayer mx583 do l=il0,nlayer 580 584 write(*,'(i2,1x,19(e12.4,1x))') l,zz(l),tt(l),RHOK(l,1)/sum(RHOK(l,:)),RHOKINIT(l,1)/sum(RHOKINIT(l,:)),& 581 585 & RHOK(l,2)/sum(RHOK(l,:)),RHOKINIT(l,2)/sum(RHOKINIT(l,:)),& … … 590 594 Mtot2(1:ncompdiff)=0d0 591 595 592 do l=il0,nlayer mx596 do l=il0,nlayer 593 597 do nn=1,ncompdiff 594 598 Mtot2(nn)=Mtot2(nn)+1d0/g*qnew(l,nn)* & … … 600 604 601 605 ! do nn=1,ncompdiff 602 ! CALL CheckMass2(qq,qnew,pplev(ig,:),il0,nlayer mx,nn,ncompdiff)606 ! CALL CheckMass2(qq,qnew,pplev(ig,:),il0,nlayer,nn,ncompdiff) 603 607 ! enddo 604 608 605 609 ! Compute the diffusion trends du to diffusion 606 610 607 do l=1,nlayer mx611 do l=1,nlayer 608 612 do nn=1,ncompdiff 609 613 pdqdiff(ig,l,gcmind(nn))=(qnew(l,nn)-qq(l,nn))/ptimestep -
trunk/LMDZ.MARS/libf/aeronomars/moldiffcoeff.F
r1036 r1047 19 19 #include "dimphys.h" 20 20 #include "callkeys.h" 21 #include "comdiurn.h"21 !#include "comdiurn.h" 22 22 #include "chimiedata.h" 23 23 !#include "tracer.h" 24 #include "conc.h"24 !#include "conc.h" 25 25 26 26 c----------------------------------------------------------------------- -
trunk/LMDZ.MARS/libf/aeronomars/moldiffcoeff_red.F
r1036 r1047 15 15 #include "dimphys.h" 16 16 #include "callkeys.h" 17 #include "comdiurn.h"17 !#include "comdiurn.h" 18 18 #include "chimiedata.h" 19 19 !#include "tracer.h" 20 #include "conc.h"20 !#include "conc.h" 21 21 #include "diffusion.h" 22 22 -
trunk/LMDZ.MARS/libf/aeronomars/molvis.F
r690 r1047 1 SUBROUTINE molvis(ptimestep,pplay,pplev,pt,pdteuv,pdtconduc 1 SUBROUTINE molvis(ngrid,nlayer,ptimestep, 2 & pplay,pplev,pt,pdteuv,pdtconduc 2 3 $ ,pvel,tsurf,zzlev,zzlay,zdvelmolvis) 4 5 use conc_mod, only: cpnew, Akknew, rnew 3 6 IMPLICIT NONE 4 7 … … 17 20 c----------------------------------------------------------------------- 18 21 19 #include "dimensions.h"20 #include "dimphys.h"21 #include "comcstfi.h"22 #include "surfdat.h"23 #include "chimiedata.h"24 #include "conc.h"22 !#include "dimensions.h" 23 !#include "dimphys.h" 24 !#include "comcstfi.h" 25 !#include "surfdat.h" 26 !#include "chimiedata.h" 27 !#include "conc.h" 25 28 26 29 c arguments: 27 30 c ---------- 28 31 32 integer,intent(in) :: ngrid ! number of atmospheric columns 33 integer,intent(in) :: nlayer ! number of atmospheric layers 29 34 REAL ptimestep 30 REAL pplay(ngrid mx,nlayermx)31 REAL pplev(ngrid mx,nlayermx+1)32 REAL zzlay(ngrid mx,nlayermx)33 REAL zzlev(ngrid mx,nlayermx+1)34 real pt(ngrid mx,nlayermx)35 real tsurf(ngrid mx)36 REAL pvel(ngrid mx,nlayermx)37 REAL pdvel(ngrid mx,nlayermx)38 real pdteuv(ngrid mx,nlayermx)39 real pdtconduc(ngrid mx,nlayermx)35 REAL pplay(ngrid,nlayer) 36 REAL pplev(ngrid,nlayer+1) 37 REAL zzlay(ngrid,nlayer) 38 REAL zzlev(ngrid,nlayer+1) 39 real pt(ngrid,nlayer) 40 real tsurf(ngrid) 41 REAL pvel(ngrid,nlayer) 42 REAL pdvel(ngrid,nlayer) 43 real pdteuv(ngrid,nlayer) 44 real pdtconduc(ngrid,nlayer) 40 45 41 real zdvelmolvis(ngrid mx,nlayermx)46 real zdvelmolvis(ngrid,nlayer) 42 47 43 48 c local: 44 49 c ------ 45 50 46 INTEGER l,ig, n grid,nz47 real Akk, skk,phitop,velsurf,fac, m, tmean48 REAL zvel(nlayer mx)49 real zt(nlayer mx)50 REAL alpha(nlayer mx)51 REAL lambda(nlayer mx)52 real muvol(nlayer mx)53 REAL C(nlayer mx)54 real D(nlayer mx)55 real den(nlayer mx)56 REAL pdvelm(nlayer mx)57 REAL zlay(nlayer mx)58 real zlev(nlayer mx+1)51 INTEGER l,ig, nz 52 real Akk,phitop,fac, m, tmean 53 REAL zvel(nlayer) 54 real zt(nlayer) 55 REAL alpha(nlayer) 56 REAL lambda(nlayer) 57 real muvol(nlayer) 58 REAL C(nlayer) 59 real D(nlayer) 60 real den(nlayer) 61 REAL pdvelm(nlayer) 62 REAL zlay(nlayer) 63 real zlev(nlayer+1) 59 64 60 65 c constants used locally … … 67 72 68 73 69 PARAMETER (skk=0.69)74 REAL,PARAMETER :: skk=0.69 70 75 71 PARAMETER (velsurf =0.0)76 REAL,PARAMETER :: velsurf =0.0 72 77 73 logical firstcall 74 save firstcall 75 data firstcall /.true./ 78 logical,save :: firstcall=.true. 79 76 80 c----------------------------------------------------------------------- 77 81 c calcul des coefficients alpha et lambda … … 90 94 phitop=0.0 91 95 92 ngrid=ngridmx 93 nz=nlayermx 96 nz=nlayer 94 97 95 98 do ig=1,ngrid -
trunk/LMDZ.MARS/libf/aeronomars/perosat.F
r1036 r1047 1 SUBROUTINE perosat( ig, ptimestep,1 SUBROUTINE perosat(ngrid,nlayer,nq,ig, ptimestep, 2 2 $ pplev, pplay, zt, 3 3 & zy, pdqcloud, pdqscloud) 4 use tracer_mod, only: nqmx, igcm_h2o2, mmol 4 5 use tracer_mod, only: igcm_h2o2, mmol 6 use conc_mod, only: mmean 5 7 IMPLICIT NONE 6 8 … … 22 24 c ------------- 23 25 24 #include "dimensions.h"25 #include "dimphys.h"26 !#include "dimensions.h" 27 !#include "dimphys.h" 26 28 #include "comcstfi.h" 27 #include "chimiedata.h"29 !#include "chimiedata.h" 28 30 !#include "tracer.h" 29 #include "conc.h"31 !#include "conc.h" 30 32 c 31 33 c arguments: 32 34 c ---------- 33 35 36 integer,intent(in) :: ngrid ! number of atmospheric columns 37 integer,intent(in) :: nlayer ! number of atmospheric layers 38 integer,intent(in) :: nq ! number of tracers 34 39 INTEGER ig 35 40 REAL ptimestep ! pas de temps physique (s) 36 REAL pplev(ngrid mx,nlayermx+1)! pression aux inter-couches (Pa)37 REAL pplay(ngrid mx,nlayermx)! pression au milieu des couches (Pa)38 REAL zt(nlayer mx)! temperature au centre des couches (K)41 REAL pplev(ngrid,nlayer+1) ! pression aux inter-couches (Pa) 42 REAL pplay(ngrid,nlayer) ! pression au milieu des couches (Pa) 43 REAL zt(nlayer) ! temperature au centre des couches (K) 39 44 ! deja mise a jour dans calchim 40 45 41 46 c Traceurs : 42 real zy(nlayer mx,nqmx) ! traceur (fraction molaire sortie chimie)43 real pdqcloud(ngrid mx,nlayermx,nqmx) ! tendance condensation (kg/kg.s-1)44 real pdqscloud(ngrid mx,nqmx) ! flux en surface (kg.m-2.s-1)47 real zy(nlayer,nq) ! traceur (fraction molaire sortie chimie) 48 real pdqcloud(ngrid,nlayer,nq) ! tendance condensation (kg/kg.s-1) 49 real pdqscloud(ngrid,nq) ! flux en surface (kg.m-2.s-1) 45 50 46 51 c local: … … 49 54 INTEGER l,iq 50 55 51 REAL zysat(nlayer mx)52 REAL zynew(nlayer mx)! mole fraction after condensation56 REAL zysat(nlayer) 57 REAL zynew(nlayer) ! mole fraction after condensation 53 58 REAL psat_hg ! pression saturante (mm Hg) 54 59 REAL psat_hpa ! pression saturante (hPa) … … 57 62 c Pour diagnostique : 58 63 c ~~~~~~~~~~~~~~~~~ 59 REAL taucond(ngrid mx,nlayermx) ! taux de condensation (kg/kg/s-1)64 REAL taucond(ngrid,nlayer) ! taux de condensation (kg/kg/s-1) 60 65 61 66 c----------------------------------------------------------------------- … … 80 85 c domaine d'application: T < 220 K 81 86 c 82 do l = 1,nlayer mx87 do l = 1,nlayer 83 88 84 89 c print *,'ig=',ig,' l=',l,' igcm_h2o2=',igcm_h2o2 … … 103 108 c (Pour diagnostic seulement !) 104 109 c 105 do l=1, nlayer mx110 do l=1, nlayer 106 111 taucond(ig,l)=max((zy(l,igcm_h2o2)-zysat(l))*mmol(igcm_h2o2) 107 112 $ /(mmean(ig,l)*ptimestep),0.) … … 111 116 c ~~~~~~~~~~~~~~~~~~~~~~~~~~ 112 117 c 113 do l=nlayer mx,2, -1118 do l=nlayer,2, -1 114 119 if (zynew(l).gt.zysat(l)) then 115 120 zynew(l-1) = zynew(l-1) + (zynew(l) - zysat(l)) … … 135 140 c ~~~~~~~~~~~~~~~ 136 141 c 137 do l=1, nlayer mx142 do l=1, nlayer 138 143 pdqcloud(ig,l,igcm_h2o2)=(zynew(l) - zy(l,igcm_h2o2)) 139 144 & *mmol(igcm_h2o2)/(mmean(ig,l)*ptimestep) -
trunk/LMDZ.MARS/libf/aeronomars/surfacearea.F
r1036 r1047 7 7 use tracer_mod, only: nuice_sed, igcm_dust_number, 8 8 & igcm_ccn_number, varian, ccn_factor 9 use conc_mod, only: rnew 9 10 implicit none 10 11 … … 18 19 19 20 #include "dimensions.h" 20 #include "dimphys.h"21 !#include "dimphys.h" 21 22 #include "comcstfi.h" 22 23 #include "callkeys.h" 23 24 !#include "tracer.h" 24 #include "dimradmars.h" 25 !#include "dimradmars.h" 26 ! naerkind is set in scatterers.h (built when compiling with makegcm -s #) 27 #include"scatterers.h" 25 28 #include "chimiedata.h" 26 #include "conc.h"29 !#include "conc.h" 27 30 28 31 ! input -
trunk/LMDZ.MARS/libf/aeronomars/thermosphere.F
r1036 r1047 1 subroutine thermosphere(pplev,pplay,dist_sol, 1 subroutine thermosphere(ngrid,nlayer,nq, 2 & pplev,pplay,dist_sol, 2 3 $ mu0,ptimestep,ptime,zday,tsurf,zzlev,zzlay, 3 4 & pt,pq,pu,pv,pdt,pdq, 4 5 $ zdteuv,zdtconduc,zdumolvis,zdvmolvis,zdqmoldiff) 5 6 6 use tracer_mod, only: nqmx ! number of advecter tracers7 use conc_mod, only: rnew, cpnew 7 8 implicit none 8 9 9 #include "dimensions.h"10 #include "dimphys.h"10 !#include "dimensions.h" 11 !#include "dimphys.h" 11 12 #include "comcstfi.h" 12 13 #include "callkeys.h" 13 #include "comdiurn.h"14 #include "param.h"15 #include "param_v4.h"16 #include "chimiedata.h"17 #include "conc.h"14 !#include "comdiurn.h" 15 !#include "param.h" 16 !#include "param_v4.h" 17 !#include "chimiedata.h" 18 !#include "conc.h" 18 19 19 20 20 INTEGER l,ig 21 22 REAL pplay(ngridmx,nlayermx) 23 real pplev(ngridmx,nlayermx+1) 24 REAL zzlay(ngridmx,nlayermx) 25 real zzlev(ngridmx,nlayermx+1) 26 REAL pt(ngridmx,nlayermx) 21 integer,intent(in) :: ngrid ! number of atmospheric columns 22 integer,intent(in) :: nlayer ! number of atmospheric layers 23 integer,intent(in) :: nq ! number of advected tracers 24 REAL pplay(ngrid,nlayer) 25 real pplev(ngrid,nlayer+1) 26 REAL zzlay(ngrid,nlayer) 27 real zzlev(ngrid,nlayer+1) 28 REAL pt(ngrid,nlayer) 27 29 real zday 28 30 REAL dist_sol 29 real mu0(ngrid mx)30 real pq(ngrid mx,nlayermx,nqmx)31 real mu0(ngrid) 32 real pq(ngrid,nlayer,nq) 31 33 real ptimestep 32 34 real ptime 33 real tsurf(ngrid mx)34 REAL pu(ngrid mx,nlayermx),pv(ngridmx,nlayermx)35 REAL pdt(ngrid mx,nlayermx),pdq(ngridmx,nlayermx,nqmx)35 real tsurf(ngrid) 36 REAL pu(ngrid,nlayer),pv(ngrid,nlayer) 37 REAL pdt(ngrid,nlayer),pdq(ngrid,nlayer,nq) 36 38 37 REAL zdteuv(ngrid mx,nlayermx)38 REAL zdtconduc(ngrid mx,nlayermx)39 REAL zdumolvis(ngrid mx,nlayermx)40 REAL zdvmolvis(ngrid mx,nlayermx)41 real zdqmoldiff(ngrid mx,nlayermx,nqmx)39 REAL zdteuv(ngrid,nlayer) 40 REAL zdtconduc(ngrid,nlayer) 41 REAL zdumolvis(ngrid,nlayer) 42 REAL zdvmolvis(ngrid,nlayer) 43 real zdqmoldiff(ngrid,nlayer,nq) 42 44 43 logical firstcall 44 save firstcall 45 data firstcall /.true./ 45 INTEGER l,ig 46 logical,save :: firstcall=.true. 46 47 47 48 if (firstcall) then 48 49 if (.not. tracer) then 49 do l=1,nlayer mx50 do ig=1,ngrid mx50 do l=1,nlayer 51 do ig=1,ngrid 51 52 rnew(ig,l)=r 52 53 cpnew(ig,l)=cpp … … 58 59 59 60 if (calleuv) then 60 call zerophys(ngridmx*nlayermx,zdteuv)61 call euvheat( pt,pdt,pplev,pplay,zzlay,61 zdteuv(1:ngrid,1:nlayer)=0 62 call euvheat(ngrid,nlayer,nq,pt,pdt,pplev,pplay,zzlay, 62 63 $ mu0,ptimestep,ptime,zday,pq,pdq,zdteuv) 63 64 endif 64 65 65 66 if (callconduct) THEN 66 call zerophys(ngridmx*nlayermx,zdtconduc)67 call conduction( ptimestep,pplay,pplev,pt,zdteuv,67 zdtconduc(1:ngrid,1:nlayer)=0 68 call conduction(ngrid,nlayer,ptimestep,pplay,pplev,pt,zdteuv, 68 69 $ tsurf,zzlev,zzlay,zdtconduc) 69 70 endif 70 71 71 72 if (callmolvis) THEN 72 call zerophys(ngridmx*nlayermx,zdumolvis) 73 call molvis(ptimestep,pplay,pplev,pt,zdteuv,zdtconduc,pu, 73 zdumolvis(1:ngrid,1:nlayer)=0 74 call molvis(ngrid,nlayer,ptimestep,pplay,pplev,pt, 75 & zdteuv,zdtconduc,pu, 74 76 $ tsurf,zzlev,zzlay,zdumolvis) 75 call zerophys(ngridmx*nlayermx,zdvmolvis) 76 call molvis(ptimestep,pplay,pplev,pt,zdteuv,zdtconduc,pv, 77 zdvmolvis(1:ngrid,1:nlayer)=0 78 call molvis(ngrid,nlayer,ptimestep,pplay,pplev,pt, 79 & zdteuv,zdtconduc,pv, 77 80 $ tsurf,zzlev,zzlay,zdvmolvis) 78 81 endif 79 82 80 83 if (callmoldiff) THEN 81 call zerophys(ngridmx*nlayermx*nqmx,zdqmoldiff) 82 call moldiff_red(pplay,pplev,pt,pdt,pq,pdq,ptimestep, 84 zdqmoldiff(1:ngrid,1:nlayer,1:nq)=0 85 call moldiff_red(ngrid,nlayer,nq, 86 & pplay,pplev,pt,pdt,pq,pdq,ptimestep, 83 87 & zzlay,zdteuv,zdtconduc,zdqmoldiff) 84 88 endif
Note: See TracChangeset
for help on using the changeset viewer.