Changeset 5203


Ignore:
Timestamp:
Sep 20, 2024, 1:10:18 PM (4 hours ago)
Author:
Laurent Fairhead
Message:

Merge with trunk revision 5202 before reintegration to trunk

Location:
LMDZ6/branches/cirrus
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/cirrus

  • LMDZ6/branches/cirrus/libf/dyn3d/check_isotopes.F90

    r5202 r5203  
    33   USE infotrac,    ONLY: nqtot, niso, nphas, isotope, isoCheck, iqIsoPha, isoSelect, &
    44                          ntiso, iH2O, nzone, tracers, isoName,  itZonIso, getKey
     5#ifdef CPP_IOIPSL
     6   USE ioipsl,          ONLY: getin
     7#else
     8   USE ioipsl_getincom, ONLY: getin
     9#endif
    510   IMPLICIT NONE
    611   include "dimensions.h"
     
    2025                      deltaDmin =-999.0, &
    2126                      ridicule  = 1e-12
    22    INTEGER, SAVE :: iso_eau, iso_HDO, iso_O18, &
    23                              iso_O17, iso_HTO
    24    LOGICAL, SAVE :: first=.TRUE.
    25    LOGICAL, PARAMETER :: tnat1=.TRUE.
     27   INTEGER, SAVE :: iso_eau, iso_O17, iso_O18, iso_HDO, iso_HTO
     28   LOGICAL, SAVE :: ltnat1, first=.TRUE.
    2629
    2730   modname='check_isotopes'
     
    3033   IF(niso == 0)        RETURN                   !--- No isotopes => finished
    3134   IF(first) THEN
     35      ltnat1 = .TRUE.; CALL getin('tnateq1', ltnat1)
     36      ALLOCATE(tnat(niso))
    3237      iso_eau = strIdx(isoName,'H216O')
     38      iso_O17 = strIdx(isoName,'H217O')
     39      iso_O18 = strIdx(isoName,'H218O')
    3340      iso_HDO = strIdx(isoName,'HDO')
    34       iso_O18 = strIdx(isoName,'H218O')
    35       iso_O17 = strIdx(isoName,'H217O')
    3641      iso_HTO = strIdx(isoName,'HTO')
    37       if (tnat1) then
    38               tnat(:)=1.0
    39       else
     42      IF(ltnat1) THEN
     43         tnat(:)=1.0
     44      ELSE
    4045         IF(getKey('tnat', tnat)) CALL abort_gcm(modname, 'missing isotopic parameter', 1)
    41       endif
     46      END IF
    4247      first = .FALSE.
    4348   END IF
     
    5156         DO k = 1, llm
    5257            DO i = 1, ip1jmp1
    53                IF(ABS(q(i,k,iq)) < borne) CYCLE
     58               IF(ABS(q(i,k,iq)) <= borne) CYCLE
    5459               WRITE(msg1,'(s,"(",i0,",",i0,",",i0,") = ",ES12.4)')TRIM(isoName(ixt)),i,k,iq,q(i,k,iq)
    5560               CALL msg(msg1, modname)
  • LMDZ6/branches/cirrus/libf/dyn3d/dynetat0.F90

    r5202 r5203  
    66! Purpose: Initial state reading.
    77!-------------------------------------------------------------------------------
    8   USE infotrac,    ONLY: nqtot, tracers, niso, iqIsoPha, iH2O, isoName
     8  USE infotrac,    ONLY: nqtot, tracers, niso, iqIsoPha, iH2O, isoName, &
     9                         new2oldH2O, newHNO3, oldHNO3, getKey
    910  USE strings_mod, ONLY: maxlen, msg, strStack, real2str, int2str
    1011  USE netcdf,      ONLY: NF90_OPEN,  NF90_NOWRITE, NF90_INQ_VARID, &
    1112                         NF90_CLOSE, NF90_GET_VAR, NF90_NoErr
    12   USE readTracFiles_mod, ONLY: new2oldH2O, newHNO3, oldHNO3, getKey
    1313  USE control_mod, ONLY: planet_type
    1414  USE assert_eq_m, ONLY: assert_eq
     
    1919  USE temps_mod, ONLY: annee_ref, day_ini, day_ref, itau_dyn, start_time
    2020  USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0
     21#ifdef CPP_IOIPSL
     22  USE IOIPSL,   ONLY: getin
     23#else
     24  USE ioipsl_getincom, ONLY: getin
     25#endif
    2126
    2227  IMPLICIT NONE
     
    4247  INTEGER :: iq, fID, vID, idecal, iqParent, iName, iZone, iPhase
    4348  REAL    :: time, tnat, alpha_ideal, tab_cntrl(length)    !--- RUN PARAMS TABLE
    44   LOGICAL :: lSkip, ll
    45   LOGICAL,PARAMETER :: tnat1=.TRUE.
     49  LOGICAL :: lSkip, ll, ltnat1
    4650!-------------------------------------------------------------------------------
    4751  modname="dynetat0"
     
    116120  var="temps"
    117121  IF(NF90_INQ_VARID(fID,var,vID)/=NF90_NoErr) THEN
    118     CALL msg('missing field <temps> ; trying with <Time>', modname)
     122    CALL msg('Missing field <temps> ; trying with <Time>', modname)
    119123    var="Time"
    120124    CALL err(NF90_INQ_VARID(fID,var,vID),"inq",var)
     
    133137  ll = NF90_INQ_VARID(fID, 'HNO3tot', vID) /= NF90_NoErr                                 !--- DETECT OLD REPRO start.nc FILE
    134138#endif
     139  ltnat1 = .TRUE.; CALL getin('tnateq1', ltnat1)
    135140  DO iq=1,nqtot
    136141    var = tracers(iq)%name
     
    148153    !--------------------------------------------------------------------------------------------------------------------------
    149154    ELSE IF(NF90_INQ_VARID(fID, oldVar, vID) == NF90_NoErr) THEN                         !=== TRY WITH ALTERNATE NAME
    150       CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized to <'//TRIM(oldVar)//'>', modname)
     155      CALL msg('Missing tracer <'//TRIM(var)//'> => initialized to <'//TRIM(oldVar)//'>', modname)
    151156      CALL err(NF90_GET_VAR(fID,vID,q(:,:,:,iq)),"get",oldVar)
    152157    !--------------------------------------------------------------------------------------------------------------------------
     
    156161      iqParent = tracers(iq)%iqParent
    157162      IF(tracers(iq)%iso_iZone == 0) THEN
    158          if (tnat1) then
    159                  tnat=1.0
    160                  alpha_ideal=1.0
    161                  write(*,*) 'attention dans dynetat0: les alpha_ideal sont a 1'
    162          else
     163         IF(ltnat1) THEN
     164            tnat = 1.0
     165            alpha_ideal = 1.0
     166            CALL msg(' !!!  Beware: alpha_ideal put to 1  !!!', modname)
     167         ELSE
    163168          IF(getKey('tnat', tnat, isoName(iName)) .OR. getKey('alpha', alpha_ideal, isoName(iName))) &
    164169            CALL abort_gcm(TRIM(modname), 'missing isotopic parameters', 1)
    165          endif
    166          CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized with a simplified Rayleigh distillation law.', modname)
     170         END IF
     171         CALL msg('Missing tracer <'//TRIM(var)//'> => initialized with a simplified Rayleigh distillation law.', modname)
    167172         q(:,:,:,iq) = q(:,:,:,iqParent)*tnat*(q(:,:,:,iqParent)/30.e-3)**(alpha_ideal-1.)
    168173      ELSE
    169          CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized to its parent isotope concentration.', modname)
     174         CALL msg('Missing tracer <'//TRIM(var)//'> => initialized to its parent isotope concentration.', modname)
    170175         ! Camille 9 mars 2023: attention!! seuls les tags qui correspondent à
    171176         ! izone=izone_init (définie dans isotrac_mod) sont initialisés comme
     
    181186    !--------------------------------------------------------------------------------------------------------------------------
    182187    ELSE                                                                                 !=== MISSING: SET TO 0
    183       CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized to zero', modname)
     188      CALL msg('Missing tracer <'//TRIM(var)//'> => initialized to zero', modname)
    184189      q(:,:,:,iq)=0.
    185190    !--------------------------------------------------------------------------------------------------------------------------
  • LMDZ6/branches/cirrus/libf/dyn3d/iniacademic.F90

    r5202 r5203  
    55
    66  USE filtreg_mod, ONLY: inifilr
    7   USE infotrac,    ONLY: nqtot, niso, iqIsoPha, tracers, getKey, isoName
     7  USE infotrac,    ONLY: nqtot, niso, iqIsoPha, tracers, getKey, isoName, addPhase
    88  USE control_mod, ONLY: day_step,planet_type
    99  use exner_hyb_m, only: exner_hyb
     
    2121  USE temps_mod, ONLY: annee_ref, day_ini, day_ref
    2222  USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0
    23   USE readTracFiles_mod, ONLY: addPhase
    2423  use netcdf, only : NF90_NOWRITE,NF90_OPEN,NF90_NOERR,NF90_INQ_VARID
    2524  use netcdf, only : NF90_CLOSE, NF90_GET_VAR
     
    8079
    8180  REAL zdtvr, tnat, alpha_ideal
    82   LOGICAL,PARAMETER :: tnat1=.true.
     81  LOGICAL :: ltnat1
    8382 
    8483  character(len=*),parameter :: modname="iniacademic"
     
    309308        ! bulk initialization of tracers
    310309        if (planet_type=="earth") then
     310           ltnat1 = .TRUE.; CALL getin('tnateq1', ltnat1)
    311311           ! Earth: first two tracers will be water
    312312           do iq=1,nqtot
     
    322322              iqParent = tracers(iq)%iqParent
    323323              IF(tracers(iq)%iso_iZone == 0) THEN
    324                  if (tnat1) then
    325                          tnat=1.0
    326                          alpha_ideal=1.0
    327                          write(*,*) 'Attention dans iniacademic: alpha_ideal=1'
    328                  else
     324                 IF(ltnat1) THEN
     325                    tnat = 1.0
     326                    alpha_ideal = 1.0
     327                    WRITE(lunout, *)'In '//TRIM(modname)//': !!!  Beware: alpha_ideal put to 1  !!!'
     328                 ELSE
    329329                    IF(getKey('tnat', tnat, isoName(iName)) .OR. getKey('alpha', alpha_ideal, isoName(iName))) &
    330330                    CALL abort_gcm(TRIM(modname), 'missing isotopic parameters', 1)
    331                  endif
     331                 END IF
    332332                 q(:,:,iq) = q(:,:,iqParent)*tnat*(q(:,:,iqParent)/30.e-3)**(alpha_ideal-1.)
    333333              ELSE !IF(tracers(iq)%iso_iZone == 0) THEN
  • LMDZ6/branches/cirrus/libf/dyn3d/qminimum.F

    r5202 r5203  
    44      SUBROUTINE qminimum( q,nqtot,deltap )
    55
    6       USE infotrac, ONLY: niso, ntiso,iqIsoPha, tracers
     6      USE infotrac, ONLY: niso, ntiso, iqIsoPha, tracers, addPhase
    77      USE strings_mod, ONLY: strIdx
    8       USE readTracFiles_mod, ONLY: addPhase
    98      IMPLICIT none
    109c
  • LMDZ6/branches/cirrus/libf/dyn3d_common/infotrac.F90

    r5202 r5203  
    77        delPhase, niso, getKey, isot_type, processIsotopes,  isotope, maxTableWidth, iqIsoPha, nphas, ixIso, isoPhas, &
    88        addPhase, iH2O, addKey, isoSelect, testTracersFiles, isoKeys, indexUpdate,  iqWIsoPha, nbIso, ntiso, isoName, isoCheck
     9   USE readTracFiles_mod, ONLY: new2oldH2O, newHNO3, oldHNO3
    910   IMPLICIT NONE
    1011
     
    1617   PUBLIC :: nqtot,   nbtr,   nqo,   nqCO2,   nqtottr      !--- Main dimensions
    1718   PUBLIC :: conv_flg, pbl_flg                             !--- Convection & boundary layer activation keys
     19   PUBLIC :: new2oldH2O, newHNO3, oldHNO3                  !--- For backwards compatibility in dynetat0
     20   PUBLIC :: addPhase, delPhase                            !--- Add/remove the phase from the name of a tracer
    1821
    1922   !=== FOR ISOTOPES: General
     
    2124   PUBLIC :: isoSelect, ixIso                              !--- Isotopes family selection tool + selected family index
    2225   !=== FOR ISOTOPES: Specific to water
    23    PUBLIC :: iH2O                                          !--- H2O isotopes class index
     26   PUBLIC :: iH2O                                          !--- Value of "ixIso" for "H2O" isotopes class
    2427   PUBLIC :: min_qParent, min_qMass, min_ratio             !--- Min. values for various isotopic quantities
    2528   !=== FOR ISOTOPES: Depending on the selected isotopes family
    26    PUBLIC :: isotope, isoKeys                              !--- Selected isotopes database + associated keys (cf. getKey)
    27    PUBLIC :: isoName, isoZone, isoPhas                     !--- Isotopes and tagging zones names, phases
    28    PUBLIC :: niso,    nzone,   nphas,   ntiso              !---  " " numbers + isotopes & tagging tracers number
    29    PUBLIC :: itZonIso                                      !--- idx "it" (in "isoName(1:niso)") = function(tagging idx, isotope idx)
    30    PUBLIC :: iqIsoPha                                      !--- idx "iq" (in "qx") = function(isotope idx, phase idx) + aliases
     29   PUBLIC :: isotope                                       !--- Selected isotopes database (argument of getKey)
     30   PUBLIC :: isoKeys, isoName, isoZone, isoPhas            !--- Isotopes keys & names, tagging zones names, phases
     31   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)
    3134   PUBLIC :: isoCheck                                      !--- Run isotopes checking routines
    3235   !=== FOR BOTH TRACERS AND ISOTOPES
     
    3639!  |--------------------+-----------------------+-----------------+---------------+----------------------------|
    3740!  | water in different |    water tagging      |  water isotopes | other tracers | additional tracers moments |
    38 !  | phases: H2O_[gls|      isotopes         |                 |               |  for higher order schemes  |
     41!  | phases: H2O_[glsrb]|      isotopes         |                 |               |  for higher order schemes  |
    3942!  |--------------------+-----------------------+-----------------+---------------+----------------------------|
    4043!  |                    |                       |                 |               |                            |
     
    6164!  |-------------+------------------------------------------------------+-------------+------------------------+
    6265!  | name        | Name (short)                                         | tname       |                        |
     66!  | keys        | key/val pairs accessible with "getKey" routine       | /           |                        |
    6367!  | gen0Name    | Name of the 1st generation ancestor                  | /           |                        |
    6468!  | parent      | Name of the parent                                   | /           |                        |
    6569!  | longName    | Long name (with adv. scheme suffix) for outputs      | ttext       |                        |
    6670!  | type        | Type (so far: tracer or tag)                         | /           | tracer,tag             |
    67 !  | phase       | Phases list ("g"as / "l"iquid / "s"olid)             | /           | [g][l][s]              |
     71!  | phase       | Phases list ("g"as / "l"iquid / "s"olid              |             | [g|l|s|r|b]            |
     72!  |             |              "r"(cloud) / "b"lowing)                 | /           |                        |
    6873!  | component   | Name(s) of the merged/cumulated section(s)           | /           | coma-separated names   |
    6974!  | iGeneration | Generation (>=1)                                     | /           |                        |
     
    7277!  | nqDescen    | Number of the descendants   (all generations)        | nqdesc      | 1:nqtot                |
    7378!  | nqChildren  | Number of childs            (1st generation only)    | nqfils      | 1:nqtot                |
    74 !  | keys        | key/val pairs accessible with "getKey" routine       | /           |                        |
    7579!  | iadv        | Advection scheme number                              | iadv        | 1,2,10-20(exc.15,19),30|
    76 !  | isAdvected  | advected tracers flag (.TRUE. if iadv >= 0)          | /           | nqtrue  .TRUE. values  |
    77 !  | isInPhysics | tracers not extracted from the main table in physics | /           | nqtottr .TRUE. values  |
     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  |
    7882!  | iso_iGroup  | Isotopes group index in isotopes(:)                  | /           | 1:nbIso                |
    7983!  | iso_iName   | Isotope  name  index in isotopes(iso_iGroup)%trac(:) | iso_indnum  | 1:niso                 |
     
    9195!  | trac   | ntiso  | Isotopes + tagging tracers list + number         | / | ntraciso       |                 |
    9296!  | zone   | nzone  | Geographic tagging zones   list + number         | / | ntraceurs_zone |                 |
    93 !  | phase  | nphas  | Phases                     list + number         |                    | [g][l][s], 1:3 |
     97!  | phase  | nphas  | Phases                     list + number         |                    | [g|l|s|r|b] 1:5 |
    9498!  | iqIsoPha        | Index in "qx"           = f(name(1:ntiso)),phas) | iqiso              | 1:nqtot         |
    9599!  | itZonIso        | Index in "trac(1:ntiso)"= f(zone, name(1:niso))  | index_trac         | 1:ntiso         |
     
    99103
    100104   !=== DIMENSIONS OF THE TRACERS TABLES AND OTHER SCALAR VARIABLES
    101    INTEGER,               SAVE :: nqtot,  &                     !--- Tracers nb in dynamics (incl. higher moments + H2O)
    102                                   nbtr,   &                     !--- Tracers nb in physics  (excl. higher moments + H2O)
    103                                   nqo,    &                     !--- Number of water phases
     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
    104108                                  nqtottr, &                    !--- Number of tracers passed to phytrac (TO BE DELETED ?)
    105109                                  nqCO2                         !--- Number of tracers of CO2  (ThL)
    106    CHARACTER(LEN=maxlen), SAVE :: type_trac                     !--- Keyword for tracers type
     110   CHARACTER(LEN=maxlen), SAVE :: type_trac                     !--- Keyword for tracers type(s)
    107111
    108112   !=== VARIABLES FOR INCA
    109    INTEGER,               SAVE, ALLOCATABLE :: conv_flg(:), &   !--- Convection     activation ; needed for INCA        (nbtr)
    110                                                 pbl_flg(:)      !--- Boundary layer activation ; needed for INCA        (nbtr)
     113   INTEGER, DIMENSION(:), SAVE, ALLOCATABLE :: &
     114                    conv_flg, pbl_flg                           !--- Convection / boundary layer activation (nbtr)
    111115
    112116CONTAINS
     
    115119   USE control_mod, ONLY: planet_type
    116120#ifdef REPROBUS
    117    USE CHEM_REP,    ONLY: Init_chem_rep_trac
     121   USE CHEM_REP, ONLY: Init_chem_rep_trac
    118122#endif
    119123   IMPLICIT NONE
     
    160164   TYPE(trac_type), ALLOCATABLE, TARGET :: ttr(:)
    161165   TYPE(trac_type), POINTER             :: t1, t(:)
    162    CHARACTER(LEN=maxlen),   ALLOCATABLE :: types_trac(:)  !--- Keyword for tracers type(s), parsed version
    163 
     166   CHARACTER(LEN=maxlen),   ALLOCATABLE :: types_trac(:)             !--- Keywords for tracers type(s), parsed version
    164167   CHARACTER(LEN=*), PARAMETER :: modname="init_infotrac"
    165168!------------------------------------------------------------------------------------------------------------------------------
     
    171174   descrq(10:20) = ['VL1','VLP','FH1','FH2','VLH','   ','PPM','PPS','PPP','   ','SLP']
    172175   descrq(30)    =  'PRA'
    173    
    174    CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname)
    175176
    176177   lerr=strParse(type_trac, '|', types_trac, n=nt)
    177178   IF (nt .GT. 1) THEN
    178179      IF (nt .GT. 2) CALL abort_gcm(modname, 'you need to modify type_trac, this version is not supported by lmdz', 1)
    179       if (nt .EQ. 2) type_trac=types_trac(2)
     180      IF (nt .EQ. 2) type_trac=types_trac(2)
    180181   ENDIF
    181182
     183   CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname)
    182184
    183185   
     
    213215
    214216!==============================================================================================================================
    215 ! 1) Get the numbers of: true (first order only) tracers "nqtrue", water tracers "nqo" (vapor/liquid/solid)
    216 !==============================================================================================================================
    217    texp = type_trac                                                  !=== EXPANDED VERSION OF "type_trac", WITH "|" SEPARATOR
     217! 0) DETERMINE THE TYPE OF THE INPUT TRACERS DESCRIPTION FILE AND READ IT
     218!==============================================================================================================================
     219   texp = type_trac                                                            !=== EXPANDED (WITH "|" SEPARATOR) "type_trac"
    218220   IF(texp == 'inco') texp = 'co2i|inca'
    219221   IF(texp /= 'lmdz') texp = 'lmdz|'//TRIM(texp)
    220 
    221    !=== DETERMINE THE TYPE OF THE INPUT TRACERS DESCRIPTION FILE
    222222   IF(testTracersFiles(modname, texp, fType, .TRUE.)) CALL abort_gcm(modname, 'problem with tracers file(s)',1)
    223223   ttp = type_trac; IF(fType /= 1) ttp = texp
    224 
    225224   IF(readTracersFiles(ttp, lRepr=type_trac=='repr')) CALL abort_gcm(modname, 'problem with tracers file(s)',1)
    226    !---------------------------------------------------------------------------------------------------------------------------
    227    IF(fType == 0) CALL abort_gcm(modname, 'Missing tracers file: "traceur.def", "tracer.def" or "tracer_<keyword>.def file.',1)
    228    !---------------------------------------------------------------------------------------------------------------------------
    229    IF(fType == 1 .AND. ANY(['inca','inco']==type_trac)) THEN         !=== FOUND OLD STYLE INCA "traceur.def"
     225
     226!==============================================================================================================================
     227! 1) Get various numbers: "nqtrue" (first order only tracers), "nqo" (water phases), 'nbtr' (tracers passed to physics), etc.
     228!==============================================================================================================================
     229   !---------------------------------------------------------------------------------------------------------------------------
     230   IF(fType == 0) CALL abort_gcm(modname, 'Missing "traceur.def", "tracer.def" or "tracer_<keyword>.def tracers file.',1)
     231   !---------------------------------------------------------------------------------------------------------------------------
     232   IF(fType == 1 .AND. ANY(['inca', 'inco'] == type_trac)) THEN      !=== FOUND OLD STYLE INCA "traceur.def"
    230233   !---------------------------------------------------------------------------------------------------------------------------
    231234#ifdef INCA
     
    264267   ELSE                                                              !=== OTHER CASES (OLD OR NEW FORMAT, NO INCA MODULE)
    265268   !---------------------------------------------------------------------------------------------------------------------------
    266       nqo    =        COUNT(delPhase(tracers(:)%name)     == 'H2O' &
    267                                .AND. tracers(:)%component == 'lmdz') !--- Number of water phases
    268       nqtrue = SIZE(tracers)                                         !--- Total number of "true" tracers
    269       nbtr   = nqtrue-COUNT(delPhase(tracers(:)%gen0Name) == 'H2O' &
    270                                .AND. tracers(:)%component == 'lmdz') !--- Number of tracers passed to phytrac
     269   nqtrue = SIZE(tracers)                                                                               !--- "true" tracers
     270   nqo    =      COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%name)     == 'H2O')     !--- Water phases
     271   nbtr = nqtrue-COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%gen0Name) == 'H2O')     !--- Passed to phytrac
     272   nqCO2  =      COUNT( [type_trac == 'inco', type_trac == 'co2i'] )
    271273#ifdef INCA
    272       nqINCA = COUNT(tracers(:)%component == 'inca')
    273 #endif
    274       lerr = getKey('hadv', hadv, ky=tracers(:)%keys)
    275       lerr = getKey('vadv', vadv, ky=tracers(:)%keys)
     274   nqINCA =      COUNT(tracers(:)%component == 'inca')
     275#endif
     276   IF(getKey('hadv', hadv, ky=tracers(:)%keys)) CALL abort_gcm(modname, 'missing key "hadv"', 1)
     277   IF(getKey('vadv', vadv, ky=tracers(:)%keys)) CALL abort_gcm(modname, 'missing key "vadv"', 1)
    276278   !---------------------------------------------------------------------------------------------------------------------------
    277279   END IF
     
    279281
    280282#ifdef REPROBUS
    281    !--- Transfert the number of tracers to Reprobus
    282283   CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name)
    283 
    284 #endif
     284#endif
     285
    285286!==============================================================================================================================
    286287! 2) Calculate nqtot, number of tracers needed (greater if advection schemes 20 or 30 have been chosen).
     
    332333      IF(iad == -1) CALL abort_gcm(modname, msg1, 1)
    333334
    334       !--- SET FIELDS %longName, %iadv, %isAdvected, %isInPhysics
     335      !--- SET FIELDS longName, iadv, isAdvected, isInPhysics
    335336      t1%longName   = t1%name; IF(iad > 0) t1%longName=TRIM(t1%name)//descrq(iad)
    336337      t1%iadv       = iad
    337338      t1%isAdvected = iad >= 0
    338       t1%isInPhysics= delPhase(t1%gen0Name) /= 'H2O' &
    339                           .OR. t1%component /= 'lmdz' !=== OTHER EXCEPTIONS TO BE ADDED: CO2i, SURSATURATED WATER CLOUD...
     339      t1%isInPhysics= delPhase(t1%gen0Name) /= 'H2O' .OR. t1%component /= 'lmdz' !=== MORE EXCEPTIONS ? CO2i, SURSAT CLOUD H2O
    340340      ttr(iq)       = t1
    341341
     
    347347      ttr(jq+1:jq+nm)             = t1
    348348      ttr(jq+1:jq+nm)%name        = [ (TRIM(t1%name)    //'-'//TRIM(suff(im)), im=1, nm) ]
     349      ttr(jq+1:jq+nm)%gen0Name    = [ (TRIM(t1%name)    //'-'//TRIM(suff(im)), im=1, nm) ]
    349350      ttr(jq+1:jq+nm)%parent      = [ (TRIM(t1%parent)  //'-'//TRIM(suff(im)), im=1, nm) ]
    350351      ttr(jq+1:jq+nm)%longName    = [ (TRIM(t1%longName)//'-'//TRIM(suff(im)), im=1, nm) ]
     
    356357   CALL MOVE_ALLOC(FROM=ttr, TO=tracers)
    357358
    358    !--- SET FIELDS %iqParent, %nqChildren, %iGeneration, %iqDescen, %nqDescen
     359   !--- SET FIELDS iqParent, iqDescen, nqDescen, nqChildren
    359360   IF(indexUpdate(tracers)) CALL abort_gcm(modname, 'problem with tracers indices update', 1)
    360361
    361362   !=== TEST ADVECTION SCHEME
    362    DO iq=1,nqtot ; t1 => tracers(iq); iad = t1%iadv
     363   DO iq = 1, nqtot ; t1 => tracers(iq); iad = t1%iadv
    363364
    364365      !--- ONLY TESTED VALUES FOR TRACERS FOR NOW:               iadv = 14, 10 (and 0 for non-transported tracers)
     
    405406#endif
    406407   t => tracers
    407    CALL msg('Information stored in infotrac :', modname)
    408 
    409    IF(dispTable('isssssssssiiiiiiiii', ['iq  ', 'name', 'lNam', 'g0Nm', 'prnt', 'type', 'phas', 'comp',    &
    410                 'isPh', 'isAd', 'iadv', 'iGen', 'iqPr', 'nqDe', 'nqCh', 'iGrp', 'iNam', 'iZon', 'iPha'],   &
    411       cat(t%name, t%longName, t%gen0Name, t%parent, t%type, t%phase, t%component, bool2str(t%isInPhysics), &
    412                                                                                   bool2str(t%isAdvected)), &
     408   CALL msg('Information stored in '//TRIM(modname)//': ', modname)
     409   IF(dispTable('isssssssiiiiiiiii', ['iq  ', 'name', 'lNam', 'g0Nm', 'prnt', 'type', 'phas', 'comp',      &
     410                              'iAdv', 'iGen', 'iqPr', 'nqDe', 'nqCh', 'iGrp', 'iNam', 'iZon', 'iPha'],     &
     411      cat(t%name, t%longName, t%gen0Name, t%parent, t%type, t%phase, t%component),                         &
    413412      cat([(iq, iq=1, nqtot)], t%iadv, t%iGeneration, t%iqParent, t%nqDescen, t%nqChildren, t%iso_iGroup,  &
    414413                  t%iso_iName, t%iso_iZone, t%iso_iPhase), nColMax=maxTableWidth, nHead=2, sub=modname))   &
  • LMDZ6/branches/cirrus/libf/dyn3d_common/iso_verif_dyn.F

    r4325 r5203  
    6464        function iso_verif_aberrant_nostop
    6565     :           (x,iso,q,err_msg)
     66#ifdef CPP_IOIPSL
     67        USE IOIPSL, ONLY: getin
     68#else
     69        USE ioipsl_getincom, ONLY: getin
     70#endif
    6671        USE infotrac, ONLY: isoName, getKey
    6772        implicit none
     
    7782        parameter (qmin=1e-11)
    7883        parameter (deltaDmax=200.0,deltaDmin=-999.9)
     84        LOGICAL, SAVE :: ltnat1
     85        LOGICAL, SAVE :: lFirst=.TRUE.
    7986
    8087        ! output
    8188        integer iso_verif_aberrant_nostop
    8289
     90        IF(lFirst) THEN
     91           ltnat1 = .TRUE.; CALL getin('tnateq1', ltnat1)
     92           lFirst = .FALSE.
     93        END IF
    8394        iso_verif_aberrant_nostop=0
    8495
    8596        ! verifier que HDO est raisonable
    8697         if (q.gt.qmin) then
    87              IF(getKey('tnat', tnat, isoName(iso))) THEN
     98             IF(ltnat1) THEN
     99                tnat = 1.0
     100             ELSE IF(getKey('tnat', tnat, isoName(iso))) THEN
    88101                  err_msg = 'Missing isotopic parameter "tnat"'
    89102                  iso_verif_aberrant_nostop=1
  • LMDZ6/branches/cirrus/libf/dyn3dmem/check_isotopes_loc.F90

    r5202 r5203  
    44   USE infotrac,    ONLY: nqtot, niso, nphas, isotope, isoCheck, iqIsoPha, isoSelect, &
    55                          ntiso, iH2O, nzone, tracers, isoName,  itZonIso, getKey
     6#ifdef CPP_IOIPSL
     7   USE ioipsl,          ONLY: getin
     8#else
     9   USE ioipsl_getincom, ONLY: getin
     10#endif
    611   IMPLICIT NONE
    712   include "dimensions.h"
     
    2126                      deltaDmin =-999.0, &
    2227                      ridicule  = 1e-12
    23    INTEGER, SAVE :: iso_eau, iso_HDO, iso_O18, & !--- OpenMP shared variables
    24                              iso_O17, iso_HTO
     28   INTEGER, SAVE :: iso_eau, iso_HDO, iso_O18, iso_O17, iso_HTO
     29!$OMP THREADPRIVATE(iso_eau, iso_HDO, iso_O18, iso_O17, iso_HTO)
     30   LOGICAL       :: ltnat1
    2531   LOGICAL, SAVE :: first=.TRUE.
    26    LOGICAL, PARAMETER :: tnat1=.TRUE.
    2732!$OMP THREADPRIVATE(first)
    2833
     
    3338   IF(first) THEN
    3439!$OMP MASTER
     40      ltnat1 = .TRUE.; CALL getin('tnateq1', ltnat1)
     41      ALLOCATE(tnat(niso))
    3542      iso_eau = strIdx(isoName,'H216O')
     43      iso_O17 = strIdx(isoName,'H217O')
     44      iso_O18 = strIdx(isoName,'H218O')
    3645      iso_HDO = strIdx(isoName,'HDO')
    37       iso_O18 = strIdx(isoName,'H218O')
    38       iso_O17 = strIdx(isoName,'H217O')
    3946      iso_HTO = strIdx(isoName,'HTO')
    40       if (tnat1) then
    41               tnat(:)=1.0
    42       else
     47      IF(ltnat1) THEN
     48         tnat(:)=1.0
     49      ELSE
    4350         IF(getKey('tnat', tnat)) CALL abort_gcm(modname, 'missing isotopic parameter', 1)
    44       endif
     51      END IF
    4552!$OMP END MASTER
    4653!$OMP BARRIER
     
    5764         DO k = 1, llm
    5865            DO i = ijb, ije
    59                IF(ABS(q(i,k,iq))<=borne) CYCLE
     66               IF(ABS(q(i,k,iq)) <= borne) CYCLE
    6067               WRITE(msg1,'(s,"(",i0,",",i0,",",i0,") = ",ES12.4)')TRIM(isoName(ixt)),i,k,iq,q(i,k,iq)
    6168               CALL msg(msg1, modname)
  • LMDZ6/branches/cirrus/libf/dyn3dmem/dynetat0_loc.F90

    r5202 r5203  
    77!-------------------------------------------------------------------------------
    88  USE parallel_lmdz
    9   USE infotrac,    ONLY: nqtot, tracers, niso, iqIsoPha, iH2O, isoName
     9  USE infotrac,    ONLY: nqtot, tracers, niso, iqIsoPha, iH2O, isoName, &
     10                         new2oldH2O, newHNO3, oldHNO3, getKey
    1011  USE strings_mod, ONLY: maxlen, msg, strStack, real2str, int2str, strIdx
    1112  USE netcdf,      ONLY: NF90_OPEN,  NF90_NOWRITE, NF90_INQUIRE_DIMENSION, NF90_INQ_VARID, &
    1213                         NF90_CLOSE, NF90_GET_VAR, NF90_INQUIRE_VARIABLE,  NF90_NoErr
    13   USE readTracFiles_mod, ONLY: new2oldH2O, newHNO3, oldHNO3, getKey
    1414  USE control_mod, ONLY: planet_type
    1515  USE assert_eq_m, ONLY: assert_eq
     
    2020  USE temps_mod, ONLY: annee_ref, day_ini, day_ref, itau_dyn, start_time
    2121  USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0
     22#ifdef CPP_IOIPSL
     23  USE IOIPSL,   ONLY: getin
     24#else
     25  USE ioipsl_getincom, ONLY: getin
     26#endif
    2227
    2328  IMPLICIT NONE
     
    4752  REAL,             ALLOCATABLE :: ucov_glo(:,:),    q_glo(:,:), phis_glo(:)
    4853  REAL,             ALLOCATABLE :: teta_glo(:,:)
    49   LOGICAL :: lSkip, ll
    50   LOGICAL,PARAMETER :: tnat1=.TRUE.
     54  LOGICAL :: lSkip, ll, ltnat1
    5155!-------------------------------------------------------------------------------
    5256  modname="dynetat0_loc"
     
    158162  ll = NF90_INQ_VARID(fID, 'HNO3tot', vID) /= NF90_NoErr                                 !--- DETECT OLD REPRO start.nc FILE
    159163#endif
     164  ltnat1 = .TRUE.; CALL getin('tnateq1', ltnat1)
    160165  DO iq=1,nqtot
    161166    var = tracers(iq)%name
     
    173178    !--------------------------------------------------------------------------------------------------------------------------
    174179    ELSE IF(NF90_INQ_VARID(fID, oldVar, vID) == NF90_NoErr) THEN                         !=== TRY WITH ALTERNATE NAME
    175       CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized to <'//TRIM(oldVar)//'>', modname)
     180      CALL msg('Missing tracer <'//TRIM(var)//'> => initialized to <'//TRIM(oldVar)//'>', modname)
    176181      CALL get_var2(oldVar, q_glo); q(ijb_u:ije_u,:,iq)=q_glo(ijb_u:ije_u,:)
    177182    !--------------------------------------------------------------------------------------------------------------------------
     
    181186      iqParent = tracers(iq)%iqParent
    182187      IF(tracers(iq)%iso_iZone == 0) THEN
    183          if (tnat1) then
    184                  tnat=1.0
    185                  alpha_ideal=1.0
    186                  write(*,*) 'attention dans dynetat0: les alpha_ideal sont a 1'
    187          else
     188         IF(ltnat1) THEN
     189            tnat = 1.0
     190            alpha_ideal = 1.0
     191            CALL msg(' !!!  Beware: alpha_ideal put to 1  !!!', modname)
     192         ELSE
    188193          IF(getKey('tnat', tnat, isoName(iName)) .OR. getKey('alpha', alpha_ideal, isoName(iName))) &
    189194            CALL abort_gcm(TRIM(modname), 'missing isotopic parameters', 1)
    190          endif
    191          CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized with a simplified Rayleigh distillation law.', modname)
     195         END IF
     196         CALL msg('Missing tracer <'//TRIM(var)//'> => initialized with a simplified Rayleigh distillation law.', modname)
    192197         q(ijb_u:ije_u,:,iq) = q(ijb_u:ije_u,:,iqParent)*tnat*(q(ijb_u:ije_u,:,iqParent)/30.e-3)**(alpha_ideal-1.)
    193198         ! Camille 9 mars 2023: point de vigilence: initialisation incohérente
    194199         ! avec celle de xt_ancien dans la physiq.
    195200      ELSE
    196          CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized to its parent isotope concentration.', modname)
     201         CALL msg('Missing tracer <'//TRIM(var)//'> => initialized to its parent isotope concentration.', modname)
    197202         ! Camille 9 mars 2023: attention!! seuls les tags qui correspondent à
    198203         ! izone=izone_init (définie dans isotrac_mod) sont initialisés comme
     
    208213    !--------------------------------------------------------------------------------------------------------------------------
    209214    ELSE                                                                                 !=== MISSING: SET TO 0
    210       CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized to zero', modname)
     215      CALL msg('missing tracer <'//TRIM(var)//'> => initialized to zero', modname)
    211216      q(ijb_u:ije_u,:,iq)=0.
    212217    !--------------------------------------------------------------------------------------------------------------------------
  • LMDZ6/branches/cirrus/libf/dyn3dmem/iniacademic_loc.F90

    r5202 r5203  
    55
    66  USE filtreg_mod, ONLY: inifilr
    7   USE infotrac,    ONLY: nqtot, niso, iqIsoPha, tracers, getKey, isoName
     7  USE infotrac,    ONLY: nqtot, niso, iqIsoPha, tracers, getKey, isoName, addPhase
    88  USE control_mod, ONLY: day_step,planet_type
    99  use exner_hyb_m, only: exner_hyb
     
    2222  USE temps_mod, ONLY: annee_ref, day_ini, day_ref
    2323  USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0
    24   USE readTracFiles_mod, ONLY: addPhase
    2524  use netcdf, only : NF90_NOWRITE,NF90_OPEN,NF90_NOERR,NF90_INQ_VARID
    2625  use netcdf, only : NF90_CLOSE, NF90_GET_VAR
     
    8584
    8685  REAL zdtvr, tnat, alpha_ideal
    87   LOGICAL,PARAMETER :: tnat1=.true.
     86  LOGICAL :: ltnat1
    8887 
    8988  character(len=*),parameter :: modname="iniacademic"
     
    311310        ! bulk initialization of tracers
    312311        if (planet_type=="earth") then
     312           ltnat1 = .TRUE.; CALL getin('tnateq1', ltnat1)
    313313           ! Earth: first two tracers will be water
    314314           do iq=1,nqtot
     
    324324              iqParent = tracers(iq)%iqParent
    325325              IF(tracers(iq)%iso_iZone == 0) THEN
    326                  if (tnat1) then
    327                          tnat=1.0
    328                          alpha_ideal=1.0
    329                          write(*,*) 'Attention dans iniacademic: alpha_ideal=1'
    330                  else
     326                 IF(ltnat1) THEN
     327                    tnat = 1.0
     328                    alpha_ideal = 1.0
     329                    WRITE(lunout, *) 'In '//TRIM(modname)//': !!!  Beware: alpha_ideal put to 1  !!!'
     330                 ELSE
    331331                    IF(getKey('tnat', tnat, isoName(iName)) .OR. getKey('alpha', alpha_ideal, isoName(iName))) &
    332332                    CALL abort_gcm(TRIM(modname), 'missing isotopic parameters', 1)
    333                  endif
     333                 END IF
    334334                 q(ijb_u:ije_u,:,iq) = q(ijb_u:ije_u,:,iqParent)*tnat*(q(ijb_u:ije_u,:,iqParent)/30.e-3)**(alpha_ideal-1.)
    335335              ELSE !IF(tracers(iq)%iso_iZone == 0) THEN
  • LMDZ6/branches/cirrus/libf/dyn3dmem/qminimum_loc.F

    r5202 r5203  
    44      SUBROUTINE qminimum_loc( q,nqtot,deltap )
    55      USE parallel_lmdz
    6       USE infotrac, ONLY: niso, ntiso, iqIsoPha, tracers,
     6      USE infotrac, ONLY: niso, ntiso, iqIsoPha, tracers, addPhase,
    77     &                    isoCheck, min_qParent
    88      USE strings_mod, ONLY: strIdx
    9       USE readTracFiles_mod, ONLY: addPhase
    109      IMPLICIT none
    1110c
  • LMDZ6/branches/cirrus/libf/phylmd/infotrac_phy.F90

    r5202 r5203  
    77        delPhase, niso, getKey, isot_type, processIsotopes,  isotope, maxTableWidth, iqIsoPha, nphas, ixIso, isoPhas, &
    88        addPhase, iH2O, addKey, isoSelect, testTracersFiles, isoKeys, indexUpdate,  iqWIsoPha, nbIso, ntiso, isoName, isoCheck
     9   USE readTracFiles_mod, ONLY: new2oldH2O
    910   IMPLICIT NONE
    1011
     
    1617   PUBLIC :: nqtot,   nbtr,   nqo,   nqCO2,   nqtottr      !--- Main dimensions
    1718   PUBLIC :: conv_flg, pbl_flg                             !--- Convection & boundary layer activation keys
    18 #ifdef CPP_StratAer
     19   PUBLIC :: new2oldH2O                                    !--- For backwards compatibility in phyetat0
     20   PUBLIC :: addPhase, delPhase                            !--- Add/remove the phase from the name of a tracer
     21#if defined CPP_StratAer || defined REPROBUS
    1922   PUBLIC :: nbtr_bin, nbtr_sulgas                         !--- Number of aerosols bins and sulfur gases for StratAer model
    2023   PUBLIC :: id_OCS_strat, id_SO2_strat, id_H2SO4_strat, id_BIN01_strat, id_TEST_strat
    2124#endif
    2225
    23    !=== FOR WATER
    24    PUBLIC :: ivap, iliq, isol
    2526   !=== FOR ISOTOPES: General
    2627   PUBLIC :: isot_type, nbIso                              !--- Derived type, full isotopes families database + nb of families
    2728   PUBLIC :: isoSelect, ixIso                              !--- Isotopes family selection tool + selected family index
    2829   !=== FOR ISOTOPES: Specific to water
    29    PUBLIC :: iH2O                                          !--- H2O isotopes class index
     30   PUBLIC :: iH2O                                          !--- Value of "ixIso" for "H2O" isotopes class
     31   PUBLIC :: ivap, iliq, isol
    3032   !=== FOR ISOTOPES: Depending on the selected isotopes family
    31    PUBLIC :: isotope, isoKeys                              !--- Selected isotopes database + associated keys (cf. getKey)
    32    PUBLIC :: isoName, isoZone, isoPhas                     !--- Isotopes and tagging zones names, phases
    33    PUBLIC :: niso,    nzone,   nphas,   ntiso              !---  " " numbers + isotopes & tagging tracers number
    34    PUBLIC :: itZonIso                                      !--- idx "it" (in "isoName(1:niso)") = function(tagging idx, isotope idx)
    35    PUBLIC :: iqIsoPha                                      !--- idx "iq" (in "qx") = function(isotope idx, phase idx) + aliases
    36    PUBLIC :: iqWIsoPha                                      !--- Same as iqIsoPha but with normal water phases
    37 
     33   PUBLIC :: isotope                                       !--- Selected isotopes database (argument of getKey)
     34   PUBLIC :: isoKeys, isoName, isoZone, isoPhas            !--- Isotopes keys & names, tagging zones names, phases
     35   PUBLIC ::    niso,   ntiso,   nzone,   nphas            !--- Number of   "   "
     36   PUBLIC :: itZonIso                                      !--- Index "it" in "isoName(1:niso)" = f(tagging idx, isotope idx)
     37   PUBLIC :: iqIsoPha                                      !--- Index "iq" in "qx"              = f(isotope idx,   phase idx)
     38   PUBLIC :: iqWIsoPha                                     !--- Same as iqIsoPha but with normal water phases
    3839   PUBLIC :: isoCheck                                      !--- Run isotopes checking routines
    3940   !=== FOR BOTH TRACERS AND ISOTOPES
     
    4344!  |--------------------+-----------------------+-----------------+---------------+----------------------------|
    4445!  | water in different |    water tagging      |  water isotopes | other tracers | additional tracers moments |
    45 !  | phases: H2O_[gls|      isotopes         |                 |               |  for higher order schemes  |
     46!  | phases: H2O_[glsrb]|      isotopes         |                 |               |  for higher order schemes  |
    4647!  |--------------------+-----------------------+-----------------+---------------+----------------------------|
    4748!  |                    |                       |                 |               |                            |
     
    6869!  |-------------+------------------------------------------------------+-------------+------------------------+
    6970!  | name        | Name (short)                                         | tname       |                        |
     71!  | keys        | key/val pairs accessible with "getKey" routine       | /           |                        |
    7072!  | gen0Name    | Name of the 1st generation ancestor                  | /           |                        |
    7173!  | parent      | Name of the parent                                   | /           |                        |
    7274!  | longName    | Long name (with adv. scheme suffix) for outputs      | ttext       |                        |
    7375!  | type        | Type (so far: tracer or tag)                         | /           | tracer,tag             |
    74 !  | phase       | Phases list ("g"as / "l"iquid / "s"olid)             | /           | [g][l][s]              |
     76!  | phase       | Phases list ("g"as / "l"iquid / "s"olid              |             | [g|l|s|r|b]            |
     77!  |             |              "r"(cloud) / "b"lowing)                 | /           |                        |
    7578!  | component   | Name(s) of the merged/cumulated section(s)           | /           | coma-separated names   |
    7679!  | iGeneration | Generation (>=1)                                     | /           |                        |
     
    7982!  | nqDescen    | Number of the descendants   (all generations)        | nqdesc      | 1:nqtot                |
    8083!  | nqChildren  | Number of childs            (1st generation only)    | nqfils      | 1:nqtot                |
    81 !  | keys        | key/val pairs accessible with "getKey" routine       | /           |                        |
    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  |
     84!  | isAdvected  | Advected tracers flag (.TRUE. if iadv >= 0)          | /           | nqtrue  .TRUE. values  |
     85!  | isInPhysics | Tracers not extracted from the main table in physics | /           | nqtottr .TRUE. values  |
    8486!  | iso_iGroup  | Isotopes group index in isotopes(:)                  | /           | 1:nbIso                |
    8587!  | iso_iName   | Isotope  name  index in isotopes(iso_iGroup)%trac(:) | iso_indnum  | 1:niso                 |
     
    9799!  | trac   | ntiso  | Isotopes + tagging tracers list + number         | / | ntraciso       |                 |
    98100!  | zone   | nzone  | Geographic tagging zones   list + number         | / | ntraceurs_zone |                 |
    99 !  | phase  | nphas  | Phases                     list + number         |                    | [g][l][s], 1:3 |
     101!  | phase  | nphas  | Phases                     list + number         |                    | [g|l|s|r|b] 1:5 |
    100102!  | iqIsoPha        | Index in "qx"           = f(name(1:ntiso)),phas) | iqiso              | 1:nqtot         |
    101 !  | iqWIsoPha       | Index in "qx"           = f(name(1:ntiso)),phas) | iqiso              | 1:nqtot         |
     103!  | iqWIsoPha       | Index in "qx"       = f(name(1:ntiso+nqo)),phas) |   /                | 1:nqtot         |
    102104!  | itZonIso        | Index in "trac(1:ntiso)"= f(zone, name(1:niso))  | index_trac         | 1:ntiso         |
    103105!  +-----------------+--------------------------------------------------+--------------------+-----------------+
    104106
     107   !=== INDICES FOR WATER
     108   INTEGER, SAVE :: ivap, iliq, isol
     109!$OMP THREADPRIVATE(ivap, iliq, isol)
     110
    105111   !=== DIMENSIONS OF THE TRACERS TABLES AND OTHER SCALAR VARIABLES
    106    INTEGER,               SAVE :: nqtot,  &                     !--- Tracers nb in dynamics (incl. higher moments + H2O)
    107                                   nbtr,   &                     !--- Tracers nb in physics  (excl. higher moments + H2O)
    108                                   nqo,    &                     !--- Number of water phases
     112   INTEGER,               SAVE :: nqtot,   &                    !--- Tracers nb in dynamics (incl. higher moments + H2O)
     113                                  nbtr,    &                    !--- Tracers nb in physics  (excl. higher moments + H2O)
     114                                  nqo,     &                    !--- Number of water phases
    109115                                  nqtottr, &                    !--- Number of tracers passed to phytrac (TO BE DELETED ?)
    110116                                  nqCO2                         !--- Number of tracers of CO2  (ThL)
     
    112118!$OMP THREADPRIVATE(nqtot, nbtr, nqo, nqtottr, nqCO2, type_trac)
    113119
    114    !=== INDICES OF WATER
    115    INTEGER,               SAVE :: ivap,iliq,isol ! Indices for vap, liq and ice
    116 !$OMP THREADPRIVATE(ivap,iliq,isol)
    117 
    118120   !=== VARIABLES FOR INCA
    119    INTEGER,               SAVE, ALLOCATABLE :: conv_flg(:), &   !--- Convection     activation ; needed for INCA        (nbtr)
    120                                                 pbl_flg(:)      !--- Boundary layer activation ; needed for INCA        (nbtr)
     121   INTEGER, DIMENSION(:), SAVE, ALLOCATABLE :: &
     122                    conv_flg, pbl_flg                           !--- Convection / boundary layer activation (nbtr)
    121123!$OMP THREADPRIVATE(conv_flg, pbl_flg)
    122124
    123 #ifdef CPP_StratAer
     125#if defined CPP_StratAer || defined REPROBUS
    124126  !=== SPECIFIC TO STRATOSPHERIC AEROSOLS (CK/OB)
    125127  INTEGER, SAVE ::  nbtr_bin, nbtr_sulgas         !--- number of aerosols bins and sulfur gases for StratAer model
     
    173175   CHARACTER(LEN=2)      ::   suff(9)                                !--- Suffixes for schemes of order 3 or 4 (Prather)
    174176   CHARACTER(LEN=3)      :: descrq(30)                               !--- Advection scheme description tags
    175    CHARACTER(LEN=maxlen) :: msg1, texp, ttp                          !--- String for messages and expanded tracers type
     177   CHARACTER(LEN=maxlen) :: msg1, texp, ttp                          !--- Strings for messages and expanded tracers type
    176178   INTEGER :: fType                                                  !--- Tracers description file type ; 0: none
    177179                                                                     !--- 1/2/3: "traceur.def"/"tracer.def"/"tracer_*.def"
    178180   INTEGER :: nqtrue                                                 !--- Tracers nb from tracer.def (no higher order moments)
    179181   INTEGER :: iad                                                    !--- Advection scheme number
    180    INTEGER :: iq, jq, nt, im, nm, k                                 !--- Indexes and temporary variables
     182   INTEGER :: iq, jq, nt, im, nm                                     !--- Indexes and temporary variables
    181183   LOGICAL :: lerr, lInit
    182184   TYPE(trac_type), ALLOCATABLE, TARGET :: ttr(:)
    183185   TYPE(trac_type), POINTER             :: t1, t(:)
    184    CHARACTER(LEN=maxlen),   ALLOCATABLE :: types_trac(:)  !--- Keyword for tracers type(s), parsed version
    185    
     186   CHARACTER(LEN=maxlen),   ALLOCATABLE :: types_trac(:)             !--- Keywords for tracers type(s), parsed version
    186187   CHARACTER(LEN=*), PARAMETER :: modname="init_infotrac_phy"
    187188!------------------------------------------------------------------------------------------------------------------------------
     
    202203   ENDIF
    203204
    204    
    205205   CALL msg('type_trac = "'//TRIM(type_trac)//'"', modname)
    206206   lInit = .NOT.ALLOCATED(tracers)
     
    243243
    244244!==============================================================================================================================
    245 ! 1) Get the numbers of: true (first order only) tracers "nqtrue", water tracers "nqo" (vapor/liquid/solid)
    246 !==============================================================================================================================
    247    texp = type_trac                                                  !=== EXPANDED VERSION OF "type_trac", WITH "|" SEPARATOR
     245! 0) DETERMINE THE TYPE OF THE INPUT TRACERS DESCRIPTION FILE AND READ IT
     246!==============================================================================================================================
     247   texp = type_trac                                                            !=== EXPANDED (WITH "|" SEPARATOR) "type_trac"
    248248   IF(texp == 'inco') texp = 'co2i|inca'
    249249   IF(texp /= 'lmdz') texp = 'lmdz|'//TRIM(texp)
    250 
    251    !=== DETERMINE THE TYPE OF THE INPUT TRACERS DESCRIPTION FILE
    252250   IF(testTracersFiles(modname, texp, fType, lInit)) CALL abort_physic(modname, 'problem with tracers file(s)',1)
    253 
    254251   ttp = type_trac; IF(fType /= 1) ttp = texp
    255252
     
    262259!##############################################################################################################################
    263260
    264    !---------------------------------------------------------------------------------------------------------------------------
    265    IF(fType == 0) CALL abort_physic(modname, 'Missing tracers file: "traceur.def", "tracer.def" or "tracer_<keyword>.def file.',1)
    266    !---------------------------------------------------------------------------------------------------------------------------
    267    IF(fType == 1 .AND. ANY(['inca','inco']==type_trac) .AND. lInit) THEN  !=== FOUND OLD STYLE INCA "traceur.def"
     261!==============================================================================================================================
     262! 1) Get various numbers: "nqtrue" (first order only tracers), "nqo" (water phases), 'nbtr' (tracers passed to physics), etc.
     263!==============================================================================================================================
     264   !---------------------------------------------------------------------------------------------------------------------------
     265   IF(fType == 0) CALL abort_physic(modname, 'Missing "traceur.def", "tracer.def" or "tracer_<keyword>.def tracers file.',1)
     266   !---------------------------------------------------------------------------------------------------------------------------
     267   IF(fType == 1 .AND. ANY(['inca', 'inco'] == type_trac) .AND. lInit) THEN  !=== FOUND OLD STYLE INCA "traceur.def"
    268268   !---------------------------------------------------------------------------------------------------------------------------
    269269#ifdef INCA
     
    281281      ttr(1+nqo:nqCO2+nqo   )%component = 'co2i'
    282282      ttr(1+nqo+nqCO2:nqtrue)%component = 'inca'
    283       ttr(1+nqo      :nqtrue)%name      = [('CO2     ', k=1, nqCO2), solsym_inca]
     283      ttr(1+nqo      :nqtrue)%name      = [('CO2     ', iq=1, nqCO2), solsym_inca]
    284284      ttr(1+nqo+nqCO2:nqtrue)%parent    = tran0
    285285      ttr(1+nqo+nqCO2:nqtrue)%phase     = 'g'
     
    302302   ELSE                                                              !=== OTHER CASES (OLD OR NEW FORMAT, NO INCA MODULE)
    303303   !---------------------------------------------------------------------------------------------------------------------------
    304       nqo    =        COUNT(delPhase(tracers(:)%name)     == 'H2O' &
    305                                .AND. tracers(:)%component == 'lmdz') !--- Number of water phases
    306       nqtrue = SIZE(tracers)                                         !--- Total number of "true" tracers
    307       nbtr   = nqtrue-COUNT(delPhase(tracers(:)%gen0Name) == 'H2O' &
    308                                .AND. tracers(:)%component == 'lmdz') !--- Number of tracers passed to phytrac
     304   nqtrue = SIZE(tracers)                                                                               !--- "true" tracers
     305   nqo    =      COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%name)     == 'H2O')     !--- Water phases
     306   nbtr = nqtrue-COUNT(tracers(:)%component == 'lmdz' .AND. delPhase(tracers(:)%gen0Name) == 'H2O')     !--- Passed to phytrac
     307   nqCO2  =      COUNT( [type_trac == 'inco', type_trac == 'co2i'] )
    309308#ifdef INCA
    310       nqINCA = COUNT(tracers(:)%component == 'inca')
    311 #endif
    312       lerr = getKey('hadv', hadv, ky=tracers(:)%keys)
    313       lerr = getKey('vadv', vadv, ky=tracers(:)%keys)
    314    !---------------------------------------------------------------------------------------------------------------------------
    315    END IF
    316    !---------------------------------------------------------------------------------------------------------------------------
    317 
    318    !--- Transfert the number of tracers to Reprobus
     309   nqINCA =      COUNT(tracers(:)%component == 'inca')
     310#endif
     311   IF(getKey('hadv', hadv, ky=tracers(:)%keys)) CALL abort_physic(modname, 'missing key "hadv"', 1)
     312   IF(getKey('vadv', vadv, ky=tracers(:)%keys)) CALL abort_physic(modname, 'missing key "vadv"', 1)
     313   !---------------------------------------------------------------------------------------------------------------------------
     314   END IF
     315   !---------------------------------------------------------------------------------------------------------------------------
     316
    319317#ifdef REPROBUS
    320    CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name)
     318   CALL Init_chem_rep_trac(nbtr, nqo, tracers(:)%name)                         !--- Transfert the number of tracers to Reprobus
    321319#endif
    322320
     
    359357      IF(iad == -1) CALL abort_physic(modname, msg1, 1)
    360358
    361       !--- SET FIELDS %longName, %isAdvected, %isInPhysics
     359      !--- SET FIELDS longName, isAdvected, isInPhysics
    362360      t1%longName   = t1%name; IF(iad > 0) t1%longName=TRIM(t1%name)//descrq(iad)
    363361      t1%isAdvected = iad >= 0
    364       t1%isInPhysics= delPhase(t1%gen0Name) /= 'H2O' &
    365                           .OR. t1%component /= 'lmdz' !=== OTHER EXCEPTIONS TO BE ADDED: CO2i, SURSATURATED WATER CLOUD...
     362      t1%isInPhysics= delPhase(t1%gen0Name) /= 'H2O' .OR. t1%component /= 'lmdz' !=== MORE EXCEPTIONS ? CO2i, SURSAT CLOUD H2O
    366363      ttr(iq)       = t1
    367364
     
    372369      IF(nm == 0) CYCLE                                              !--- No higher moments
    373370      ttr(jq+1:jq+nm)             = t1
    374       ttr(jq+1:jq+nm)%name        = [(TRIM(t1%name)    //'-'//TRIM(suff(im)), im=1, nm) ]
    375       ttr(jq+1:jq+nm)%parent      = [(TRIM(t1%parent)  //'-'//TRIM(suff(im)), im=1, nm) ]
    376       ttr(jq+1:jq+nm)%longName    = [(TRIM(t1%longName)//'-'//TRIM(suff(im)), im=1, nm) ]
    377       ttr(jq+1:jq+nm)%isAdvected  = [(.FALSE., im=1, nm) ]
     371      ttr(jq+1:jq+nm)%name        = [ (TRIM(t1%name)    //'-'//TRIM(suff(im)), im=1, nm) ]
     372      ttr(jq+1:jq+nm)%gen0Name    = [ (TRIM(t1%name)    //'-'//TRIM(suff(im)), im=1, nm) ]
     373      ttr(jq+1:jq+nm)%parent      = [ (TRIM(t1%parent)  //'-'//TRIM(suff(im)), im=1, nm) ]
     374      ttr(jq+1:jq+nm)%longName    = [ (TRIM(t1%longName)//'-'//TRIM(suff(im)), im=1, nm) ]
     375      ttr(jq+1:jq+nm)%isAdvected  = [ (.FALSE., im=1, nm) ]
     376      ttr(jq+1:jq+nm)%isInPhysics = [ (.FALSE., im=1, nm) ]
    378377      jq = jq + nm
    379378   END DO
     
    381380   CALL MOVE_ALLOC(FROM=ttr, TO=tracers)
    382381
    383    !--- SET FIELDS %iqParent, %nqChildren, %iGeneration, %iqDescen, %nqDescen
    384    IF(indexUpdate(tracers)) CALL abort_gcm(modname, 'problem when processing isotopes parameters', 1)
     382   !--- SET FIELDS iqParent, iqDescen, nqDescen, nqChildren, iGeneration
     383   IF(indexUpdate(tracers)) CALL abort_physic(modname, 'problem with tracers indices update', 1)
    385384
    386385!##############################################################################################################################
     
    404403!##############################################################################################################################
    405404   !--- Convection / boundary layer activation for all tracers
    406    IF (.NOT.ALLOCATED(conv_flg)) ALLOCATE(conv_flg(nbtr)); conv_flg(1:nbtr) = 1
    407    IF (.NOT.ALLOCATED(pbl_flg)) ALLOCATE( pbl_flg(nbtr));  pbl_flg(1:nbtr) = 1
     405   IF(.NOT.ALLOCATED(conv_flg)) ALLOCATE(conv_flg(nbtr)); conv_flg(1:nbtr) = 1
     406   IF(.NOT.ALLOCATED( pbl_flg)) ALLOCATE( pbl_flg(nbtr));  pbl_flg(1:nbtr) = 1
    408407
    409408   !--- Note: nqtottr can differ from nbtr when nmom/=0
     
    424423#endif
    425424   t => tracers
    426    CALL msg('Information stored in infotrac_phy :', modname)
    427    IF(dispTable('issssssssiiiiiiii', ['iq  ', 'name', 'lNam', 'g0Nm', 'prnt', 'type', 'phas', 'comp',      &
    428                               'isPh', 'iGen', 'iqPr', 'nqDe', 'nqCh', 'iGrp', 'iNam', 'iZon', 'iPha'],     &
    429       cat(t%name, t%longName, t%gen0Name, t%parent, t%type, t%phase, t%component, bool2str(t%isInPhysics)),&
     425   CALL msg('Information stored in '//TRIM(modname)//': ', modname)
     426   IF(dispTable('isssssssssiiiiiiii', ['iq  ', 'name', 'lNam', 'g0Nm', 'prnt', 'type', 'phas', 'comp',     &
     427                       'isPh', 'isAd', 'iGen', 'iqPr', 'nqDe', 'nqCh', 'iGrp', 'iNam', 'iZon', 'iPha'],    &
     428      cat(t%name, t%longName, t%gen0Name, t%parent, t%type, t%phase, t%component,                          &
     429                                                         bool2str(t%isInPhysics), bool2str(t%isAdvected)), &
    430430      cat([(iq, iq=1, nqtot)], t%iGeneration, t%iqParent, t%nqDescen, t%nqChildren, t%iso_iGroup,          &
    431431                  t%iso_iName, t%iso_iZone, t%iso_iPhase), nColMax=maxTableWidth, nHead=2, sub=modname))   &
  • LMDZ6/branches/cirrus/libf/phylmd/lmdz_lscp.F90

    r5202 r5203  
    15261526                znebprecipcld(i)=0.0
    15271527            ENDIF
    1528         !IF ( ((1-zfice(i))*zoliq(i) .GT. 0.) .AND. (zt(i) .LE. 233.15) ) THEN
    1529         !print*,'WARNING LEA OLIQ A <-40°C '
    1530         !print*,'zt,Tbef,oliq,oice,cldfraliq,icefrac,rneb',zt(i),Tbef(i),(1-zfice(i))*zoliq(i),zfice(i)*zoliq(i),cldfraliq(i,k),zfice(i),rneb(i,k)
    1531         !ENDIF
    15321528        ENDDO
    15331529
  • LMDZ6/branches/cirrus/libf/phylmd/lmdz_wake.F90

    r4908 r5203  
    11MODULE lmdz_wake
    22
    3 ! $Id$
     3  USE lmdz_wake_ini, ONLY: CPPKEY_IOPHYS_WK
     4
     5  IMPLICIT NONE; PRIVATE
     6  PUBLIC wake
    47
    58CONTAINS
     
    353356!
    354357IF (first_call) THEN
    355 !!#define IOPHYS_WK
    356 #undef IOPHYS_WK
    357 #ifdef IOPHYS_WK
     358IF (CPPKEY_IOPHYS_WK) THEN
    358359  IF (phys_sub) THEN
    359360    call iophys_ini(dtimesub)
     
    361362    call iophys_ini(dtime)
    362363  ENDIF
    363 #endif
     364END IF
    364365  first_call = .false.
    365366ENDIF   !(first_call)
     
    771772
    772773  END DO
    773 #ifdef IOPHYS_WK
     774IF (CPPKEY_IOPHYS_WK) THEN
    774775  IF (.not.phys_sub) CALL iophys_ecrit('wape_a',1,'wape_a','J/kg',wape)
    775 #endif
     776END IF
    776777
    777778  ! 2.2 Prognostic variable update
     
    10071008!!--------------------------------------------------------
    10081009    ELSEIF (iflag_wk_pop_dyn == 3) THEN
    1009 #ifdef IOPHYS_WK
     1010IF (CPPKEY_IOPHYS_WK) THEN
    10101011    IF (phys_sub) THEN
    10111012     CALL iophys_ecrit('ptop',1,'ptop','Pa',ptop)
     
    10181019     CALL iophys_ecrit('irad_wk',1,'irad_wk','m',irad_wk)
    10191020    ENDIF
    1020 #endif
     1021END IF
    10211022  !
    10221023     CALL wake_popdyn_3 ( klon, klev, phys_sub, wk_adv, dtimesub, wgen, &
     
    10721073!!--------------------------------------------------------
    10731074
    1074 #ifdef IOPHYS_WK
     1075IF (CPPKEY_IOPHYS_WK) THEN
    10751076    IF (phys_sub) THEN
    10761077     CALL iophys_ecrit('wdensa',1,'wdensa','m',wdens)
     
    10791080     CALL iophys_ecrit('asigmawa',1,'asigmawa','m',asigmaw)
    10801081    ENDIF
    1081 #endif
     1082END IF
    10821083    ! calcul de la difference de vitesse verticale poche - zone non perturbee
    10831084    ! IM 060208 differences par rapport au code initial; init. a 0 dp_deltomg
     
    16691670          END DO
    16701671
    1671 #ifdef IOPHYS_WK
     1672IF (CPPKEY_IOPHYS_WK) THEN
    16721673    IF (phys_sub) THEN
    16731674     CALL iophys_ecrit('wdensb',1,'wdensb','m',wdens)
     
    17021703     CALL iophys_ecrit('d_asig_bnd2',1,'d_asig_bnd2','m',d_asig_bnd2)
    17031704    ENDIF
    1704 #endif
     1705END IF
    17051706        ENDIF ! (iflag_wk_pop_dyn == 3)
    17061707      ENDIF ! (iflag_wk_pop_dyn >= 2)
     
    18661867  !
    18671868
    1868 #ifdef IOPHYS_WK
     1869IF (CPPKEY_IOPHYS_WK) THEN
    18691870    IF (.not.phys_sub) CALL iophys_ecrit('wape_b',1,'wape_b','J/kg',wape)
    1870 #endif
     1871END IF
    18711872  IF (prt_level>=10) THEN
    18721873    PRINT *, 'wake-5, sigmaw(igout), cstar(igout), wape(igout), ptop(igout) ', &
     
    20092010    END IF
    20102011  END DO
    2011 #ifdef IOPHYS_WK
     2012IF (CPPKEY_IOPHYS_WK) THEN
    20122013  IF (.not.phys_sub) CALL iophys_ecrit('wape2_a',1,'wape2_a','J/kg',wape2)
    2013 #endif
     2014END IF
    20142015
    20152016
     
    20412042    END DO
    20422043  END IF
    2043 #ifdef IOPHYS_WK
     2044IF (CPPKEY_IOPHYS_WK) THEN
    20442045  IF (.not.phys_sub) CALL iophys_ecrit('wape2_b',1,'wape2_b','J/kg',wape2)
    2045 #endif
     2046END IF
    20462047
    20472048
     
    20872088        gwake(i) = .TRUE.
    20882089      END IF
    2089 #ifdef IOPHYS_WK
     2090IF (CPPKEY_IOPHYS_WK) THEN
    20902091  IF (.not.phys_sub) CALL iophys_ecrit('cstar2',1,'cstar2','J/kg',cstar2)
    2091 #endif
     2092END IF
    20922093    END IF  ! (ok_qx_qw(i))
    20932094  END DO
     
    21232124  END DO
    21242125    IF (iflag_wk_pop_dyn >= 3) THEN
    2125 #ifdef IOPHYS_WK
     2126IF (CPPKEY_IOPHYS_WK) THEN
    21262127      IF (.not.phys_sub) THEN
    21272128       CALL iophys_ecrit('fip',1,'fip','J/kg',fip)
     
    21632164       CALL iophys_ecrit('d_asig_bnd2',1,'d_asig_bnd2','m',d_asig_bnd2)
    21642165      ENDIF  ! (.not.phys_sub)
    2165 #endif
     2166END IF
    21662167    ENDIF  ! (iflag_wk_pop_dyn >= 3)
    21672168  ! Limitation de sigmaw
     
    22682269                      wape(igout),wape2(igout),ktopw(igout),OK_qx_qw(igout)
    22692270  ENDIF
    2270 #ifdef IOPHYS_WK
     2271IF (CPPKEY_IOPHYS_WK) THEN
    22712272  IF (.not.phys_sub) CALL iophys_ecrit('wape_c',1,'wape_c','J/kg',wape)
    2272 #endif
     2273END IF
    22732274
    22742275
     
    32553256          d_sig_spread(i) =  d_sig_spread(i)*dtimesub
    32563257          d_sigmaw(i) =  d_sig_gen(i) + d_sig_death(i) + d_sig_col(i) + d_sig_spread(i)
    3257 #ifdef IOPHYS_WK
     3258IF (CPPKEY_IOPHYS_WK) THEN
    32583259          IF (phys_sub) call iophys_ecrit('d_sigmaw0',1,'d_sigmaw0','',d_sigmaw)
    3259 #endif
     3260END IF
    32603261
    32613262         
     
    32663267          d_sigmaw(i) = d_sigmaw_targ
    32673268!!          d_sigmaw(i) = max(d_sigmaw(i), sigmad-sigmaw(i))
    3268 #ifdef IOPHYS_WK
     3269IF (CPPKEY_IOPHYS_WK) THEN
    32693270          IF (phys_sub) THEN
    32703271             call iophys_ecrit('tauwk_inv',1,'tau_wk_inv_min','',tau_wk_inv_min)
     
    32763277             call iophys_ecrit('d_sig_bnd',1,'d_sig_bnd','',d_sig_bnd)
    32773278          ENDIF
    3278 #endif
     3279END IF
    32793280          d_asig_death(i) = - asigmaw(i)/tau_prime(i)
    32803281          d_asig_aicol(i) = (agfl(i)*iwdens(i) + igfl(i)*awdens(i))*cstar(i)*is_wk(i)
     
    32873288          d_asig_spread(i) =  d_asig_spread(i)*dtimesub
    32883289          d_asigmaw(i) =  d_sig_gen(i) + d_asig_death(i) + d_asig_aicol(i) + d_asig_iicol(i) + d_asig_spread(i)
    3289 #ifdef IOPHYS_WK
     3290IF (CPPKEY_IOPHYS_WK) THEN
    32903291          IF (phys_sub) call iophys_ecrit('d_asigmaw0',1,'d_asigmaw0','',d_asigmaw)
    3291 #endif
     3292END IF
    32923293
    32933294          d_sigmaw_targ = min(max(d_asigmaw(i),-asigmaw(i)), sigmaw(i)-asigmaw(i))
     
    32953296          d_asig_bnd(i) = d_sigmaw_targ - d_asigmaw(i)
    32963297          d_asigmaw(i) = d_sigmaw_targ
    3297 #ifdef IOPHYS_WK
     3298IF (CPPKEY_IOPHYS_WK) THEN
    32983299          IF (phys_sub) THEN
    32993300             call iophys_ecrit('d_asigmaw',1,'d_asigmaw','',d_asigmaw)
     
    33043305             call iophys_ecrit('d_asig_bnd',1,'d_asig_bnd','',d_asig_bnd)
    33053306          ENDIF
    3306 #endif
     3307END IF
    33073308          d_dens_gen(i) = wgen(i)
    33083309          d_dens_death(i) = - iwdens(i)*tau_wk_inv_min
     
    33183319          d_dens_bnd(i) = d_wdens_targ - d_wdens(i)
    33193320          d_wdens(i) = d_wdens_targ
    3320 #ifdef IOPHYS_WK
     3321IF (CPPKEY_IOPHYS_WK) THEN
    33213322    IF (phys_sub) THEN
    33223323        call iophys_ecrit('d_wdens',1,'d_wdens','',d_wdens)
     
    33253326        call iophys_ecrit('d_dens_col',1,'d_dens_col','',d_dens_col)
    33263327    ENDIF
    3327 #endif
     3328END IF
    33283329
    33293330          d_adens_death(i) = -awdens(i)/tau_prime(i)
     
    33353336          d_adens_acol(i)  =   d_adens_acol(i)*dtimesub
    33363337          d_awdens(i) =   d_dens_gen(i) + d_adens_death(i) + d_adens_icol(i) + d_adens_acol(i)     
    3337 #ifdef IOPHYS_WK
     3338IF (CPPKEY_IOPHYS_WK) THEN
    33383339    IF (phys_sub) THEN
    33393340        call iophys_ecrit('d_awdens',1,'d_awdens','',d_awdens)
     
    33423343        call iophys_ecrit('d_adens_acol',1,'d_adens_acol','',d_adens_acol)
    33433344    ENDIF
    3344 #endif
     3345END IF
    33453346          d_wdens_targ = min(max(d_awdens(i),-awdens(i)), wdens(i)-awdens(i))
    33463347!!          d_dens_bnd(i) = d_dens_bnd(i) + d_wdens_targ - d_wdens(i)
  • LMDZ6/branches/cirrus/libf/phylmd/lmdz_wake_ini.F90

    r4908 r5203  
    8181  !$OMP THREADPRIVATE(wk_int_delta_t_min)
    8282
     83! CPP key used only in this module for debugging purposes. jyg 09/24
     84!!#define IOPHYS_WK
     85#ifdef IOPHYS_WK
     86  LOGICAL, PARAMETER :: CPPKEY_IOPHYS_WK = .TRUE.
     87#else
     88  LOGICAL, PARAMETER :: CPPKEY_IOPHYS_WK = .FALSE.
     89#endif
     90
    8391
    8492
  • LMDZ6/branches/cirrus/libf/phylmd/phyetat0_mod.F90

    r4951 r5203  
    3333  USE geometry_mod,     ONLY: longitude_deg, latitude_deg
    3434  USE iostart,          ONLY: close_startphy, get_field, get_var, open_startphy
    35   USE infotrac_phy,     ONLY: nqtot, nbtr, type_trac, tracers
    36   USE readTracFiles_mod,ONLY: maxlen, new2oldH2O
     35  USE infotrac_phy,     ONLY: nqtot, nbtr, type_trac, tracers, new2oldH2O
     36  USE strings_mod,      ONLY: maxlen
    3737  USE traclmdz_mod,     ONLY: traclmdz_from_restart
    3838  USE carbon_cycle_mod, ONLY: carbon_cycle_init, carbon_cycle_cpl, carbon_cycle_tr, carbon_cycle_rad, co2_send, RCO2_glo
  • LMDZ6/branches/cirrus/libf/phylmd/phys_local_var_mod.F90

    r5202 r5203  
    400400      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: tpot, tpote, ue, uq, uwat, ve, vq, vwat, zxffonte
    401401!$OMP THREADPRIVATE(tpot, tpote, ue, uq, uwat, ve, vq, vwat, zxffonte)
    402       REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxustartlic, zxrhoslic, zxqsaltlic
    403 !$OMP THREADPRIVATE(zxustartlic, zxrhoslic, zxqsaltlic)
     402      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxustartlic, zxrhoslic, zxqsaltlic, tempsmoothlic
     403!$OMP THREADPRIVATE(zxustartlic, zxrhoslic, zxqsaltlic, tempsmoothlic)
    404404      REAL,ALLOCATABLE,SAVE,DIMENSION(:) :: zxfqcalving
    405405!$OMP THREADPRIVATE(zxfqcalving)
     
    10511051      ALLOCATE(zxrunofflic(klon), runoff_diag(klon))
    10521052      runoff_diag(:)=0.
    1053       ALLOCATE(zxustartlic(klon), zxrhoslic(klon), zxqsaltlic(klon))
    1054       zxustartlic(:)=0. ; zxrhoslic(:)=0. ; zxqsaltlic(:)=0.
     1053      ALLOCATE(zxustartlic(klon), zxrhoslic(klon), zxqsaltlic(klon), tempsmoothlic(klon))
     1054      zxustartlic(:)=0. ; zxrhoslic(:)=0. ; zxqsaltlic(:)=0. ; tempsmoothlic(:)=0.
    10551055      ALLOCATE(rain_lsc(klon))
    10561056      ALLOCATE(rain_num(klon))
     
    14801480! SN runoff_diag
    14811481      DEALLOCATE(zxrunofflic, runoff_diag)
    1482       DEALLOCATE(zxustartlic, zxrhoslic, zxqsaltlic)
     1482      DEALLOCATE(zxustartlic, zxrhoslic, zxqsaltlic, tempsmoothlic)
    14831483      DEALLOCATE(zxtsol, snow_lsc, zxfqfonte, zxqsurf)
    14841484      DEALLOCATE(rain_lsc)
  • LMDZ6/branches/cirrus/libf/phylmd/physiq_mod.F90

    r5202 r5203  
    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
    42     USE readTracFiles_mod, ONLY: addPhase
     41    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, type_trac, addPhase
    4342    USE strings_mod,  ONLY: strIdx
    4443    USE iophy
     
    12701269    !albedo SB <<<
    12711270
     1271    !--Lea Raillard qs_ini
     1272    REAL, dimension(klon,klev) :: qs_ini
     1273
    12721274    !--OB variables for mass fixer (hard coded for now)
    12731275    REAL qql1(klon),qql2(klon),corrqql
     
    24612463       ENDDO
    24622464    ENDDO
     2465    ! Lea Raillard qs_ini for cloud phase param.
     2466    qs_ini(:,:)=qs_seri(:,:)
    24632467    !
    24642468    !--OB water mass fixer
     
    38583862
    38593863    CALL lscp(klon,klev,phys_tstep,missing_val,paprs,pplay, &
    3860          t_seri, q_seri,qs_ancien,ptconv,ratqs, &
     3864         t_seri, q_seri,qs_ini,ptconv,ratqs, &
    38613865         d_t_lsc, d_q_lsc, d_ql_lsc, d_qi_lsc, rneb, rneblsvol, &
    38623866         pfraclr, pfracld, cldfraliq, sigma2_icefracturb, mean_icefracturb,  &
  • LMDZ6/branches/cirrus/libf/phylmd/surf_landice_mod.F90

    r5202 r5203  
    3636    USE cpl_mod,          ONLY : cpl_send_landice_fields
    3737    USE calcul_fluxs_mod
    38     USE phys_local_var_mod, ONLY : zxrhoslic, zxustartlic, zxqsaltlic
     38    USE phys_local_var_mod, ONLY : zxrhoslic, zxustartlic, zxqsaltlic, tempsmoothlic
    3939    USE phys_output_var_mod, ONLY : snow_o,zfra_o
    4040#ifdef ISO   
     
    185185
    186186    REAL,DIMENSION(klon) :: alb1,alb2
     187    REAL                 :: time_tempsmooth,coef_tempsmooth
    187188    REAL,DIMENSION(klon) :: precip_totsnow, evap_totsnow
    188189    REAL, DIMENSION (klon,6) :: alb6
     
    230231           PRINT*, 'alb_nir_sno_lic',alb_nir_sno_lic
    231232 
     233  DO j=1,knon
     234       i = knindex(j)
     235       tempsmoothlic(i) = temp_air(j)
     236  ENDDO
    232237  firstcall=.false.
    233238  ENDIF
     
    445450    z0h(1:knon) = z0h_landice
    446451else
    447     ! parameterization of z0=f(T) following measurements in Adelie Land by Amory et al 2018
     452    ! parameterization of z0=f(T) following measurements in Adelie Land by Amory et al 2017
    448453    coefa = 0.1658 !0.1862 !Ant
    449454    coefb = -50.3869 !-55.7718 !Ant
     
    456461    coefc = log(z03/z02)/(ta3-ta2)
    457462    coefd = log(z03)-coefc*ta3
     463    time_tempsmooth=2.*86400.
     464    coef_tempsmooth=min(1.,dtime/time_tempsmooth)
     465    !coef_tempsmooth=0.
    458466    do j=1,knon
    459       if (temp_air(j) .lt. ta1) then
     467      i=knindex(j)
     468      tempsmoothlic(i)=temp_air(j)*coef_tempsmooth+tempsmoothlic(i)*(1.-coef_tempsmooth)
     469      if (tempsmoothlic(i) .lt. ta1) then
    460470        z0m(j) = z01
    461       else if (temp_air(j).ge.ta1 .and. temp_air(j).lt.ta2) then
    462         z0m(j) = exp(coefa*temp_air(j) + coefb)
    463       else if (temp_air(j).ge.ta2 .and. temp_air(j).lt.ta3) then
     471      else if (tempsmoothlic(i).ge.ta1 .and. tempsmoothlic(i).lt.ta2) then
     472        z0m(j) = exp(coefa*tempsmoothlic(i) + coefb)
     473      else if (tempsmoothlic(i).ge.ta2 .and. tempsmoothlic(i).lt.ta3) then
    464474        ! if st > 0, melting induce smooth surface
    465         z0m(j) = exp(coefc*temp_air(j) + coefd)
     475        z0m(j) = exp(coefc*tempsmoothlic(i) + coefd)
    466476      else
    467477        z0m(j) = z03
  • LMDZ6/branches/cirrus/libf/phylmdiso/isotopes_mod.F90

    r5202 r5203  
    161161   !=== Local variables:
    162162   INTEGER :: ixt
    163 
     163   LOGICAL :: ltnat1
     164   CHARACTER(LEN=maxlen) :: modname, sxt
    164165 
    165166   !--- For H2[17]O
     
    170171   LOGICAL, PARAMETER ::   ok_nocinsat = .FALSE. ! if T: no sursaturation effect for ice
    171172   LOGICAL, PARAMETER :: Rdefault_smow = .FALSE. ! if T: Rdefault=smow; if F: nul
    172    LOGICAL, PARAMETER :: tnat1 = .TRUE. ! If T: all tnats are 1.
    173173
    174174   !--- For [3]H
    175175   INTEGER :: iessai
    176 
    177    CHARACTER(LEN=maxlen) :: modname, sxt
    178176
    179177   modname = 'iso_init'
     
    265263   IF(ANY(isoName == 'HTO')) &
    266264   CALL get_in('ok_prod_nucl_tritium', ok_prod_nucl_tritium, .FALSE., .FALSE.)
     265   CALL get_in('tnateq1', ltnat1, .TRUE.)
    267266
    268267   ! Ocean composition
     
    295294       tkcin1(ixt) = 0.0005016
    296295       tkcin2(ixt) = 0.0014432
    297        if (tnat1) then
    298                tnat(ixt)=1
    299        else
    300                tnat(ixt)=0.
    301        endif
     296       tnat(ixt) = 0.0; IF(ltnat1) tnat(ixt)=1
    302297       toce(ixt)=4.0E-19 ! rapport T/H = 0.2 TU Dreisigacker and Roether 1978
    303298       tcorr(ixt)=1.
     
    318313       tkcin1(ixt) = tkcin1_O18*fac_kcin
    319314       tkcin2(ixt) = tkcin2_O18*fac_kcin
    320        if (tnat1) then
    321                tnat(ixt)=1
    322        else
    323                tnat(ixt)=0.004/100. ! O17 représente 0.004% de l'oxygène
    324        endif
     315       tnat(ixt)=0.004/100. ! O17 représente 0.004% de l'oxygène
     316       IF(ltnat1) tnat(ixt)=1
    325317       toce(ixt)=tnat(ixt)*(1.0+deltaO18_oce/1000.0)**pente_MWL
    326318       tcorr(ixt)=1.0+fac_enrichoce18*pente_MWL ! donné par Amaelle           
     
    338330       tkcin1(ixt) = tkcin1_O18
    339331       tkcin2(ixt) = tkcin2_O18
    340        if (tnat1) then
    341                tnat(ixt)=1
    342        else
    343                tnat(ixt)=2005.2E-6
    344        endif
     332       tnat(ixt)=2005.2E-6; IF(ltnat1) tnat(ixt)=1
    345333       toce(ixt)=tnat(ixt)*(1.0+deltaO18_oce/1000.0)
    346334       tcorr(ixt)=1.0+fac_enrichoce18
     
    362350       tkcin1(ixt) = tkcin1_O18*fac_kcin
    363351       tkcin2(ixt) = tkcin2_O18*fac_kcin
    364        if (tnat1) then
    365                tnat(ixt)=1
    366        else
    367                tnat(ixt)=155.76E-6
    368        endif
     352       tnat(ixt)=155.76E-6; IF(ltnat1) tnat(ixt)=1
    369353       toce(ixt)=tnat(ixt)*(1.0+pente_MWL*deltaO18_oce/1000.0)
    370354       tcorr(ixt)=1.0+fac_enrichoce18*pente_MWL         
  • LMDZ6/branches/cirrus/libf/phylmdiso/isotopes_routines_mod.F90

    r5202 r5203  
    1641916419   USE isotopes_mod,      ONLY: isoName,iso_HDO,iso_eau
    1642016420   USE phyetat0_get_mod,  ONLY: phyetat0_get, phyetat0_srf
    16421    USE readTracFiles_mod, ONLY: new2oldH2O
    16422    USE strings_mod,       ONLY: strIdx, strTail, maxlen, msg, int2str
     16421   USE infotrac_phy,      ONLY: new2oldH2O
     16422   USE strings_mod,       ONLY: strIdx, strHead, strTail, maxlen, msg, int2str
    1642316423#ifdef ISOVERIF
    1642416424   USE isotopes_verif_mod
     
    1645916459      outiso = isoName(ixt)
    1646016460      oldIso = strTail(new2oldH2O(outiso), '_')            !--- Remove "H2O_" from "H2O_<iso>[_<tag>]"
    16461       i = INDEX(outiso, '_', .TRUE.)
    16462       oldIso2 = outiso(1:i-1)//outiso(i+1:LEN_TRIM(outiso)) ! CR 2023: on ajoute cette possibilité aussi, elle correspond au cas le plus récent.
     16461      oldIso2= TRIM(strHead(outiso,'_'))//strTail(outiso,'_') ! CR 2023: most recent possibility
    1646316462!      write(*,*) 'tmp 16541:'
    1646416463!      write(*,*) 'outiso=',outiso
  • LMDZ6/branches/cirrus/libf/phylmdiso/isotrac_mod.F90

    r4493 r5203  
    33
    44MODULE isotrac_mod
    5   USE infotrac_phy,      ONLY: niso, ntiso, nzone
    6   USE readTracFiles_mod, ONLY: delPhase
    7   USE isotopes_mod,      ONLY: ridicule, get_in
     5  USE infotrac_phy, ONLY: niso, ntiso, nzone, delPhase
     6  USE isotopes_mod, ONLY: ridicule, get_in
    87
    98  IMPLICIT NONE
  • LMDZ6/branches/cirrus/libf/phylmdiso/phyetat0_mod.F90

    r5202 r5203  
    4141  USE geometry_mod,     ONLY: longitude_deg, latitude_deg
    4242  USE iostart,          ONLY: close_startphy, get_field, get_var, open_startphy
    43   USE infotrac_phy,     ONLY: nqtot, nbtr, type_trac, tracers
    44   USE readTracFiles_mod,ONLY: maxlen, new2oldH2O
     43  USE infotrac_phy,     ONLY: nqtot, nbtr, type_trac, tracers, new2oldH2O
     44  USE strings_mod,      ONLY: maxlen
    4545  USE traclmdz_mod,     ONLY: traclmdz_from_restart
    4646  USE carbon_cycle_mod, ONLY: carbon_cycle_init, carbon_cycle_cpl, carbon_cycle_tr, carbon_cycle_rad, co2_send, RCO2_glo
  • LMDZ6/branches/cirrus/libf/phylmdiso/physiq_mod.F90

    r5202 r5203  
    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,ivap,iliq,isol
    42     USE readTracFiles_mod, ONLY: addPhase
     41    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, type_trac,addPhase, ivap, iliq, isol
    4342    USE strings_mod,  ONLY: strIdx
    4443    USE iophy
     
    13751374!$OMP THREADPRIVATE(SFRWL)
    13761375    !albedo SB <<<
     1376
     1377    !--Lea Raillard qs_ini
     1378    REAL, dimension(klon,klev) :: qs_ini
    13771379
    13781380    !--OB variables for mass fixer (hard coded for now)
     
    50905092
    50915093    CALL lscp(klon,klev,phys_tstep,missing_val,paprs,pplay, &
    5092          t_seri, q_seri,qs_ancien,ptconv,ratqs, &
     5094         t_seri, q_seri,qs_ini,ptconv,ratqs, &
    50935095         d_t_lsc, d_q_lsc, d_ql_lsc, d_qi_lsc, rneb, rneblsvol, &
    50945096         pfraclr, pfracld, cldfraliq, sigma2_icefracturb, mean_icefracturb,  &
     
    71727174       ENDDO
    71737175    ENDDO
     7176   
     7177    ! Lea Raillard qs_ini for cloud phase param.
     7178    qs_ini(:,:)=qs_seri(:,:)
    71747179
    71757180    ! C Risi: dispatcher les isotopes dans les xt_seri
Note: See TracChangeset for help on using the changeset viewer.