Changeset 120


Ignore:
Timestamp:
May 17, 2011, 4:27:01 PM (14 years ago)
Author:
emillour
Message:

-Mars GCM:

set internal computations using double precision in growthrate.F and

watercloud.F (otherwise we sometimes end up with Nans).

add extra checks in newcondens.F to avoid possibility of out of bounds

evaluation of array masse()

EM

Location:
trunk/mars
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/mars/README

    r117 r120  
    632632   --> fix by moving the closing "endif" [in addition to corrections mentioned in the previous point]
    633633
     634== 17/10/2011 == EM
     635>> set internal computations using double precision in growthrate.F and
     636   watercloud.F (otherwise we sometimes end up with Nans).
     637>> add extra checks in newcondens.F to avoid possibility of out of bounds
     638   evaluation of array masse()
     639   
  • trunk/mars/libf/phymars/growthrate.F

    r38 r120  
    2323      REAL*8 psat ! water vapor saturation pressure (Pa)
    2424      REAL r    ! crystal radius before condensation (m)
    25       REAL seq  ! Equilibrium saturation ratio
    26       REAL dr   ! crystal radius variation (m)
     25      REAL*8 seq  ! Equilibrium saturation ratio
     26!      REAL dr   ! crystal radius variation (m)
     27      REAL*8 Cste
    2728
    2829c   local:
    2930c   ------
    3031
    31       REAL molco2,molh2o
    32       REAL Mco2,Mh2o,rho_i,sigh2o
    33       REAL nav,rgp,kbz,pi,To
     32      REAL*8 molco2,molh2o
     33      REAL*8 Mco2,Mh2o,rho_i,sigh2o
     34      REAL*8 nav,rgp,kbz,pi,To
    3435
    3536c     Effective gas molecular radius (m)
    36       data molco2/2.2e-10/   ! CO2
     37      data molco2/2.2d-10/   ! CO2
    3738c     Effective gas molecular radius (m)
    38       data molh2o/1.2e-10/   ! H2O
     39      data molh2o/1.2d-10/   ! H2O
    3940c     Molecular weight of CO2
    40       data Mco2/44.e-3/            ! kg.mol-1
     41      data Mco2/44.d-3/            ! kg.mol-1
    4142c     Molecular weight of H2O
    42       data Mh2o/18.e-3/            ! kg.mol-1
     43      data Mh2o/18.d-3/            ! kg.mol-1
    4344c     surface tension of ice/vapor
    4445      data sigh2o/0.12/      ! N.m
     
    4647      data rho_i/917./        ! kg.m-3 also defined in initcld.f
    4748c     Avogadro number
    48       data nav/6.023e23/
     49      data nav/6.023d23/
    4950c     Perfect gas constant
    5051      data rgp/8.3143/
    5152c     Boltzman constant
    52       data kbz/1.381e-23/
     53      data kbz/1.381d-23/
    5354c     pi number
    5455      data pi/3.141592654/
     
    5657      data To/273.15/
    5758
    58       REAL k,Lv                 
    59       REAL knudsen           ! Knudsen number (gas mean free path/particle radius)
    60       REAL a,Dv,lambda       ! Intermediate computations for growth rate
     59      REAL*8 k,Lv                 
     60      REAL*8 knudsen           ! Knudsen number (gas mean free path/particle radius)
     61      REAL*8 a,Dv,lambda       ! Intermediate computations for growth rate
    6162      REAL*8 Rk,Rd
    62       REAL Cste, rf
    6363
    6464c-----------------------------------------------------------------------
  • trunk/mars/libf/phymars/newcondens.F

    r86 r120  
    854854             Mtot = masse(m+1)
    855855             MQtot = masse(m+1)*q(m+1)
    856              do while ((m.gt.0).and.(-w(l+1).gt.(Mtot+masse(m))))
     856             if (m.gt.0) then ! because some compilers will have problems
     857                              ! evaluating masse(0)
     858              do while ((m.gt.0).and.(-w(l+1).gt.(Mtot+masse(m))))
    857859                m=m-1
    858860                Mtot = Mtot + masse(m+1)
    859861                MQtot = MQtot + masse(m+1)*q(m+1)
    860              end do
     862                if (m.eq.0) exit
     863              end do
     864             endif
    861865             if (m.gt.0) then
    862866                sigw=(w(l+1)+Mtot)/masse(m)
  • trunk/mars/libf/phymars/newsedim.F

    r117 r120  
    179179             ptop=exp(-(dztop-Ep)*g/(r*pt(ig,l+k)))
    180180             IF ( ptop .eq. 1. ) THEN
    181                 PRINT*, 'exposant trop petit ', ig, l
     181                PRINT*, 'newsedim: exposant trop petit ', ig, l
    182182                ptop=pplev(ig,l+k) * ( 1. - (dztop-Ep)*g/(r*pt(ig,l+k)))
    183183             ELSE
  • trunk/mars/libf/phymars/watercloud.F

    r83 r120  
    7575      REAL CBRT
    7676      EXTERNAL CBRT
    77       INTEGER ig,iq,l
     77      INTEGER ig,l
    7878
    7979
     
    8585      REAL masse (ngridmx,nlayermx)
    8686      REAL epaisseur (ngridmx,nlayermx)
    87       REAL rfinal        ! Ice crystal radius after condensation(m)
    88       REAL seq           ! Equilibrium saturation ration (accounting for curvature effect)
    89       REAL dzq           ! masse de glace echangee (kg/kg)
     87!      REAL rfinal        ! Ice crystal radius after condensation(m)
     88      REAL*8 seq           ! Equilibrium saturation ration (accounting for curvature effect)
     89      REAL*8 dzq           ! masse de glace echangee (kg/kg)
    9090      REAL lw       !Latent heat of sublimation (J.kg-1)
    9191      REAL,PARAMETER :: To=273.15 ! reference temperature, T=273.15 K
     
    9393      REAL Ctot
    9494      REAL*8 ph2o,satu
    95       REAL gr,Cste,up,dwn,newvap
     95      REAL*8 gr,Cste,up,dwn,newvap
    9696
    9797      LOGICAL,SAVE :: firstcall=.true.
     
    104104c     REAL rave(ngridmx)               ! Mean crystal radius in a column (m)
    105105
    106       INTEGER i
    107 
    108106! indexes of water vapour, water ice and dust tracers:
    109107      INTEGER,SAVE :: i_h2o=0  ! water vapour
    110108      INTEGER,SAVE :: i_ice=0  ! water ice
    111       CHARACTER(LEN=20) :: tracername ! to temporarly store text
    112109
    113110c    ** un petit test de coherence
     
    209206c         Improved microphysics scheme
    210207c         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    211 
    212208           Ctot = zq(ig,l,i_h2o) + zq(ig,l,i_ice)
    213209           ph2o = zq(ig,l,i_h2o) * 44. / 18. * pplay(ig,l)
Note: See TracChangeset for help on using the changeset viewer.