Ignore:
Timestamp:
Sep 20, 2012, 1:26:25 PM (12 years ago)
Author:
emillour
Message:

Mars GCM utility:

update of zrecast utility: add possibility to have automatic "MCD/GCM"

altitude above surface levels as well as the possibility to specify min,
max and number of levels.

EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/util/zrecast.F90

    r777 r788  
    128128                            ! has to be computed; false if these are given
    129129                            ! by the user
     130logical :: auto_mcd_levels ! Flag: specific case for MCD automatic above
     131                           ! local surface levels
    130132!===============================================================================
    131133! 1. Input parameters
     
    549551text="dummy" ! dummy initialization
    550552auto_vert_levels=.true. ! dummy initialization to get rid of compiler warning
    551 do while ((trim(text).ne."yes").and.(trim(text).ne."no"))
     553do while ((trim(text).ne."yes").and.(trim(text).ne."no").and.(trim(text).ne."mcd"))
    552554  write(*,*) ""
    553555  write(*,*) "Automatic generation of vertical levels distribution? (yes/no)"
    554556  write(*,*) "(yes: you only provide min, max and number of levels)"
    555557  write(*,*) "(no: you provide values for each level)"
     558  write(*,*) "(mcd: special case for above local surface levels for MCD)"
    556559  read(*,'(a64)') text
    557560  if (trim(text).eq."yes") then
    558561    auto_vert_levels=.true.
    559   else
     562    auto_mcd_levels=.false.
     563  elseif(trim(text).eq."no") then
    560564    auto_vert_levels=.false.
     565  elseif(trim(text).eq."mcd") then
     566    auto_vert_levels=.true.
     567    auto_mcd_levels=.true.
    561568  endif
    562569enddo
     
    565572  ! ask for # of points and end values for pressure or above areoid cases
    566573  write(*,*) ""
    567   if ((ztype.le.2).or.(ztype.ge.4)) then
    568     write(*,*) "Enter min and max of vertical coordinate (Pa or m)"
    569     write(*,*) " (in that order and on the same line)"
    570     if (ztype.eq.1) then ! pressure coordinate
    571       read(*,*) pmin,pmax
    572     else ! altitude coordinate
    573       read(*,*) zamin,zamax
    574     endif
    575   endif ! of if ((ztype.le.2).or.(ztype.ge.4))
     574  write(*,*) "Enter min and max of vertical coordinate (Pa or m)"
     575  write(*,*) " (in that order and on the same line)"
     576  if (ztype.eq.1) then ! pressure coordinate
     577    read(*,*) pmin,pmax
     578  else ! altitude coordinate
     579     read(*,*) zamin,zamax
     580  endif
    576581
    577582  ! Build corresponding vertical coordinates
     
    611616    endif
    612617  else if (ztype.eq.3) then ! above local surface
    613     ! set nblev to # of levels from input data files
    614     nblev=altlength
    615     allocate(zsurface(nblev),stat=ierr)
    616     if (ierr.ne.0) then
    617       write(*,*) "Error: Failed to allocate zsurface(nblev)"
    618       write(*,*) "     nblev=",nblev
    619       stop
    620     endif
    621     ! build specific above local surface altitudes
    622     call build_zs(nblev,have_sigma,sigma,aps,bps,zsurface)
     618    if (auto_mcd_levels) then
     619      ! set nblev to # of levels from input data files
     620      nblev=altlength
     621      allocate(zsurface(nblev),stat=ierr)
     622      if (ierr.ne.0) then
     623        write(*,*) "Error: Failed to allocate zsurface(nblev)"
     624        write(*,*) "     nblev=",nblev
     625        stop
     626      endif
     627      ! build specific above local surface altitudes
     628      call build_zs(nblev,have_sigma,sigma,aps,bps,zsurface)
     629    else
     630      write(*,*) "Number of levels along vertical coordinate?"
     631      read(*,*) nblev
     632      allocate(zsurface(nblev),stat=ierr)
     633      if (ierr.ne.0) then
     634        write(*,*) "Error: Failed to allocate zsurface(nblev)"
     635        write(*,*) "     nblev=",nblev
     636        stop
     637      endif
     638      if (nblev.eq.1) then ! in case only one level is asked for
     639        zsurface(nblev)=zamin
     640      else
     641        do i=1,nblev
     642          zsurface(i)=zamin+(real(i)-1.0)*((zamax-zamin)/(real(nblev)-1.0))
     643        enddo
     644      endif
     645    endif ! of if (auto_mcd_levels)
    623646  else ! distance to center of planet
    624647   write(*,*) "Number of levels along vertical coordinate?"
Note: See TracChangeset for help on using the changeset viewer.