Changeset 1366 for trunk/UTIL


Ignore:
Timestamp:
Nov 7, 2014, 11:11:45 AM (10 years ago)
Author:
slebonnois
Message:

SL: zrecast corrected and tested to be compatible with Venus and Titan. Adopted.

Location:
trunk/UTIL
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/UTIL/compile

    r1360 r1366  
    44# > compile zrecast
    55
    6 # pgf90 -Bstatic   $1.F90 \
    7 #-I/distrib/local/netcdf/pgi_7.1-6_32/include \
    8 #-L/distrib/local/netcdf/pgi_7.1-6_32/lib -lnetcdf  -o $1.e
     6# pgf sur les machines du LMD:
     7#-----------------------------
     8#pgf95 -Bstatic $1.F90 \
     9#-I/distrib/local/netcdf/pgi_7.1-6_64/include \
     10#-L/distrib/local/netcdf/pgi_7.1-6_64/lib -lnetcdf -o $1.e
    911
    10 #ifort $1.F90 \
    11 #pgf90 $1.F90 \
     12# ifort
     13#------
    1214ifort $1.F90 \
    1315-I$NETCDF/include \
    1416-L$NETCDF/lib -lnetcdf -o $1.e
    1517
     18#-----------------------------------------------------------------
    1619# Before running that on you computer you might want to change :
     20#-----------------------------------------------------------------
    1721# 1) replace "pgf90" with the name of your favorite compiler
    1822#    (you may also add some non-agressive optimization options e.g. -O2)
  • trunk/UTIL/zrecast.F90

    r1363 r1366  
    55real :: g0 ! gravity at a0  (Mars: g0=3.7257964 ; Lemoine et al. 2001)
    66real :: R0 ! reduced gaz constant (Mars: R=191)
     7character(len=20) :: planet
    78end module planet_const
    89
     
    17141715    stop
    17151716  endif
    1716 else ! hybrid coordinates
     1717elseif (have_hyb) then ! hybrid coordinates
    17171718  ierr=NF_PUT_VAR_REAL(outfid,aps_varid,aps)
    17181719  if (ierr.ne.NF_NOERR) then
     
    20162017! initialize planetary constants using the "controle" array in the file
    20172018! if "controle" array not found in file, look for it in "diagfi.nc"
     2019! if still no "controle" array nowhere, ask for planet name
     2020
    20182021use planet_const
    20192022use netcdf
     
    20282031integer :: infid2 ! for an alternate input file
    20292032real :: controle(100) ! to store "controle" array
     2033logical :: have_ctl
     2034
     2035planet="dunno"
     2036have_ctl=.false.
    20302037
    20312038! look for "controle" in input file
     
    20332040varname="controle"
    20342041status=nf90_inq_varid(infid,trim(varname),varid)
    2035 if (status.ne.nf90_noerr) then
     2042
     2043if (status.eq.nf90_noerr) then
     2044  write(*,*) "OK, found ",trim(varname)
     2045  have_ctl=.true.
     2046else
    20362047  write(*,*) "init_planet_const: Failed to find ",trim(varname)
    20372048  write(*,*) " looking for it in file diagfi.nc"
    20382049  status=nf90_open("diagfi.nc",NF90_NOWRITE,infid2)
    2039   if (status.ne.nf90_noerr) then
     2050  if (status.eq.nf90_noerr) then
     2051    status=nf90_inq_varid(infid2,trim(varname),varid)
     2052    if (status.eq.nf90_noerr) then
     2053      write(*,*) "OK, found ",trim(varname)
     2054      have_ctl=.true.
     2055    else
     2056      write(*,*) " Failed to find ",trim(varname)," in file!!"
     2057    endif
     2058  else
    20402059    write(*,*) " no diafi.nc file ... looking for diagfi1.nc"
    20412060    status=nf90_open("diagfi1.nc",NF90_NOWRITE,infid2)
    2042     if (status.ne.nf90_noerr) then
    2043       write(*,*) "might as well stop here..."
    2044       stop
     2061    if (status.eq.nf90_noerr) then
     2062      status=nf90_inq_varid(infid2,trim(varname),varid)
     2063      if (status.eq.nf90_noerr) then
     2064        write(*,*) "OK, found ",trim(varname)
     2065        have_ctl=.true.
     2066      else
     2067        write(*,*) " Failed to find ",trim(varname)," in file!!"
     2068      endif
    20452069    endif
    20462070  endif
    2047   status=nf90_inq_varid(infid2,trim(varname),varid)
     2071endif
     2072
     2073if (have_ctl) then
     2074  status=nf90_get_var(infid2,varid,controle)
    20482075  if (status.ne.nf90_noerr) then
    2049     write(*,*) " Failed to find ",trim(varname)," in file!!"
     2076    write(*,*) "init_planet_const: Failed to load ",trim(varname)
    20502077    stop
    20512078  endif
    2052   write(*,*) "OK, found ",trim(varname)
     2079  ! now that we have "controle"; extract relevent informations
     2080  a0=controle(5) ! = radius of planet (m)
     2081  g0=controle(7) ! = gravity (m.s-2) at a0
     2082  R0=1000.*8.314511/controle(8) ! controle(8)=mugaz = molar mass (g.mol-1) of atm.
     2083else
     2084   write(*,*) "No controle found."
     2085   write(*,*) "You need to tell me on which planet we are:"
     2086   read(*,'(a20)') planet
     2087   write(*,*) ""
     2088   if (trim(planet).eq."titan") then
     2089     a0=2575.E3 ! = radius of planet (m)
     2090     g0=1.35 ! = gravity (m.s-2) at a0
     2091     R0=296.9 ! = molecular gas constant
     2092   else if (trim(planet).eq."venus") then
     2093     a0=6051.E3 ! = radius of planet (m)
     2094     g0=8.87 ! = gravity (m.s-2) at a0
     2095     R0=191.4 ! = molecular gas constant
     2096   else
     2097     write(*,*) "init_planet_const: Failed to init ",trim(planet), &
     2098                 " constants..."
     2099     stop
     2100   endif
    20532101endif
    2054 status=nf90_get_var(infid2,varid,controle)
    2055 if (status.ne.nf90_noerr) then
    2056   write(*,*) "init_planet_const: Failed to load ",trim(varname)
    2057   stop
    2058 endif
    2059 
    2060 ! now that we have "controle"; extract relevent informations
    2061 a0=controle(5) ! = radius of planet (m)
    2062 g0=controle(7) ! = gravity (m.s-2) at a0
    2063 R0=1000.*8.314511/controle(8) ! controle(8)=mugaz = molar mass (g.mol-1) of atm.
    20642102
    20652103end subroutine init_planet_const
Note: See TracChangeset for help on using the changeset viewer.