Ignore:
Timestamp:
Feb 12, 2025, 10:08:35 AM (4 days ago)
Author:
aborella
Message:

Revert merge with trunk

Location:
LMDZ6/branches/contrails
Files:
1 deleted
56 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/contrails

  • LMDZ6/branches/contrails/DefLists/field_def_lmdz.xml

    r5489 r5536  
    113113        <field id="snow"    long_name="Snow fall"               unit="kg/(s*m2)" />
    114114        <field id="evap"    long_name="Evaporat"                unit="kg/(s*m2)" />
    115         <field id="icesub_lic"    long_name="sublimation of ice over landice, mesh-averaged"  unit="kg/(s*m2)" />
    116115        <field id="snowerosion"    long_name="blowing snow erosion"                unit="kg/(s*m2)" />
    117116        <field id="bsfall"    long_name="blowing snow precipitation"                unit="kg/(s*m2)" />
  • LMDZ6/branches/contrails/libf/dyn3d/replay3d.f90

    r5489 r5536  
    1818        grossismx, grossismy, dzoomx, dzoomy,taux,tauy
    1919  USE mod_const_mpi, ONLY: comm_lmdz
    20   USE ioipsl, only: getin
    21 
    2220!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    2321  ! FH 2008/05/09 On elimine toutes les clefs physiques dans la dynamique
     
    2826  USE dimensions_mod, ONLY: iim, jjm, llm, ndm
    2927  USE paramet_mod_h
    30 
    3128  IMPLICIT NONE
    3229
     
    7471
    7572  integer :: ntime=10000,it,klon,klev
    76 
    77   character*20 :: lmax_replay
    7873
    7974
     
    167162
    168163
     164     CALL iophys_ini(900.)
    169165print*,'Rlatu=',rlatu
    170166klon=2+iim*(jjm-1)
    171 
    172 print*,'AVANT getin'
    173167klev=llm
    174 CALL getin('lmax_replay',lmax_replay)
    175 print*,'APRES getin',lmax_replay
    176 CALL getin(lmax_replay,klev)
    177 print*,'replay3d lmax_replay klev',lmax_replay,klev
    178 
    179      CALL iophys_ini(900.,klev)
    180168
    181169!---------------------------------------------------------------------
  • LMDZ6/branches/contrails/libf/dyn3d_common/infotrac.f90

    r5489 r5536  
    33MODULE infotrac
    44
    5    USE       strings_mod, ONLY: msg, maxlen, cat, dispTable, int2str, bool2str, strStack, strParse, strCount, strIdx
    6    USE readTracFiles_mod, ONLY: trac_type, readTracersFiles, tracers,  addPhase,  addKey, iH2O, &
    7        isoSelect,  indexUpdate, isot_type, testTracersFiles, isotope,  delPhase,  getKey, tran0, &
    8        isoKeys, isoName, isoZone, isoPhas, processIsotopes,  isoCheck, itZonIso,  nbIso,         &
    9           niso,   ntiso,   nzone,   nphas,   maxTableWidth,  iqIsoPha, iqWIsoPha, ixIso, new2oldH2O, newHNO3, oldHNO3
     5   USE       strings_mod, ONLY: msg, fmsg, maxlen, cat, dispTable, int2str, bool2str, strStack, strParse
     6   USE readTracFiles_mod, ONLY: trac_type, readTracersFiles, tracers, setGeneration, itZonIso, nzone, tran0, isoZone, &
     7        delPhase, niso, getKey, isot_type, processIsotopes,  isotope, maxTableWidth, iqIsoPha, nphas, ixIso, isoPhas, &
     8        addPhase, iH2O, addKey, isoSelect, testTracersFiles, isoKeys, indexUpdate,  iqWIsoPha, nbIso, ntiso, isoName, isoCheck
     9   USE readTracFiles_mod, ONLY: new2oldH2O, newHNO3, oldHNO3
    1010   IMPLICIT NONE
    1111
     
    3030   PUBLIC :: isoKeys, isoName, isoZone, isoPhas            !--- Isotopes keys & names, tagging zones names, phases
    3131   PUBLIC ::    niso,   ntiso,   nzone,   nphas            !--- Number of   "   "
    32    PUBLIC :: itZonIso                                      !--- Index "it" in "isoName(1:niso)" = f(tagging idx, isotope idx)
    33    PUBLIC :: iqIsoPha                                      !--- Index "iq" in "qx"              = f(isotope idx,   phase idx)
     32   PUBLIC :: itZonIso                                      !--- index "it" in "isoName(1:niso)" = f(tagging idx, isotope idx)
     33   PUBLIC :: iqIsoPha                                      !--- index "iq" in "qx"              = f(isotope idx,   phase idx)
    3434   PUBLIC :: isoCheck                                      !--- Run isotopes checking routines
    3535   !=== FOR BOTH TRACERS AND ISOTOPES
     
    7878!  | nqChildren  | Number of childs            (1st generation only)    | nqfils      | 1:nqtot                |
    7979!  | iadv        | Advection scheme number                              | iadv        | 1,2,10-20(exc.15,19),30|
     80!  | isAdvected  | Advected tracers flag (.TRUE. if iadv >= 0)          | /           | nqtrue  .TRUE. values  |
     81!  | isInPhysics | Tracers not extracted from the main table in physics | /           | nqtottr .TRUE. values  |
    8082!  | iso_iGroup  | Isotopes group index in isotopes(:)                  | /           | 1:nbIso                |
    8183!  | iso_iName   | Isotope  name  index in isotopes(iso_iGroup)%trac(:) | iso_indnum  | 1:niso                 |
     
    101103
    102104   !=== DIMENSIONS OF THE TRACERS TABLES AND OTHER SCALAR VARIABLES
    103    INTEGER, SAVE :: nqtot                                       !--- Tracers nb in dynamics (incl. higher moments + H2O)
    104    INTEGER, SAVE :: nbtr                                        !--- Tracers nb in physics  (excl. higher moments + H2O)
    105    INTEGER, SAVE :: nqo                                         !--- Number of water phases
    106    INTEGER, SAVE :: nqtottr                                     !--- Number of tracers passed to phytrac (TO BE DELETED ?)
    107    INTEGER, SAVE :: nqCO2                                       !--- Number of tracers of CO2  (ThL)
     105   INTEGER,               SAVE :: nqtot,   &                    !--- Tracers nb in dynamics (incl. higher moments + H2O)
     106                                  nbtr,    &                    !--- Tracers nb in physics  (excl. higher moments + H2O)
     107                                  nqo,     &                    !--- Number of water phases
     108                                  nqtottr, &                    !--- Number of tracers passed to phytrac (TO BE DELETED ?)
     109                                  nqCO2                         !--- Number of tracers of CO2  (ThL)
    108110   CHARACTER(LEN=maxlen), SAVE :: type_trac                     !--- Keyword for tracers type(s)
    109111
    110112   !=== VARIABLES FOR INCA
    111    INTEGER, SAVE, ALLOCATABLE :: conv_flg(:), pbl_flg(:)        !--- Convection / boundary layer activation (nbtr)
     113   INTEGER, DIMENSION(:), SAVE, ALLOCATABLE :: &
     114                    conv_flg, pbl_flg                           !--- Convection / boundary layer activation (nbtr)
    112115
    113116CONTAINS
     
    144147! Local variables
    145148   INTEGER, ALLOCATABLE :: hadv(:), vadv(:)                          !--- Horizontal/vertical transport scheme number
     149   INTEGER, ALLOCATABLE :: had (:), hadv_inca(:), conv_flg_inca(:), &!--- Variables specific to INCA
     150                           vad (:), vadv_inca(:),  pbl_flg_inca(:)
     151   CHARACTER(LEN=8), ALLOCATABLE :: solsym_inca(:)                   !--- Tracers names for INCA
    146152   INTEGER :: nqINCA
    147153   CHARACTER(LEN=2)      ::   suff(9)                                !--- Suffixes for schemes of order 3 or 4 (Prather)
    148154   CHARACTER(LEN=3)      :: descrq(30)                               !--- Advection scheme description tags
    149    CHARACTER(LEN=maxlen) :: msg1, texp, ttp, nam, val                !--- Strings for messages and expanded tracers type
     155   CHARACTER(LEN=maxlen) :: msg1, texp, ttp                          !--- Strings for messages and expanded tracers type
    150156   INTEGER :: fType                                                  !--- Tracers description file type ; 0: none
    151157                                                                     !--- 1/2/3: "traceur.def"/"tracer.def"/"tracer_*.def"
    152158   INTEGER :: nqtrue                                                 !--- Tracers nb from tracer.def (no higher order moments)
    153159   INTEGER :: iad                                                    !--- Advection scheme number
    154    INTEGER :: iq, jq, nt, im, nm, ig                                 !--- Indexes and temporary variables
    155    LOGICAL :: lerr
     160   INTEGER :: iq, jq, nt, im, nm                                     !--- Indexes and temporary variables
     161   LOGICAL :: lerr, ll
    156162   TYPE(trac_type), ALLOCATABLE, TARGET :: ttr(:)
    157163   TYPE(trac_type), POINTER             :: t1, t(:)
     
    167173   descrq(30)    =  'PRA'
    168174
     175   lerr=strParse(type_trac, '|', types_trac, n=nt)
     176   IF (nt .GT. 1) THEN
     177      IF (nt .GT. 2) CALL abort_gcm(modname, 'you need to modify type_trac, this version is not supported by lmdz', 1)
     178      IF (nt .EQ. 2) type_trac=types_trac(2)
     179   ENDIF
     180
    169181   CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname)
    170    IF(strCount(type_trac, '|', nt)) CALL abort_gcm(modname, 'Could''nt parse the "type_trac" string with delimiter "|"', 1)
    171    IF(nt >= 3) CALL abort_gcm(modname, 'you need to modify type_trac, this version is not supported by lmdz', 1)
    172    IF(strParse(type_trac, '|', types_trac, n=nt)) CALL abort_gcm(modname, "couldn't parse "//'"type_trac"', 1)
    173    IF(nt == 2) type_trac = types_trac(2) ! TO BE DELETED SOON
    174 
    175    CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname)
    176 
    177 !##############################################################################################################################
    178    IF(.TRUE.) THEN                                                   !=== SKIPED IF ALREADY DONE IN dyn3d_common/infotrac  ####
    179 !##############################################################################################################################
     182
     183   
    180184   !--- MESSAGE ABOUT THE CHOSEN CONFIGURATION
    181185   msg1 = 'For type_trac = "'//TRIM(type_trac)//'":'
     
    193197   SELECT CASE(type_trac)
    194198      CASE('inca', 'inco')
    195          IF(.NOT.CPPKEY_INCA)     CALL abort_gcm(modname, 'You must add cpp key INCA and compile with INCA code', 1)
     199IF (.NOT. CPPKEY_INCA) THEN
     200         CALL abort_gcm(modname, 'You must add cpp key INCA and compile with INCA code', 1)
     201END IF
    196202      CASE('repr')
    197          IF(.NOT.CPPKEY_REPROBUS) CALL abort_gcm(modname, 'You must add cpp key REPROBUS and compile with REPROBUS code', 1)
     203IF (.NOT. CPPKEY_REPROBUS) THEN
     204         CALL abort_gcm(modname, 'You must add cpp key REPROBUS and compile with REPROBUS code', 1)
     205END IF
    198206      CASE('coag')
    199          IF(.NOT.CPPKEY_STRATAER) CALL abort_gcm(modname, 'You must add cpp key StratAer and compile with StratAer code', 1)
     207IF (.NOT. CPPKEY_STRATAER) THEN
     208         CALL abort_gcm(modname, 'You must add cpp key StratAer and compile with StratAer code', 1)
     209END IF
    200210   END SELECT
    201 !##############################################################################################################################
    202    END IF
    203 !##############################################################################################################################
     211
     212   nqCO2 = COUNT( [type_trac == 'inco', type_trac == 'co2i'] )
    204213
    205214!==============================================================================================================================
    206215! 0) DETERMINE THE TYPE OF THE INPUT TRACERS DESCRIPTION FILE AND READ IT
    207216!==============================================================================================================================
    208    texp = type_trac                                                  !=== EXPANDED (WITH "|" SEPARATOR) "type_trac"
     217   texp = type_trac                                                            !=== EXPANDED (WITH "|" SEPARATOR) "type_trac"
    209218   IF(texp == 'inco') texp = 'co2i|inca'
    210219   IF(texp /= 'lmdz') texp = 'lmdz|'//TRIM(texp)
    211220   IF(testTracersFiles(modname, texp, fType, .TRUE.)) CALL abort_gcm(modname, 'problem with tracers file(s)',1)
    212221   ttp = type_trac; IF(fType /= 1) ttp = texp
     222   IF(readTracersFiles(ttp, lRepr=type_trac=='repr')) CALL abort_gcm(modname, 'problem with tracers file(s)',1)
     223
     224!==============================================================================================================================
     225! 1) Get various numbers: "nqtrue" (first order only tracers), "nqo" (water phases), 'nbtr' (tracers passed to physics), etc.
     226!==============================================================================================================================
    213227   !---------------------------------------------------------------------------------------------------------------------------
    214228   IF(fType == 0) CALL abort_gcm(modname, 'Missing "traceur.def", "tracer.def" or "tracer_<keyword>.def tracers file.',1)
    215229   !---------------------------------------------------------------------------------------------------------------------------
    216    IF(fType == 1 .AND. ANY(['inca', 'inco'] == type_trac)) &         !=== FOUND OLD STYLE INCA "traceur.def"
    217       CALL abort_gcm(modname, 'retro-compatibility with old-style INCA traceur.def files has been disabled.', 1)
    218    !---------------------------------------------------------------------------------------------------------------------------
    219 
    220 !##############################################################################################################################
    221    IF(readTracersFiles(ttp, lRepr=type_trac == 'repr')) CALL abort_gcm(modname, 'problem with tracers file(s)',1)
    222 !##############################################################################################################################
    223 
    224 !==============================================================================================================================
    225 ! 1) Get various numbers: "nqtrue" (first order only tracers), "nqo" (water phases), 'nbtr' (tracers passed to physics), etc.
    226 !==============================================================================================================================
     230   IF(fType == 1 .AND. ANY(['inca', 'inco'] == type_trac)) THEN      !=== FOUND OLD STYLE INCA "traceur.def"
     231   !---------------------------------------------------------------------------------------------------------------------------
     232IF (CPPKEY_INCA) THEN
     233      nqo = SIZE(tracers) - nqCO2
     234      CALL Init_chem_inca_trac(nqINCA)                               !--- Get nqINCA from INCA
     235      nbtr = nqINCA + nqCO2                                          !--- Number of tracers passed to phytrac
     236      nqtrue = nbtr + nqo                                            !--- Total number of "true" tracers
     237      IF(ALL([2,3] /= nqo)) CALL abort_gcm(modname, 'Only 2 or 3 water phases allowed ; found nqo='//TRIM(int2str(nqo)), 1)
     238      ALLOCATE(hadv(nqtrue), hadv_inca(nqINCA), conv_flg_inca(nqINCA), solsym_inca(nqINCA))
     239      ALLOCATE(vadv(nqtrue), vadv_inca(nqINCA),  pbl_flg_inca(nqINCA))
     240      CALL init_transport(solsym_inca, conv_flg_inca, pbl_flg_inca, hadv_inca, vadv_inca)
     241      ALLOCATE(ttr(nqtrue))
     242      ttr(1:nqo+nqCO2)                  = tracers
     243      ttr(1    :      nqo   )%component = 'lmdz'
     244      ttr(1+nqo:nqCO2+nqo   )%component = 'co2i'
     245      ttr(1+nqo+nqCO2:nqtrue)%component = 'inca'
     246      ttr(1+nqo      :nqtrue)%name      = [('CO2     ', iq=1, nqCO2), solsym_inca]
     247      ttr(1+nqo+nqCO2:nqtrue)%parent    = tran0
     248      ttr(1+nqo+nqCO2:nqtrue)%phase     = 'g'
     249      lerr = getKey('hadv', had, ky=tracers(:)%keys)
     250      lerr = getKey('vadv', vad, ky=tracers(:)%keys)
     251      hadv(1:nqo+nqCO2) = had(:); hadv(1+nqo+nqCO2:nqtrue) = hadv_inca
     252      vadv(1:nqo+nqCO2) = vad(:); vadv(1+nqo+nqCO2:nqtrue) = vadv_inca
     253      CALL MOVE_ALLOC(FROM=ttr, TO=tracers)
     254      DO iq = 1, nqtrue
     255         t1 => tracers(iq)
     256         CALL addKey('name',      t1%name,      t1%keys)
     257         CALL addKey('component', t1%component, t1%keys)
     258         CALL addKey('parent',    t1%parent,    t1%keys)
     259         CALL addKey('phase',     t1%phase,     t1%keys)
     260      END DO
     261      IF(setGeneration(tracers)) CALL abort_gcm(modname,'See above',1) !- SET FIELDS %iGeneration, %gen0Name
     262      DEALLOCATE(had, hadv_inca, vad, vadv_inca, conv_flg_inca, pbl_flg_inca, solsym_inca)
     263END IF
     264   !---------------------------------------------------------------------------------------------------------------------------
     265   ELSE                                                              !=== OTHER CASES (OLD OR NEW FORMAT, NO INCA MODULE)
     266   !---------------------------------------------------------------------------------------------------------------------------
    227267   nqtrue = SIZE(tracers)                                                                               !--- "true" tracers
    228268   nqo    =      COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%name)     == 'H2O')     !--- Water phases
    229269   nbtr = nqtrue-COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%gen0Name) == 'H2O')     !--- Passed to phytrac
    230270   nqCO2  =      COUNT( [type_trac == 'inco', type_trac == 'co2i'] )
    231    IF(CPPKEY_INCA) &
     271IF (CPPKEY_INCA) THEN
    232272   nqINCA =      COUNT(tracers(:)%component == 'inca')
    233    IF(CPPKEY_REPROBUS) CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name)
    234 
    235 !==============================================================================================================================
    236 ! 2) Calculate nqtot, number of tracers needed (greater if advection schemes 20 or 30 have been chosen).
    237 !==============================================================================================================================
     273END IF
    238274   IF(getKey('hadv', hadv, ky=tracers(:)%keys)) CALL abort_gcm(modname, 'missing key "hadv"', 1)
    239275   IF(getKey('vadv', vadv, ky=tracers(:)%keys)) CALL abort_gcm(modname, 'missing key "vadv"', 1)
     276   !---------------------------------------------------------------------------------------------------------------------------
     277   END IF
     278   !---------------------------------------------------------------------------------------------------------------------------
     279
     280IF (CPPKEY_REPROBUS) THEN
     281   CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name)
     282END IF
     283
     284!==============================================================================================================================
     285! 2) Calculate nqtot, number of tracers needed (greater if advection schemes 20 or 30 have been chosen).
     286!==============================================================================================================================
    240287   DO iq = 1, nqtrue
    241288      IF( hadv(iq)<20 .OR. (ANY(hadv(iq)==[20,30]) .AND. hadv(iq)==vadv(iq)) ) CYCLE
     
    255302
    256303!==============================================================================================================================
    257 ! 3) Determine the advection scheme choice for water and tracers "iadv" and the field "long name".
     304! 3) Determine the advection scheme choice for water and tracers "iadv" and the fields long name, isAdvected.
    258305!     iadv = 1    "LMDZ-specific humidity transport" (for H2O vapour)          LMV
    259306!     iadv = 2    backward                           (for H2O liquid)          BAK
     
    273320!==============================================================================================================================
    274321   ALLOCATE(ttr(nqtot))
    275    jq = nqtrue+1
     322   jq = nqtrue+1; tracers(:)%iadv = -1
    276323   DO iq = 1, nqtrue
    277324      t1 => tracers(iq)
     
    284331      IF(iad == -1) CALL abort_gcm(modname, msg1, 1)
    285332
    286       !--- SET FIELDS longName and iadv
     333      !--- SET FIELDS longName, iadv, isAdvected, isInPhysics
    287334      t1%longName   = t1%name; IF(iad > 0) t1%longName=TRIM(t1%name)//descrq(iad)
    288335      t1%iadv       = iad
     336      t1%isAdvected = iad >= 0
     337      t1%isInPhysics= delPhase(t1%gen0Name) /= 'H2O' .OR. t1%component /= 'lmdz' !=== MORE EXCEPTIONS ? CO2i, SURSAT CLOUD H2O
    289338      ttr(iq)       = t1
    290339
     
    300349      ttr(jq+1:jq+nm)%longName    = [ (TRIM(t1%longName)//'-'//TRIM(suff(im)), im=1, nm) ]
    301350      ttr(jq+1:jq+nm)%iadv        = [ (-iad,    im=1, nm) ]
     351      ttr(jq+1:jq+nm)%isAdvected  = [ (.FALSE., im=1, nm) ]
    302352      jq = jq + nm
    303353   END DO
     
    309359
    310360   !=== TEST ADVECTION SCHEME
    311    DO iq = 1, nqtot ; t1 => tracers(iq)
    312       iad = t1%iadv
    313       ig  = t1%iGeneration
    314       nam = t1%name
    315       val = 'iadv='//TRIM(int2str(iad))
     361   DO iq = 1, nqtot ; t1 => tracers(iq); iad = t1%iadv
    316362
    317363      !--- ONLY TESTED VALUES FOR TRACERS FOR NOW:               iadv = 14, 10 (and 0 for non-transported tracers)
    318       IF(ALL([10,14,0] /= iad)) CALL abort_gcm(modname, TRIM(val)//' has not been tested yet ; 10 or 14 only are allowed !', 1)
    319 
    320       !--- ONLY TESTED VALUES SO FAR FOR PARENTS HAVING CHILDREN: iadv = 14, 10 (PARENTS: TRACERS OF GENERATION 0)
    321       IF(ALL([10,14] /= iad) .AND. ig == 0 .AND. ANY(tracers(:)%parent==nam)) &
    322          CALL abort_gcm(modname, TRIM(val)//' is not implemented for parents ; 10 or 14 only are allowed !', 1)
    323 
    324       !--- ONLY TESTED VALUES SO FAR FOR DESCENDANTS (TRACERS OF GENERATION > 0): iadv = 10 ; WATER VAPOUR: iadv = 14
    325       lerr = iad /= 10 .AND. ig > 0;                     IF(lerr) tracers(iq)%iadv = 10
    326       CALL msg('WARNING! '//TRIM(val)//  ' not implemented for children. Setting iadv=10 for "'//TRIM(nam)//'"', modname, lerr)
    327       lerr = iad == 14 .AND. nam /= addPhase('H2O','g'); IF(lerr) tracers(iq)%iadv = 10
    328       CALL msg('WARNING! '//TRIM(val)//' is valid for water vapour only. Setting iadv=10 for "'//TRIM(nam)//'"', modname, lerr)
     364      IF(ALL([10,14,0] /= iad)) &
     365         CALL abort_gcm(modname, 'Not tested for iadv='//TRIM(int2str(iad))//' ; 10 or 14 only are allowed !', 1)
     366
     367      !--- ONLY TESTED VALUES FOR PARENTS HAVING CHILDS FOR NOW: iadv = 14, 10 (PARENTS: TRACERS OF GENERATION 1)
     368      IF(ALL([10,14] /= iad) .AND. t1%iGeneration == 1 .AND. ANY(tracers(:)%iGeneration > 1)) &
     369         CALL abort_gcm(modname, 'iadv='//TRIM(int2str(iad))//' not implemented for parents ; 10 or 14 only are allowed !', 1)
     370
     371      !--- ONLY TESTED VALUES FOR CHILDS FOR NOW:                iadv = 10     (CHILDS:  TRACERS OF GENERATION GREATER THAN 1)
     372      IF(fmsg('WARNING ! iadv='//TRIM(int2str(iad))//' not implemented for childs. Setting iadv=10 for "'//TRIM(t1%name)//'"',&
     373         modname, iad /= 10 .AND. t1%iGeneration > 1)) t1%iadv = 10
     374
     375      !--- ONLY VALID SCHEME NUMBER FOR WATER VAPOUR:            iadv = 14
     376      ll = t1%name /= addPhase('H2O','g')
     377      IF(fmsg('WARNING ! iadv=14 is valid for water vapour only. Setting iadv=10 for "'//TRIM(t1%name)//'".', &
     378         modname, iad == 14 .AND. ll))                 t1%iadv = 10
    329379   END DO
    330380
     
    334384
    335385   !--- Convection / boundary layer activation for all tracers
    336    IF(.NOT.ALLOCATED(conv_flg)) ALLOCATE(conv_flg(nbtr)); conv_flg(1:nbtr) = 1
    337    IF(.NOT.ALLOCATED( pbl_flg)) ALLOCATE( pbl_flg(nbtr));  pbl_flg(1:nbtr) = 1
     386   ALLOCATE(conv_flg(nbtr)); conv_flg(1:nbtr) = 1
     387   ALLOCATE( pbl_flg(nbtr));  pbl_flg(1:nbtr) = 1
    338388
    339389   !--- Note: nqtottr can differ from nbtr when nmom/=0
     
    343393
    344394   !=== DISPLAY THE RESULTS
    345    IF(.NOT..TRUE.) RETURN
    346395   CALL msg('nqo    = '//TRIM(int2str(nqo)),    modname)
    347396   CALL msg('nbtr   = '//TRIM(int2str(nbtr)),   modname)
     
    350399   CALL msg('niso   = '//TRIM(int2str(niso)),   modname)
    351400   CALL msg('ntiso  = '//TRIM(int2str(ntiso)),  modname)
    352    CALL msg('nqCO2  = '//TRIM(int2str(nqCO2)),  modname, CPPKEY_INCA)
    353    CALL msg('nqINCA = '//TRIM(int2str(nqINCA)), modname, CPPKEY_INCA)
     401IF (CPPKEY_INCA) THEN
     402   CALL msg('nqCO2  = '//TRIM(int2str(nqCO2)),  modname)
     403   CALL msg('nqINCA = '//TRIM(int2str(nqINCA)), modname)
     404END IF
    354405   t => tracers
    355406   CALL msg('Information stored in '//TRIM(modname)//': ', modname)
     
    360411                  t%iso_iName, t%iso_iZone, t%iso_iPhase), nColMax=maxTableWidth, nHead=2, sub=modname))   &
    361412      CALL abort_gcm(modname, "problem with the tracers table content", 1)
    362    CALL msg('No isotopes identified.', modname, nbIso == 0)
    363    IF(nbIso == 0) RETURN
    364    CALL msg('For isotopes family "H2O":', modname)
    365    CALL msg('  isoKeys%name = '//strStack(isoKeys%name), modname)
    366    CALL msg('  isoName = '//strStack(isoName),      modname)
    367    CALL msg('  isoZone = '//strStack(isoZone),      modname)
    368    CALL msg('  isoPhas = '//TRIM(isoPhas),          modname)
     413   IF(niso > 0) THEN
     414      CALL msg('Where, for isotopes family "'//TRIM(isotope%parent)//'":', modname)
     415      CALL msg('  isoKeys%name = '//strStack(isoKeys%name), modname)
     416      CALL msg('  isoName = '//strStack(isoName),      modname)
     417      CALL msg('  isoZone = '//strStack(isoZone),      modname)
     418      CALL msg('  isoPhas = '//TRIM(isoPhas),          modname)
     419   ELSE
     420      CALL msg('No isotopes identified.', modname)
     421   END IF
     422   CALL msg('end', modname)
    369423
    370424END SUBROUTINE init_infotrac
  • LMDZ6/branches/contrails/libf/dynphy_lonlat/calfis.f90

    r5489 r5536  
    279279  itr=0
    280280  DO iq=1,nqtot
    281      IF(tracers(iq)%iadv < 0) CYCLE
     281     IF(.NOT.tracers(iq)%isAdvected) CYCLE
    282282     itr = itr + 1
    283283     DO l=1,llm
     
    597597  itr = 0
    598598  DO iq=1,nqtot
    599      IF(tracers(iq)%iadv < 0) CYCLE
     599     IF(.NOT.tracers(iq)%isAdvected) CYCLE
    600600     itr = itr + 1
    601601     DO l=1,llm
  • LMDZ6/branches/contrails/libf/dynphy_lonlat/calfis_loc.F90

    r5489 r5536  
    356356  itr = 0
    357357  DO iq=1,nqtot
    358      IF(tracers(iq)%iadv < 0) CYCLE
     358     IF(.NOT.tracers(iq)%isAdvected) CYCLE
    359359     itr = itr + 1
    360360!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
     
    10591059  itr = 0
    10601060  DO iq=1,nqtot
    1061      IF(tracers(iq)%iadv < 0) CYCLE
     1061     IF(.NOT.tracers(iq)%isAdvected) CYCLE
    10621062     itr = itr + 1
    10631063!$OMP DO SCHEDULE(STATIC,OMP_CHUNK)
  • LMDZ6/branches/contrails/libf/misc/readTracFiles_mod.f90

    r5489 r5536  
    6161    INTEGER               :: nqChildren  = 0                    !--- Number of children  (first generation)
    6262    INTEGER               :: iadv        = 10                   !--- Advection scheme used
     63    LOGICAL               :: isAdvected  = .FALSE.              !--- "true" tracers: iadv > 0.   COUNT(isAdvected )=nqtrue
    6364    LOGICAL               :: isInPhysics = .TRUE.               !--- "true" tracers: in tr_seri. COUNT(isInPhysics)=nqtottr
    6465    INTEGER               :: iso_iGroup  = 0                    !--- Isotopes group index in isotopes(:)
     
    184185!     * The "keys" component (of type keys_type) is in principle enough to store everything we could need.
    185186!     But some variables are stored as direct-access keys to make the code more readable and because they are used often.
    186 !     * Most of the direct-access keys are set in this module, but some are not (longName, iadv and isInPhysicsfor now).
     187!     * Most of the direct-access keys are set in this module, but some are not (longName, iadv, isAdvected for now).
    187188!     * Some of the direct-access keys must be updated (using the routine "setDirectKeys") is a subset of "tracers(:)"
    188189!     is extracted: the indexes are no longer valid for a subset (examples: iqParent, iqDescen).
  • LMDZ6/branches/contrails/libf/misc/wxios_mod.F90

    r5489 r5536  
    188188      ! On boucle sur les traceurs pour les ajouter au groupe puis fixer les attributs
    189189      DO iq = 1, nqtot
    190          IF(.NOT.tracers(iq)%isInPhysics) CYCLE
     190         IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
    191191         dn = 'd'//TRIM(tracers(iq)%name)//'_'
    192192
     
    241241      ! On boucle sur les traceurs pour les ajouter au groupe puis fixer les attributs
    242242      DO iq = 1, nqtot
    243          IF(.NOT.tracers(iq)%isInPhysics) CYCLE
     243         IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
    244244         
    245245         unt = "kg m-2"
  • LMDZ6/branches/contrails/libf/phy_common/abort_physic.f90

    r5489 r5536  
    4949        endif         
    5050      endif
    51       END SUBROUTINE abort_physic
     51      END
  • LMDZ6/branches/contrails/libf/phy_common/mod_phys_lmdz_mpi_transfert.f90

    r5489 r5536  
    6565!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    6666
    67 !! -- Les chaine de charactere -- !!
     67!! -- Les chaine de charactère -- !!
    6868
    6969  SUBROUTINE bcast_mpi_c(var1)
  • LMDZ6/branches/contrails/libf/phy_common/mod_phys_lmdz_omp_transfert.f90

    r5489 r5536  
    116116!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    117117
    118 !! -- Les chaine de charactere -- !!
     118!! -- Les chaine de charactère -- !!
    119119
    120120  SUBROUTINE bcast_omp_c(var)
  • LMDZ6/branches/contrails/libf/phy_common/mod_phys_lmdz_transfert_para.f90

    r5489 r5536  
    5757!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    5858
    59 !! -- Les chaine de charactere -- !!
     59!! -- Les chaine de charactère -- !!
    6060
    6161  SUBROUTINE bcast_c(var)
  • LMDZ6/branches/contrails/libf/phydev/infotrac_phy.f90

    r5489 r5536  
    3232    TYPE(keys_type)       :: keys                          !--- <key>=<val> pairs vector
    3333    INTEGER               :: iadv        = 10              !--- Advection scheme used
     34    LOGICAL               :: isAdvected  = .FALSE.         !--- "true" tracers: iadv > 0.   COUNT(isAdvected )=nqtrue
    3435    LOGICAL               :: isInPhysics = .TRUE.          !--- "true" tracers: in tr_seri. COUNT(isInPhysics)=nqtottr
    3536    INTEGER               :: iso_iGroup  = 0               !--- Isotopes group index in isotopes(:)
  • LMDZ6/branches/contrails/libf/phylmd/Dust/read_dust.f90

    r5489 r5536  
    2121  save ncid1, varid1, ncid2, varid2
    2222!$OMP THREADPRIVATE(ncid1, varid1, ncid2, varid2)
    23   integer :: start_(4),count_(4)
     23  integer :: start(4),count(4), status
    2424  integer :: i, j, ig
    2525  !
     
    2828  if (debutphy) then
    2929  !
    30      rcode=nf90_open('dust.nc',nf90_nowrite,ncid1)
    31      if ( rcode /= 0 ) then ; call abort_physic('LMDZ','open dust.nc dans read_vent',1) ; endif
    32 
    33      rcode=nf90_inq_varid(ncid1,'EMISSION',varid1)
    34      if ( rcode /= 0 ) then ; call abort_physic('LMDZ','inq varid EMISSION dans read_vent',1) ; endif
     30     ncid1=nf90_open('dust.nc',nf90_nowrite,rcode)
     31     varid1=nf90_inq_varid(ncid1,'EMISSION',rcode)
    3532  !
    3633  endif
    3734  !
    38   start_(1)=1
    39   start_(2)=1
    40   start_(3)=step
    41   start_(4)=0
     35  start(1)=1
     36  start(2)=1
     37  start(4)=0
    4238
    43    ! count_(1)=iip1
    44   count_(1)=nbp_lon+1
    45    ! count_(2)=jjp1
    46   count_(2)=nbp_lat
    47   count_(3)=1
    48   count_(4)=0
     39   ! count(1)=iip1
     40  count(1)=nbp_lon+1
     41   ! count(2)=jjp1
     42  count(2)=nbp_lat
     43  count(3)=1
     44  count(4)=0
    4945  !
     46  start(3)=step
    5047  !
    51   rcode = nf90_get_var(ncid1, varid1, dust_nc_glo, start_, count_)
    52   if ( rcode /= 0 ) then ; call abort_physic('LMDZ','get EMISSION dans read_vent',1) ; endif
     48  status = nf90_get_var(ncid1, varid1, dust_nc_glo, start, count)
    5349
    5450  !
  • LMDZ6/branches/contrails/libf/phylmd/Dust/read_surface.f90

    r5489 r5536  
    3131       real surfa_glo(klon_glo,5)
    3232!
    33        integer ncid, varid, rcode, varlatid,tmpid
    34        integer start_(2),count_(2)
     33       integer ncid, varid, rcode
     34       integer start(2),count(2),status
    3535       integer i,j,l,ig
    3636       character*1 str1
     
    4141      real, dimension(nbp_lat) :: lats
    4242      real, dimension(nbp_lat) :: lats_glo
    43       integer, dimension(1) :: start_j,endj
     43      integer, dimension(1) :: startj,endj
    4444!JE20140526>>
    4545!$OMP MASTER
     
    4747
    4848       print*,'Lecture du fichier donnees_lisa.nc'
    49        rcode=nf90_open('donnees_lisa.nc',nf90_nowrite,ncid)
    50        if ( rcode /= 0 ) then ; call abort_physic('LMDZ','open donnees_lisa.nc dans read_vent',1) ; endif
    51 
     49       ncid=nf90_open('donnees_lisa.nc',nf90_nowrite,rcode)
    5250
    5351!JE20140526<<: check if are inversed or not the latitude grid in donnes_lisa
     
    5654      isinversed=.false.
    5755      do i=1,5
    58           if (i==1) aux4s='latu'
    59           if (i==2) aux4s='LATU'
    60           if (i==3) aux4s='LatU'
    61           if (i==4) aux4s='Latu'
    62           if (i==5) aux4s='latU'
    63           rcode = nf90_inq_varid(ncid, aux4s, tmpid)
    64           IF ((rcode==0).and.( .not. outcycle )) THEN
    65             outcycle=.true.
    66             varlatid=tmpid
    67           ENDIF
     56       if (i==1) aux4s='latu'
     57       if (i==2) aux4s='LATU'
     58       if (i==3) aux4s='LatU'
     59       if (i==4) aux4s='Latu'
     60       if (i==5) aux4s='latU'
     61       status = nf90_inq_varid(ncid, aux4s, rcode)
     62!       print *,'stat,i',status,i,outcycle,aux4s
     63!       print *,'ifclause',status.NE. nf90_noerr ,outcycle == .false.
     64       IF ((.not.(status.NE. nf90_noerr) ).and.( .not. outcycle )) THEN
     65         outcycle=.true.
     66         latstr=aux4s
     67       ENDIF
    6868      enddo ! check if it inversed lat
    69       start_j(1)=1
     69      startj(1)=1
     70!      endj(1)=jjp1
    7071      endj(1)=nbp_lat
    71       rcode = nf90_get_var(ncid, varlatid, lats_glo, start_j, endj)
    72       if ( .not. outcycle ) then ; call abort_physic('LMDZ','get lat dans read_surface',1) ; endif
     72      varid=nf90_inq_varid(ncid,latstr,rcode)
    7373
    74 
     74          status = nf90_get_var(ncid, varid, lats_glo, startj, endj)
     75!      print *,latstr,varid,status,jjp1,rcode
     76!      IF (status .NE. nf90_noerr) print*,'NOOOOOOO'
     77!      print *,lats
     78!stop
    7579
    7680! check if netcdf is latitude inversed or not.
     
    8286          write(str1,'(i1)') i
    8387          varname=trim(name)//str1
    84           rcode=nf90_inq_varid(ncid,trim(varname),varid)
    85           if ( rcode /= 0 ) then ; call abort_physic('LMDZ','get'//varname//'  dans read_vent',1) ; endif
     88       print*,'lecture variable:',varname
     89          varid=nf90_inq_varid(ncid,trim(varname),rcode)
    8690!          varid=nf90_inq_varid(ncid,varname,rcode)
    8791
     
    8993!  -----------------------------------------------------
    9094
    91           start_(1)=1
    92           start_(2)=1     
    93           count_(1)=nbp_lon+1
    94 !          count_(1)=iip1
    95           count_(2)=nbp_lat
    96 !          count_(2)=jjp1
     95          start(1)=1
     96          start(2)=1     
     97          count(1)=nbp_lon+1
     98!          count(1)=iip1
     99          count(2)=nbp_lat
     100!          count(2)=jjp1
    97101
    98102! mise a zero des tableaux
     
    102106! Lecture
    103107! -----------------------
    104           rcode = nf90_get_var(ncid, varid, tmp_dyn_glo, start_, count_)
    105           if ( rcode /= 0 ) then ; call abort_physic('LMDZ','get'//varname//'  dans read_vent',1) ; endif
     108          status = nf90_get_var(ncid, varid, tmp_dyn_glo, start, count)
    106109
    107110!      call dump2d(iip1,jjp1,tmp_dyn,'tmp_dyn   ')
  • LMDZ6/branches/contrails/libf/phylmd/Dust/read_vent.f90

    r5489 r5536  
    2323  save ncidu1, varidu1, ncidv1, varidv1
    2424!$OMP THREADPRIVATE(ncidu1, varidu1, ncidv1, varidv1)
    25   integer :: start(4),count_(4)
     25  integer :: start(4),count(4), status
    2626  integer :: i, j, ig
    2727
     
    3232  if (debutphy) then
    3333  !
    34      rcode=nf90_open('u10m.nc',nf90_nowrite,ncidu1)
    35      if ( rcode /= 0 ) then ; call abort_physic('LMDZ','open u10m.nc dans read_vent',1) ; endif
    36      rcode=nf90_inq_varid(ncidu1,'U10M',varidu1)
    37      if ( rcode /= 0 ) then ; call abort_physic('LMDZ','get id u10m dans read_vent',1) ; endif
    38      rcode=nf90_open('v10m.nc',nf90_nowrite,ncidv1)
    39      if ( rcode /= 0 ) then ; call abort_physic('LMDZ','open v10m.nc dans read_vent',1) ; endif
    40      rcode=nf90_inq_varid(ncidv1,'V10M',varidv1)
    41      if ( rcode /= 0 ) then ; call abort_physic('LMDZ','get id v10m dans read_vent',1) ; endif
     34     ncidu1=nf90_open('u10m.nc',nf90_nowrite,rcode)
     35     varidu1=nf90_inq_varid(ncidu1,'U10M',rcode)
     36     ncidv1=nf90_open('v10m.nc',nf90_nowrite,rcode)
     37     varidv1=nf90_inq_varid(ncidv1,'V10M',rcode)
    4238  !
    4339  endif
     
    4541  start(1)=1
    4642  start(2)=1
    47   start(3)=step
    4843  start(4)=0
    4944
    50    ! count_(1)=iip1
    51   count_(1)=nbp_lon+1
    52    ! count_(2)=jjp1
    53   count_(2)=nbp_lat
    54   count_(3)=1
    55   count_(4)=0
     45   ! count(1)=iip1
     46  count(1)=nbp_lon+1
     47   ! count(2)=jjp1
     48  count(2)=nbp_lat
     49  count(3)=1
     50  count(4)=0
    5651  !
     52  start(3)=step
    5753  !
    58   rcode = nf90_get_var(ncidu1, varidu1, u10m_nc_glo, start, count_)
    59   if ( rcode /= 0 ) then ; call abort_physic('LMDZ','lecture u10m dans read_vent',1) ; endif
    60   rcode = nf90_get_var(ncidv1, varidv1, v10m_nc_glo, start, count_)
    61   if ( rcode /= 0 ) then ; call abort_physic('LMDZ','lecture v10m dans read_vent',1) ; endif
     54  status = nf90_get_var(ncidu1, varidu1, u10m_nc_glo, start, count)
    6255
    63 
    64 ! ------- Tests 2024/12/31-FH----------------------------------------
    65 ! print*,'nbp_lon,npb_lat ',nbp_lon,nbp_lat
    66 ! print*,'start ',start
    67 ! print*,'count_ ',count_
    68 ! print*,'satus lecture u10m ',rcode
    69 ! call dump2d(nbp_lon+1,nbp_lat,u10m_nc_glo,'U10M global read_vent')
    70 ! call dump2d(nbp_lon+1,nbp_lat,v10m_nc_glo,'V10M global read_vent')
    71 ! stop
    72 ! ------- Tests -----------------------------------------------------
     56    ! print *,status
     57  !
     58  status = nf90_get_var(ncidv1, varidv1, v10m_nc_glo, start, count)
    7359
    7460  !
     
    7763  !  print *,'beforebidcor v10m_nc', v10m_nc(1,jjp1)
    7864
    79   !   print *,rcode
     65  !   print *,status
    8066  !  call correctbid(iim,jjp1,u10m_nc)
    8167  !  call correctbid(iim,jjp1,v10m_nc)
  • LMDZ6/branches/contrails/libf/phylmd/calcul_fluxs_mod.f90

    r5489 r5536  
    177177       zx_coefh(i) = cdragh(i) * zx_wind(i) * p1lay(i)/(RD*t1lay(i))
    178178       zx_coefq(i) = cdragq(i) * zx_wind(i) * p1lay(i)/(RD*t1lay(i))
     179!      zx_wind(i)=min_wind_speed+SQRT(gustiness(i)+u1lay(i)**2+v1lay(i)**2) &
     180!                * p1lay(i)/(RD*t1lay(i))
     181!      zx_coefh(i) = cdragh(i) * zx_wind(i)
     182!      zx_coefq(i) = cdragq(i) * zx_wind(i)
    179183    ENDDO
    180184
  • LMDZ6/branches/contrails/libf/phylmd/carbon_cycle_mod.f90

    r5489 r5536  
    350350
    351351  CHARACTER(len=10),SAVE :: planet_type="earth"
    352 
    353   !$OMP THREADPRIVATE(cfname_root,cftext_root,cfunits_root)
    354   !$OMP THREADPRIVATE(mask_in_root,mask_out_root)
    355 
    356352
    357353!-----------------------------------------------------------------------
  • LMDZ6/branches/contrails/libf/phylmd/clesphys_mod_h.f90

    r5489 r5536  
    2222          , co2_ppm0                                                   &
    2323          , tau_thermals                                               &
    24           , Cd_frein, nm_oro_t, zpmm_orodr_t, zpmm_orolf_t, zstd_orodr_t &
     24          , Cd_frein, zrel_oro_t, zpmm_orodr_t, zpmm_orolf_t, zstd_orodr_t &
    2525          , ecrit_LES                                                  &
    2626          , ecrit_ins, ecrit_hf, ecrit_day                             &
     
    5555
    5656  ! threshold on to activate SSO schemes
    57   REAL nm_oro_t, zpmm_orodr_t, zpmm_orolf_t, zstd_orodr_t
     57  ! threshold on to activate SSO schemes
     58  REAL zrel_oro_t, zpmm_orodr_t, zpmm_orolf_t, zstd_orodr_t
    5859  INTEGER iflag_cycle_diurne
    5960  LOGICAL soil_model, new_oliq, ok_orodr, ok_orolf
     
    178179  !$OMP      , co2_ppm0                                                   &
    179180  !$OMP      , tau_thermals                                               &
    180   !$OMP      , Cd_frein, nm_oro_t, zpmm_orodr_t, zpmm_orolf_t, zstd_orodr_t &
     181  !$OMP      , Cd_frein, zrel_oro_t, zpmm_orodr_t, zpmm_orolf_t, zstd_orodr_t &
    181182  !$OMP      , ecrit_LES                                                  &
    182183  !$OMP      , ecrit_ins, ecrit_hf, ecrit_day                             &
  • LMDZ6/branches/contrails/libf/phylmd/conf_phys_m.f90

    r5489 r5536  
    213213    LOGICAL, SAVE :: ok_lic_cond_omp
    214214    !
    215     REAL, SAVE    :: nm_oro_t_omp, zstd_orodr_t_omp
     215    REAL, SAVE    :: zrel_oro_t_omp, zstd_orodr_t_omp
    216216    REAL, SAVE    :: zpmm_orodr_t_omp, zpmm_orolf_t_omp
    217217    INTEGER, SAVE :: iflag_cycle_diurne_omp
     
    893893
    894894
    895     !Config  Key  =  nm_oro_t
    896     !Config  Desc = nm_oro_t
    897     !Config  Def  = -1
     895    !Config  Key  =  zrel_oro_t
     896    !Config  Desc = zrel_oro_t
     897    !Config  Def  = 9999.
    898898    !Config  Help = Connais pas !
    899     nm_oro_t_omp = -1.
    900     CALL getin('nm_oro_t', nm_oro_t_omp)
     899    zrel_oro_t_omp = 9999.
     900    CALL getin('zrel_oro_t', zrel_oro_t_omp)
    901901
    902902    !Config  Key  =  zstd_orodr_t
     
    23132313    ok_orodr = ok_orodr_omp
    23142314    ok_orolf = ok_orolf_omp
    2315     nm_oro_t=nm_oro_t_omp
     2315    zrel_oro_t=zrel_oro_t_omp
    23162316    zstd_orodr_t=zstd_orodr_t_omp
    23172317    zpmm_orodr_t=zpmm_orodr_t_omp
     
    27322732    WRITE(lunout,*) ' ok_orodr=',ok_orodr
    27332733    WRITE(lunout,*) ' ok_orolf=',ok_orolf
    2734     WRITE(lunout,*) ' nm_oro_t=',nm_oro_t
     2734    WRITE(lunout,*) ' zrel_oro_t=',zrel_oro_t
    27352735    WRITE(lunout,*) ' zstd_orodr_t=',zstd_orodr_t
    27362736    WRITE(lunout,*) ' zpmm_orodr_t=',zpmm_orodr_t
  • LMDZ6/branches/contrails/libf/phylmd/cv3_routines.f90

    r5489 r5536  
    49384938   USE lmdz_cv_ini, ONLY : nl
    49394939  USE cvflag_mod_h
    4940   USE ioipsl_getin_p_mod, ONLY : getin_p
    49414940  IMPLICIT NONE
    49424941
    49434942
    49444943!inputs:
    4945 !------
    49464944  INTEGER, INTENT (IN)                               :: ncum, nd, na, nloc, len
    49474945  INTEGER, DIMENSION (len), INTENT (IN)              :: icb, inb
     
    49514949  REAL, DIMENSION (len, nd+1), INTENT (IN)           :: Vprecip
    49524950!ouputs:
    4953 !------
    49544951  REAL, DIMENSION (len, na, na), INTENT (OUT)        :: phi, phi2, epmlmMm
    49554952  REAL, DIMENSION (len, na), INTENT (OUT)            :: da, d1a, dam, eplaMm
    49564953!
     4954! variables pour tracer dans precip de l'AA et des mel
    49574955!local variables:
    4958 !---------------
    4959 ! variables pour tracer dans precip de l'AA et des mel
    49604956  INTEGER i, j, k
    49614957  REAL epm(nloc, na, na)
    4962 !
    4963   LOGICAL,SAVE   ::  first=.TRUE.
    4964   LOGICAL,SAVE   ::  keep_bug_indices_cv3_tracer
    4965 !$OMP THREADPRIVATE(first, keep_bug_indices_cv3_tracer)
    49664958
    49674959! variables d'Emanuel : du second indice au troisieme
     
    49704962! variables personnelles : du troisieme au second indice
    49714963! --->    tab(i,j,k) -> de k a j
    4972 ! phi, phi2, epm, epmlmMm
    4973 
    4974   IF (first) THEN
    4975     keep_bug_indices_cv3_tracer = .FALSE.
    4976     CALL getin_p('keep_bug_indices_cv3_tracer', keep_bug_indices_cv3_tracer)
    4977     first = .FALSE.
    4978   ENDIF ! (first)
     4964! phi, phi2
     4965
    49794966! initialisations
    49804967
     
    50355022        d1a(i, j) = d1a(i, j) + ment(i, k, j)*ep(i, k)*(1.-sigij(i,k,j))
    50365023        IF (k<=j) THEN
     5024          dam(i, j) = dam(i, j) + ment(i, k, j)*epm(i, k, j)*(1.-ep(i,k))*(1.-sigij(i,k,j))
    50375025          phi2(i, j, k) = phi(i, j, k)*epm(i, j, k)
    50385026        END IF
     
    50405028    END DO
    50415029  END DO
    5042 
    5043   IF (keep_bug_indices_cv3_tracer) THEN
    5044     DO j = 1, nl
    5045       DO k = 1, nl
    5046         DO i = 1, ncum
    5047           IF (k<=j) THEN
    5048             dam(i, j) = dam(i, j) + ment(i, k, j)*epm(i, k, j)*(1.-ep(i,k))*(1.-sigij(i,k,j))
    5049           END IF ! (k<=j)
    5050         END DO
    5051       END DO
    5052     END DO
    5053   ELSE  ! (keep_bug_indices_cv3_tracer)
    5054     DO j = 1, nl
    5055       DO k = 1, nl
    5056         DO i = 1, ncum
    5057           IF (k<=j) THEN
    5058             dam(i, j) = dam(i, j) + ment(i, k, j)*epm(i, j, k)*(1.-ep(i,k))*(1.-sigij(i,k,j))
    5059           END IF ! (k<=j)
    5060         END DO
    5061       END DO
    5062     END DO
    5063   ENDIF ! (keep_bug_indices_cv3_tracer)
    50645030
    50655031  RETURN
  • LMDZ6/branches/contrails/libf/phylmd/dimphy.f90

    r5489 r5536  
    1313  INTEGER,SAVE :: kflev
    1414
    15 !$OMP THREADPRIVATE(klon,kdlon,kfdia,kidia,klev,klevp1,klevm1,kflev)
     15!$OMP THREADPRIVATE(klon,kfdia,kidia,kdlon)
    1616  REAL,save,allocatable,dimension(:) :: zmasq
    1717!$OMP THREADPRIVATE(zmasq)   
  • LMDZ6/branches/contrails/libf/phylmd/dyn1d/replay1d.f90

    r5489 r5536  
    2424CHARACTER (len=10) :: calend
    2525CHARACTER(len=20) :: calendrier
    26 CHARACTER(len=20) :: lmax_replay
     26
    2727
    2828!---------------------------------------------------------------------
     
    5656call getin('calend',calend)
    5757call getin('day_step',day_step)
    58 
    59 print*,'AVANT getin'
    60 klev=llm
    61 CALL getin('lmax_replay',lmax_replay)
    62 print*,'APRES getin',lmax_replay
    63 CALL getin(lmax_replay,klev)
    64 print*,'replay1d lmax_replay klev',lmax_replay,klev
    65 
    6658calendrier=calend
    6759if ( calendrier == "earth_360d" ) calendrier="360_day"
     
    7769
    7870klon=1
     71klev=llm
    7972call iotd_ini('phys.nc',1,1,klev,0.,0.,presnivs,jour0,mois0,an0,0.,86400./day_step,calendrier)
    8073! Consistent with ... CALL iophys_ini(600.)
  • LMDZ6/branches/contrails/libf/phylmd/fonte_neige_mod.F90

    r5489 r5536  
    231231  SUBROUTINE fonte_neige( knon, nisurf, knindex, dtime, &
    232232       tsurf, precip_rain, precip_snow, &
    233        snow, qsol, tsurf_new, evap, ice_sub &
     233       snow, qsol, tsurf_new, evap &
    234234#ifdef ISO   
    235235     & ,fq_fonte_diag,fqfonte_diag,snow_evap_diag,fqcalving_diag   &
     
    288288    REAL, DIMENSION(klon), INTENT(INOUT) :: evap
    289289
    290 
    291     REAL, DIMENSION(klon), INTENT(OUT)   :: ice_sub
    292290#ifdef ISO   
    293291        ! sortie de quelques diagnostiques
     
    299297    REAL, DIMENSION(klon), INTENT(OUT) ::  runoff_diag   
    300298    REAL, DIMENSION(klon), INTENT(OUT) :: run_off_lic_diag 
    301     REAL,                  INTENT(OUT) :: coeff_rel_diag   
    302 #endif
    303 
     299    REAL,                  INTENT(OUT) :: coeff_rel_diag
     300#endif
    304301
    305302! Local variables
     
    348345
    349346    snow_evap = 0.
    350     ice_sub(:) = 0.
    351347 
    352348    IF (.NOT. ok_lic_cond) THEN
     
    367363   
    368364    bil_eau_s(:) = (precip_rain(:) * dtime) - (evap(:) - snow_evap(:)) * dtime
    369 
    370     IF (nisurf==is_lic) THEN
    371        DO i=1,knon
    372           ice_sub(i)=evap(i)-snow_evap(i)
    373        ENDDO
    374     ENDIF
    375 
    376365#ifdef ISO
    377366    snow_evap_diag(:) = snow_evap(:)
  • LMDZ6/branches/contrails/libf/phylmd/infotrac_phy.F90

    r5489 r5536  
    33MODULE infotrac_phy
    44
    5    USE       strings_mod, ONLY: msg, maxlen, cat, dispTable, int2str, bool2str, strStack, strParse, strCount, strIdx
    6    USE readTracFiles_mod, ONLY: trac_type, readTracersFiles, tracers,  addPhase,  addKey, iH2O, &
    7        isoSelect,  indexUpdate, isot_type, testTracersFiles, isotope,  delPhase,  getKey, tran0, &
    8        isoKeys, isoName, isoZone, isoPhas, processIsotopes,  isoCheck, itZonIso,  nbIso,         &
    9           niso,   ntiso,   nzone,   nphas,   maxTableWidth,  iqIsoPha, iqWIsoPha, ixIso, new2oldH2O
     5   USE       strings_mod, ONLY: msg, fmsg, maxlen, cat, dispTable, int2str, bool2str, strStack, strParse, strIdx
     6   USE readTracFiles_mod, ONLY: trac_type, readTracersFiles, tracers, setGeneration, itZonIso, nzone, tran0, isoZone, &
     7        delPhase, niso, getKey, isot_type, processIsotopes,  isotope, maxTableWidth, iqIsoPha, nphas, ixIso, isoPhas, &
     8        addPhase, iH2O, addKey, isoSelect, testTracersFiles, isoKeys, indexUpdate,  iqWIsoPha, nbIso, ntiso, isoName, isoCheck
     9   USE readTracFiles_mod, ONLY: new2oldH2O
    1010   IMPLICIT NONE
    1111
     
    2727   !=== FOR ISOTOPES: Specific to water
    2828   PUBLIC :: iH2O                                          !--- Value of "ixIso" for "H2O" isotopes class
    29    PUBLIC :: ivap, iliq, isol, ibs, icf, irvc, ircont
     29   PUBLIC :: ivap, iliq, isol
    3030   !=== FOR ISOTOPES: Depending on the selected isotopes family
    3131   PUBLIC :: isotope                                       !--- Selected isotopes database (argument of getKey)
     
    8080!  | nqDescen    | Number of the descendants   (all generations)        | nqdesc      | 1:nqtot                |
    8181!  | nqChildren  | Number of childs            (1st generation only)    | nqfils      | 1:nqtot                |
    82 !  | isInPhysics | Advected tracers from the main table kept in physics | /           | nqtottr .TRUE. values  |
     82!  | isAdvected  | Advected tracers flag (.TRUE. if iadv >= 0)          | /           | nqtrue  .TRUE. values  |
     83!  | isInPhysics | Tracers not extracted from the main table in physics | /           | nqtottr .TRUE. values  |
    8384!  | iso_iGroup  | Isotopes group index in isotopes(:)                  | /           | 1:nbIso                |
    8485!  | iso_iName   | Isotope  name  index in isotopes(iso_iGroup)%trac(:) | iso_indnum  | 1:niso                 |
     
    103104
    104105   !=== INDICES FOR WATER
    105    INTEGER, SAVE :: ivap, iliq, isol, ibs, icf, irvc, ircont
    106 !$OMP THREADPRIVATE(ivap, iliq, isol, ibs, icf, irvc, ircont)
     106   INTEGER, SAVE :: ivap, iliq, isol
     107!$OMP THREADPRIVATE(ivap, iliq, isol)
    107108
    108109   !=== DIMENSIONS OF THE TRACERS TABLES AND OTHER SCALAR VARIABLES
    109    INTEGER, SAVE :: nqtot                                       !--- Tracers nb in dynamics (incl. higher moments + H2O)
    110    INTEGER, SAVE :: nbtr                                        !--- Tracers nb in physics  (excl. higher moments + H2O)
    111    INTEGER, SAVE :: nqo                                         !--- Number of water phases
    112    INTEGER, SAVE :: nqtottr                                     !--- Number of tracers passed to phytrac (TO BE DELETED ?)
    113    INTEGER, SAVE :: nqCO2                                       !--- Number of tracers of CO2  (ThL)
     110   INTEGER,               SAVE :: nqtot                       !--- Tracers nb in dynamics (incl. higher moments + H2O)
     111   INTEGER,               SAVE :: nbtr                        !--- Tracers nb in physics  (excl. higher moments + H2O)
     112   INTEGER,               SAVE :: nqo                         !--- Number of water phases
     113   INTEGER,               SAVE :: nqtottr                     !--- Number of tracers passed to phytrac (TO BE DELETED ?)
     114   INTEGER,               SAVE :: nqCO2                         !--- Number of tracers of CO2  (ThL)
    114115   CHARACTER(LEN=maxlen), SAVE :: type_trac                     !--- Keyword for tracers type(s)
    115116!$OMP THREADPRIVATE(nqtot, nbtr, nqo, nqtottr, nqCO2, type_trac)
    116117
    117118   !=== VARIABLES FOR INCA
    118    INTEGER, SAVE, ALLOCATABLE :: conv_flg(:), pbl_flg(:)        !--- Convection / boundary layer activation (nbtr)
     119   INTEGER, DIMENSION(:), SAVE, ALLOCATABLE ::  conv_flg, pbl_flg !--- Convection / boundary layer activation (nbtr)
    119120!$OMP THREADPRIVATE(conv_flg, pbl_flg)
    120121
     
    132133   USE lmdz_reprobus_wrappers, ONLY: Init_chem_rep_trac
    133134   USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_INCA, CPPKEY_REPROBUS, CPPKEY_STRATAER
    134    USE mod_phys_lmdz_para, ONLY: is_master, is_omp_master
    135    IMPLICIT NONE
     135IMPLICIT NONE
    136136!==============================================================================================================================
    137137!
     
    158158! Local variables
    159159   INTEGER, ALLOCATABLE :: hadv(:), vadv(:)                          !--- Horizontal/vertical transport scheme number
     160   INTEGER, ALLOCATABLE :: had (:), hadv_inca(:), conv_flg_inca(:), &!--- Variables specific to INCA
     161                           vad (:), vadv_inca(:),  pbl_flg_inca(:)
     162   CHARACTER(LEN=8), ALLOCATABLE :: solsym_inca(:)                   !--- Tracers names for INCA
    160163   INTEGER :: nqINCA
    161164   CHARACTER(LEN=maxlen), ALLOCATABLE :: tnames(:)
     
    184187   CALL getin_p('type_trac',type_trac)
    185188
    186    CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname, is_master)
    187    IF(strCount(type_trac, '|', nt)) CALL abort_physic(modname, 'Could''nt parse the "type_trac" string with delimiter "|"', 1)
    188    IF(nt >= 3) CALL abort_physic(modname, 'you need to modify type_trac, this version is not supported by lmdz', 1)
    189    IF(strParse(type_trac, '|', types_trac, n=nt)) CALL abort_physic(modname, "couldn't parse "//'"type_trac"', 1)
    190    IF(nt == 2) type_trac = types_trac(2) ! TO BE DELETED SOON
     189   lerr=strParse(type_trac, '|', types_trac, n=nt)
     190   IF (nt .GT. 1) THEN
     191      IF (nt .GT. 2) CALL abort_physic(modname, 'you need to modify type_trac, this version is not supported by lmdz', 1)
     192      IF (nt .EQ. 2) type_trac=types_trac(2)
     193   ENDIF
    191194
    192195   CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname)
     
    194197
    195198!##############################################################################################################################
    196    IF(lInit .AND. is_master) THEN                                    !=== SKIPED IF ALREADY DONE IN dyn3d_common/infotrac  ####
     199   IF(lInit) THEN                                                    !=== SKIPED IF ALREADY DONE IN dyn3d_common/infotrac  ####
    197200!##############################################################################################################################
    198201   !--- MESSAGE ABOUT THE CHOSEN CONFIGURATION
     
    211214   SELECT CASE(type_trac)
    212215      CASE('inca', 'inco')
    213          IF(.NOT.CPPKEY_INCA)     CALL abort_physic(modname, 'You must add cpp key INCA and compile with INCA code', 1)
     216IF (.NOT. CPPKEY_INCA) THEN
     217         CALL abort_physic(modname, 'You must add cpp key INCA and compile with INCA code', 1)
     218END IF
    214219      CASE('repr')
    215          IF(.NOT.CPPKEY_REPROBUS) CALL abort_physic(modname, 'You must add cpp key REPROBUS and compile with REPROBUS code', 1)
     220IF (.NOT. CPPKEY_REPROBUS) THEN
     221         CALL abort_physic(modname, 'You must add cpp key REPROBUS and compile with REPROBUS code', 1)
     222END IF
    216223      CASE('coag')
    217          IF(.NOT.CPPKEY_STRATAER) CALL abort_physic(modname, 'You must add cpp key StratAer and compile with StratAer code', 1)
     224IF (.NOT. CPPKEY_STRATAER) THEN
     225         CALL abort_physic(modname, 'You must add cpp key StratAer and compile with StratAer code', 1)
     226END IF
    218227   END SELECT
    219228!##############################################################################################################################
     
    221230!##############################################################################################################################
    222231
     232   nqCO2 = COUNT( [type_trac == 'inco', type_trac == 'co2i'] )
     233
    223234!==============================================================================================================================
    224235! 0) DETERMINE THE TYPE OF THE INPUT TRACERS DESCRIPTION FILE AND READ IT
    225236!==============================================================================================================================
    226    texp = type_trac                                                  !=== EXPANDED (WITH "|" SEPARATOR) "type_trac"
     237   texp = type_trac                                                            !=== EXPANDED (WITH "|" SEPARATOR) "type_trac"
    227238   IF(texp == 'inco') texp = 'co2i|inca'
    228239   IF(texp /= 'lmdz') texp = 'lmdz|'//TRIM(texp)
    229    IF(testTracersFiles(modname, texp, fType, lInit.AND.is_master)) CALL abort_physic(modname, 'problem with tracers file(s)',1)
     240   IF(testTracersFiles(modname, texp, fType, lInit)) CALL abort_physic(modname, 'problem with tracers file(s)',1)
    230241   ttp = type_trac; IF(fType /= 1) ttp = texp
     242
     243!##############################################################################################################################
     244   IF(lInit) THEN
     245      IF(readTracersFiles(ttp, lRepr=type_trac=='repr')) CALL abort_physic(modname, 'problem with tracers file(s)',1)
     246   ELSE
     247      CALL msg('No tracers description file(s) reading needed: already done in the dynamics', modname)
     248   END IF
     249!##############################################################################################################################
     250
     251!==============================================================================================================================
     252! 1) Get various numbers: "nqtrue" (first order only tracers), "nqo" (water phases), 'nbtr' (tracers passed to physics), etc.
     253!==============================================================================================================================
    231254   !---------------------------------------------------------------------------------------------------------------------------
    232255   IF(fType == 0) CALL abort_physic(modname, 'Missing "traceur.def", "tracer.def" or "tracer_<keyword>.def tracers file.',1)
    233256   !---------------------------------------------------------------------------------------------------------------------------
    234    IF(fType == 1 .AND. ANY(['inca', 'inco'] == type_trac)) &         !=== FOUND OLD STYLE INCA "traceur.def"
    235       CALL abort_physic(modname, 'retro-compatibility with old-style INCA traceur.def files has been disabled.', 1)
    236    !---------------------------------------------------------------------------------------------------------------------------
    237 
    238 !##############################################################################################################################
    239    IF(lInit) THEN
    240       IF(readTracersFiles(ttp, lRepr=type_trac == 'repr')) CALL abort_physic(modname, 'problem with tracers file(s)',1)
    241    END IF
    242    CALL msg('No tracers description file(s) reading needed: already done', modname, .NOT.lInit.AND.is_master)
    243 !##############################################################################################################################
    244 
    245 !==============================================================================================================================
    246 ! 1) Get various numbers: "nqtrue" (first order only tracers), "nqo" (water phases), 'nbtr' (tracers passed to physics), etc.
    247 !==============================================================================================================================
     257   IF(fType == 1 .AND. ANY(['inca', 'inco'] == type_trac) .AND. lInit) THEN  !=== FOUND OLD STYLE INCA "traceur.def"
     258   !---------------------------------------------------------------------------------------------------------------------------
     259IF (CPPKEY_INCA) THEN
     260      nqo = SIZE(tracers) - nqCO2
     261      CALL Init_chem_inca_trac(nqINCA)                               !--- Get nqINCA from INCA
     262      nbtr = nqINCA + nqCO2                                          !--- Number of tracers passed to phytrac
     263      nqtrue = nbtr + nqo                                            !--- Total number of "true" tracers
     264      IF(ALL([2,3] /= nqo)) CALL abort_physic(modname, 'Only 2 or 3 water phases allowed ; found nqo='//TRIM(int2str(nqo)), 1)
     265      ALLOCATE(hadv(nqtrue), hadv_inca(nqINCA), conv_flg_inca(nqINCA), solsym_inca(nqINCA))
     266      ALLOCATE(vadv(nqtrue), vadv_inca(nqINCA),  pbl_flg_inca(nqINCA))
     267      CALL init_transport(solsym_inca, conv_flg_inca, pbl_flg_inca, hadv_inca, vadv_inca)
     268      ALLOCATE(ttr(nqtrue))
     269      ttr(1:nqo+nqCO2)                  = tracers
     270      ttr(1    :      nqo   )%component = 'lmdz'
     271      ttr(1+nqo:nqCO2+nqo   )%component = 'co2i'
     272      ttr(1+nqo+nqCO2:nqtrue)%component = 'inca'
     273      ttr(1+nqo      :nqtrue)%name      = [('CO2     ', iq=1, nqCO2), solsym_inca]
     274      ttr(1+nqo+nqCO2:nqtrue)%parent    = tran0
     275      ttr(1+nqo+nqCO2:nqtrue)%phase     = 'g'
     276      lerr = getKey('hadv', had, ky=tracers(:)%keys)
     277      lerr = getKey('vadv', vad, ky=tracers(:)%keys)
     278      hadv(1:nqo+nqCO2) = had(:); hadv(1+nqo+nqCO2:nqtrue) = hadv_inca
     279      vadv(1:nqo+nqCO2) = vad(:); vadv(1+nqo+nqCO2:nqtrue) = vadv_inca
     280      CALL MOVE_ALLOC(FROM=ttr, TO=tracers)
     281      DO iq = 1, nqtrue
     282         t1 => tracers(iq)
     283         CALL addKey('name',      t1%name,      t1%keys)
     284         CALL addKey('component', t1%component, t1%keys)
     285         CALL addKey('parent',    t1%parent,    t1%keys)
     286         CALL addKey('phase',     t1%phase,     t1%keys)
     287      END DO
     288      IF(setGeneration(tracers)) CALL abort_physic(modname,'See below',1) !- SET FIELDS %iGeneration, %gen0Name
     289      DEALLOCATE(had, hadv_inca, vad, vadv_inca, conv_flg_inca, pbl_flg_inca, solsym_inca)
     290END IF
     291   !---------------------------------------------------------------------------------------------------------------------------
     292   ELSE                                                              !=== OTHER CASES (OLD OR NEW FORMAT, NO INCA MODULE)
     293   !---------------------------------------------------------------------------------------------------------------------------
    248294   nqtrue = SIZE(tracers)                                                                               !--- "true" tracers
    249295   nqo    =      COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%name)     == 'H2O')     !--- Water phases
    250296   nbtr = nqtrue-COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%gen0Name) == 'H2O')     !--- Passed to phytrac
    251297   nqCO2  =      COUNT( [type_trac == 'inco', type_trac == 'co2i'] )
    252    IF(CPPKEY_INCA) &
     298IF (CPPKEY_INCA) THEN
    253299   nqINCA =      COUNT(tracers(:)%component == 'inca')
    254    IF(CPPKEY_REPROBUS) CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name)     !--- Transfert the number of tracers to Reprobus
    255 
    256 !==============================================================================================================================
    257 ! 2) Calculate nqtot, number of tracers needed (greater if advection schemes 20 or 30 have been chosen).
    258 !==============================================================================================================================
     300END IF
    259301   IF(getKey('hadv', hadv, ky=tracers(:)%keys)) CALL abort_physic(modname, 'missing key "hadv"', 1)
    260302   IF(getKey('vadv', vadv, ky=tracers(:)%keys)) CALL abort_physic(modname, 'missing key "vadv"', 1)
     303   !---------------------------------------------------------------------------------------------------------------------------
     304   END IF
     305   !---------------------------------------------------------------------------------------------------------------------------
     306
     307IF (CPPKEY_REPROBUS) THEN
     308   CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name)                         !--- Transfert the number of tracers to Reprobus
     309END IF
     310
     311!##############################################################################################################################
     312   IF(lInit) THEN                                                    !=== SKIPED IF ALREADY DONE IN dyn3d_common/infotrac  ####
     313!##############################################################################################################################
     314
     315!==============================================================================================================================
     316! 2) Calculate nqtot, number of tracers needed (greater if advection schemes 20 or 30 have been chosen).
     317!==============================================================================================================================
    261318   DO iq = 1, nqtrue
    262319      IF( hadv(iq)<20 .OR. (ANY(hadv(iq)==[20,30]) .AND. hadv(iq)==vadv(iq)) ) CYCLE
     
    275332   END IF
    276333
    277 !##############################################################################################################################
    278    IF(lInit) THEN                                                    !=== SKIPED IF ALREADY DONE IN dyn3d_common/infotrac  ####
    279 !##############################################################################################################################
    280 
    281 !==============================================================================================================================
    282 ! 3) Determine the advection scheme ; needed to compute the full tracers list, the long names and nqtot
     334!==============================================================================================================================
     335! 3) Determine the advection scheme ; needed to compute the full tracers list, the long names, nqtot and %isAdvected
    283336!==============================================================================================================================
    284337   ALLOCATE(ttr(nqtot))
    285    jq = nqtrue+1
     338   jq = nqtrue+1; tracers(:)%iadv = -1
    286339   DO iq = 1, nqtrue
    287340      t1 => tracers(iq)
     
    294347      IF(iad == -1) CALL abort_physic(modname, msg1, 1)
    295348
    296       !--- SET FIELDS longName, isInPhysics
     349      !--- SET FIELDS longName, isAdvected, isInPhysics
    297350      t1%longName   = t1%name; IF(iad > 0) t1%longName=TRIM(t1%name)//descrq(iad)
    298       t1%isInPhysics= iad >= 0 .AND. (delPhase(t1%gen0Name) /= 'H2O' .OR. t1%component /= 'lmdz')
     351      t1%isAdvected = iad >= 0
     352      t1%isInPhysics= delPhase(t1%gen0Name) /= 'H2O' .OR. t1%component /= 'lmdz' !=== MORE EXCEPTIONS ? CO2i, SURSAT CLOUD H2O
    299353      ttr(iq)       = t1
    300354
     
    309363      ttr(jq+1:jq+nm)%parent      = [ (TRIM(t1%parent)  //'-'//TRIM(suff(im)), im=1, nm) ]
    310364      ttr(jq+1:jq+nm)%longName    = [ (TRIM(t1%longName)//'-'//TRIM(suff(im)), im=1, nm) ]
     365      ttr(jq+1:jq+nm)%isAdvected  = [ (.FALSE., im=1, nm) ]
    311366      ttr(jq+1:jq+nm)%isInPhysics = [ (.FALSE., im=1, nm) ]
    312367      jq = jq + nm
     
    318373   IF(indexUpdate(tracers)) CALL abort_physic(modname, 'problem with tracers indices update', 1)
    319374
     375!##############################################################################################################################
     376   END IF
     377!##############################################################################################################################
     378
     379!##############################################################################################################################
     380   IF(.NOT.lInit) THEN
     381!##############################################################################################################################
     382     nqtot = SIZE(tracers)
     383!##############################################################################################################################
     384   ELSE
     385!##############################################################################################################################
     386
    320387   !=== READ PHYSICAL PARAMETERS FOR ISOTOPES
    321388   niso = 0; nzone = 0; nphas = nqo; ntiso = 0; isoCheck = .FALSE.
     
    323390
    324391!##############################################################################################################################
    325    ELSE
    326 !##############################################################################################################################
    327    DO iq = 1, nqtrue
    328       t1 => tracers(iq)
    329       IF(hadv(iq)     ==    vadv(iq)    ) iad = hadv(iq)
    330       IF(hadv(iq)==10 .AND. vadv(iq)==16) iad = 11
    331       tracers(iq)%isInPhysics= iad >= 0 .AND. (delPhase(t1%gen0Name) /= 'H2O' .OR. t1%component /= 'lmdz')
    332    END DO
    333 !##############################################################################################################################
    334    END IF
    335 !##############################################################################################################################
    336 
     392   END IF
     393!##############################################################################################################################
    337394   !--- Convection / boundary layer activation for all tracers
    338395   IF(.NOT.ALLOCATED(conv_flg)) ALLOCATE(conv_flg(nbtr)); conv_flg(1:nbtr) = 1
     
    344401      CALL abort_physic(modname, 'problem with the computation of nqtottr', 1)
    345402
    346    !--- Compute indices for water
    347    ivap = strIdx(tracers(:)%name, addPhase('H2O', 'g'))
    348    iliq = strIdx(tracers(:)%name, addPhase('H2O', 'l'))
    349    isol = strIdx(tracers(:)%name, addPhase('H2O', 's'))
    350    ibs  = strIdx(tracers(:)%name, addPhase('H2O', 'b'))
    351    icf  = strIdx(tracers(:)%name, addPhase('H2O', 'f'))
    352    irvc = strIdx(tracers(:)%name, addPhase('H2O', 'c'))
    353    ircont = strIdx(tracers(:)%name, addPhase('H2O', 'a'))
    354 
    355    IF(CPPKEY_STRATAER .AND. type_trac == 'coag') THEN
     403   !=== DISPLAY THE RESULTS
     404   CALL msg('nqo    = '//TRIM(int2str(nqo)),    modname)
     405   CALL msg('nbtr   = '//TRIM(int2str(nbtr)),   modname)
     406   CALL msg('nqtrue = '//TRIM(int2str(nqtrue)), modname)
     407   CALL msg('nqtot  = '//TRIM(int2str(nqtot)),  modname)
     408   CALL msg('niso   = '//TRIM(int2str(niso)),   modname)
     409   CALL msg('ntiso  = '//TRIM(int2str(ntiso)),  modname)
     410IF (CPPKEY_INCA) THEN
     411   CALL msg('nqCO2  = '//TRIM(int2str(nqCO2)),  modname)
     412   CALL msg('nqINCA = '//TRIM(int2str(nqINCA)), modname)
     413END IF
     414   t => tracers
     415   CALL msg('Information stored in '//TRIM(modname)//': ', modname)
     416   IF(dispTable('isssssssssiiiiiiii', ['iq  ', 'name', 'lNam', 'g0Nm', 'prnt', 'type', 'phas', 'comp',     &
     417                       'isPh', 'isAd', 'iGen', 'iqPr', 'nqDe', 'nqCh', 'iGrp', 'iNam', 'iZon', 'iPha'],    &
     418      cat(t%name, t%longName, t%gen0Name, t%parent, t%type, t%phase, t%component,                          &
     419                                                         bool2str(t%isInPhysics), bool2str(t%isAdvected)), &
     420      cat([(iq, iq=1, nqtot)], t%iGeneration, t%iqParent, t%nqDescen, t%nqChildren, t%iso_iGroup,          &
     421                  t%iso_iName, t%iso_iZone, t%iso_iPhase), nColMax=maxTableWidth, nHead=2, sub=modname))   &
     422      CALL abort_physic(modname, "problem with the tracers table content", 1)
     423   IF(niso > 0) THEN
     424      CALL msg('Where, for isotopes family "'//TRIM(isotope%parent)//'":', modname)
     425      CALL msg('  isoKeys%name = '//strStack(isoKeys%name), modname)
     426      CALL msg('  isoName = '//strStack(isoName),      modname)
     427      CALL msg('  isoZone = '//strStack(isoZone),      modname)
     428      CALL msg('  isoPhas = '//TRIM(isoPhas),          modname)
     429   ELSE
     430      CALL msg('No isotopes identified.', modname)
     431   END IF
     432
     433#ifdef ISOVERIF
     434   CALL msg('iso_iName = '//strStack(int2str(PACK(tracers(:)%iso_iName, MASK=tracers(:)%iso_iGroup==iH2O))), modname)
     435#endif
     436IF (CPPKEY_STRATAER) THEN
     437   IF (type_trac == 'coag') THEN
    356438      nbtr_bin    = COUNT([(tracers(iq)%name(1:3)=='BIN', iq=1, nqtot)])
    357439      nbtr_sulgas = COUNT([(tracers(iq)%name(1:3)=='GAS', iq=1, nqtot)])
     
    362444      id_H2SO4_strat = strIdx(tnames, 'GASH2SO4')
    363445      id_TEST_strat  = strIdx(tnames, 'GASTEST' )
    364    END IF
    365 
    366    !=== DISPLAY THE RESULTS
    367    IF(.NOT.is_master) RETURN
    368    CALL msg('nqo    = '//TRIM(int2str(nqo)),    modname)
    369    CALL msg('nbtr   = '//TRIM(int2str(nbtr)),   modname)
    370    CALL msg('nqtrue = '//TRIM(int2str(nqtrue)), modname)
    371    CALL msg('nqtot  = '//TRIM(int2str(nqtot)),  modname)
    372    CALL msg('niso   = '//TRIM(int2str(niso)),   modname)
    373    CALL msg('ntiso  = '//TRIM(int2str(ntiso)),  modname)
    374    CALL msg('nqCO2  = '//TRIM(int2str(nqCO2)),  modname, CPPKEY_INCA)
    375    CALL msg('nqINCA = '//TRIM(int2str(nqINCA)), modname, CPPKEY_INCA)
    376    t => tracers
    377    CALL msg('Information stored in '//TRIM(modname)//': ', modname)
    378    IF(dispTable('issssssssiiiiiiii', ['iq  ', 'name', 'lNam', 'g0Nm', 'prnt', 'type', 'phas', 'comp',      &
    379                               'isPh', 'iGen', 'iqPr', 'nqDe', 'nqCh', 'iGrp', 'iNam', 'iZon', 'iPha'],     &
    380       cat(t%name, t%longName, t%gen0Name, t%parent, t%type, t%phase, t%component, bool2str(t%isInPhysics)),&
    381       cat([(iq, iq=1, nqtot)], t%iGeneration, t%iqParent, t%nqDescen, t%nqChildren, t%iso_iGroup,          &
    382                   t%iso_iName, t%iso_iZone, t%iso_iPhase), nColMax=maxTableWidth, nHead=2, sub=modname))   &
    383       CALL abort_physic(modname, "problem with the tracers table content", 1)
    384    CALL msg('No isotopes identified.', modname, nbIso == 0)
    385    IF(nbIso == 0) RETURN
    386    CALL msg('For isotopes family "H2O":', modname)
    387    CALL msg('  isoKeys%name = '//strStack(isoKeys%name), modname)
    388    CALL msg('  isoName = '//strStack(isoName),      modname)
    389    CALL msg('  isoZone = '//strStack(isoZone),      modname)
    390    CALL msg('  isoPhas = '//TRIM(isoPhas),          modname)
    391 
    392    IF(CPPKEY_STRATAER .AND. type_trac == 'coag') THEN
    393446      CALL msg('nbtr_bin       ='//TRIM(int2str(nbtr_bin      )), modname)
    394447      CALL msg('nbtr_sulgas    ='//TRIM(int2str(nbtr_sulgas   )), modname)
     
    399452      CALL msg('id_TEST_strat  ='//TRIM(int2str(id_TEST_strat )), modname)
    400453   END IF
     454END IF
     455   CALL msg('end', modname)
    401456
    402457END SUBROUTINE init_infotrac_phy
  • LMDZ6/branches/contrails/libf/phylmd/iophy.F90

    r5489 r5536  
    1313  INTEGER, SAVE :: itau_iophy
    1414  LOGICAL :: check_dim = .false.
    15 !$OMP THREADPRIVATE(io_lat,io_lon,phys_domain_id,npstn,nptabij,itau_iophy)
     15
     16!$OMP THREADPRIVATE(itau_iophy)
    1617
    1718  INTERFACE histwrite_phy
     
    971972  REAL, ALLOCATABLE, DIMENSION(:) :: fieldok
    972973  logical, save :: is_active = .true.
    973 !$OMP THREADPRIVATE(is_active)
    974974
    975975  IF (check_dim .AND. is_master) WRITE(lunout,*)'histwrite2d_phy for ',trim(var%name)
  • LMDZ6/branches/contrails/libf/phylmd/iophys.F90

    r5489 r5536  
    110110
    111111!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    112       SUBROUTINE iophys_ini(timestep,nlev)
    113       USE dimphy, ONLY: klev
     112      SUBROUTINE iophys_ini(timestep)
    114113      USE mod_phys_lmdz_para, ONLY: is_mpi_root
    115114      USE vertical_layers_mod, ONLY: presnivs
    116115      USE regular_lonlat_mod, ONLY: lon_reg, lat_reg
     116      USE dimphy, ONLY: klev
    117117      USE mod_grid_phy_lmdz, ONLY: klon_glo
    118118      USE time_phylmdz_mod, ONLY : annee_ref, day_ref, day_ini
     
    139139!   -------------
    140140
    141 integer, intent(in) :: nlev
    142 real, intent(in) :: timestep
    143 
    144141real pi
    145142INTEGER nlat_eff
    146143INTEGER jour0,mois0,an0
    147 REAL t0
     144REAL timestep,t0
    148145CHARACTER(len=20) :: calendrier
    149 integer ilev
    150 real coord_vert(nlev)
    151146
    152147!   Arguments:
     
    183178print*,'iophys_ini annee_ref day_ref',annee_ref,day_ref,day_ini,calend,t0
    184179
    185 if ( nlev == klev ) then
    186      coord_vert=presnivs
    187 print*,'ON EST LA '
    188 else
    189      do ilev=1,nlev
    190         coord_vert(ilev)=ilev
    191      enddo
    192 endif
    193 print*,'nlev=',nlev
    194 print*,'coord_vert',coord_vert
     180
    195181call iotd_ini('phys.nc', &
    196 size(lon_reg),nlat_eff,nlev,lon_reg(:)*180./pi,lat_reg*180./pi,coord_vert,jour0,mois0,an0,t0,timestep,calendrier)
    197  !  SUBROUTINE iotd_ini(fichnom,iim,jjm,llm,prlon,prlat,pcoordv,jour0,mois0,an0,t0,timestep,calendrier)
    198 !   -------
     182size(lon_reg),nlat_eff,klev,lon_reg(:)*180./pi,lat_reg*180./pi,presnivs,jour0,mois0,an0,t0,timestep,calendrier)
    199183    ENDIF
    200184!$OMP END MASTER
     
    232216
    233217      SUBROUTINE iotd_ecrit_seq(nom,lllm,titre,unite,px)
    234 !call iotd_ecrit_seq('f0',1,'f0 in thermcell_plume_6A',' ',f0(1:ngrid))
    235 
    236218        USE iotd_mod_h
    237219
     
    248230      integer i,j,l,ijl
    249231
    250       !print*,'iotd_ecrit_seq ,nom,lllm,titre,unite,px',nom,lllm,titre,unite,px
    251232      allocate(zx(imax,jmax,lllm))
    252233
  • LMDZ6/branches/contrails/libf/phylmd/iostart.f90

    r5489 r5536  
    44    INTEGER,SAVE :: nid_start
    55    INTEGER,SAVE :: nid_restart
     6   
    67    INTEGER,SAVE :: idim1,idim2,idim3,idim4
    7 !$OMP THREADPRIVATE(nid_start,nid_restart,idim1,idim2,idim3,idim4)
    8 
    98    INTEGER,PARAMETER :: length=100
    109   
  • LMDZ6/branches/contrails/libf/phylmd/iotd_ecrit.f90

    r5489 r5536  
    5555! Ajouts
    5656      integer, save :: ntime=0
    57       !$OMP THREADPRIVATE(ntime)
    5857      integer :: idim,varid
    5958      character (len =50):: fichnom
  • LMDZ6/branches/contrails/libf/phylmd/lmdz_cloudth.f90

    r5489 r5536  
    6969      REAL zpdf_a(ngrid),zpdf_b(ngrid),zpdf_e1(ngrid),zpdf_e2(ngrid)
    7070      REAL zqs(ngrid), qcloud(ngrid)
     71      REAL erf
    7172
    7273
     
    9091! Initialisation des variables r?elles
    9192!-------------------------------------------------------------------------------
    92       sigma1(:,ind2)=0.
    93       sigma2(:,ind2)=0.
    94       qlth(:,ind2)=0.
    95       qlenv(:,ind2)=0. 
    96       qltot(:,ind2)=0.
    97       rneb(:,ind2)=0.
     93      sigma1(:,:)=0.
     94      sigma2(:,:)=0.
     95      qlth(:,:)=0.
     96      qlenv(:,:)=0. 
     97      qltot(:,:)=0.
     98      rneb(:,:)=0.
    9899      qcloud(:)=0.
    99       cth(:,ind2)=0.
    100       cenv(:,ind2)=0.
    101       ctot(:,ind2)=0.
     100      cth(:,:)=0.
     101      cenv(:,:)=0.
     102      ctot(:,:)=0.
    102103      qsatmmussig1=0.
    103104      qsatmmussig2=0.
     
    316317      REAL zpdf_a(ngrid),zpdf_b(ngrid),zpdf_e1(ngrid),zpdf_e2(ngrid)
    317318      REAL zqs(ngrid), qcloud(ngrid)
     319      REAL erf
    318320
    319321!------------------------------------------------------------------------------
    320322! Initialisation des variables r?elles
    321323!------------------------------------------------------------------------------
    322       sigma1(:,ind2)=0.
    323       sigma2(:,ind2)=0.
    324       qlth(:,ind2)=0.
    325       qlenv(:,ind2)=0. 
    326       qltot(:,ind2)=0.
    327       rneb(:,ind2)=0.
     324      sigma1(:,:)=0.
     325      sigma2(:,:)=0.
     326      qlth(:,:)=0.
     327      qlenv(:,:)=0. 
     328      qltot(:,:)=0.
     329      rneb(:,:)=0.
    328330      qcloud(:)=0.
    329       cth(:,ind2)=0.
    330       cenv(:,ind2)=0.
    331       ctot(:,ind2)=0.
     331      cth(:,:)=0.
     332      cenv(:,:)=0.
     333      ctot(:,:)=0.
    332334      qsatmmussig1=0.
    333335      qsatmmussig2=0.
     
    642644      REAL zpdf_sig(ngrid),zpdf_k(ngrid),zpdf_delta(ngrid)
    643645      REAL zpdf_a(ngrid),zpdf_b(ngrid),zpdf_e1(ngrid),zpdf_e2(ngrid)
     646      REAL erf
    644647
    645648
     
    660663! Initialisation des variables r?elles
    661664!-------------------------------------------------------------------------------
    662       sigma1(:,ind2)=0.
    663       sigma2(:,ind2)=0.
    664       qlth(:,ind2)=0.
    665       qlenv(:,ind2)=0. 
    666       qltot(:,ind2)=0.
    667       rneb(:,ind2)=0.
     665      sigma1(:,:)=0.
     666      sigma2(:,:)=0.
     667      qlth(:,:)=0.
     668      qlenv(:,:)=0. 
     669      qltot(:,:)=0.
     670      rneb(:,:)=0.
    668671      qcloud(:)=0.
    669       cth(:,ind2)=0.
    670       cenv(:,ind2)=0.
    671       ctot(:,ind2)=0.
    672       cth_vol(:,ind2)=0.
    673       cenv_vol(:,ind2)=0.
    674       ctot_vol(:,ind2)=0.
     672      cth(:,:)=0.
     673      cenv(:,:)=0.
     674      ctot(:,:)=0.
     675      cth_vol(:,:)=0.
     676      cenv_vol(:,:)=0.
     677      ctot_vol(:,:)=0.
    675678      qsatmmussig1=0.
    676679      qsatmmussig2=0.
     
    875878      REAL zpdf_a(ngrid),zpdf_b(ngrid),zpdf_e1(ngrid),zpdf_e2(ngrid)
    876879      REAL zqs(ngrid), qcloud(ngrid)
     880      REAL erf
    877881
    878882      REAL rhodz(ngrid,klev)
     
    891895!------------------------------------------------------------------------------
    892896
    893       sigma1(:,ind2)=0.
    894       sigma2(:,ind2)=0.
    895       qlth(:,ind2)=0.
    896       qlenv(:,ind2)=0. 
    897       qltot(:,ind2)=0.
    898       rneb(:,ind2)=0.
     897      sigma1(:,:)=0.
     898      sigma2(:,:)=0.
     899      qlth(:,:)=0.
     900      qlenv(:,:)=0. 
     901      qltot(:,:)=0.
     902      rneb(:,:)=0.
    899903      qcloud(:)=0.
    900       cth(:,ind2)=0.
    901       cenv(:,ind2)=0.
    902       ctot(:,ind2)=0.
    903       cth_vol(:,ind2)=0.
    904       cenv_vol(:,ind2)=0.
    905       ctot_vol(:,ind2)=0.
     904      cth(:,:)=0.
     905      cenv(:,:)=0.
     906      ctot(:,:)=0.
     907      cth_vol(:,:)=0.
     908      cenv_vol(:,:)=0.
     909      ctot_vol(:,:)=0.
    906910      qsatmmussig1=0.
    907911      qsatmmussig2=0.
     
    13021306      REAL qcloud(ngrid) !eau totale dans le nuage
    13031307        !Some arithmetic variables
    1304       REAL  pi,sqrt2,sqrt2pi
     1308      REAL erf,pi,sqrt2,sqrt2pi
    13051309        !Depth of the layer
    13061310      REAL dz(ngrid,klev)    !epaisseur de la couche en metre
     
    13161320! Initialization
    13171321!------------------------------------------------------------------------------
    1318       qlth(:,ind2)=0.
    1319       qlenv(:,ind2)=0. 
    1320       qltot(:,ind2)=0.
    1321       cth_vol(:,ind2)=0.
    1322       cenv_vol(:,ind2)=0.
    1323       ctot_vol(:,ind2)=0.
    1324       cth_surf(:,ind2)=0.
    1325       cenv_surf(:,ind2)=0.
    1326       ctot_surf(:,ind2)=0.
     1322      qlth(:,:)=0.
     1323      qlenv(:,:)=0. 
     1324      qltot(:,:)=0.
     1325      cth_vol(:,:)=0.
     1326      cenv_vol(:,:)=0.
     1327      ctot_vol(:,:)=0.
     1328      cth_surf(:,:)=0.
     1329      cenv_surf(:,:)=0.
     1330      ctot_surf(:,:)=0.
    13271331      qcloud(:)=0.
    13281332      rdd=287.04
     
    15751579      REAL qlbef
    15761580      REAL dqsatenv(klon), dqsatth(klon)
     1581      REAL erf
    15771582      REAL zpdf_sig(klon),zpdf_k(klon),zpdf_delta(klon)
    15781583      REAL zpdf_a(klon),zpdf_b(klon),zpdf_e1(klon),zpdf_e2(klon)
  • LMDZ6/branches/contrails/libf/phylmd/lmdz_lscp_old.f90

    r5489 r5536  
    33!
    44MODULE lmdz_lscp_old
    5   PRIVATE
    6 
    7   INTEGER, PARAMETER :: ninter=5 ! sous-intervals pour la precipitation
    8   LOGICAL, PARAMETER :: cpartiel=.TRUE. ! condensation partielle
    9   REAL, PARAMETER :: t_coup=234.0
    10   REAL, PARAMETER :: DDT0=.01
    11   REAL, PARAMETER :: ztfondue=278.15
    12 
    13   LOGICAL, SAVE :: appel1er=.TRUE.
    14   !$OMP THREADPRIVATE(appel1er)
    15  
    16   PUBLIC fisrtilp_first, fisrtilp
    17 
    185CONTAINS
    19 
    20 ! firstilp first call part
    21 SUBROUTINE fisrtilp_first(klon, klev, dtime, pfrac_nucl, pfrac_1nucl, pfrac_impa)
    22 USE lmdz_lscp_ini, ONLY: prt_level, lunout
    23 IMPLICIT NONE
    24   REAL, INTENT(IN)     :: dtime  ! intervalle du temps (s)
    25   INTEGER, INTENT(IN)  :: klon, klev
    26   INTEGER :: i, k
    27 
    28   !AA
    29   ! Coeffients de fraction lessivee : pour OFF-LINE
    30   !
    31   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: pfrac_nucl
    32   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: pfrac_1nucl
    33   REAL, DIMENSION(klon,klev),      INTENT(OUT)  :: pfrac_impa
    34 
    35   IF (appel1er) THEN
    36     WRITE(lunout,*) 'fisrtilp, ninter:', ninter
    37     WRITE(lunout,*) 'fisrtilp, cpartiel:', cpartiel
    38     WRITE(lunout,*) 'FISRTILP VERSION LUDO'
    39      
    40     IF (ABS(dtime/REAL(ninter)-360.0).GT.0.001) THEN
    41      WRITE(lunout,*) 'fisrtilp: Ce n est pas prevu, voir Z.X.Li', dtime
    42      WRITE(lunout,*) 'Je prefere un sous-intervalle de 6 minutes'
    43      !         CALL abort
    44     ENDIF
    45     !
    46     !cdir collapse
    47     DO k = 1, klev
    48       DO i = 1, klon
    49         pfrac_nucl(i,k)=1.
    50         pfrac_1nucl(i,k)=1.
    51         pfrac_impa(i,k)=1.
    52       ENDDO
    53     ENDDO
    54     appel1er = .FALSE.
    55   ENDIF
    56  
    57 END SUBROUTINE fisrtilp_first
    58 
    596SUBROUTINE fisrtilp(klon,klev,dtime,paprs,pplay,t,q,ptconv,ratqs,sigma_qtherm, &
    607     d_t, d_q, d_ql, d_qi, rneb,rneblsvol,radliq, rain, snow,          &
     
    170117  REAL :: smallestreal
    171118
    172  ! --------------------------------------------------------------------------------
     119  INTEGER, PARAMETER :: ninter=5 ! sous-intervals pour la precipitation
     120  LOGICAL, PARAMETER :: cpartiel=.TRUE. ! condensation partielle
     121  REAL, PARAMETER :: t_coup=234.0
     122  REAL, PARAMETER :: DDT0=.01
     123  REAL, PARAMETER :: ztfondue=278.15
     124  ! --------------------------------------------------------------------------------
    173125  !
    174126  ! Variables locales:
     
    190142
    191143  REAL, DIMENSION(klon) :: zpdf_sig,zpdf_k,zpdf_delta, Zpdf_a,zpdf_b,zpdf_e1,zpdf_e2, qcloud
     144  REAL :: erf   
    192145 
    193146  REAL :: zqev, zqevt, zqev0,zqevi, zqevti, zdelq
     
    212165  REAL, DIMENSION(klon) :: zmqc
    213166  !
     167  LOGICAL, SAVE :: appel1er=.TRUE.
     168  !$OMP THREADPRIVATE(appel1er)
    214169  !
    215170! iflag_oldbug_fisrtilp=0 enleve le BUG par JYG : tglace_min -> tglace_max
     
    241196  REAL, DIMENSION(klon) :: zlh_solid
    242197  REAL :: zm_solid
    243   REAL :: tmp_var1d(klon) ! temporary variable for call site
    244198
    245199
     
    264218
    265219  if (prt_level>9)write(lunout,*)'NUAGES4 A. JAM'
    266 
    267   beta(:,:)=0.  !RomP initialisation => ym : could be probably removed but keept by security
    268 
     220  IF (appel1er) THEN
     221     WRITE(lunout,*) 'fisrtilp, ninter:', ninter
     222     WRITE(lunout,*) 'fisrtilp, cpartiel:', cpartiel
     223     WRITE(lunout,*) 'FISRTILP VERSION LUDO'
     224     
     225     IF (ABS(dtime/REAL(ninter)-360.0).GT.0.001) THEN
     226        WRITE(lunout,*) 'fisrtilp: Ce n est pas prevu, voir Z.X.Li', dtime
     227        WRITE(lunout,*) 'Je prefere un sous-intervalle de 6 minutes'
     228        !         CALL abort
     229     ENDIF
     230     appel1er = .FALSE.
     231     !
     232     !cdir collapse
     233     DO k = 1, klev
     234        DO i = 1, klon
     235           pfrac_nucl(i,k)=1.
     236           pfrac_1nucl(i,k)=1.
     237           pfrac_impa(i,k)=1.
     238           beta(i,k)=0.  !RomP initialisation
     239        ENDDO
     240     ENDDO
     241
     242  ENDIF          !  test sur appel1er
    269243  !
    270244  !MAf Initialisation a 0 de zoliq
     
    980954                 ! --------------------------
    981955                 if (iflag_t_glace.ge.1) then
    982                    tmp_var1d(:) = pplay(:,k)/paprs(:,1)
    983                    CALL icefrac_lsc(klon, zt(:), tmp_var1d, zfice(:))
     956                 CALL icefrac_lsc(klon,zt(:),pplay(:,k)/paprs(:,1),zfice(:))
    984957                 endif
    985958
     
    11501123     ELSE
    11511124         if (iflag_t_glace.ge.1) then
    1152             tmp_var1d(:) = pplay(:,k)/paprs(:,1)
    1153             CALL icefrac_lsc(klon,zt(:),tmp_var1d,zfice(:))
     1125            CALL icefrac_lsc(klon,zt(:),pplay(:,k)/paprs(:,1),zfice(:))
    11541126         endif
    11551127         if (iflag_fisrtilp_qsat.lt.1) then
     
    12701242         ENDDO
    12711243       ELSE ! of IF (iflag_t_glace.EQ.0)
    1272          tmp_var1d(:) = pplay(:,k)/paprs(:,1)
    1273          CALL icefrac_lsc(klon,zt(:), tmp_var1d, zfice(:))
     1244         CALL icefrac_lsc(klon,zt(:),pplay(:,k)/paprs(:,1),zfice(:))
    12741245!         DO i = 1, klon
    12751246!            IF (rneb(i,k).GT.0.0) THEN
  • LMDZ6/branches/contrails/libf/phylmd/lmdz_surf_wind.f90

    r5489 r5536  
    22        CONTAINS
    33
    4 SUBROUTINE surf_wind(klon,nsurfwind,zu10m,zv10m,sigmaw,cstar,ustar,wstar,wind10ms,probu)
     4SUBROUTINE surf_wind(klon,nsrfwnd,zu10m,zv10m,sigmaw,cstar,ustar,wstar,wind10ms,probu)
    55
    66USE lmdz_surf_wind_ini, ONLY : iflag_surf_wind
    77
    88IMPLICIT NONE
    9 INTEGER, INTENT(IN)                :: nsurfwind, klon
     9INTEGER, INTENT(IN)                :: nsrfwnd, klon
    1010REAL, DIMENSION(klon), INTENT(IN)  :: zu10m, zv10m
    1111REAL, DIMENSION(klon), INTENT(IN)  :: cstar
    1212REAL, DIMENSION(klon), INTENT(IN)  :: sigmaw
    1313REAL, DIMENSION(klon), INTENT(IN)  :: ustar, wstar
    14 REAL, DIMENSION(klon,nsurfwind), INTENT(OUT)         :: wind10ms, probu
     14REAL, DIMENSION(klon,nsrfwnd), INTENT(OUT)         :: wind10ms, probu
    1515
    1616
    17 REAL, DIMENSION(klon,nsurfwind)         :: sigma_th, sigma_wk
    18 REAL, DIMENSION(klon,nsurfwind)         :: xp, yp, zz
    19 REAL, DIMENSION(klon,nsurfwind)         :: vwx, vwy, vw
    20 REAL, DIMENSION(klon,nsurfwind)         :: vtx, vty
    21 REAL, DIMENSION(klon,nsurfwind)         :: windx, windy, wind
     17REAL, DIMENSION(klon,nsrfwnd)         :: sigma_th, sigma_wk
     18REAL, DIMENSION(klon,nsrfwnd)         :: xp, yp, zz
     19REAL, DIMENSION(klon,nsrfwnd)         :: vwx, vwy, vw
     20REAL, DIMENSION(klon,nsrfwnd)         :: vtx, vty
     21REAL, DIMENSION(klon,nsrfwnd)         :: windx, windy, wind
    2222REAL, DIMENSION(klon)                 :: ubwk, vbwk      ! ubwk et vbwk sont les vitesses moyennes dans les poches
    2323REAL, DIMENSION(klon)                 :: weilambda, U10mMOD
     
    3030REAL    :: ktwk, ktth, kzth
    3131
    32 !print*,'LLLLLLLLLLLLLLLLLLLLL nsurfwind=',nsurfwind
     32print*,'LLLLLLLLLLLLLLLLLLLLL nsrfwnd=',nsrfwnd
    3333pi=2.*acos(0.)
    3434ray=7000.
     
    3737kzth=1.
    3838kref=3
    39 nwb=nsurfwind
     39nwb=nsrfwnd
    4040
    4141ubwk(klon) = zu10m(klon)
     
    5353IF (iflag_surf_wind == 0) THEN
    5454    !U10mMOD=sqrt(zu10m(i)*zu10m(i)+zv10m(i)*zv10m(i))
    55     IF (nsurfwind /= 1 ) THEN
    56             STOP 'Si iflag_surf_wind=0, nsurfwind=1'
     55    IF (nsrfwnd /= 1 ) THEN
     56            STOP 'Si iflag_surf_wind=0, nsrfwnd=1'
    5757    ENDIF
    5858    DO i=1,klon
     
    6666
    6767    DO i=1, klon
    68         DO nmc=1, nsurfwind
     68        DO nmc=1, nsrfwnd
    6969             ! Utilisation de la distribution de weibull
    7070             !U10mMOD=sqrt(zu10m(i)*zu10m(i)+zv10m(i)*zv10m(i))
     
    9090
    9191    DO i=1, klon
    92         DO nmc=1, nsurfwind
     92        DO nmc=1, nsrfwnd
    9393            ! Utilisation de la distribution du vent a l interieur et a l exterieur des poches
    9494            call Random_number(zz)     ! tirage uniforme entre 0 et 1.
     
    122122                  wind(i,nmc) = sqrt(windx(i,nmc)**2 + windy(i,nmc)**2)
    123123                  wind10ms(i,nmc) = wind(i,nmc)
    124                   probu(i,nmc) = wind(i,nmc)/nsurfwind
     124                  probu(i,nmc) = wind(i,nmc)/nsrfwnd
    125125
    126126            ELSE
     
    143143                  wind(i,nmc) = sqrt(windx(i,nmc)**2 + windy(i,nmc)**2)
    144144                  wind10ms(i,nmc) = wind(i,nmc)
    145                   probu(i,nmc) = wind(i,nmc)/nsurfwind
     145                  probu(i,nmc) = wind(i,nmc)/nsrfwnd
    146146                  ! print*, 'wind10ms', wind10ms(i,nmc)         
    147147            ENDIF
  • LMDZ6/branches/contrails/libf/phylmd/lmdz_wake.f90

    r5489 r5536  
    358358IF (CPPKEY_IOPHYS_WK) THEN
    359359  IF (phys_sub) THEN
    360     call iophys_ini(dtimesub,klev)
     360    call iophys_ini(dtimesub)
    361361  ELSE
    362     call iophys_ini(dtime,klev)
     362    call iophys_ini(dtime)
    363363  ENDIF
    364364END IF
  • LMDZ6/branches/contrails/libf/phylmd/modd_csts.f90

    r5489 r5536  
    8888REAL,SAVE     :: XSURF_EPSILON       ! minimum space with 1.0
    8989!
    90 !$OMP THREADPRIVATE(XPI,XDAY,XSIYEA,XSIDAY,XKARMAN,XLIGHTSPEED,XPLANCK,XBOLTZ,XAVOGADRO)
    91 !$OMP THREADPRIVATE(XRADIUS,XOMEGA,XG,XP00,XSTEFAN,XI0,XMD,XMV,XRD,XRV)
    92 !$OMP THREADPRIVATE(XCPD,XCPV,XRHOLW,XCL,XCI,XTT,XTTSI,XTTS,XICEC,XLVTT,XLSTT,XLMTT,XESTT)
    93 !$OMP THREADPRIVATE(XALPW,XBETAW,XGAMW,XALPI,XBETAI,XGAMI,XTH00)
    94 !$OMP THREADPRIVATE(XRHOLI,XCONDI,NDAYSEC)
    95 !$OMP THREADPRIVATE(XSURF_TINY,XSURF_TINY_12,XSURF_EPSILON)
    96 
    9790END MODULE MODD_CSTS
    9891
  • LMDZ6/branches/contrails/libf/phylmd/oasis.F90

    r5489 r5536  
    139139    LOGICAL, SAVE                      :: cpl_current_omp
    140140    INTEGER, DIMENSION(klon_mpi)       :: ind_cell_glo_mpi
    141 
    142     !$OMP THREADPRIVATE(cpl_current_omp)
    143 
    144141
    145142!*    1. Initializations
  • LMDZ6/branches/contrails/libf/phylmd/ocean_forced_mod.F90

    r5489 r5536  
    335335    REAL                        :: zfra
    336336    REAL, PARAMETER             :: t_grnd=271.35
    337     REAL, DIMENSION(klon)       :: cal, beta, dif_grnd, capsol, icesub
     337    REAL, DIMENSION(klon)       :: cal, beta, dif_grnd, capsol
    338338    REAL, DIMENSION(klon)       :: alb_neig, tsurf_tmp
    339339    REAL, DIMENSION(klon)       :: soilcap, soilflux
     
    452452    CALL fonte_neige( knon, is_sic, knindex, dtime, &
    453453         tsurf_tmp, precip_rain, precip_snow, &
    454          snow, qsol, tsurf_new, evap, icesub &
     454         snow, qsol, tsurf_new, evap &
    455455#ifdef ISO   
    456456     &  ,fq_fonte_diag,fqfonte_diag,snow_evap_diag,fqcalving_diag   &
  • LMDZ6/branches/contrails/libf/phylmd/output_physiqex_mod.f90

    r5489 r5536  
    5858
    5959   !$OMP MASTER
    60    CALL iophys_ini(pdtphys,klev)
     60   CALL iophys_ini(pdtphys)
    6161   !$OMP END MASTER
    6262   !$OMP BARRIER
  • LMDZ6/branches/contrails/libf/phylmd/pbl_surface_mod.F90

    r5489 r5536  
    277277!>jyg
    278278       alb_dir_m,    alb_dif_m,  zxsens,   zxevap,  zxsnowerosion,      &
    279        icesub_lic, alb3_lic,  runoff,    snowhgt,   qsnow,     to_ice,    sissnow,  &
     279       alb3_lic,  runoff,    snowhgt,   qsnow,     to_ice,    sissnow,  &
    280280       zxtsol,    zxfluxlat, zt2m,     qsat2m, zn2mout,                 &
    281281       d_t,       d_q,    d_qbs,    d_u,      d_v, d_t_diss,            &
     
    522522    REAL, DIMENSION(klon),        INTENT(OUT)       :: zxevap     ! water vapour flux at surface, positiv upwards
    523523    REAL, DIMENSION(klon),        INTENT(OUT)       :: zxsnowerosion     ! blowing snow flux at surface
    524     REAL, DIMENSION(klon),        INTENT(OUT)       :: icesub_lic ! ice (no snow!) sublimation over ice sheet
    525524    REAL, DIMENSION(klon),        INTENT(OUT)       :: zxtsol     ! temperature at surface, mean for each grid point
    526525!!! jyg le ???
     
    746745    REAL, DIMENSION(klon)              :: AcoefQBS, BcoefQBS
    747746    REAL, DIMENSION(klon)              :: ypsref
    748     REAL, DIMENSION(klon)              :: yevap, yevap_pot, ytsurf_new, yalb3_new, yicesub_lic
     747    REAL, DIMENSION(klon)              :: yevap, yevap_pot, ytsurf_new, yalb3_new
    749748!albedo SB >>>
    750749    REAL, DIMENSION(klon,nsw)          :: yalb_dir_new, yalb_dif_new
     
    12471246 zxfluxt(:,:)=0. ; zxfluxq(:,:)=0.; zxfluxqbs(:,:)=0.
    12481247 qsnow(:)=0. ; snowhgt(:)=0. ; to_ice(:)=0. ; sissnow(:)=0.
    1249  runoff(:)=0. ; icesub_lic(:)=0.
     1248 runoff(:)=0.
    12501249#ifdef ISO
    12511250zxxtevap(:,:)=0.
     
    24992498                  ypsref, yu1, yv1, ygustiness, yrugoro, pctsrf, &
    25002499                  ysnow, yqsurf, yqsol,yqbs1, yagesno, &
    2501                   ytsoil, yz0m, yz0h, SFRWL, yalb_dir_new, yalb_dif_new, yevap, yicesub_lic, yfluxsens,yfluxlat, &
     2500                  ytsoil, yz0m, yz0h, SFRWL, yalb_dir_new, yalb_dif_new, yevap,yfluxsens,yfluxlat, &
    25022501                  yfluxbs, ytsurf_new, y_dflux_t, y_dflux_q, &
    25032502                  yzmea, yzsig, ycldt, &
     
    25222521                sissnow(i)   = ysissnow(j)
    25232522                runoff(i)    = yrunoff(j)
    2524                 icesub_lic(i) = yicesub_lic(j)*ypct(j)
    25252523             ENDDO
    25262524             ! Martin
     
    32273225
    32283226       ENDIF  ! (iflag_split .eq.0)
    3229 
     3227!!!
    32303228
    32313229       ! tendencies of blowing snow
  • LMDZ6/branches/contrails/libf/phylmd/phyetat0_mod.f90

    r5489 r5536  
    538538     it = 0
    539539     DO iq = 1, nqtot
    540         IF(.NOT.tracers(iq)%isInPhysics) CYCLE
     540        IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
    541541        it = it+1
    542542        tname = tracers(iq)%name
  • LMDZ6/branches/contrails/libf/phylmd/phyredem.f90

    r5489 r5536  
    360360       it = 0
    361361       DO iq = 1, nqtot
    362           IF(.NOT.tracers(iq)%isInPhysics) CYCLE
     362          IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
    363363          it = it+1
    364364          CALL put_field(pass,"trs_"//tracers(iq)%name, "", trs(:, it))
  • LMDZ6/branches/contrails/libf/phylmd/phys_local_var_mod.F90

    r5489 r5536  
    385385      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: dthmin, evap, snowerosion, fder, plcl, plfc, prw, prlw, prsw, prbsw, water_budget
    386386!$OMP THREADPRIVATE(dthmin, evap, snowerosion, fder, plcl, plfc, prw, prlw, prsw, prbsw, water_budget)
    387       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: icesub_lic
    388 !$OMP THREADPRIVATE(icesub_lic)
    389387      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zustar, zu10m, zv10m, rh2m
    390388!$OMP THREADPRIVATE(zustar, zu10m, zv10m, rh2m)
     
    10351033      ALLOCATE(cldm(klon), cldq(klon), cldt(klon), qsat2m(klon))
    10361034      ALLOCATE(JrNt(klon))
    1037       ALLOCATE(dthmin(klon), evap(klon), snowerosion(klon), fder(klon), plcl(klon), plfc(klon), icesub_lic(klon))
     1035      ALLOCATE(dthmin(klon), evap(klon), snowerosion(klon), fder(klon), plcl(klon), plfc(klon))
    10381036      ALLOCATE(prw(klon), prlw(klon), prsw(klon), prbsw(klon), water_budget(klon), zustar(klon), zu10m(klon), zv10m(klon), rh2m(klon))
    10391037      ALLOCATE(s_lcl(klon))
     
    14711469      DEALLOCATE(cldm, cldq, cldt, qsat2m)
    14721470      DEALLOCATE(JrNt)
    1473       DEALLOCATE(dthmin, evap, snowerosion, icesub_lic, fder, plcl, plfc)
     1471      DEALLOCATE(dthmin, evap, snowerosion, fder, plcl, plfc)
    14741472      DEALLOCATE(prw, prlw, prsw, prbsw, water_budget, zustar, zu10m, zv10m, rh2m, s_lcl)
    14751473      DEALLOCATE(s_pblh, s_pblt, s_therm)
  • LMDZ6/branches/contrails/libf/phylmd/phys_output_ctrlout_mod.F90

    r5489 r5536  
    384384  TYPE(ctrl_out), SAVE :: o_snowerosion = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
    385385   'snowerosion', 'blowing snow flux', 'kg/(s*m2)', (/ ('', i=1, 10) /))
    386   TYPE(ctrl_out), SAVE :: o_icesub_lic = ctrl_out((/ 10, 10, 10, 10, 10, 10, 11, 11, 11, 11/), &
    387    'icesub_lic', 'sublimation of ice over landice tiles, mesh-averaged', 'kg/(s*m2)', (/ ('', i=1, 10) /))
    388386  TYPE(ctrl_out), SAVE :: o_ustart_lic = ctrl_out((/ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11/), &
    389387    'ustart_lic', 'threshold velocity', 'm/s', (/ ('', i=1, 10) /))
     
    20032001  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_sat(:)
    20042002  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_uscav(:)
    2005   TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_wet_cv(:)
    2006   TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_wet(:)
     2003  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_wet_con(:)
    20072004  TYPE(ctrl_out), SAVE, ALLOCATABLE :: o_dtr_dry(:)
    20082005
  • LMDZ6/branches/contrails/libf/phylmd/phys_output_mod.F90

    r5489 r5536  
    77  USE phys_output_write_mod, ONLY : phys_output_write
    88  REAL, DIMENSION(nfiles),SAVE :: ecrit_files
    9   !$OMP THREADPRIVATE(ecrit_files)
    10 
    119
    1210! Abderrahmane 12 2007
     
    141139    REAL, DIMENSION(nfiles), SAVE ::  phys_out_latmin  = [   -90.,    -90.,    -90.,    -90.,    -90.,    -90.,    -90.,    -90.,    -90.,    -90.]
    142140    REAL, DIMENSION(nfiles), SAVE ::  phys_out_latmax  = [    90.,     90.,     90.,     90.,     90.,     90.,     90.,     90.,     90.,     90.]
    143 !$OMP THREADPRIVATE(phys_out_regfkey,phys_out_lonmin,phys_out_lonmax,phys_out_latmin,phys_out_latmax)
    144 
    145141    REAL, DIMENSION(klev,2) :: Ahyb_bounds, Bhyb_bounds
    146142    REAL, DIMENSION(klev+1)   :: lev_index
     
    176172    ALLOCATE(o_dtr_evapls(nqtot),o_dtr_ls(nqtot),o_dtr_trsp(nqtot))
    177173    ALLOCATE(o_dtr_sscav(nqtot),o_dtr_sat(nqtot),o_dtr_uscav(nqtot))
    178     ALLOCATE(o_dtr_wet_cv(nqtot), o_dtr_wet(nqtot))
     174    ALLOCATE(o_dtr_wet_con(nqtot))
    179175    ALLOCATE(o_dtr_dry(nqtot),o_dtr_vdf(nqtot))
    180176IF (CPPKEY_STRATAER) THEN
     
    517513          itr = 0; itrb = 0
    518514          DO iq = 1, nqtot
    519             IF(.NOT.tracers(iq)%isInPhysics) CYCLE
     515            IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
    520516            itr = itr + 1
    521517            dn = 'd'//TRIM(tracers(iq)%name)//'_'
     
    546542
    547543            lnam = 'tracer convective wet deposition'//TRIM(tracers(iq)%longName)
    548             tnam = TRIM(dn)//'wet_cv';       o_dtr_wet_cv       (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    549             lnam = 'tracer total wet deposition'//TRIM(tracers(iq)%longName)
    550             tnam = TRIM(dn)//'wet';       o_dtr_wet       (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     544            tnam = TRIM(dn)//'wet_con';       o_dtr_wet_con       (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
    551545            lnam = 'tracer tendency dry deposition'//TRIM(tracers(iq)%longName)
    552546            tnam = 'cum'//TRIM(dn)//'dry';  o_dtr_dry       (itr) = ctrl_out(flag, tnam, lnam, "-", [('',i=1,nfiles)])
     
    642636
    643637!  DO iq=1,nqtot
    644 !    IF(.NOT.tracers(iq)%isInPhysics) CYCLE
     638!    IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
    645639!    WRITE(*,'(a,i1,a,10i3)')'trac(',iq,')%flag = ',o_trac(iq)%flag
    646640!    WRITE(*,'(a,i1,a)')'trac(',iq,')%name = '//TRIM(o_trac(iq)%name)
  • LMDZ6/branches/contrails/libf/phylmd/phys_output_var_mod.f90

    r5489 r5536  
    104104  !$OMP THREADPRIVATE(clef_files, clef_stations, lev_files,nid_files,nnid_files)
    105105  INTEGER, DIMENSION(nfiles), SAVE :: nnhorim
     106
    106107  INTEGER, DIMENSION(nfiles), SAVE :: nhorim, nvertm
    107108  INTEGER, DIMENSION(nfiles), SAVE :: nvertap, nvertbp, nvertAlt
    108109  REAL, DIMENSION(nfiles), SAVE                :: zoutm
    109110  CHARACTER(LEN=20), DIMENSION(nfiles), SAVE   :: type_ecri
    110   !$OMP THREADPRIVATE(nnhorim,nhorim,nvertm,nvertap,nvertbp,nvertAlt,zoutm,type_ecri)
     111  !$OMP THREADPRIVATE(nnhorim, nhorim, nvertm, zoutm,type_ecri)
    111112  CHARACTER(LEN=20), DIMENSION(nfiles), SAVE  :: type_ecri_files, phys_out_filetypes
    112113  !$OMP THREADPRIVATE(type_ecri_files, phys_out_filetypes)
  • LMDZ6/branches/contrails/libf/phylmd/phys_output_write_mod.F90

    r5489 r5536  
    66  USE phytrac_mod, ONLY : d_tr_cl, d_tr_th, d_tr_cv, d_tr_lessi_impa, &
    77       d_tr_lessi_nucl, d_tr_insc, d_tr_bcscav, d_tr_evapls, d_tr_ls,  &
    8        d_tr_trsp, d_tr_sscav, d_tr_sat, d_tr_uscav,  &
    9        flux_tr_wet_cv, flux_tr_wet, flux_tr_dry
     8       d_tr_trsp, d_tr_sscav, d_tr_sat, d_tr_uscav, flux_tr_wet, flux_tr_dry
    109
    1110  ! Author: Abderrahmane IDELKADI (original include file)
     
    4948         o_psol, o_mass, o_qsurf, o_qsol, &
    5049         o_precip, o_rain_fall, o_rain_con, o_ndayrain, o_plul, o_pluc, o_plun, &
    51          o_snow, o_msnow, o_fsnow, o_evap, o_snowerosion, o_ustart_lic, o_qsalt_lic, o_rhosnow_lic, o_bsfall, &
    52          o_icesub_lic, &
     50         o_snow, o_msnow, o_fsnow, o_evap, o_snowerosion, o_ustart_lic, o_qsalt_lic, o_rhosnow_lic, o_bsfall, &
    5351         o_ep,o_epmax_diag, & ! epmax_cape
    5452         o_tops, o_tops0, o_topl, o_topl0, &
     
    191189         o_dtr_insc, o_dtr_bcscav, o_dtr_evapls, &
    192190         o_dtr_ls, o_dtr_trsp, o_dtr_sscav, o_dtr_dry, &
    193          o_dtr_sat, o_dtr_uscav, o_dtr_wet_cv, o_dtr_wet, &
     191         o_dtr_sat, o_dtr_uscav, o_dtr_wet_con, &
    194192         o_trac_cum, o_du_gwd_rando, o_dv_gwd_rando, &
    195193         o_ustr_gwd_hines,o_vstr_gwd_hines,o_ustr_gwd_rando,o_vstr_gwd_rando, &
     
    319317    USE phys_local_var_mod, ONLY: zxfluxlat, slp, ptstar, pt0, zxtsol, zt2m, &
    320318         zn2mout, t2m_min_mon, t2m_max_mon, evap, &
    321          snowerosion, icesub_lic, zxustartlic, zxrhoslic, zxqsaltlic, &
     319         snowerosion, zxustartlic, zxrhoslic, zxqsaltlic, &
    322320         l_mixmin,l_mix, pbl_eps, tke_shear, tke_buoy, tke_trans, &
    323321         zu10m, zv10m, zq2m, zustar, zxqsurf, &
     
    918916       CALL histwrite_phy(o_fsnow, zfra_o)
    919917       CALL histwrite_phy(o_evap, evap)
    920        CALL histwrite_phy(o_icesub_lic, icesub_lic)
    921918
    922919       IF (ok_bs) THEN
     
    28662863             CALL histwrite_phy(o_dtr_uscav(itr),d_tr_uscav(:,:,itr))
    28672864            !--2D fields
    2868              CALL histwrite_phy(o_dtr_wet_cv(itr), flux_tr_wet_cv(:,itr))
    2869              CALL histwrite_phy(o_dtr_wet(itr), flux_tr_wet(:,itr))
     2865             CALL histwrite_phy(o_dtr_wet_con(itr), flux_tr_wet(:,itr))
    28702866             CALL histwrite_phy(o_dtr_dry(itr), flux_tr_dry(:,itr))
    28712867             zx_tmp_fi2d=0.
  • LMDZ6/branches/contrails/libf/phylmd/physiq_mod.F90

    r5489 r5536  
    3939    USE ioipsl_getin_p_mod, ONLY : getin_p
    4040    USE indice_sol_mod
    41     USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, type_trac, addPhase, ivap, iliq, isol, ibs, icf, irvc, ircont
     41    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, type_trac, addPhase
    4242    USE strings_mod,  ONLY: strIdx
    4343    USE iophy
     
    7878    USE lmdz_lscp, ONLY : lscp
    7979    USE lmdz_call_cloud_optics_prop, ONLY : call_cloud_optics_prop
    80     USE lmdz_lscp_old, ONLY : fisrtilp, fisrtilp_first
     80    USE lmdz_lscp_old, ONLY : fisrtilp
    8181    USE lmdz_call_blowing_snow, ONLY : call_blowing_snow_sublim_sedim
    8282    USE lmdz_wake_ini, ONLY : wake_ini
     
    248248       cldh, cldl,cldm, cldq, cldt,      &
    249249       JrNt,                             &
    250        dthmin, evap, snowerosion, icesub_lic, fder, plcl, plfc,   &
     250       dthmin, evap, snowerosion,fder, plcl, plfc,   &
    251251       prw, prlw, prsw, prbsw, water_budget,         &
    252252       s_lcl, s_pblh, s_pblt, s_therm,   &
     
    376376       USE phys_output_write_spl_mod, ONLY: phys_output_write_spl
    377377       USE phytracr_spl_mod, ONLY: phytracr_spl_out_init, phytracr_spl
    378        USE s2s, ONLY : s2s_initialize
    379378    IMPLICIT NONE
    380379    !>======================================================================
     
    513512    !======================================================================
    514513    !
     514    ! indices de traceurs eau vapeur, liquide, glace, fraction nuageuse LS (optional), blowing snow (optional)
     515    INTEGER,SAVE :: ivap, iliq, isol, ibs, icf, irvc, ircont
     516!$OMP THREADPRIVATE(ivap, iliq, isol, ibs, icf, irvc, ircont)
     517    !
    515518    !
    516519    ! Variables argument:
     
    10181021
    10191022    REAL picefra(klon,klev)
    1020     REAL nm_oro(klon)
     1023    REAL zrel_oro(klon)
    10211024    !IM cf. AM 081204 END
    10221025    !
     
    10931096    CHARACTER*80 abort_message
    10941097    LOGICAL, SAVE ::  ok_sync, ok_sync_omp
    1095     !$OMP THREADPRIVATE(ok_sync,ok_sync_omp)
     1098    !$OMP THREADPRIVATE(ok_sync)
    10961099    REAL date0
    10971100
     
    11031106    REAL ztsol(klon)
    11041107    REAL q2m(klon,nbsrf)  ! humidite a 2m
     1108    REAL fsnowerosion(klon,nbsrf) ! blowing snow flux at surface
    11051109    REAL qbsfra  ! blowing snow fraction
    11061110    !IM: t2m, q2m, ustar, u10m, v10m et t2mincels, t2maxcels
     
    12661270    ! Subgrid scale wind :
    12671271    ! Need to be allocatable/save because the number of bin is not known (provided by surf_wind_ini)
    1268     integer, save :: nsurfwind=1
     1272    integer, save :: nsrfwnd=1
    12691273    real, dimension(:,:), allocatable, save :: surf_wind_value, surf_wind_proba ! module and probability of sugrdi wind wind sample
    1270     !$OMP THREADPRIVATE(nsurfwind,surf_wind_value, surf_wind_proba)
     1274    !$OMP THREADPRIVATE(nsrfwnd,surf_wind_value, surf_wind_proba)
    12711275   
    12721276
     
    13481352
    13491353    IF (first) THEN
    1350        
    1351         CALL s2s_initialize     ! initialization of source to source tools
    1352        
     1354       ivap = strIdx(tracers(:)%name, addPhase('H2O', 'g'))
     1355       iliq = strIdx(tracers(:)%name, addPhase('H2O', 'l'))
     1356       isol = strIdx(tracers(:)%name, addPhase('H2O', 's'))
     1357       ibs  = strIdx(tracers(:)%name, addPhase('H2O', 'b'))
     1358       icf  = strIdx(tracers(:)%name, addPhase('H2O', 'f'))
     1359       irvc = strIdx(tracers(:)%name, addPhase('H2O', 'c'))
     1360       ircont = strIdx(tracers(:)%name, addPhase('H2O', 'a'))
    13531361!       CALL init_etat0_limit_unstruct
    13541362!       IF (.NOT. create_etat0_limit) CALL init_limit_read(days_elapsed)
     
    18331841!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    18341842       CALL surf_wind_ini(klon,lunout)
    1835        CALL getin_p('nsurfwind',nsurfwind)
    1836        allocate(surf_wind_value(klon,nsurfwind),surf_wind_proba(klon,nsurfwind))
     1843       CALL getin_p('nsrfwnd',nsrfwnd)
     1844       allocate(surf_wind_value(klon,nsrfwnd),surf_wind_proba(klon,nsrfwnd))
    18371845   
    18381846!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    1839    CALL iophys_ini(pdtphys,nsurfwind) ! replay automatic include  ! replay automatic include
    18401847       CALL wake_ini(rg,rd,rv,prt_level)
    18411848       CALL yamada_ini(klon,lunout,prt_level)
     
    29102917            cdragh,    cdragm,  u1,    v1,            &
    29112918            beta_aridity, &
    2912             albsol_dir,   albsol_dif,   sens,    evap, snowerosion, icesub_lic, &
     2919                                !albedo SB >>>
     2920                                ! albsol1,   albsol2,   sens,    evap,      &
     2921            albsol_dir,   albsol_dif,   sens,    evap, snowerosion, &
     2922                                !albedo SB <<<
    29132923            albsol3_lic,runoff,   snowhgt,   qsnow, to_ice, sissnow, &
    29142924            zxtsol,    zxfluxlat, zt2m,    qsat2m,  zn2mout, &
     
    37263736             !  poches, la tendance moyenne associ\'ee doit etre
    37273737             !  multipliee par la fraction surfacique qu'ils couvrent.
    3728              IF (mod(iflag_pbl_split/10,10) == 1) THEN
    3729                 ! On tient compte du splitting pour modifier les profils deltatq/T des poches
    3730                 DO k=1,klev
    3731                    DO i=1,klon
    3732                       d_deltat_the(i,k) = - d_t_ajs(i,k)
    3733                       d_deltaq_the(i,k) = - d_q_ajs(i,k)
    3734                    ENDDO
    3735                 ENDDO
    3736              ELSE
    3737                 d_deltat_the(:,:) = 0.
    3738                 d_deltaq_the(:,:) = 0.
    3739              ENDIF
    3740 
    37413738             DO k=1,klev
    37423739                DO i=1,klon
     3740                   !
     3741                   d_deltat_the(i,k) = - d_t_ajs(i,k)
     3742                   d_deltaq_the(i,k) = - d_q_ajs(i,k)
     3743                   !
    37433744                   d_u_ajs(i,k) = d_u_ajs(i,k)*(1.-wake_s(i))
    37443745                   d_v_ajs(i,k) = d_v_ajs(i,k)*(1.-wake_s(i))
    37453746                   d_t_ajs(i,k) = d_t_ajs(i,k)*(1.-wake_s(i))
    37463747                   d_q_ajs(i,k) = d_q_ajs(i,k)*(1.-wake_s(i))
     3748                   !
    37473749                ENDDO
    37483750             ENDDO
     
    38353837    !===================================================================
    38363838    ! Computation of subrgid scale near-surface wind distribution
    3837     call surf_wind(klon,nsurfwind,u10m,v10m,wake_s,wake_Cstar,ustar,wstar,surf_wind_value,surf_wind_proba)
     3839    call surf_wind(klon,nsrfwnd,u10m,v10m,wake_s,wake_Cstar,ustar,wstar,surf_wind_value,surf_wind_proba)
    38383840
    38393841    !===================================================================
     
    39223924
    39233925    ELSE
    3924    
    3925     CALL fisrtilp_first(klon, klev, phys_tstep, pfrac_impa, pfrac_nucl, pfrac_1nucl)
     3926
    39263927    CALL fisrtilp(klon,klev,phys_tstep,paprs,pplay, &
    39273928         t_seri, q_seri,ptconv,ratqs,sigma_qtherm, &
     
    48584859    ! a l'echelle sous-maille:
    48594860    !
    4860 
    4861     ! calculation of nm_oro
    4862     DO i=1,klon
    4863           ! nm_oro is a proxy for the number of subgrid scale mountains
    4864           ! -> condition on nm_oro can deactivate the lifting on tilted planar terrains
    4865           !    such as ice sheets (work by V. Wiener)
    4866           ! in such a case, the SSO scheme should activate only where nm_oro>0 i.e. by setting
    4867           ! nm_oro_t=0.
    4868           nm_oro(i)=zsig(i)*sqrt(cell_area(i)*(pctsrf(i,is_ter)+pctsrf(i,is_lic)))/(4.*MAX(zstd(i),1.e-8))-1.
    4869     ENDDO
    4870 
    48714861    IF (prt_level .GE.10) THEN
    48724862       print *,' call orography ? ', ok_orodr
     
    48794869       DO i=1,klon
    48804870          itest(i)=0
     4871          zrel_oro(i)=zstd(i)/(max(zsig(i),1.E-8)*sqrt(cell_area(i)))
     4872          !zrel_oro: relative mountain height wrt relief explained by mean slope
     4873          ! -> condition on zrel_oro can deactivate the drag on tilted planar terrains
     4874          !    such as ice sheets (work by V. Wiener)
    48814875          ! zpmm_orodr_t and zstd_orodr_t are activation thresholds set by F. Lott to
    48824876          ! earn computation time but they are not physical.
    4883           IF (((zpic(i)-zmea(i)).GT.zpmm_orodr_t).AND.(zstd(i).GT.zstd_orodr_t).AND.(nm_oro(i).GT.nm_oro_t)) THEN
     4877          IF (((zpic(i)-zmea(i)).GT.zpmm_orodr_t).AND.(zstd(i).GT.zstd_orodr_t).AND.(zrel_oro(i).LE.zrel_oro_t)) THEN
    48844878             itest(i)=1
    48854879             igwd=igwd+1
     
    49304924       DO i=1,klon
    49314925          itest(i)=0
    4932           IF (((zpic(i)-zmea(i)).GT.zpmm_orolf_t).AND.(nm_oro(i).GT.nm_oro_t)) THEN
     4926          !zrel_oro: relative mountain height wrt relief explained by mean slope
     4927          ! -> condition on zrel_oro can deactivate the lifting on tilted planar terrains
     4928          !    such as ice sheets (work by V. Wiener)
     4929          zrel_oro(i)=zstd(i)/(max(zsig(i),1.E-8)*sqrt(cell_area(i)))
     4930          IF (((zpic(i)-zmea(i)).GT.zpmm_orolf_t).AND.(zrel_oro(i).LE.zrel_oro_t)) THEN
    49334931             itest(i)=1
    49344932             igwd=igwd+1
     
    51715169! car on peut s'attendre a ce que les petites echelles produisent aussi de la TKE
    51725170! Mais attention, cela ne va pas dans le sens de la conservation de l'energie!
    5173           IF ((zstd(i).GT.1.0) .AND.(nm_oro(i).GT.nm_oro_t)) THEN
     5171          IF ((zstd(i).GT.1.0) .AND.(zrel_oro(i).LE.zrel_oro_t)) THEN
    51745172             itest(i)=1
    51755173             igwd=igwd+1
     
    51835181       DO i=1,klon
    51845182          itest(i)=0
    5185         IF (((zpic(i)-zmea(i)).GT.zpmm_orodr_t).AND.(zstd(i).GT.zstd_orodr_t).AND.(nm_oro(i).GT.nm_oro_t)) THEN
     5183        IF (((zpic(i)-zmea(i)).GT.zpmm_orodr_t).AND.(zstd(i).GT.zstd_orodr_t).AND.(zrel_oro(i).LE.zrel_oro_t)) THEN
    51865184             itest(i)=1
    51875185             igwd=igwd+1
  • LMDZ6/branches/contrails/libf/phylmd/phystokenc_mod.f90

    r5489 r5536  
    142142  REAL,DIMENSION(:,:), ALLOCATABLE,SAVE     :: upwd
    143143  REAL,DIMENSION(:,:), ALLOCATABLE,SAVE     :: dnwd
    144 !$OMP THREADPRIVATE(sh,da,phi,mp,upwd,dnwd)
    145 
     144 
    146145  REAL, SAVE :: dtcum
    147146  INTEGER, SAVE:: iadvtr=0
  • LMDZ6/branches/contrails/libf/phylmd/phytrac_mod.f90

    r5489 r5536  
    3535  REAL,DIMENSION(:,:,:),ALLOCATABLE,SAVE :: d_tr_sat
    3636  REAL,DIMENSION(:,:,:),ALLOCATABLE,SAVE :: d_tr_uscav
    37   REAL,DIMENSION(:,:),ALLOCATABLE,SAVE   :: flux_tr_wet    ! tracer wet deposit (surface)                    jyg
    38   REAL,DIMENSION(:,:),ALLOCATABLE,SAVE   :: flux_tr_wet_cv ! tracer convective wet deposit (surface)         jyg
     37  REAL,DIMENSION(:,:),ALLOCATABLE,SAVE   :: flux_tr_wet ! tracer wet deposit (surface)                    jyg
    3938  REAL,DIMENSION(:,:,:),ALLOCATABLE,SAVE :: qPr,qDi ! concentration tra dans pluie,air descente insaturee
    4039  REAL,DIMENSION(:,:,:),ALLOCATABLE,SAVE :: qPa,qMel
     
    4948
    5049!$OMP THREADPRIVATE(qPa,qMel,qTrdi,dtrcvMA,d_tr_th,d_tr_lessi_impa,d_tr_lessi_nucl)
    51 !$OMP THREADPRIVATE(d_tr_trsp,d_tr_sscav,d_tr_sat,d_tr_uscav)
    52 !$OMP THREADPRIVATE(flux_tr_wet,flux_tr_wet_cv,qPr,qDi)
     50!$OMP THREADPRIVATE(d_tr_trsp,d_tr_sscav,d_tr_sat,d_tr_uscav,flux_tr_wet,qPr,qDi)
    5351!$OMP THREADPRIVATE(d_tr_insc,d_tr_bcscav,d_tr_evapls,d_tr_ls,qPrls)
    5452!$OMP THREADPRIVATE(d_tr_cl,d_tr_dry,flux_tr_dry,d_tr_dec,d_tr_cv)
     
    7169    ALLOCATE(d_tr_sscav(klon,klev,nbtr),d_tr_sat(klon,klev,nbtr))
    7270    ALLOCATE(d_tr_uscav(klon,klev,nbtr),qPr(klon,klev,nbtr),qDi(klon,klev,nbtr))
    73     ALLOCATE(flux_tr_wet(klon,nbtr),flux_tr_wet_cv(klon,nbtr))
     71    ALLOCATE(flux_tr_wet(klon,nbtr))
    7472    ALLOCATE(qPa(klon,klev,nbtr),qMel(klon,klev,nbtr))
    7573    ALLOCATE(qTrdi(klon,klev,nbtr),dtrcvMA(klon,klev,nbtr))
     
    413411          flux_tr_dry(i,it)=0.
    414412          flux_tr_wet(i,it)=0.
    415           flux_tr_wet_cv(i,it)=0.
    416413       ENDDO
    417414    ENDDO
     
    703700                !--with the full array tr_seri even if only item it is processed
    704701
    705                 CALL cvltr_scav(pdtphys, da, phi,phi2,d1a,dam, mp,ep,                 &
    706                      sigd,sij,wght_cvfd,clw,elij,epmlmMm,eplaMm,                      &   
    707                      pmflxr,pmflxs,evap,t_seri,wdtrainA,wdtrainM,                     & 
    708                      paprs,it,tr_seri,upwd,dnwd,itop_con,ibas_con,                    &
    709                      ccntrAA_3d,ccntrENV_3d,coefcoli_3d,                              &
    710                      d_tr_cv,d_tr_trsp,d_tr_sscav,d_tr_sat,d_tr_uscav,flux_tr_wet_cv, &
    711                      qDi,qPr,                                                         &
    712                      qPa,qMel,qTrdi,dtrcvMA,Mint,                                     &
     702                CALL cvltr_scav(pdtphys, da, phi,phi2,d1a,dam, mp,ep,                &
     703                     sigd,sij,wght_cvfd,clw,elij,epmlmMm,eplaMm,                     &    
     704                     pmflxr,pmflxs,evap,t_seri,wdtrainA,wdtrainM,                    &  
     705                     paprs,it,tr_seri,upwd,dnwd,itop_con,ibas_con,                   &
     706                     ccntrAA_3d,ccntrENV_3d,coefcoli_3d,                             &
     707                     d_tr_cv,d_tr_trsp,d_tr_sscav,d_tr_sat,d_tr_uscav,flux_tr_wet &
     708                     qDi,qPr,                                                        &
     709                     qPa,qMel,qTrdi,dtrcvMA,Mint,                                    &
    713710                     zmfd1a,zmfphi2,zmfdam)
    714711
     
    926923                           beta_v1,pplay,paprs,t_seri,tr_seri,d_tr_insc,d_tr_bcscav,d_tr_evapls,qPrls)
    927924
    928              !total wet deposit = large scale wet deposit + convective wet deposit
    929              DO i = 1, klon
    930                flux_tr_wet(i, it) = flux_tr_wet_cv(i, it) + &
    931                                     qPrls(i, it)*(prfl(i, 1)+psfl(i, 1))*pdtphys
    932              ENDDO  ! i = 1, klon
    933 
    934925             !large scale scavenging tendency
    935926             DO k = 1, klev
  • LMDZ6/branches/contrails/libf/phylmd/readaerosol_mod.f90

    r5489 r5536  
    44
    55  REAL, SAVE :: not_valid=-333.
    6 !$OMP THREADPRIVATE(not_valid) 
     6 
    77  INTEGER, SAVE :: nbp_lon_src
    88!$OMP THREADPRIVATE(nbp_lon_src) 
     
    1010!$OMP THREADPRIVATE(nbp_lat_src) 
    1111  REAL, ALLOCATABLE, SAVE    :: psurf_interp(:,:)
    12 !$OMP THREADPRIVATE(psurf_interp) 
    1312
    1413CONTAINS
  • LMDZ6/branches/contrails/libf/phylmd/surf_land_bucket_mod.F90

    r5489 r5536  
    102102    REAL, DIMENSION(klon) :: soilcap, soilflux
    103103    REAL, DIMENSION(klon) :: cal, beta, dif_grnd, capsol
    104     REAL, DIMENSION(klon) :: alb_neig, alb_lim, icesub
     104    REAL, DIMENSION(klon) :: alb_neig, alb_lim
    105105    REAL, DIMENSION(klon) :: zfra
    106106    REAL, DIMENSION(klon) :: radsol       ! total net radiance at surface
     
    239239    CALL fonte_neige( knon, is_ter, knindex, dtime, &
    240240         tsurf, precip_rain, precip_snow, &
    241          snow, qsol, tsurf_new, evap, icesub &
     241         snow, qsol, tsurf_new, evap &
    242242#ifdef ISO   
    243243     & ,fq_fonte_diag,fqfonte_diag,snow_evap_diag,fqcalving_diag   &
  • LMDZ6/branches/contrails/libf/phylmd/surf_landice_mod.F90

    r5489 r5536  
    1818       ps, u1, v1, gustiness, rugoro, pctsrf, &
    1919       snow, qsurf, qsol, qbs1, agesno, &
    20        tsoil, z0m, z0h, SFRWL, alb_dir, alb_dif, evap, icesub_lic, fluxsens, fluxlat, fluxbs, &
     20       tsoil, z0m, z0h, SFRWL, alb_dir, alb_dif, evap, fluxsens, fluxlat, fluxbs, &
    2121       tsurf_new, dflux_s, dflux_l, &
    2222       alt, slope, cloudf, &
     
    4848#endif
    4949 
     50!FC
    5051    USE clesphys_mod_h
    5152    USE yomcst_mod_h
    52     USE ioipsl_getin_p_mod, ONLY : getin_p
     53USE ioipsl_getin_p_mod, ONLY : getin_p
    5354    USE lmdz_blowing_snow_ini, ONLY : c_esalt_bs, zeta_bs, pbst_bs, prt_bs, rhoice_bs, rhohard_bs
    5455    USE lmdz_blowing_snow_ini, ONLY : rhofresh_bs, tau_eqsalt_bs, tau_dens0_bs, tau_densmin_bs
     
    5960    USE dimsoil_mod_h, ONLY: nsoilmx
    6061
     62!    INCLUDE "indicesol.h"
    6163
    6264
     
    119121    REAL, DIMENSION(klon,nsw), INTENT(OUT)        :: alb_dir,alb_dif
    120122!albedo SB <<<
    121     REAL, DIMENSION(klon), INTENT(OUT)            :: evap, fluxsens, fluxlat, icesub_lic
     123    REAL, DIMENSION(klon), INTENT(OUT)            :: evap, fluxsens, fluxlat
    122124    REAL, DIMENSION(klon), INTENT(OUT)            :: fluxbs
    123125    REAL, DIMENSION(klon), INTENT(OUT)            :: tsurf_new
     
    133135#ifdef ISO
    134136    REAL, DIMENSION(ntiso,klon), INTENT(OUT)     :: xtevap     
     137!    real, DIMENSION(niso,klon) :: xtrun_off_lic_0_diag ! est une variable globale de
     138!    fonte_neige
    135139#endif
    136140 
     
    159163    REAL, DIMENSION(niso,klon) :: xtsnow_prec,xtsol_prec
    160164    REAL, DIMENSION(klon) :: snow_prec,qsol_prec
     165!    real, DIMENSION(klon) :: run_off_lic_0_diag
    161166#endif
    162167
     
    252257!  landice_opt = 0 : soil_model, calcul_flux, fonte_neige, ... 
    253258!  landice_opt = 1  : prepare and call INterace Lmdz SISvat (INLANDSIS)
    254 !  landice_opt = 2  : skip surf_landice and use orchidee over all land surfaces
    255259!****************************************************************************************
    256260
     
    371375!
    372376!****************************************************************************************
     377!    beta(:) = 1.0
     378!    dif_grnd(:) = 0.0
    373379
    374380! Suppose zero surface speed
     
    387393#ifdef ISO
    388394#ifdef ISOVERIF
     395     !write(*,*) 'surf_land_ice 1499'   
    389396     DO i=1,knon
    390397       IF (iso_eau > 0) THEN
     
    420427!
    421428!****************************************************************************************
     429
     430!
     431!IM: plusieurs choix/tests sur l'albedo des "glaciers continentaux"
     432!       alb1(1 : knon)  = 0.6 !IM cf FH/GK
     433!       alb1(1 : knon)  = 0.82
     434!       alb1(1 : knon)  = 0.77 !211003 Ksta0.77
     435!       alb1(1 : knon)  = 0.8 !KstaTER0.8 & LMD_ARMIP5
     436!IM: KstaTER0.77 & LMD_ARMIP6   
    422437
    423438! Attantion: alb1 and alb2 are not the same!
     
    607622    CALL fonte_neige(knon, is_lic, knindex, dtime, &
    608623         tsurf, precip_rain, precip_totsnow, &
    609          snow, qsol, tsurf_new, evap_totsnow, icesub_lic &
     624         snow, qsol, tsurf_new, evap_totsnow &
    610625#ifdef ISO   
    611626     &  ,fq_fonte_diag,fqfonte_diag,snow_evap_diag,fqcalving_diag     &
  • LMDZ6/branches/contrails/libf/phylmd/traclmdz_mod.f90

    r5489 r5536  
    261261    it = 0
    262262    DO iq = 1, nqtot
    263        IF(.NOT.tracers(iq)%isInPhysics) CYCLE
     263       IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
    264264       it = it+1
    265265       ! Test if tracer is zero everywhere.
     
    310310   
    311311    USE yomcst_mod_h
    312     USE dimphy
     312USE dimphy
    313313    USE infotrac_phy, ONLY: nbtr, pbl_flg
    314314    USE strings_mod,  ONLY: int2str
  • LMDZ6/branches/contrails/libf/phylmd/yamada_c.F90

    r5489 r5536  
    138138        CALL getin_p('iflag_tke_diff',iflag_tke_diff)
    139139        allocate(l0(klon))
     140#define IOPHYS
     141#ifdef IOPHYS
     142!        call iophys_ini(timestep)
     143#endif
    140144        firstcall=.false.
    141145      endif
    142146
    143147   IF (ngrid<=0) RETURN ! Bizarre : on n a pas ce probeleme pour coef_diff_turb
     148
     149#ifdef IOPHYS
     150if (okiophys) then
     151call iophys_ecrit('q2i',klev,'q2 debut my','m2/s2',q2(:,1:klev))
     152call iophys_ecrit('kmi',klev,'Kz debut my','m/s2',km(:,1:klev))
     153endif
     154#endif
    144155
    145156      nlay=klev
  • LMDZ6/branches/contrails/libf/phylmdiso/phyetat0_mod.F90

    r5489 r5536  
    549549     it = 0
    550550     DO iq = 1, nqtot
    551         IF(.NOT.tracers(iq)%isInPhysics) CYCLE
     551        IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
    552552        it = it+1
    553553        tname = tracers(iq)%name
  • LMDZ6/branches/contrails/libf/phylmdiso/phyredem.F90

    r5489 r5536  
    370370       it = 0
    371371       DO iq = 1, nqtot
    372           IF(.NOT.tracers(iq)%isInPhysics) CYCLE
     372          IF(.NOT.(tracers(iq)%isAdvected .AND. tracers(iq)%isInPhysics)) CYCLE
    373373          it = it+1
    374374          CALL put_field(pass,"trs_"//tracers(iq)%name, "", trs(:, it))
  • LMDZ6/branches/contrails/libf/phylmdiso/physiq_mod.F90

    r5489 r5536  
    3939    USE ioipsl_getin_p_mod, ONLY : getin_p
    4040    USE indice_sol_mod
    41     USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, type_trac,addPhase, ivap, iliq, isol, ibs, icf, irvc
     41    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, type_trac,addPhase, ivap, iliq, isol
    4242    USE strings_mod,  ONLY: strIdx
    4343    USE iophy
     
    579579    !======================================================================
    580580    !
     581    ! indices de traceurs eau vapeur, liquide, glace, fraction nuageuse LS (optional), blowing snow (optional)
     582!    INTEGER,SAVE :: ivap, iliq, isol, irneb, ibs
     583!!$OMP THREADPRIVATE(ivap, iliq, isol, irneb, ibs)
     584! Camille Risi 25 juillet 2023: ivap,iliq,isol deja definis dans infotrac_phy.
     585! Et ils sont utiles ailleurs que dans physiq_mod (ex:
     586! reevap -> je commente les 2 lignes au dessus et je laisse la definition
     587! plutot dans infotrac_phy
     588    INTEGER,SAVE :: irneb, ibs, icf,irvc
     589!$OMP THREADPRIVATE(irneb, ibs, icf,irvc)
     590!
    581591    !
    582592    ! Variables argument:
     
    11111121
    11121122    REAL picefra(klon,klev)
    1113     REAL nm_oro(klon)
     1123    REAL zrel_oro(klon)
    11141124    !IM cf. AM 081204 END
    11151125    !
     
    14491459
    14501460    IF (first) THEN
     1461       ivap = strIdx(tracers(:)%name, addPhase('H2O', 'g'))
     1462       iliq = strIdx(tracers(:)%name, addPhase('H2O', 'l'))
     1463       isol = strIdx(tracers(:)%name, addPhase('H2O', 's'))
     1464       ibs  = strIdx(tracers(:)%name, addPhase('H2O', 'b'))
     1465       icf  = strIdx(tracers(:)%name, addPhase('H2O', 'f'))
     1466       irvc = strIdx(tracers(:)%name, addPhase('H2O', 'c'))
    14511467!       CALL init_etat0_limit_unstruct
    14521468       IF (.NOT. create_etat0_limit) CALL init_limit_read(days_elapsed)
     
    62676283    ! a l'echelle sous-maille:
    62686284    !
    6269    
    6270     ! calculation of nm_oro
    6271     DO i=1,klon
    6272           ! nm_oro is a proxy for the number of subgrid scale mountains
    6273           ! -> condition on nm_oro can deactivate the lifting on tilted planar terrains
    6274           !    such as ice sheets (work by V. Wiener)
    6275           ! in such a case, the SSO scheme should activate only where nm_oro>0 i.e. by setting
    6276           ! nm_oro_t=0.
    6277           nm_oro(i)=zsig(i)*sqrt(cell_area(i)*(pctsrf(i,is_ter)+pctsrf(i,is_lic)))/(4.*MAX(zstd(i),1.e-8))-1.
    6278     END DO
    6279 
    62806285    IF (prt_level .GE.10) THEN
    62816286       print *,' call orography ? ', ok_orodr
    62826287    ENDIF
    6283 
     6288    !
    62846289    IF (ok_orodr) THEN
    62856290       !
     
    62886293       DO i=1,klon
    62896294          itest(i)=0
     6295          zrel_oro(i)=zstd(i)/(max(zsig(i),1.E-8)*sqrt(cell_area(i)))
     6296          !zrel_oro: relative mountain height wrt relief explained by mean slope
     6297          ! -> condition on zrel_oro can deactivate the drag on tilted planar terrains
     6298          !    such as ice sheets (work by V. Wiener)
    62906299          ! zpmm_orodr_t and zstd_orodr_t are activation thresholds set by F. Lott to
    62916300          ! earn computation time but they are not physical.
    6292           IF (((zpic(i)-zmea(i)).GT.zpmm_orodr_t).AND.(zstd(i).GT.zstd_orodr_t).AND.(nm_oro(i).GT.nm_oro_t)) THEN
     6301          IF (((zpic(i)-zmea(i)).GT.zpmm_orodr_t).AND.(zstd(i).GT.zstd_orodr_t).AND.(zrel_oro(i).LE.zrel_oro_t)) THEN
    62936302             itest(i)=1
    62946303             igwd=igwd+1
     
    63436352       DO i=1,klon
    63446353          itest(i)=0
    6345           IF (((zpic(i)-zmea(i)).GT.zpmm_orolf_t).AND.(nm_oro(i).GT.nm_oro_t)) THEN
     6354          !zrel_oro: relative mountain height wrt relief explained by mean slope
     6355          ! -> condition on zrel_oro can deactivate the lifting on tilted planar terrains
     6356          !    such as ice sheets (work by V. Wiener)
     6357          zrel_oro(i)=zstd(i)/(max(zsig(i),1.E-8)*sqrt(cell_area(i)))
     6358          IF (((zpic(i)-zmea(i)).GT.zpmm_orolf_t).AND.(zrel_oro(i).LE.zrel_oro_t)) THEN
    63466359             itest(i)=1
    63476360             igwd=igwd+1
     
    66176630! car on peut s'attendre a ce que les petites echelles produisent aussi de la TKE
    66186631! Mais attention, cela ne va pas dans le sens de la conservation de l'energie!
    6619           IF ((zstd(i).GT.1.0) .AND.(nm_oro(i).GT.nm_oro_t)) THEN
     6632          IF ((zstd(i).GT.1.0) .AND.(zrel_oro(i).LE.zrel_oro_t)) THEN
    66206633             itest(i)=1
    66216634             igwd=igwd+1
     
    66296642       DO i=1,klon
    66306643          itest(i)=0
    6631         IF (((zpic(i)-zmea(i)).GT.zpmm_orodr_t).AND.(zstd(i).GT.zstd_orodr_t).AND.(nm_oro(i).GT.nm_oro_t)) THEN
     6644        IF (((zpic(i)-zmea(i)).GT.zpmm_orodr_t).AND.(zstd(i).GT.zstd_orodr_t).AND.(zrel_oro(i).LE.zrel_oro_t)) THEN
    66326645             itest(i)=1
    66336646             igwd=igwd+1
Note: See TracChangeset for help on using the changeset viewer.