Changeset 1224 for trunk


Ignore:
Timestamp:
Apr 15, 2014, 4:57:48 PM (11 years ago)
Author:
aslmd
Message:

LMDZ.MARS. If not major, a quite important commit.

  1. No more SAVE,ALLOCATABLE arrays outside modules.

This is important to solve the nesting conundrum in MESOSCALE.
And overall this is good for the harmony of the universe.
(Joke apart, this is good for any interfacing task. And compliant with a F90 spirit).
Note that bit-to-bit compatibility of results in debug mode was checked.

  1. inifis is split in two : phys_state_var_init + conf_phys

This makes interfacing with MESOSCALE more transparent.
This is also clearer for LMDZ.MARS.
Before, inifis has two very different tasks to do.

  1. a bit of cleaning as far as modules and saves are concerned

Point 1

  • Removed SAVE,ALLOCATABLE arrays from

physiq, aeropacity, updatereffrad, soil

and put those in

dimradmars_mod, surfdat_h, tracer_mod, comsoil_h

and changed accordingly the initialization subroutines associated to each module.
Allocating these arrays is thus done at initialization.

Point 2

  • Created a subroutine phys_state_var_init which does all the allocation / initialization work for modules. This was previously done in inifis.
  • Replaced inifis which was then (after the previous modification) just about reading callphys.def and setting a few constants by conf_phys. This mimics the new LMDZ terminology (cf. LMDZ.VENUS for instance)
  • Bye bye inifis.

Point 3

  • Removed comdiurn and put everything in comgeomfi
  • Created a turb_mod module for turbulence variables (e.g. l0 in yamada4)
  • dryness had nothing to do in tracer_h, put it in surfdat_h (like watercaptag)
  • topdust0 does not need to be SAVE in aeropacity. better use sinlat.
  • emisref does not need to be SAVE in newcondens. made it automatic array.
  • Removed useless co2ice argument in initracer.
Location:
trunk/LMDZ.MARS
Files:
2 added
1 deleted
23 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/README

    r1208 r1224  
    19481948  before such a GCM run, although 'q=profile' could be used too.
    19491949
     1950== 13/11/2013 == AS
     1951--> Added precompiling flag MESOSCALE around pressure modifications
     1952    done in revision 883. This makes the mesoscale model become crazy.
     1953
    19501954== 20/11/2013 == EM
    19511955- Correction: in physiq.F, move newcondens (CO2 condensation routine) so that
     
    20122016  Modified accordingly startfi and start_archive writing and reading routines.
    20132017
    2014 
     2018== 24/03/2014 == AS
     2019--> fixed a potential bug in thermal plume model because zlmax was computed both in thermcell_main_mars and calltherm_interface... so made it an OUT argument
     2020 of calltherm_interface. also: changed the name to limz. and added precompiling flags to avoid the use of planetwide in MESOSCALE. in MESOSCALE we just go hi
     2021gh enough (nlayer-5) and do not care about computational cost (although we certainly gain from not using MAXVAL).
     2022--> moved allocations upward in inifis. does not change anything for GCM, but make MESOSCALE modifications simpler, and overall make inifis better organized:
     2023 first allocations, then reading callphys.def file.
     2024--> added precompiling flags around lines that are both useless for MESOSCALE (notably I/O) and recently adapted to parallel computations in the GCM
     2025--> tidied up what is MESOSCALE vs. GCM in surfini
     2026
  • trunk/LMDZ.MARS/libf/phymars/aeropacity.F

    r1208 r1224  
    66      USE ioipsl_getincom, only: getin
    77      use tracer_mod, only: noms, igcm_h2o_ice, igcm_dust_mass,
    8      &                      igcm_dust_submicron, rho_dust, rho_ice
    9       use comgeomfi_h, only: lati ! grid point latitudes (rad)
     8     &                      igcm_dust_submicron, rho_dust, rho_ice,
     9     &                      nqdust
     10      use comgeomfi_h, only: lati, sinlat ! grid point latitudes (rad)
    1011      use yomaer_h, only: tauvis
    1112       IMPLICIT NONE
     
    111112                               !   Qabs instead of Qext
    112113                               !   (direct comparison with TES)
     114      REAL topdust0(ngrid)
    113115
    114116c   local saved variables
    115117c   ---------------------
    116 
    117       REAL,SAVE,ALLOCATABLE :: topdust0(:)
    118118
    119119c     Level under which the dust mixing ratio is held constant
     
    126126
    127127! indexes of water ice and dust tracers:
    128       INTEGER,ALLOCATABLE,SAVE :: nqdust(:) ! to store the indexes of dust tracers
    129128      INTEGER,SAVE :: i_ice=0  ! water ice
    130129      real,parameter :: odpref=610. ! DOD reference pressure (Pa)
     
    140139
    141140      IF (firstcall) THEN
    142         ! allocate local saved arrays
    143         allocate(nqdust(nq))
    144         allocate(topdust0(ngrid))
    145        
    146141        ! identify scatterers that are dust
    147142        naerdust=0
     
    167162          write(*,*) "aeropacity: i_ice=",i_ice
    168163        ENDIF
    169 
    170 c       altitude of the top of the aerosol layer (km) at Ls=2.76rad:
    171 c       in the Viking year scenario
    172         DO ig=1,ngrid
    173             topdust0(ig)=60. -22.*SIN(lati(ig))**2
    174         END DO
    175164
    176165c       typical profile of solsir and (1-w)^(-1):
     
    295284        else if (iddist.eq.2) then          ! "Viking" scenario
    296285          do ig=1,ngrid
     286            ! altitude of the top of the aerosol layer (km) at Ls=2.76rad:
     287            ! in the Viking year scenario
     288            topdust0(ig)=60. -22.*sinlat(ig)**2
    297289            topdust(ig)=topdust0(ig)+18.*zlsconst
    298290          end do
  • trunk/LMDZ.MARS/libf/phymars/comgeomfi_h.F90

    r1130 r1224  
    44       implicit none
    55
    6        ! These arrays are allocated in inifis
     6       ! These arrays are allocated in phys_state_var_init
    77       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: long ! longitudes (rad)
    88       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: lati ! latitudes (rad)
    99       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: area ! mesh area (m2)
    1010       REAL,SAVE :: totarea
     11       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: sinlon
     12       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: coslon
     13       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: sinlat
     14       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: coslat
     15
     16       contains
     17
     18         subroutine ini_comgeomfi_h(ngrid)
     19
     20         implicit none
     21         integer,intent(in) :: ngrid ! number of atmospheric columns
     22
     23         allocate(lati(ngrid))
     24         allocate(long(ngrid))
     25         allocate(area(ngrid))
     26
     27         end subroutine ini_comgeomfi_h
     28
     29         subroutine ini_sincosgeom(ngrid)
     30
     31         implicit none
     32         integer,intent(in) :: ngrid ! number of atmospheric columns
     33         integer :: ig
     34
     35         if (.not.allocated(lati)) then
     36           PRINT*,"lati not allocated. did you run ini_comgeomfi_h?"
     37           STOP
     38         endif
     39
     40         allocate(sinlat(ngrid))
     41         allocate(coslat(ngrid))
     42         allocate(sinlon(ngrid))
     43         allocate(coslon(ngrid))
     44         DO ig=1,ngrid
     45            sinlat(ig)=sin(lati(ig))
     46            coslat(ig)=cos(lati(ig))
     47            sinlon(ig)=sin(long(ig))
     48            coslon(ig)=cos(long(ig))
     49         ENDDO
     50         end subroutine ini_sincosgeom
    1151
    1252       end module comgeomfi_h
  • trunk/LMDZ.MARS/libf/phymars/comsoil_h.F90

    r1047 r1224  
    1414       !                 soil_settings.F)
    1515
     16  ! variables
     17  REAL,SAVE,ALLOCATABLE :: tsoil(:,:)  ! sub-surface temperatures (K)
     18  real,save,allocatable :: mthermdiff(:,:)  ! mid-layer thermal diffusivity
     19  real,save,allocatable :: thermdiff(:,:)   ! inter-layer thermal diffusivity
     20  real,save,allocatable :: coefq(:)         ! q_{k+1/2} coefficients
     21  real,save,allocatable :: coefd(:,:)       ! d_k coefficients
     22  real,save,allocatable :: alph(:,:)        ! alpha_k coefficients
     23  real,save,allocatable :: beta(:,:)        ! beta_k coefficients
     24  real,save :: mu
     25
    1626contains
    1727
     
    2434    allocate(mlayer(0:nsoilmx-1)) ! soil mid-layer depths
    2535    allocate(inertiedat(ngrid,nsoilmx)) ! soil thermal inertia
    26  
     36 
     37    allocate(tsoil(ngrid,nsoilmx)) ! soil temperatures
     38
     39    allocate(mthermdiff(ngrid,0:nsoilmx-1))
     40    allocate(thermdiff(ngrid,nsoilmx-1))
     41    allocate(coefq(0:nsoilmx-1))
     42    allocate(coefd(ngrid,nsoilmx-1))
     43    allocate(alph(ngrid,nsoilmx-1))
     44    allocate(beta(ngrid,nsoilmx-1))
     45
     46 
    2747  end subroutine ini_comsoil_h
    2848
  • trunk/LMDZ.MARS/libf/phymars/conf_phys.F

    r1223 r1224  
    1       SUBROUTINE inifis(
    2      $           ngrid,nlayer,nq
     1      SUBROUTINE conf_phys(
     2     $           nq
    33     $           ,day_ini,pdaysec,ptimestep
    4      $           ,plat,plon,parea
    54     $           ,prad,pg,pr,pcpp
    65#ifdef MESOSCALE
     
    2524!             E.M. (june 2009) use getin routine to load parameters
    2625!             adapted to the mesoscale use - Aymeric Spiga - 01/2007-07/2011
     26!             separated inifis into conf_phys and phys_state_var_init (A. Spiga)
    2727!
    2828!
     
    3333!   ------
    3434!
    35 !    ngrid                 Size of the horizontal grid.
    36 !                          All internal loops are performed on that grid.
    37 !    nlayer                Number of vertical layers.
     35!    nq                    Number of tracers
    3836!    pdayref               Day of reference for the simulation
    3937!    pday                  Number of days counted from the North. Spring
     
    4846      USE ioipsl_getincom, only : getin
    4947      use tracer_mod, only : nqmx, nuice_sed, ccn_factor
    50       use comsoil_h, only: ini_comsoil_h
    51       use comgeomfi_h, only: long, lati, area, totarea
    52       use comdiurn_h, only: sinlat, coslat, sinlon, coslon
    53       use surfdat_h, only: ini_surfdat_h, albedo_h2o_ice, inert_h2o_ice,
     48      use surfdat_h, only: albedo_h2o_ice, inert_h2o_ice,
    5449     &                     frost_albedo_threshold
    55       use comsaison_h, only: ini_comsaison_h
    56       use slope_mod, only: ini_slope_mod
    57       use dimradmars_mod, only: ini_dimradmars_mod
    58       use yomaer_h,only: ini_yomaer_h, tauvis
    59       use yomlw_h, only: ini_yomlw_h
    60       use conc_mod, only: ini_conc_mod
     50      use yomaer_h,only: tauvis
    6151      use control_mod, only: ecritphy
    6252
     
    7161      use comsoil_h, only: volcapa !!MESOSCALE -- needed to fill volcapa
    7262#endif
    73 
    7463
    7564      IMPLICIT NONE
     
    9887
    9988      REAL,INTENT(IN) :: ptimestep
    100       INTEGER,INTENT(IN) :: day_ini
    101 
    102       INTEGER,INTENT(IN) :: ngrid,nlayer,nq
    103       REAL,INTENT(IN) :: plat(ngrid),plon(ngrid),parea(ngrid)
     89      INTEGER,INTENT(IN) :: nq,day_ini
    10490      INTEGER ig,ierr
    105  
    106 !      EXTERNAL iniorbit,orbite
    107       EXTERNAL SSUM
    108       REAL SSUM
    10991 
    11092      CHARACTER ch1*12
     
    11799
    118100
    119 !!! 1. ALLOCATIONS
    120 !!! --------------
    121 
    122       ! allocate "slope_mod" arrays
    123       call ini_slope_mod(ngrid)
    124 
    125       ! allocate "comsaison_h" arrays
    126       call ini_comsaison_h(ngrid)
    127 
    128       ! allocate "surfdat_h" arrays
    129       call ini_surfdat_h(ngrid)
    130 
    131       ! allocate "comgeomfi_h" arrays
    132       allocate(lati(ngrid))
    133       allocate(long(ngrid))
    134       allocate(area(ngrid))
    135 
    136       ! fill "comgeomfi_h" data
    137       CALL SCOPY(ngrid,plon,1,long,1)
    138       CALL SCOPY(ngrid,plat,1,lati,1)
    139       CALL SCOPY(ngrid,parea,1,area,1)
    140       totarea=SSUM(ngrid,area,1)
    141 
    142       ! allocate "comdiurn_h" data
    143       allocate(sinlat(ngrid))
    144       allocate(coslat(ngrid))
    145       allocate(sinlon(ngrid))
    146       allocate(coslon(ngrid))
    147 
    148       ! fill "comdiurn_h" data
    149       DO ig=1,ngrid
    150          sinlat(ig)=sin(plat(ig))
    151          coslat(ig)=cos(plat(ig))
    152          sinlon(ig)=sin(plon(ig))
    153          coslon(ig)=cos(plon(ig))
    154       ENDDO
    155 
    156101      pi=2.*asin(1.) ! NB: pi is a common in comcstfi.h
    157 
    158       ! allocate "comsoil_h" arrays
    159       call ini_comsoil_h(ngrid)
    160 
    161       ! set some variables in "dimradmars_mod"
    162       call ini_dimradmars_mod(ngrid,nlayer)
    163 
    164       ! allocate arrays in "yomaer_h"
    165       call ini_yomaer_h
    166 
    167       ! allocate arrays in "yomlw_h"
    168       call ini_yomlw_h(ngrid)
    169 
    170       ! allocate arrays in "conc_mod"
    171       call ini_conc_mod(ngrid,nlayer)
    172 
    173 
    174 !!! 2. SETTINGS and CONSTANTS
    175 !!! -------------------------
    176102
    177103      rad=prad
     
    189115#include "meso_inc/meso_inc_inifisini.F"
    190116#endif
    191 
    192 ! --------------------------------------------------------
    193 !     The usual Tests
    194 !     --------------
    195 !      IF (nlayer.NE.nlayermx) THEN
    196 !         PRINT*,'STOP in inifis'
    197 !         PRINT*,'Probleme de dimensions :'
    198 !         PRINT*,'nlayer     = ',nlayer
    199 !         PRINT*,'nlayermx   = ',nlayermx
    200 !         STOP
    201 !      ENDIF
    202117
    203118      ! read in 'ecritphy' (frequency of calls to physics, in dynamical steps)
     
    218133         PRINT*
    219134         PRINT*,'--------------------------------------------'
    220          PRINT*,' inifis: Parameters for the physics (callphys.def)'
     135         PRINT*,' conf_phys: Parameters for the physics (callphys.def)'
    221136         PRINT*,'--------------------------------------------'
    222137
     
    789704
    790705      PRINT*
    791       PRINT*,'inifis: daysec',daysec
     706      PRINT*,'conf_phys: daysec',daysec
    792707      PRINT*
    793       PRINT*,'inifis: The radiative transfer is computed:'
     708      PRINT*,'conf_phys: The radiative transfer is computed:'
    794709      PRINT*,'           each ',iradia,' physical time-step'
    795710      PRINT*,'        or each ',iradia*dtphys,' seconds'
     
    817732     .     ,iostat=ierr)
    818733      IF(ierr.EQ.0) THEN
    819          write(*,*) 'inifis: Reading radia.def !!!'
     734         write(*,*) 'conf_phys: Reading radia.def !!!'
    820735         READ(99,fmt='(a)') ch1
    821736         READ(99,*) callemis
  • trunk/LMDZ.MARS/libf/phymars/datafile.h

    r79 r1224  
    55      COMMON/datadirectory/datafile
    66      character (len=100) :: datafile
    7 ! NB: default value for 'datafile' is set in inifis.F
     7! NB: default value for 'datafile' is set in conf_phys.F
    88!-----------------------------------------------------------------------
  • trunk/LMDZ.MARS/libf/phymars/dimradmars_mod.F90

    r1112 r1224  
    11module dimradmars_mod
    22!   Declaration and settings for radiative transfer calculations
    3 !   Initializations and allocations are done in inifis
     3!   Initializations and allocations are done in phys_state_var_init
    44implicit none
    55  ! nflev: number of vertical layer
     
    7272  integer,parameter :: nt_pademx=19
    7373
     74!!
     75!! variables
     76!!
     77  REAL,SAVE,ALLOCATABLE :: dtrad(:,:) ! Net atm. radiative heating rate (K.s-1)
     78  REAL,SAVE,ALLOCATABLE :: fluxrad_sky(:) ! rad. flux from sky absorbed by surface (W.m-2)
     79  REAL,SAVE,ALLOCATABLE :: fluxrad(:) ! Net radiative surface flux (W.m-2)
     80  REAL,SAVE,ALLOCATABLE :: albedo(:,:) ! Surface albedo in each solar band
     81  REAL,SAVE,ALLOCATABLE :: tauscaling(:)   ! Convertion factor for qdust and Ndust
     82! aerosol (dust or ice) extinction optical depth  at reference wavelength
     83! "longrefvis" set in dimradmars_mod , for one of the "naerkind"  kind of
     84! aerosol optical properties  :
     85  REAL,SAVE,ALLOCATABLE :: aerosol(:,:,:)
     86  REAL,SAVE,ALLOCATABLE :: nueffdust(:,:) ! Dust effective variance
     87
    7488contains
    7589 
     
    8094  integer,intent(in) :: ngrid ! number of atmospheric columns
    8195  integer,intent(in) :: nlayer ! number of atmospheric layers
    82  
     96
    8397   nflev=nlayer
    8498!  ndomainsz=ngrid
     
    88102   ndlo2=ndlon
    89103
     104   allocate(albedo(ngrid,2))
     105   allocate(dtrad(ngrid,nlayer))
     106   allocate(fluxrad_sky(ngrid))
     107   allocate(fluxrad(ngrid))
     108   allocate(tauscaling(ngrid))
     109   allocate(aerosol(ngrid,nlayer,naerkind))
     110   allocate(nueffdust(ngrid,nlayer))
     111
    90112  end subroutine ini_dimradmars_mod
    91113 
  • trunk/LMDZ.MARS/libf/phymars/iniphysiq.F90

    r1130 r1224  
    6969! copy some fundamental parameters to physics
    7070! and do some initializations
    71 call inifis(klon_omp,nlayer,nqtot,pdayref,punjours,ptimestep, &
    72             rlatd,rlond,airephy,prad,pg,pr,pcpp)
     71call phys_state_var_init(klon_omp,nlayer,nqtot,rlatd,rlond,airephy)
     72call conf_phys(nqtot,pdayref,punjours,ptimestep,prad,pg,pr,pcpp)
    7373
    7474!$OMP END PARALLEL
  • trunk/LMDZ.MARS/libf/phymars/initracer.F

    r1130 r1224  
    1       SUBROUTINE initracer(ngrid,nq,qsurf,co2ice)
     1      SUBROUTINE initracer(ngrid,nq,qsurf)
    22
    33#ifndef MESOSCALE
     
    3939      integer,intent(in) :: nq ! number of tracers
    4040      real,intent(out) :: qsurf(ngrid,nq) ! tracer on surface (e.g.  kg.m-2)
    41       real,intent(out) :: co2ice(ngrid) ! co2 ice mass on surface (e.g.  kg.m-2)
    4241
    4342      integer iq,ig,count
     
    6867      allocate(alpha_lift(nq))
    6968      allocate(alpha_devil(nq))
    70       allocate(dryness(ngrid))
    7169      allocate(igcm_dustbin(nq))
     70      allocate(nqdust(nq))
    7271
    7372#ifndef MESOSCALE
  • trunk/LMDZ.MARS/libf/phymars/newcondens.F

    r1130 r1224  
    145145      LOGICAL condsub(ngrid)
    146146
     147      real :: emisref(ngrid)
     148
    147149c variable speciale diagnostique
    148150      real tconda1(ngrid,nlayer)
     
    164166      integer,save :: ico2 ! index of CO2 tracer
    165167      real,save :: qco2min,qco2,mmean
    166       real,allocatable,save :: emisref(:)
    167168      real,parameter :: latcond=5.9e5 ! (J/kg) Latent heat of solid CO2 ice
    168169      real,parameter :: tcond1mb=136.27 ! condensation temperature (K) at 1 mbar
     
    182183c
    183184      IF (firstcall) THEN
    184          
    185          allocate(emisref(ngrid))
    186185         
    187186         bcond=1./tcond1mb
  • trunk/LMDZ.MARS/libf/phymars/newstart.F

    r1208 r1224  
    383383!    (for instance initracer needs to know about some flags, and/or
    384384!      'datafile' path may be changed by user)
    385       call inifis(ngridmx,llm,nqtot,day_ini,daysec,dtphys,
    386      &                latfi,lonfi,airefi,rad,g,r,cpp)
     385      call phys_state_var_init(ngridmx,llm,nqtot,latfi,lonfi,airefi)
     386      call conf_phys(nqtot,day_ini,daysec,dtphys,rad,g,r,cpp)
    387387
    388388c=======================================================================
     
    484484     
    485485      ! initialize tracer names noms(:) and indexes (igcm_co2, igcm_h2o_vap, ...)
    486       call initracer(ngridmx,nqtot,qsurf,co2ice)
     486      call initracer(ngridmx,nqtot,qsurf)
    487487     
    488488      if (count.eq.nqtot) then
  • trunk/LMDZ.MARS/libf/phymars/nirco2abs.F

    r1047 r1224  
    33                                                   
    44       use tracer_mod, only: igcm_co2, igcm_o
    5        use comdiurn_h, only: sinlon, coslon, sinlat, coslat
     5       use comgeomfi_h, only: sinlon, coslon, sinlat, coslat
    66       IMPLICIT NONE
    77c=======================================================================
  • trunk/LMDZ.MARS/libf/phymars/physiq.F

    r1212 r1224  
    1818     &                      nuice_ref, rho_ice, rho_dust, ref_r0
    1919      use comsoil_h, only: inertiedat, ! soil thermal inertia
    20      &                     nsoilmx ! number of subsurface layers
    21       use comgeomfi_h, only: long, lati, area
    22       use comdiurn_h, only: sinlon, coslon, sinlat, coslat
     20     &                     tsoil, nsoilmx ! number of subsurface layers
     21      use comgeomfi_h, only: long, lati, area,
     22     &                      sinlon, coslon, sinlat, coslat
    2323      use surfdat_h, only: phisfi, albedodat, zmea, zstd, zsig, zgam,
    2424     &                     zthe, z0, albedo_h2o_ice,
    25      &                     frost_albedo_threshold
     25     &                     frost_albedo_threshold,
     26     &                     tsurf, co2ice, emis,
     27     &                     capcal, fluxgrd, qsurf
    2628      use comsaison_h, only: dist_sol, declin, mu0, fract
    2729      use slope_mod, only: theta_sl, psi_sl
    2830      use conc_mod, only: rnew, cpnew, mmean
    2931      use control_mod, only: iphysiq, day_step, ecritstart
     32      use dimradmars_mod, only: tauscaling, aerosol,
     33     &                          dtrad, fluxrad_sky, fluxrad, albedo
     34      use turb_mod, only: q2, wstar, hfmax_th
    3035#ifdef MESOSCALE
    3136      use comsoil_h, only: mlayer,layer
     
    200205c Local saved variables:
    201206c ----------------------
    202 c     aerosol (dust or ice) extinction optical depth  at reference wavelength
    203 c     "longrefvis" set in dimradmars_mod , for one of the "naerkind"  kind of
    204 c      aerosol optical properties  :
    205       REAL,SAVE,ALLOCATABLE :: aerosol(:,:,:)
    206 
    207207      INTEGER,SAVE :: day_ini  ! Initial date of the run (sol since Ls=0)
    208208      INTEGER,SAVE :: icount     ! counter of calls to physiq during the run.
    209       REAL,SAVE,ALLOCATABLE :: tsurf(:)   ! Surface temperature (K)
    210       REAL,SAVE,ALLOCATABLE :: tsoil(:,:) ! sub-surface temperatures (K)
    211       REAL,SAVE,ALLOCATABLE :: co2ice(:)  ! co2 ice surface layer (kg.m-2) 
    212       REAL,SAVE,ALLOCATABLE :: albedo(:,:) ! Surface albedo in each solar band
    213       REAL,SAVE,ALLOCATABLE :: emis(:)    ! Thermal IR surface emissivity
    214       REAL,SAVE,ALLOCATABLE :: dtrad(:,:) ! Net atm. radiative heating rate (K.s-1)
    215       REAL,SAVE,ALLOCATABLE :: fluxrad_sky(:) ! rad. flux from sky absorbed by surface (W.m-2)
    216       REAL,SAVE,ALLOCATABLE :: fluxrad(:) ! Net radiative surface flux (W.m-2)
    217       REAL,SAVE,ALLOCATABLE :: capcal(:) ! surface heat capacity (J m-2 K-1)
    218       REAL,SAVE,ALLOCATABLE :: fluxgrd(:) ! surface conduction flux (W.m-2)
    219       REAL,ALLOCATABLE,SAVE :: qsurf(:,:) ! tracer on surface (e.g. kg.m-2)
    220       REAL,SAVE,ALLOCATABLE :: q2(:,:)    ! Turbulent Kinetic Energy
    221      
     209     
    222210c     Variables used by the water ice microphysical scheme:
    223211      REAL rice(ngrid,nlayer)    ! Water ice geometric mean radius (m)
     
    318306!      character*5 str5
    319307      real zdtdif(ngrid,nlayer), zdtadj(ngrid,nlayer)
    320       REAL,SAVE,ALLOCATABLE :: tauscaling(:)   ! Convertion factor for qdust and Ndust
    321308      real rdust(ngrid,nlayer) ! dust geometric mean radius (m)
    322309      integer igmin, lmin
     
    372359      REAL zz1(ngrid)
    373360      REAL lmax_th_out(ngrid),zmax_th(ngrid)
    374       REAL,SAVE,ALLOCATABLE :: wstar(:)
    375       REAL,SAVE,ALLOCATABLE :: hfmax_th(:)
    376361      REAL pdu_th(ngrid,nlayer),pdv_th(ngrid,nlayer)
    377362      REAL pdt_th(ngrid,nlayer),pdq_th(ngrid,nlayer,nq)
     
    399384      IF (firstcall) THEN
    400385
    401         ! allocate local (saved) arrays:
    402         allocate(qsurf(ngrid,nq))
    403         allocate(tsoil(ngrid,nsoilmx))
    404         allocate(tsurf(ngrid))
    405         allocate(aerosol(ngrid,nlayer,naerkind))
    406         allocate(co2ice(ngrid))
    407         allocate(albedo(ngrid,2))
    408         allocate(emis(ngrid))
    409         allocate(dtrad(ngrid,nlayer))
    410         allocate(fluxrad_sky(ngrid))
    411         allocate(fluxrad(ngrid))
    412         allocate(capcal(ngrid))
    413         allocate(fluxgrd(ngrid))
    414         allocate(q2(ngrid,nlayer+1))
    415         allocate(tauscaling(ngrid))
    416         allocate(wstar(ngrid))
    417         allocate(hfmax_th(ngrid))
    418        
    419386c        variables set to 0
    420387c        ~~~~~~~~~~~~~~~~~~
     
    455422         tracerdyn=tracer
    456423         IF (tracer) THEN
    457             CALL initracer(ngrid,nq,qsurf,co2ice)
     424            CALL initracer(ngrid,nq,qsurf)
    458425         ENDIF  ! end tracer
    459426
  • trunk/LMDZ.MARS/libf/phymars/soil.F

    r1047 r1224  
    33     &          timestep,tsurf,tsoil,
    44     &          capcal,fluxgrd)
    5       use comsoil_h, only: layer, mlayer, volcapa
     5
     6      use comsoil_h, only: layer, mlayer, volcapa,
     7     &                     mthermdiff, thermdiff, coefq,
     8     &                     coefd, alph, beta, mu
    69      use surfdat_h, only: watercaptag, inert_h2o_ice
     10
    711      implicit none
    812
     
    3943      real fluxgrd(ngrid) ! surface diffusive heat flux
    4044
    41 ! local saved variables:
    42       real,save,allocatable :: mthermdiff(:,:)  ! mid-layer thermal diffusivity
    43       real,save,allocatable :: thermdiff(:,:)   ! inter-layer thermal diffusivity
    44       real,save,allocatable :: coefq(:)         ! q_{k+1/2} coefficients
    45       real,save,allocatable :: coefd(:,:)       ! d_k coefficients
    46       real,save,allocatable :: alph(:,:)        ! alpha_k coefficients
    47       real,save,allocatable :: beta(:,:)        ! beta_k coefficients
    48       real,save :: mu
    49      
    5045! local variables:
    5146      integer ig,ik
    5247
    5348! 0. Initialisations and preprocessing step
    54       if (firstcall) then
    55         ! allocate local saved arrays:
    56         allocate(mthermdiff(ngrid,0:nsoil-1))
    57         allocate(thermdiff(ngrid,nsoil-1))
    58         allocate(coefq(0:nsoil-1))
    59         allocate(coefd(ngrid,nsoil-1))
    60         allocate(alph(ngrid,nsoil-1))
    61         allocate(beta(ngrid,nsoil-1))
    62       endif
    63      
    6449      if (firstcall.or.tifeedback) then
    6550      ! note: firstcall is set to .true. or .false. by the caller
  • trunk/LMDZ.MARS/libf/phymars/soil_tifeedback.F

    r1047 r1224  
    1414c   - One layer of surface water ice (the thickness is given
    1515c     by the variable icecover (in kg of ice per m2) and the thermal
    16 c     inertia is prescribed by inert_h2o_ice (see surfdat_h and inifis));
     16c     inertia is prescribed by inert_h2o_ice (see surfdat_h));
    1717c   - A transitional layer of mixed thermal inertia;
    1818c   - A last layer of regolith below the ice cover whose thermal inertia
  • trunk/LMDZ.MARS/libf/phymars/start2archive.F

    r1208 r1224  
    134134! allocate arrays:
    135135      allocate(q(ip1jmp1,llm,nqtot))
    136       allocate(qsurf(ngridmx,nqtot))
    137136      allocate(qsurfS(ip1jmp1,nqtot))
    138       call ini_surfdat_h(ngridmx)
     137      call ini_surfdat_h(ngridmx,nqtot)
    139138      call ini_comsoil_h(ngridmx)
    140139     
  • trunk/LMDZ.MARS/libf/phymars/surfdat_h.F90

    r1047 r1224  
    11module surfdat_h
    22
    3   ! arrays are allocated in inifis
     3  ! arrays are allocated in conf_phys
    44  real,save,allocatable :: albedodat(:) ! albedo of bare ground
    55  real,save,allocatable :: phisfi(:) ! geopotential at ground level
     
    99  logical,save :: TESicealbedo ! use TES ice cap albedoes (if set to .true.)
    1010  logical,save,allocatable :: watercaptag(:) ! flag for water ice surface
     11  real, save, allocatable :: dryness(:)
    1112     
    1213  logical,save :: temptag !temp tag for water caps
     
    2223  real,save :: z0_default ! default (constant over planet) surface roughness (m)
    2324
     25  !! variables
     26  REAL,SAVE,ALLOCATABLE :: tsurf(:)   ! Surface temperature (K)
     27  REAL,SAVE,ALLOCATABLE :: co2ice(:)  ! co2 ice surface layer (kg.m-2) 
     28  REAL,SAVE,ALLOCATABLE :: emis(:)    ! Thermal IR surface emissivity
     29  REAL,SAVE,ALLOCATABLE :: capcal(:) ! surface heat capacity (J m-2 K-1)
     30  REAL,SAVE,ALLOCATABLE :: fluxgrd(:) ! surface conduction flux (W.m-2)
     31  REAL,ALLOCATABLE,SAVE :: qsurf(:,:) ! tracer on surface (e.g. kg.m-2)
     32
    2433contains
    2534
    26   subroutine ini_surfdat_h(ngrid)
     35  subroutine ini_surfdat_h(ngrid,nq)
    2736 
    2837  implicit none
    2938  integer,intent(in) :: ngrid ! number of atmospheric columns
    30  
     39  integer,intent(in) :: nq ! number of tracers 
     40
    3141    allocate(albedodat(ngrid))
    3242    allocate(phisfi(ngrid))
    3343    allocate(watercaptag(ngrid))
     44    allocate(dryness(ngrid))
    3445    allocate(zmea(ngrid))
    3546    allocate(zstd(ngrid))
     
    3849    allocate(zthe(ngrid))
    3950    allocate(z0(ngrid))
    40  
     51    allocate(qsurf(ngrid,nq))
     52    allocate(tsurf(ngrid))
     53    allocate(co2ice(ngrid))
     54    allocate(emis(ngrid))
     55    allocate(capcal(ngrid))
     56    allocate(fluxgrd(ngrid))
     57 
    4158  end subroutine ini_surfdat_h
    4259
  • trunk/LMDZ.MARS/libf/phymars/surfini.F

    r1212 r1224  
    33      USE ioipsl_getincom
    44      use netcdf
    5       use tracer_mod, only: nqmx, noms, dryness
     5      use tracer_mod, only: nqmx, noms
    66      use comgeomfi_h, only: long, lati
    77      use surfdat_h, only: watercaptag, frost_albedo_threshold,
    88     &                     albedo_h2o_ice, inert_h2o_ice, albedodat,
    9      &                     albedice
     9     &                     albedice, dryness
    1010#ifndef MESOSCALE
    1111      use mod_grid_phy_lmdz, only : klon_glo ! # of physics point on full grid
  • trunk/LMDZ.MARS/libf/phymars/testphys1d.F

    r1130 r1224  
    55      use infotrac, only: nqtot, tname
    66      use comsoil_h, only: volcapa, layer, mlayer, inertiedat, nsoilmx
    7       use comgeomfi_h, only: lati, long, area
    8       use comdiurn_h, only: sinlat
     7      use comgeomfi_h, only: lati, long, area, sinlat
    98      use surfdat_h, only: albedodat, z0_default, emissiv, emisice,
    109     &                     albedice, iceradius, dtemisice, z0,
     
    473472      longitude=longitude*pi/180.E+0
    474473
    475 "inifis" does some initializations (some of which have already been
     474some initializations (some of which have already been
    476475!  done above!) and loads parameters set in callphys.def
    477476!  and allocates some arrays
    478477!Mars possible matter with dtphys in input and include!!!
    479       CALL inifis(1,llm,nq,day0,daysec,dtphys,
    480      &            latitude,longitude,1.0,rad,g,r,cpp)
     478      call phys_state_var_init(1,llm,nq,latitude,longitude,1.0)
     479      call conf_phys(nq,day0,daysec,dtphys,rad,g,r,cpp)
    481480
    482481
  • trunk/LMDZ.MARS/libf/phymars/tracer_mod.F90

    r1036 r1224  
    44 
    55      ! number of tracers:
    6       integer,save :: nqmx ! initialized in inifis
     6      integer,save :: nqmx ! initialized in conf_phys
    77     
    88      character*20,allocatable,save ::  noms(:)  ! name of the tracer
     
    2323      real,save :: ccn_factor  ! ratio of nuclei for water ice particles
    2424
    25       real,allocatable,save :: dryness(:)!"Dryness coefficient" for grnd water ice sublimation
    26      
     25      INTEGER,ALLOCATABLE,SAVE :: nqdust(:) ! to store the indexes of dust tracers (cf aeropacity)
     26
    2727! tracer indexes: these are initialized in initracer and should be 0 if the
    2828!                 corresponding tracer does not exist
  • trunk/LMDZ.MARS/libf/phymars/updatereffrad.F

    r1208 r1224  
    88     &                       igcm_ccn_number, nuice_ref, varian,
    99     &                       ref_r0, igcm_dust_submicron
     10       USE dimradmars_mod, only: nueffdust
    1011       IMPLICIT NONE
    1112c=======================================================================
     
    8485      REAL tauscaling(ngrid)         ! Convertion factor for qccn and Nccn
    8586
    86       LOGICAL,SAVE :: firstcall=.true. , firstcall_alloc=.true.
     87      LOGICAL,SAVE :: firstcall=.true.
    8788
    8889      REAL CBRT
    8990      EXTERNAL CBRT
    90 
    91       REAL,SAVE,ALLOCATABLE :: nueffdust(:,:) ! Dust effective variance
    92 
    93 c     Local saved variables:
    94 c     ---------------------
    95 
    96         if (firstcall_alloc) then
    97           !allocate local saved arrays:
    98           allocate(nueffdust(ngrid,nlayer))
    99           firstcall_alloc=.false.
    100         endif
    10191
    10292c==================================================================
  • trunk/LMDZ.MARS/libf/phymars/vdifc.F

    r1130 r1224  
    1313      use tracer_mod, only: noms, igcm_dust_mass, igcm_dust_number,
    1414     &                      igcm_dust_submicron, igcm_h2o_vap,
    15      &                      igcm_h2o_ice, dryness, alpha_lift
    16       use surfdat_h, only: watercaptag, frost_albedo_threshold
     15     &                      igcm_h2o_ice, alpha_lift
     16      use surfdat_h, only: watercaptag, frost_albedo_threshold, dryness
    1717      IMPLICIT NONE
    1818
  • trunk/LMDZ.MARS/libf/phymars/yamada4.F

    r1046 r1224  
    1212     s   ,iflag_pbl)
    1313      use tracer_mod, only: noms
     14      use turb_mod, only: l0
    1415      IMPLICIT NONE
    1516!.......................................................................
     
    9192      REAL m2cstat,mcstat,kmcstat
    9293      REAL l(ngrid,nlay+1)
    93       REAL,allocatable,SAVE :: l0(:)
    9494      REAL sq(ngrid),sqz(ngrid),zz(ngrid,nlay+1)
    9595      INTEGER iter
     
    151151           enddo
    152152        endif
    153       allocate(l0(ngrid))
    154153      ndt=ceiling(3840./(3699.*24./dt))
    155154      firstcall=.false.
  • trunk/LMDZ.MARS/libf/phymars/yomlw_h.F90

    r1047 r1224  
    2424contains
    2525
    26 ! Allocate array (subroutine ini_yomlw_h is called by inifis)
     26! Allocate array (subroutine ini_yomlw_h is called by phys_state_var_init)
    2727  subroutine ini_yomlw_h(ngrid)
    2828   
Note: See TracChangeset for help on using the changeset viewer.