Ignore:
Timestamp:
Sep 10, 2024, 4:25:29 PM (4 months ago)
Author:
abarral
Message:

(WIP) Replace REPROBUS CPP KEY by logical
properly name modules

Location:
LMDZ6/branches/Amaury_dev/libf/dyn3d
Files:
12 edited
1 moved

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/addfi.F90

    r5159 r5182  
    33SUBROUTINE addfi(pdt, leapf, forward, pucov, pvcov, pteta, pq, pps, pdufi, pdvfi, pdhfi, pdqfi, pdpfi)
    44
    5   USE infotrac, ONLY: nqtot
     5  USE lmdz_infotrac, ONLY: nqtot
    66  USE control_mod, ONLY: planet_type
    77  USE lmdz_ssum_scopy, ONLY: ssum
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/advtrac.f90

    r5159 r5182  
    99  !            M.A Filiberti (04/2002)
    1010
    11   USE infotrac, ONLY: nqtot, tracers, isoCheck
     11  USE lmdz_infotrac, ONLY: nqtot, tracers, isoCheck
    1212  USE control_mod, ONLY: iapp_tracvl, day_step
    1313  USE comconst_mod, ONLY: dtvr
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/caladvtrac.F90

    r5159 r5182  
    77        flxw, pk)
    88
    9   USE infotrac, ONLY: nqtot
     9  USE lmdz_infotrac, ONLY: nqtot
    1010  USE control_mod, ONLY: iapp_tracvl, planet_type
    1111  USE comconst_mod, ONLY: dtvr
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/check_isotopes.F90

    r5159 r5182  
    11SUBROUTINE check_isotopes_seq(q, ip1jmp1, err_msg)
    22   USE lmdz_strings, ONLY: maxlen, msg, strIdx, strStack, int2str, real2str
    3    USE infotrac,    ONLY: nqtot, niso, nphas, isotope, isoCheck, iqIsoPha, isoSelect, &
     3   USE lmdz_infotrac,    ONLY: nqtot, niso, nphas, isotope, isoCheck, iqIsoPha, isoSelect, &
    44                          ntiso, iH2O, nzone, tracers, isoName,  itZonIso, getKey
    55
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/conf_gcm.f90

    r5159 r5182  
    55  USE control_mod
    66  USE IOIPSL
    7   USE infotrac, ONLY: type_trac
     7  USE lmdz_infotrac, ONLY: type_trac
    88  USE lmdz_assert, ONLY: assert
    99  USE comconst_mod, ONLY: dissip_deltaz, dissip_factz, dissip_zref, &
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/dynredem.F90

    r5159 r5182  
    66  USE IOIPSL
    77  USE lmdz_strings, ONLY: maxlen
    8   USE infotrac, ONLY: nqtot, tracers
     8  USE lmdz_infotrac, ONLY: nqtot, tracers
    99  USE netcdf, ONLY: nf90_create, nf90_def_dim, nf90_inq_varid, nf90_global, &
    1010          nf90_close, nf90_put_att, nf90_unlimited, nf90_clobber, &
     
    160160  !-------------------------------------------------------------------------------
    161161  USE lmdz_strings, ONLY: maxlen
    162   USE infotrac, ONLY: nqtot, tracers, type_trac
     162  USE lmdz_infotrac, ONLY: nqtot, tracers, type_trac
    163163  USE control_mod
    164164  USE netcdf, ONLY: nf90_open, nf90_nowrite, nf90_get_var, nf90_inq_varid, &
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/gcm.F90

    r5159 r5182  
    99
    1010  USE lmdz_filtreg, ONLY: inifilr
    11   USE infotrac, ONLY: nqtot, init_infotrac
     11  USE lmdz_infotrac, ONLY: nqtot, init_infotrac
    1212  USE control_mod
    1313  USE mod_const_mpi, ONLY: COMM_LMDZ
     
    1919  USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_PHYS
    2020  USE lmdz_description, ONLY: descript
     21  USE lmdz_dynetat0, ONLY: dynetat0
    2122
    2223  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    212213    !        if (planet_type.EQ."earth") THEN
    213214    ! Load an Earth-format start file
    214     CALL dynetat0("start.nc", vcov, ucov, &
    215             teta, q, masse, ps, phis, time_0)
     215    CALL dynetat0("start.nc", vcov, ucov, teta, q, masse, ps, phis, time_0)
    216216    !        endif ! of if (planet_type.EQ."earth")
    217217
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/iniacademic.F90

    r5159 r5182  
    44
    55  USE lmdz_filtreg, ONLY: inifilr
    6   USE infotrac, ONLY: nqtot, niso, iqIsoPha, tracers, getKey, isoName
     6  USE lmdz_infotrac, ONLY: nqtot, niso, iqIsoPha, tracers, getKey, isoName
    77  USE control_mod, ONLY: day_step, planet_type
    88  USE exner_hyb_m, ONLY: exner_hyb
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/leapfrog.F90

    r5159 r5182  
    88  !IM : pour sortir les param. du modele dans un fis. netcdf 110106
    99  USE IOIPSL
    10   USE infotrac, ONLY: nqtot, isoCheck
     10  USE lmdz_infotrac, ONLY: nqtot, isoCheck
    1111  USE guide_mod, ONLY: guide_main
    1212  USE lmdz_write_field, ONLY: writefield
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/lmdz_dynetat0.f90

    r5181 r5182  
    1 SUBROUTINE dynetat0(fichnom,vcov,ucov,teta,q,masse,ps,phis,time)
    2 
    3 !-------------------------------------------------------------------------------
    4 ! Authors: P. Le Van , L.Fairhead
    5 !-------------------------------------------------------------------------------
    6 ! Purpose: Initial state reading.
    7 !-------------------------------------------------------------------------------
    8   USE infotrac,    ONLY: nqtot, tracers, niso, iqIsoPha, iH2O, isoName
    9   USE lmdz_strings, ONLY: maxlen, msg, strStack, real2str, int2str
    10   USE netcdf,      ONLY: nf90_open,  nf90_nowrite, nf90_inq_varid, &
    11                          nf90_close, nf90_get_var, nf90_noerr
    12   USE lmdz_readTracFiles, ONLY: new2oldH2O, newHNO3, oldHNO3, getKey
    13   USE control_mod, ONLY: planet_type
    14   USE lmdz_assert_eq, ONLY: assert_eq
    15   USE comvert_mod, ONLY: pa,preff
    16   USE comconst_mod, ONLY: cpp, daysec, dtvr, g, im, jm, kappa, lllm, omeg, rad
    17   USE logic_mod, ONLY: fxyhypb, ysinus
    18   USE serre_mod, ONLY: clon, clat, grossismx, grossismy
    19   USE temps_mod, ONLY: annee_ref, day_ini, day_ref, itau_dyn, start_time
    20   USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0
    21   USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_INCA
    22   USE lmdz_description, ONLY: descript
    23   USE lmdz_iniprint, ONLY: lunout, prt_level
    24   USE lmdz_comgeom2
    25 
    26 USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
    27   USE lmdz_paramet
    28   IMPLICIT NONE
    29 
    30 
    31 !===============================================================================
    32 ! Arguments:
    33   CHARACTER(LEN=*), INTENT(IN) :: fichnom          !--- FILE NAME
    34   REAL, INTENT(OUT) ::  vcov(iip1,jjm, llm)        !--- V COVARIANT WIND
    35   REAL, INTENT(OUT) ::  ucov(iip1,jjp1,llm)        !--- U COVARIANT WIND
    36   REAL, INTENT(OUT) ::  teta(iip1,jjp1,llm)        !--- POTENTIAL TEMP.
    37   REAL, INTENT(OUT) ::     q(iip1,jjp1,llm,nqtot)  !--- TRACERS
    38   REAL, INTENT(OUT) :: masse(iip1,jjp1,llm)        !--- MASS PER CELL
    39   REAL, INTENT(OUT) ::    ps(iip1,jjp1)            !--- GROUND PRESSURE
    40   REAL, INTENT(OUT) ::  phis(iip1,jjp1)            !--- GEOPOTENTIAL
    41 !===============================================================================
    42 ! Local variables:
    43   CHARACTER(LEN=maxlen) :: mesg, var, modname, oldVar
    44   INTEGER, PARAMETER :: length=100
    45   INTEGER :: iq, fID, vID, idecal, iqParent, iName, iZone, iPhase
    46   REAL    :: time, tnat, alpha_ideal, tab_cntrl(length)    !--- RUN PARAMS TABLE
    47   LOGICAL :: lSkip, ll
    48   LOGICAL,PARAMETER :: tnat1=.TRUE.
    49 !-------------------------------------------------------------------------------
    50   modname="dynetat0"
    51 
    52 !--- Initial state file opening
    53   var=fichnom
    54   CALL err(nf90_open(var,nf90_nowrite,fID),"open",var)
    55   CALL get_var1("controle",tab_cntrl)
    56 
    57 !!! AS: idecal is a hack to be able to read planeto starts...
    58 !!!     .... while keeping everything OK for LMDZ EARTH
    59   IF(planet_type=="generic") THEN
    60     CALL msg('NOTE NOTE NOTE : Planeto-like start files', modname)
    61     idecal = 4
    62     annee_ref  = 2000
    63   ELSE
    64     CALL msg('NOTE NOTE NOTE : Earth-like start files', modname)
    65     idecal = 5
    66     annee_ref  = tab_cntrl(5)
    67   END IF
    68   im         = tab_cntrl(1)
    69   jm         = tab_cntrl(2)
    70   lllm       = tab_cntrl(3)
    71   day_ref    = tab_cntrl(4)
    72   rad        = tab_cntrl(idecal+1)
    73   omeg       = tab_cntrl(idecal+2)
    74   g          = tab_cntrl(idecal+3)
    75   cpp        = tab_cntrl(idecal+4)
    76   kappa      = tab_cntrl(idecal+5)
    77   daysec     = tab_cntrl(idecal+6)
    78   dtvr       = tab_cntrl(idecal+7)
    79   etot0      = tab_cntrl(idecal+8)
    80   ptot0      = tab_cntrl(idecal+9)
    81   ztot0      = tab_cntrl(idecal+10)
    82   stot0      = tab_cntrl(idecal+11)
    83   ang0       = tab_cntrl(idecal+12)
    84   pa         = tab_cntrl(idecal+13)
    85   preff      = tab_cntrl(idecal+14)
    86 
    87   clon       = tab_cntrl(idecal+15)
    88   clat       = tab_cntrl(idecal+16)
    89   grossismx  = tab_cntrl(idecal+17)
    90   grossismy  = tab_cntrl(idecal+18)
    91 
    92   IF ( tab_cntrl(idecal+19)==1. )  THEN
    93     fxyhypb  = .TRUE.
    94 !   dzoomx   = tab_cntrl(25)
    95 !   dzoomy   = tab_cntrl(26)
    96 !   taux     = tab_cntrl(28)
    97 !   tauy     = tab_cntrl(29)
    98   ELSE
    99     fxyhypb = .FALSE.
    100     ysinus  = tab_cntrl(idecal+22)==1.
    101   END IF
    102 
    103   day_ini    = tab_cntrl(30)
    104   itau_dyn   = tab_cntrl(31)
    105   start_time = tab_cntrl(32)
    106 
    107 !-------------------------------------------------------------------------------
    108   CALL msg('rad, omeg, g, cpp, kappa = '//TRIM(strStack(real2str([rad,omeg,g,cpp,kappa]))), modname)
    109   CALL check_dim(im,iim,'im','im')
    110   CALL check_dim(jm,jjm,'jm','jm')
    111   CALL check_dim(lllm,llm,'lm','lllm')
    112   CALL get_var1("rlonu",rlonu)
    113   CALL get_var1("rlatu",rlatu)
    114   CALL get_var1("rlonv",rlonv)
    115   CALL get_var1("rlatv",rlatv)
    116   CALL get_var2("cu"   ,cu)
    117   CALL get_var2("cv"   ,cv)
    118   CALL get_var2("aire" ,aire)
    119   var="temps"
    120   IF(nf90_inq_varid(fID,var,vID)/=nf90_noerr) THEN
    121     CALL msg('missing field <temps> ; trying with <Time>', modname)
    122     var="Time"
    123     CALL err(nf90_inq_varid(fID,var,vID),"inq",var)
    124   END IF
    125   CALL err(nf90_get_var(fID,vID,time),"get",var)
    126   CALL get_var2("phisinit",phis)
    127   CALL get_var3("ucov",ucov)
    128   CALL get_var3("vcov",vcov)
    129   CALL get_var3("teta",teta)
    130   CALL get_var3("masse",masse)
    131   CALL get_var2("ps",ps)
    132 
    133 !--- Tracers
    134   ll=.FALSE.
    135 #ifdef REPROBUS
    136   ll = nf90_inq_varid(fID, 'HNO3tot', vID) /= nf90_noerr                                 !--- DETECT OLD REPRO start.nc FILE
    137 #endif
    138   DO iq=1,nqtot
    139     var = tracers(iq)%name
    140     oldVar = new2oldH2O(var)
    141     lSkip = ll .AND. var == 'HNO3'                                                       !--- FORCE "HNO3_g" READING FOR "HNO3"
    142 #ifdef REPROBUS
    143     ix = strIdx(newHNO3, var); IF(ix /= 0) oldVar = oldHNO3(ix)                          !--- REPROBUS HNO3 exceptions
    144 #endif
    145     IF (CPPKEY_INCA) THEN
    146       IF(var == 'O3') oldVar = 'OX'                                                        !--- DEAL WITH INCA OZONE EXCEPTION
    147     END IF
    148     !--------------------------------------------------------------------------------------------------------------------------
    149     IF(nf90_inq_varid(fID, var, vID) == nf90_noerr .AND. .NOT.lSkip) THEN                !=== REGULAR CASE: AVAILABLE VARIABLE
    150       CALL err(nf90_get_var(fID,vID,q(:,:,:,iq)),"get",var)
    151     !--------------------------------------------------------------------------------------------------------------------------
    152     ELSE IF(nf90_inq_varid(fID, oldVar, vID) == nf90_noerr) THEN                         !=== TRY WITH ALTERNATE NAME
    153       CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized to <'//TRIM(oldVar)//'>', modname)
    154       CALL err(nf90_get_var(fID,vID,q(:,:,:,iq)),"get",oldVar)
    155     !--------------------------------------------------------------------------------------------------------------------------
    156     ELSE IF(tracers(iq)%iso_iGroup == iH2O .AND. niso > 0) THEN                          !=== WATER ISOTOPES
    157       iName    = tracers(iq)%iso_iName
    158       iPhase   = tracers(iq)%iso_iPhase
    159       iqParent = tracers(iq)%iqParent
    160       IF(tracers(iq)%iso_iZone == 0) THEN
    161          IF (tnat1) THEN
    162                  tnat=1.0
    163                  alpha_ideal=1.0
    164                  WRITE(*,*) 'attention dans dynetat0: les alpha_ideal sont a 1'
    165          else
    166           IF(getKey('tnat', tnat, isoName(iName)) .OR. getKey('alpha', alpha_ideal, isoName(iName))) &
    167             CALL abort_gcm(TRIM(modname), 'missing isotopic parameters', 1)
    168          endif
    169          CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized with a simplified Rayleigh distillation law.', modname)
    170          q(:,:,:,iq) = q(:,:,:,iqParent)*tnat*(q(:,:,:,iqParent)/30.e-3)**(alpha_ideal-1.)
    171       ELSE
    172          CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized to its parent isotope concentration.', modname)
    173          ! Camille 9 mars 2023: attention!! seuls les tags qui correspondent à
    174          ! izone=izone_init (définie dans isotrac_mod) sont initialisés comme
    175          ! les parents. Sinon, c'est nul.
    176          ! j'ai fait ça en attendant, mais il faudrait initialiser proprement en
    177          ! remplacant 1 par izone_init dans la ligne qui suit.
    178          IF(tracers(iq)%iso_iZone == 1) THEN
    179            q(:,:,:,iq) = q(:,:,:,iqIsoPha(iName,iPhase))
    180          ELSE
    181            q(:,:,:,iq) = 0.
    182          END IF
     1MODULE lmdz_dynetat0
     2  IMPLICIT NONE; PRIVATE
     3  PUBLIC dynetat0
     4CONTAINS
     5
     6  SUBROUTINE dynetat0(fichnom, vcov, ucov, teta, q, masse, ps, phis, time)
     7
     8    !-------------------------------------------------------------------------------
     9    ! Authors: P. Le Van , L.Fairhead
     10    !-------------------------------------------------------------------------------
     11    ! Purpose: Initial state reading.
     12    !-------------------------------------------------------------------------------
     13    USE lmdz_infotrac, ONLY: nqtot, tracers, niso, iqIsoPha, iH2O, isoName
     14    USE lmdz_strings, ONLY: maxlen, msg, strStack, real2str, int2str
     15    USE netcdf, ONLY: nf90_open, nf90_nowrite, nf90_inq_varid, nf90_close, nf90_get_var, nf90_noerr
     16    USE lmdz_readTracFiles, ONLY: new2oldH2O, newHNO3, oldHNO3, getKey
     17    USE control_mod, ONLY: planet_type
     18    USE lmdz_assert_eq, ONLY: assert_eq
     19    USE comvert_mod, ONLY: pa, preff
     20    USE comconst_mod, ONLY: cpp, daysec, dtvr, g, im, jm, kappa, lllm, omeg, rad
     21    USE logic_mod, ONLY: fxyhypb, ysinus
     22    USE serre_mod, ONLY: clon, clat, grossismx, grossismy
     23    USE temps_mod, ONLY: annee_ref, day_ini, day_ref, itau_dyn, start_time
     24    USE ener_mod, ONLY: etot0, ptot0, ztot0, stot0, ang0
     25    USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_INCA, CPPKEY_REPROBUS
     26    USE lmdz_description, ONLY: descript
     27    USE lmdz_iniprint, ONLY: lunout, prt_level
     28    USE lmdz_comgeom2
     29    USE lmdz_strings, ONLY: strIdx
     30
     31    USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm
     32    USE lmdz_paramet
     33    IMPLICIT NONE
     34
     35
     36    !===============================================================================
     37    ! Arguments:
     38    CHARACTER(LEN = *), INTENT(IN) :: fichnom          !--- FILE NAME
     39    REAL, INTENT(OUT) :: vcov(iip1, jjm, llm)        !--- V COVARIANT WIND
     40    REAL, INTENT(OUT) :: ucov(iip1, jjp1, llm)        !--- U COVARIANT WIND
     41    REAL, INTENT(OUT) :: teta(iip1, jjp1, llm)        !--- POTENTIAL TEMP.
     42    REAL, INTENT(OUT) :: q(iip1, jjp1, llm, nqtot)  !--- TRACERS
     43    REAL, INTENT(OUT) :: masse(iip1, jjp1, llm)        !--- MASS PER CELL
     44    REAL, INTENT(OUT) :: ps(iip1, jjp1)            !--- GROUND PRESSURE
     45    REAL, INTENT(OUT) :: phis(iip1, jjp1)            !--- GEOPOTENTIAL
     46    !===============================================================================
     47    ! Local variables:
     48    CHARACTER(LEN = maxlen) :: mesg, var, modname, oldVar
     49    INTEGER, PARAMETER :: length = 100
     50    INTEGER :: iq, fID, vID, idecal, iqParent, iName, iZone, iPhase, ix
     51    REAL :: time, tnat, alpha_ideal, tab_cntrl(length)    !--- RUN PARAMS TABLE
     52    LOGICAL :: lSkip, ll
     53    LOGICAL, PARAMETER :: tnat1 = .TRUE.
     54    !-------------------------------------------------------------------------------
     55    modname = "dynetat0"
     56
     57    !--- Initial state file opening
     58    var = fichnom
     59    CALL err(nf90_open(var, nf90_nowrite, fID), "open", var)
     60    CALL get_var1("controle", tab_cntrl)
     61
     62    !!! AS: idecal is a hack to be able to read planeto starts...
     63    !!!     .... while keeping everything OK for LMDZ EARTH
     64    IF(planet_type=="generic") THEN
     65      CALL msg('NOTE NOTE NOTE : Planeto-like start files', modname)
     66      idecal = 4
     67      annee_ref = 2000
     68    ELSE
     69      CALL msg('NOTE NOTE NOTE : Earth-like start files', modname)
     70      idecal = 5
     71      annee_ref = tab_cntrl(5)
     72    END IF
     73    im = tab_cntrl(1)
     74    jm = tab_cntrl(2)
     75    lllm = tab_cntrl(3)
     76    day_ref = tab_cntrl(4)
     77    rad = tab_cntrl(idecal + 1)
     78    omeg = tab_cntrl(idecal + 2)
     79    g = tab_cntrl(idecal + 3)
     80    cpp = tab_cntrl(idecal + 4)
     81    kappa = tab_cntrl(idecal + 5)
     82    daysec = tab_cntrl(idecal + 6)
     83    dtvr = tab_cntrl(idecal + 7)
     84    etot0 = tab_cntrl(idecal + 8)
     85    ptot0 = tab_cntrl(idecal + 9)
     86    ztot0 = tab_cntrl(idecal + 10)
     87    stot0 = tab_cntrl(idecal + 11)
     88    ang0 = tab_cntrl(idecal + 12)
     89    pa = tab_cntrl(idecal + 13)
     90    preff = tab_cntrl(idecal + 14)
     91
     92    clon = tab_cntrl(idecal + 15)
     93    clat = tab_cntrl(idecal + 16)
     94    grossismx = tab_cntrl(idecal + 17)
     95    grossismy = tab_cntrl(idecal + 18)
     96
     97    IF (tab_cntrl(idecal + 19)==1.)  THEN
     98      fxyhypb = .TRUE.
     99      !   dzoomx   = tab_cntrl(25)
     100      !   dzoomy   = tab_cntrl(26)
     101      !   taux     = tab_cntrl(28)
     102      !   tauy     = tab_cntrl(29)
     103    ELSE
     104      fxyhypb = .FALSE.
     105      ysinus = tab_cntrl(idecal + 22)==1.
     106    END IF
     107
     108    day_ini = tab_cntrl(30)
     109    itau_dyn = tab_cntrl(31)
     110    start_time = tab_cntrl(32)
     111
     112    !-------------------------------------------------------------------------------
     113    CALL msg('rad, omeg, g, cpp, kappa = ' // TRIM(strStack(real2str([rad, omeg, g, cpp, kappa]))), modname)
     114    CALL check_dim(im, iim, 'im', 'im')
     115    CALL check_dim(jm, jjm, 'jm', 'jm')
     116    CALL check_dim(lllm, llm, 'lm', 'lllm')
     117    CALL get_var1("rlonu", rlonu)
     118    CALL get_var1("rlatu", rlatu)
     119    CALL get_var1("rlonv", rlonv)
     120    CALL get_var1("rlatv", rlatv)
     121    CALL get_var2("cu", cu)
     122    CALL get_var2("cv", cv)
     123    CALL get_var2("aire", aire)
     124    var = "temps"
     125    IF(nf90_inq_varid(fID, var, vID)/=nf90_noerr) THEN
     126      CALL msg('missing field <temps> ; trying with <Time>', modname)
     127      var = "Time"
     128      CALL err(nf90_inq_varid(fID, var, vID), "inq", var)
     129    END IF
     130    CALL err(nf90_get_var(fID, vID, time), "get", var)
     131    CALL get_var2("phisinit", phis)
     132    CALL get_var3("ucov", ucov)
     133    CALL get_var3("vcov", vcov)
     134    CALL get_var3("teta", teta)
     135    CALL get_var3("masse", masse)
     136    CALL get_var2("ps", ps)
     137
     138    !--- Tracers
     139    ll = .FALSE.
     140    IF (CPPKEY_REPROBUS) THEN
     141      ll = nf90_inq_varid(fID, 'HNO3tot', vID) /= nf90_noerr                                 !--- DETECT OLD REPRO start.nc FILE
     142    END IF
     143    DO iq = 1, nqtot
     144      var = tracers(iq)%name
     145      oldVar = new2oldH2O(var)
     146      lSkip = ll .AND. var == 'HNO3'                                                       !--- FORCE "HNO3_g" READING FOR "HNO3"
     147      IF (CPPKEY_REPROBUS) THEN
     148        ix = strIdx(newHNO3, var); IF(ix /= 0) oldVar = oldHNO3(ix)                          !--- REPROBUS HNO3 exceptions
    183149      END IF
    184     !--------------------------------------------------------------------------------------------------------------------------
    185     ELSE                                                                                 !=== MISSING: SET TO 0
    186       CALL msg('Tracer <'//TRIM(var)//'> is missing => initialized to zero', modname)
    187       q(:,:,:,iq)=0.
    188     !--------------------------------------------------------------------------------------------------------------------------
    189     END IF
    190   END DO
    191 
    192   CALL err(nf90_close(fID),"close",fichnom)
    193   day_ini=day_ini+INT(time)
    194   time=time-INT(time)
     150      IF (CPPKEY_INCA) THEN
     151        IF(var == 'O3') oldVar = 'OX'                                                        !--- DEAL WITH INCA OZONE EXCEPTION
     152      END IF
     153      !--------------------------------------------------------------------------------------------------------------------------
     154      IF(nf90_inq_varid(fID, var, vID) == nf90_noerr .AND. .NOT.lSkip) THEN                !=== REGULAR CASE: AVAILABLE VARIABLE
     155        CALL err(nf90_get_var(fID, vID, q(:, :, :, iq)), "get", var)
     156        !--------------------------------------------------------------------------------------------------------------------------
     157      ELSE IF(nf90_inq_varid(fID, oldVar, vID) == nf90_noerr) THEN                         !=== TRY WITH ALTERNATE NAME
     158        CALL msg('Tracer <' // TRIM(var) // '> is missing => initialized to <' // TRIM(oldVar) // '>', modname)
     159        CALL err(nf90_get_var(fID, vID, q(:, :, :, iq)), "get", oldVar)
     160        !--------------------------------------------------------------------------------------------------------------------------
     161      ELSE IF(tracers(iq)%iso_iGroup == iH2O .AND. niso > 0) THEN                          !=== WATER ISOTOPES
     162        iName = tracers(iq)%iso_iName
     163        iPhase = tracers(iq)%iso_iPhase
     164        iqParent = tracers(iq)%iqParent
     165        IF(tracers(iq)%iso_iZone == 0) THEN
     166          IF (tnat1) THEN
     167            tnat = 1.0
     168            alpha_ideal = 1.0
     169            WRITE(*, *) 'attention dans dynetat0: les alpha_ideal sont a 1'
     170          else
     171            IF(getKey('tnat', tnat, isoName(iName)) .OR. getKey('alpha', alpha_ideal, isoName(iName))) &
     172                    CALL abort_gcm(TRIM(modname), 'missing isotopic parameters', 1)
     173          endif
     174          CALL msg('Tracer <' // TRIM(var) // '> is missing => initialized with a simplified Rayleigh distillation law.', modname)
     175          q(:, :, :, iq) = q(:, :, :, iqParent) * tnat * (q(:, :, :, iqParent) / 30.e-3)**(alpha_ideal - 1.)
     176        ELSE
     177          CALL msg('Tracer <' // TRIM(var) // '> is missing => initialized to its parent isotope concentration.', modname)
     178          ! Camille 9 mars 2023: attention!! seuls les tags qui correspondent à
     179          ! izone=izone_init (définie dans isotrac_mod) sont initialisés comme
     180          ! les parents. Sinon, c'est nul.
     181          ! j'ai fait ça en attendant, mais il faudrait initialiser proprement en
     182          ! remplacant 1 par izone_init dans la ligne qui suit.
     183          IF(tracers(iq)%iso_iZone == 1) THEN
     184            q(:, :, :, iq) = q(:, :, :, iqIsoPha(iName, iPhase))
     185          ELSE
     186            q(:, :, :, iq) = 0.
     187          END IF
     188        END IF
     189        !--------------------------------------------------------------------------------------------------------------------------
     190      ELSE                                                                                 !=== MISSING: SET TO 0
     191        CALL msg('Tracer <' // TRIM(var) // '> is missing => initialized to zero', modname)
     192        q(:, :, :, iq) = 0.
     193        !--------------------------------------------------------------------------------------------------------------------------
     194      END IF
     195    END DO
     196
     197    CALL err(nf90_close(fID), "close", fichnom)
     198    day_ini = day_ini + INT(time)
     199    time = time - INT(time)
    195200
    196201
     
    198203
    199204
    200 SUBROUTINE check_dim(n1,n2,str1,str2)
    201   INTEGER,          INTENT(IN) :: n1, n2
    202   CHARACTER(LEN=*), INTENT(IN) :: str1, str2
    203   CHARACTER(LEN=maxlen) :: s1, s2
    204   IF(n1/=n2) CALL abort_gcm(TRIM(modname), 'value of "'//TRIM(str1)//'" = '//TRIM(int2str(n1))// &
    205    ' read in starting file differs from gcm value of "'//TRIM(str2)//'" = '//TRIM(int2str(n2)), 1)
    206 END SUBROUTINE check_dim
    207 
    208 
    209 SUBROUTINE get_var1(var,v)
    210   CHARACTER(LEN=*), INTENT(IN)  :: var
    211   REAL,             INTENT(OUT) :: v(:)
    212   CALL err(nf90_inq_varid(fID,var,vID),"inq",var)
    213   CALL err(nf90_get_var(fID,vID,v),"get",var)
    214 END SUBROUTINE get_var1
    215 
    216 
    217 SUBROUTINE get_var2(var,v)
    218   CHARACTER(LEN=*), INTENT(IN)  :: var
    219   REAL,             INTENT(OUT) :: v(:,:)
    220   CALL err(nf90_inq_varid(fID,var,vID),"inq",var)
    221   CALL err(nf90_get_var(fID,vID,v),"get",var)
    222 END SUBROUTINE get_var2
    223 
    224 
    225 SUBROUTINE get_var3(var,v)
    226   CHARACTER(LEN=*), INTENT(IN)  :: var
    227   REAL,             INTENT(OUT) :: v(:,:,:)
    228   CALL err(nf90_inq_varid(fID,var,vID),"inq",var)
    229   CALL err(nf90_get_var(fID,vID,v),"get",var)
    230 END SUBROUTINE get_var3
    231 
    232 
    233 SUBROUTINE err(ierr,typ,nam)
    234   INTEGER,          INTENT(IN) :: ierr   !--- NetCDF ERROR CODE
    235   CHARACTER(LEN=*), INTENT(IN) :: typ    !--- TYPE OF OPERATION
    236   CHARACTER(LEN=*), INTENT(IN) :: nam    !--- FIELD/FILE NAME
    237   IF(ierr==nf90_noerr) RETURN
    238   SELECT CASE(typ)
    239     CASE('inq');   mesg="Field <"//TRIM(nam)//"> is missing"
    240     CASE('get');   mesg="Reading failed for <"//TRIM(nam)//">"
    241     CASE('open');  mesg="File opening failed for <"//TRIM(nam)//">"
    242     CASE('close'); mesg="File closing failed for <"//TRIM(nam)//">"
    243   END SELECT
    244   CALL ABORT_gcm(TRIM(modname),TRIM(mesg),ierr)
    245 END SUBROUTINE err
    246 
    247 END SUBROUTINE dynetat0
     205    SUBROUTINE check_dim(n1, n2, str1, str2)
     206      INTEGER, INTENT(IN) :: n1, n2
     207      CHARACTER(LEN = *), INTENT(IN) :: str1, str2
     208      CHARACTER(LEN = maxlen) :: s1, s2
     209      IF(n1/=n2) CALL abort_gcm(TRIM(modname), 'value of "' // TRIM(str1) // '" = ' // TRIM(int2str(n1)) // &
     210              ' read in starting file differs from gcm value of "' // TRIM(str2) // '" = ' // TRIM(int2str(n2)), 1)
     211    END SUBROUTINE check_dim
     212
     213
     214    SUBROUTINE get_var1(var, v)
     215      CHARACTER(LEN = *), INTENT(IN) :: var
     216      REAL, INTENT(OUT) :: v(:)
     217      CALL err(nf90_inq_varid(fID, var, vID), "inq", var)
     218      CALL err(nf90_get_var(fID, vID, v), "get", var)
     219    END SUBROUTINE get_var1
     220
     221
     222    SUBROUTINE get_var2(var, v)
     223      CHARACTER(LEN = *), INTENT(IN) :: var
     224      REAL, INTENT(OUT) :: v(:, :)
     225      CALL err(nf90_inq_varid(fID, var, vID), "inq", var)
     226      CALL err(nf90_get_var(fID, vID, v), "get", var)
     227    END SUBROUTINE get_var2
     228
     229
     230    SUBROUTINE get_var3(var, v)
     231      CHARACTER(LEN = *), INTENT(IN) :: var
     232      REAL, INTENT(OUT) :: v(:, :, :)
     233      CALL err(nf90_inq_varid(fID, var, vID), "inq", var)
     234      CALL err(nf90_get_var(fID, vID, v), "get", var)
     235    END SUBROUTINE get_var3
     236
     237
     238    SUBROUTINE err(ierr, typ, nam)
     239      INTEGER, INTENT(IN) :: ierr   !--- NetCDF ERROR CODE
     240      CHARACTER(LEN = *), INTENT(IN) :: typ    !--- TYPE OF OPERATION
     241      CHARACTER(LEN = *), INTENT(IN) :: nam    !--- FIELD/FILE NAME
     242      IF(ierr==nf90_noerr) RETURN
     243      SELECT CASE(typ)
     244      CASE('inq');   mesg = "Field <" // TRIM(nam) // "> is missing"
     245      CASE('get');   mesg = "Reading failed for <" // TRIM(nam) // ">"
     246      CASE('open');  mesg = "File opening failed for <" // TRIM(nam) // ">"
     247      CASE('close'); mesg = "File closing failed for <" // TRIM(nam) // ">"
     248      END SELECT
     249      CALL ABORT_gcm(TRIM(modname), TRIM(mesg), ierr)
     250    END SUBROUTINE err
     251
     252  END SUBROUTINE dynetat0
     253END MODULE lmdz_dynetat0
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/qminimum.F90

    r5159 r5182  
    33SUBROUTINE qminimum(q, nqtot, deltap)
    44
    5   USE infotrac, ONLY: niso, ntiso, iqIsoPha, tracers
     5  USE lmdz_infotrac, ONLY: niso, ntiso, iqIsoPha, tracers
    66  USE lmdz_strings, ONLY: strIdx
    77  USE lmdz_readTracFiles, ONLY: addPhase
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/vlsplt.F90

    r5159 r5182  
    44
    55SUBROUTINE vlsplt(q, pente_max, masse, w, pbaru, pbarv, pdt, iq)
    6   USE infotrac, ONLY: nqtot, tracers
     6  USE lmdz_infotrac, ONLY: nqtot, tracers
    77  USE lmdz_ssum_scopy, ONLY: scopy
    88
     
    107107END SUBROUTINE vlsplt
    108108RECURSIVE SUBROUTINE vlx(q, pente_max, masse, u_m, iq)
    109   USE infotrac, ONLY: nqtot, tracers, & ! CRisi
     109  USE lmdz_infotrac, ONLY: nqtot, tracers, & ! CRisi
    110110          min_qParent, min_qMass, min_ratio ! MVals et CRisi
    111111  USE lmdz_iniprint, ONLY: lunout, prt_level
     
    423423END SUBROUTINE vlx
    424424RECURSIVE SUBROUTINE vly(q, pente_max, masse, masse_adv_v, iq)
    425   USE infotrac, ONLY: nqtot, tracers, & ! CRisi
     425  USE lmdz_infotrac, ONLY: nqtot, tracers, & ! CRisi
    426426          min_qParent, min_qMass, min_ratio ! MVals et CRisi
    427427  USE lmdz_ssum_scopy, ONLY: ssum
     
    749749END SUBROUTINE vly
    750750RECURSIVE SUBROUTINE vlz(q, pente_max, masse, w, iq)
    751   USE infotrac, ONLY: nqtot, tracers, & ! CRisi
     751  USE lmdz_infotrac, ONLY: nqtot, tracers, & ! CRisi
    752752          min_qParent, min_qMass, min_ratio ! MVals et CRisi
    753753
  • LMDZ6/branches/Amaury_dev/libf/dyn3d/vlspltqs.F90

    r5159 r5182  
    44SUBROUTINE vlspltqs(q, pente_max, masse, w, pbaru, pbarv, pdt, &
    55        p, pk, teta, iq)
    6   USE infotrac, ONLY: nqtot, tracers
     6  USE lmdz_infotrac, ONLY: nqtot, tracers
    77
    88  ! Auteurs:   P.Le Van, F.Hourdin, F.Forget, F.Codron
     
    178178END SUBROUTINE vlspltqs
    179179SUBROUTINE vlxqs(q, pente_max, masse, u_m, qsat, iq)
    180   USE infotrac, ONLY: nqtot, tracers ! CRisi
     180  USE lmdz_infotrac, ONLY: nqtot, tracers ! CRisi
    181181
    182182
     
    511511END SUBROUTINE vlxqs
    512512SUBROUTINE vlyqs(q, pente_max, masse, masse_adv_v, qsat, iq)
    513   USE infotrac, ONLY: nqtot, tracers ! CRisi
     513  USE lmdz_infotrac, ONLY: nqtot, tracers ! CRisi
    514514
    515515  ! Auteurs:   P.Le Van, F.Hourdin, F.Forget
Note: See TracChangeset for help on using the changeset viewer.