Ignore:
Timestamp:
Apr 19, 2014, 10:35:38 AM (11 years ago)
Author:
emillour
Message:

Mars GCM:
Add "composition" option in newstart to enable global modification of
CO2,N2,Ar,O2 and CO mixing ratios. Plus some cleanup on physics variables
(saved arrays) which have been moved to modules.
FF+EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/phymars/newstart.F

    r1231 r1232  
    1515c=======================================================================
    1616
    17 ! to use  'getin'
    1817      use ioipsl_getincom, only: getin
    1918      use infotrac, only: iniadvtrac, nqtot, tname
    20       use tracer_mod, only: noms, igcm_dust_number, igcm_dust_mass,
     19      use tracer_mod, only: noms, mmol,
     20     &                      igcm_dust_number, igcm_dust_mass,
    2121     &                      igcm_ccn_number, igcm_ccn_mass,
    22      &                      igcm_h2o_vap, igcm_h2o_ice
     22     &                      igcm_h2o_vap, igcm_h2o_ice, igcm_co2,
     23     &                      igcm_n2, igcm_ar, igcm_o2, igcm_co
    2324      use surfdat_h, only: phisfi, z0, zmea, zstd, zsig, zgam, zthe,
    24      &                     albedodat, z0_default
    25       use comsoil_h, only: inertiedat, layer, mlayer, nsoilmx
     25     &                     albedodat, z0_default, qsurf, tsurf,
     26     &                     co2ice, emis
     27      use comsoil_h, only: inertiedat, layer, mlayer, nsoilmx, tsoil
    2628      use control_mod, only: day_step, iphysiq, anneeref
    2729      use phyredem, only: physdem0, physdem1
    2830      use iostart, only: open_startphy
    2931      use comgeomphy, only: initcomgeomphy
    30       use planete_h
     32!      use planete_h
     33      use dimradmars_mod, only: tauscaling
     34      use turb_mod, only: q2
    3135      implicit none
    3236
     
    6973c--------------------------------------------------
    7074      INTEGER nid_dyn, nid_fi,nid,nvarid
    71 !      INTEGER size
    72       INTEGER length
    73       parameter (length = 100)
    7475      INTEGER tab0
    75       INTEGER   NB_ETATMAX
    76       parameter (NB_ETATMAX = 100)
    7776
    7877      REAL  date
     
    105104c variable physique
    106105c------------------
    107       REAL tsurf(ngridmx)       ! surface temperature
    108       REAL tsoil(ngridmx,nsoilmx) ! soil temperature
    109       REAL co2ice(ngridmx)      ! CO2 ice layer
    110       REAL emis(ngridmx)        ! surface emissivity
    111       REAL tauscaling(ngridmx) ! dust conversion factor
     106!      REAL tsurf(ngridmx)      ! surface temperature
     107!      REAL tsoil(ngridmx,nsoilmx) ! soil temperature
     108!      REAL co2ice(ngridmx)     ! CO2 ice layer
     109!      REAL emis(ngridmx)       ! surface emissivity
     110!      REAL tauscaling(ngridmx) ! dust conversion factor
    112111      REAL tauscadyn(iip1,jjp1) ! dust conversion factor on the dynamics grid
    113       REAL,ALLOCATABLE :: qsurf(:,:)
    114       REAL q2(ngridmx,nlayermx+1)
     112!      REAL,ALLOCATABLE :: qsurf(:,:)
     113!      REAL q2(ngridmx,nlayermx+1)
    115114!      REAL rnaturfi(ngridmx)
    116115      real alb(iip1,jjp1),albfi(ngridmx) ! albedos
     
    122121      real mugaz ! molar mass of the atmosphere
    123122
    124       EXTERNAL iniconst,geopot,inigeom
    125123      integer ierr  !, nbetat
    126       integer ismin
    127       external ismin
    128124
    129125c Variables on the new grid along scalar points
     
    181177      real :: MONS_coeffN ! coeff for northern hemisphere
    182178!      real,parameter :: icedepthmin=1.e-3 ! Ice begins at most at that depth
     179! Reference position for composition
     180      real :: latref,lonref,dlatmin,dlonmin
     181! Variable used to change composition
     182      real :: Svmr,Smmr,Smmr_old,Smmr_new,Sn
     183      real :: Mair_old,Mair_new,vmr_old,vmr_new
     184      real,allocatable :: coefvmr(:)  ! Correction coefficient when changing composition
    183185
    184186c sortie visu pour les champs dynamiques
     
    200202! allocate arrays
    201203      allocate(q(iip1,jjp1,llm,nqtot))
    202       allocate(qsurf(ngridmx,nqtot))
    203      
     204!      allocate(qsurf(ngridmx,nqtot)) ! done in ini_surfdat_h
     205      allocate(coefvmr(nqtot))
     206
    204207c=======================================================================
    205208c   Choice of the start file(s) to use
     
    521524      write(*,*) 'ini_q-h2o    : tracers initialization for chemistry
    522525     $ only'
     526      write(*,*) 'composition  : change atm main composition: CO2,N2,Ar,
     527     $ O2,CO'
    523528      write(*,*) 'ini_h2osurf  : reinitialize surface water ice '
    524529      write(*,*) 'noglacier    : Remove tropical H2O ice if |lat|<45'
     
    974979          write(*,*) 'inichim_newstart: chemical species initialised
    975980     $ (except water vapour)'
     981
     982c      composition : change main composition: CO2,N2,Ar,O2,CO (FF 03/2014)
     983c      --------------------------------------------------------
     984       else if (trim(modif) .eq. 'composition') then
     985          write(*,*) "Lat (degN)  lon (degE) of the reference site ?"
     986          write(*,*) "e.g. MSL : -4.5  137.  "
     987 301      read(*,*,iostat=ierr) latref, lonref
     988          if(ierr.ne.0) goto 301
     989
     990
     991        !  Select GCM point close to reference site
     992          dlonmin =90.
     993          DO i=1,iip1-1
     994             if (abs(rlonv(i)*180./pi -lonref).lt.dlonmin)then
     995                iref=i
     996                dlonmin=abs(rlonv(i)*180./pi -lonref)
     997             end if   
     998          ENDDO
     999          dlatmin =45.
     1000          DO j=1,jjp1
     1001             if (abs(rlatu(j)*180./pi -latref).lt.dlatmin)then
     1002                jref=j
     1003                dlatmin=abs(rlatu(j)*180./pi -latref)
     1004             end if   
     1005          ENDDO
     1006          write(*,*) "In GCM : lat= " ,  rlatu(jref)*180./pi
     1007          write(*,*) "In GCM : lon= " ,  rlonv(iref)*180./pi
     1008          write(*,*)
     1009
     1010        ! Compute air molar mass at reference site
     1011          Smmr=0
     1012          Sn = 0
     1013          do iq=1,nqtot
     1014             if ((iq.eq.igcm_co2).or.(iq.eq.igcm_n2)
     1015     &      .or. (iq.eq.igcm_ar).or.(iq.eq.igcm_o2)
     1016     &      .or. (iq.eq.igcm_co)) then
     1017                 Smmr=Smmr+q(iref,jref,1,iq)
     1018                 Sn=Sn+q(iref,jref,1,iq)/mmol(iq)
     1019             end if
     1020          end do
     1021          write(*,*) "At reference site :  "
     1022          write(*,*) "Sum of mass mix. ratio (should be about 1)=",Smmr
     1023          Mair_old =Smmr/Sn
     1024          write(*,*)
     1025     &     "Air molar mass (g/mol) at reference site= ",Mair_old
     1026
     1027        ! Ask for new volume mixing ratio at reference site
     1028          Svmr =0.
     1029          Sn =0.
     1030          do iq=1,nqtot
     1031           coefvmr(iq) = 1.
     1032           if ((iq.eq.igcm_n2).or.(iq.eq.igcm_ar)
     1033     &     .or. (iq.eq.igcm_o2).or.(iq.eq.igcm_co)) then
     1034
     1035             vmr_old=q(iref,jref,1,iq)*Mair_old/mmol(iq) 
     1036             write(*,*) "Previous vmr("//trim(tname(iq))//")= ", vmr_old
     1037
     1038              if (iq.eq.igcm_n2) then
     1039                write(*,*) "New vmr(n2)? (MSL: 1.89E-02 at Ls~186)"
     1040              endif
     1041              if (iq.eq.igcm_ar) then
     1042                write(*,*) "New vmr(ar)? (MSL: 1.93E-02 at Ls~186)"
     1043              endif
     1044              if (iq.eq.igcm_o2) then
     1045                write(*,*) "New vmr(o2)? (MSL: 1.46E-03) at Ls~186"
     1046              endif
     1047              if (iq.eq.igcm_co) then
     1048                write(*,*) "New vmr(co)? (~8.E-04)"
     1049              endif
     1050 302          read(*,*,iostat=ierr) vmr_new
     1051              if(ierr.ne.0) goto 302
     1052              write(*,*) "New vmr("//trim(tname(iq))//")= ",vmr_new
     1053              write(*,*)
     1054              coefvmr(iq) = vmr_new/vmr_old
     1055              Svmr=Svmr+vmr_new
     1056              Sn=Sn+vmr_new*mmol(iq)
     1057           end if
     1058          enddo ! of do iq=1,nqtot
     1059      !  Estimation of new Air molar mass at reference site (assuming vmr_co2 = 1-Svmr)
     1060          Mair_new = Sn + (1-Svmr)*mmol(igcm_co2)
     1061          write(*,*)
     1062     &     "NEW Air molar mass (g/mol) at reference site= ",Mair_new
     1063
     1064        ! Compute mass mixing ratio changes 
     1065          do iq=1,nqtot 
     1066            if ((iq.eq.igcm_n2).or.(iq.eq.igcm_ar)
     1067     &          .or. (iq.eq.igcm_o2).or.(iq.eq.igcm_co)) then
     1068             write(*,*) "Everywhere mmr("//trim(tname(iq))//
     1069     &        ") is multiplied by ",coefvmr(iq)*Mair_old/Mair_new
     1070            end if
     1071          end do
     1072
     1073        ! Recompute mass mixing ratios everywhere, and adjust mmr(CO2) to keep sum of mmr constant.
     1074          do l=1,llm
     1075           do j=1,jjp1
     1076            do i=1,iip1
     1077              Smmr_old = 0.
     1078              Smmr_new = 0.
     1079              do iq=1,nqtot 
     1080                if ((iq.eq.igcm_n2).or.(iq.eq.igcm_ar)
     1081     &         .or. (iq.eq.igcm_o2).or.(iq.eq.igcm_co)) then
     1082                   Smmr_old = Smmr_old + q(i,j,l,iq) ! sum of old mmr
     1083                   q(i,j,l,iq)=q(i,j,l,iq)*coefvmr(iq)*Mair_old/Mair_new
     1084                   Smmr_new = Smmr_new + q(i,j,l,iq) ! sum of new mmr
     1085                end if
     1086              enddo
     1087              q(i,j,l,igcm_co2) = q(i,j,l,igcm_co2) + Smmr_old-Smmr_new
     1088            enddo
     1089           enddo
     1090          enddo
     1091
     1092          write(*,*)
     1093     &   "mmr(CO2) is modified everywhere to keep sum of mmr constant"
     1094          write(*,*) 'At reference site vmr(CO2)=',
     1095     &        q(iref,jref,1,igcm_co2)*Mair_new/mmol(igcm_co2)
     1096          write(*,*) "Compared to MSL observation: vmr(CO2)= 0.9597"
     1097
    9761098
    9771099c      wetstart : wet atmosphere with a north to south gradient
Note: See TracChangeset for help on using the changeset viewer.