Ignore:
Timestamp:
Mar 6, 2012, 11:36:52 AM (13 years ago)
Author:
emillour
Message:

Mars GCM:

Added option "q=profile" in newstart to initialize a given tracer with

a profile specified in an ASCII file.

Minor fix on lect_start_archive : when tracers were not found, a default

value was asked to user, but twice! Once is enough.

EM

File:
1 edited

Legend:

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

    r480 r563  
    155155     
    156156      INTEGER :: nq,numvanle
    157       character(len=20) :: txt ! to store some text
     157      character(len=50) :: txt ! to store some text
    158158      integer :: count
     159      real :: profile(llm+1) ! to store an atmospheric profile + surface value
    159160
    160161! MONS data:
     
    482483      write(*,*) 'q=0 : ALL tracer =zero'
    483484      write(*,*) 'q=x : give a specific uniform value to one tracer'
     485      write(*,*) 'q=profile : specify a profile for a tracer'
    484486      write(*,*) 'ini_q : tracers initialisation for chemistry, water an
    485487     $d ice   '
     
    779781                 qsurf(ig,iq)=val
    780782             ENDDO
     783
     784c       q=profile : initialize tracer with a given profile
     785c       --------------------------------------------------
     786        else if (trim(modif) .eq. 'q=profile') then
     787             write(*,*) 'Tracer profile will be sought in ASCII file'
     788             write(*,*) "'profile_tracer' where 'tracer' is tracer name"
     789             write(*,*) "(one value per line in file; starting with"
     790             write(*,*) "surface value, the 1st atmospheric layer"
     791             write(*,*) "followed by 2nd, etc. up to top of atmosphere)"
     792             write(*,*) 'Which tracer do you want to set?'
     793             do iq=1,nqmx
     794               write(*,*)iq,' : ',trim(tnom(iq))
     795             enddo
     796             write(*,*) '(choose between 1 and ',nqmx,')'
     797             read(*,*) iq
     798             if ((iq.lt.1).or.(iq.gt.nqmx)) then
     799               ! wrong value for iq, go back to menu
     800               write(*,*) "wrong input value:",iq
     801               cycle
     802             endif
     803             ! look for input file 'profile_tracer'
     804             txt="profile_"//trim(tnom(iq))
     805             open(41,file=trim(txt),status='old',form='formatted',
     806     &            iostat=ierr)
     807             if (ierr.eq.0) then
     808               ! OK, found file 'profile_...', load the profile
     809               do l=1,llm+1
     810                 read(41,*,iostat=ierr) profile(l)
     811                 if (ierr.ne.0) then ! something went wrong
     812                   exit ! quit loop
     813                 endif
     814               enddo
     815               if (ierr.eq.0) then
     816                 ! initialize tracer values
     817                 qsurf(:,iq)=profile(1)
     818                 do l=1,llm
     819                   q(:,:,l,iq)=profile(l+1)
     820                 enddo
     821                 write(*,*)'OK, tracer ',trim(tnom(iq)),' initialized ',
     822     &                     'using values from file ',trim(txt)
     823               else
     824                 write(*,*)'problem reading file ',trim(txt),' !'
     825                 write(*,*)'No modifications to tracer ',trim(tnom(iq))
     826               endif
     827             else
     828               write(*,*)'Could not find file ',trim(txt),' !'
     829               write(*,*)'No modifications to tracer ',trim(tnom(iq))
     830             endif
     831             
    781832
    782833c       ini_q : Initialize tracers for chemistry
Note: See TracChangeset for help on using the changeset viewer.