Ignore:
Timestamp:
Dec 6, 2022, 1:01:47 PM (2 years ago)
Author:
lguez
Message:

Sync latest trunk changes to branch Ocean_skin

Location:
LMDZ6/branches/Ocean_skin
Files:
9 edited
3 copied

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/Ocean_skin

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

    r4368 r4369  
    1111   INTEGER :: ixt, ipha, k, i, iq, iiso, izon, ieau, iqeau, iqpar
    1212   INTEGER, ALLOCATABLE ::   ix(:)
    13    REAL,    ALLOCATABLE :: tnat(:)
     13   REAL,    ALLOCATABLE, SAVE :: tnat(:)
    1414   REAL    :: xtractot, xiiso, deltaD, q1, q2
    1515   REAL, PARAMETER :: borne     = 1e19,  &
  • LMDZ6/branches/Ocean_skin/libf/dyn3dmem/check_isotopes_loc.F90

    r4368 r4369  
    1212   INTEGER :: ixt, ipha, k, i, iq, iiso, izon, ieau, iqeau, iqpar
    1313   INTEGER, ALLOCATABLE ::   ix(:)
    14    REAL,    ALLOCATABLE :: tnat(:)               !--- OpenMP shared variable
     14   REAL,    ALLOCATABLE, SAVE :: tnat(:)         !--- OpenMP shared variable
    1515   REAL    :: xtractot, xiiso, deltaD, q1, q2
    1616   REAL, PARAMETER :: borne     = 1e19,  &
  • LMDZ6/branches/Ocean_skin/libf/misc/readTracFiles_mod.f90

    r4368 r4369  
    13061306    RETURN
    13071307  END IF
    1308   iky = 0; IF(ALLOCATED(ky%key)) iky = strIdx(ky%key,key)
     1308  iky = strIdx(ky%key,key)
    13091309  IF(iky == 0) THEN
    1310     nky = 0; IF(ALLOCATED(ky%key)) nky = SIZE(ky%key)
     1310    nky = SIZE(ky%key)
    13111311    ALLOCATE(k(nky+1)); k(1:nky) = ky%key; k(nky+1) = key; ky%key = k
    13121312    ALLOCATE(v(nky+1)); v(1:nky) = ky%val; v(nky+1) = val; ky%val = v
  • LMDZ6/branches/Ocean_skin/libf/phylmd/phyetat0_mod.F90

    r4368 r4369  
    44
    55  PRIVATE
    6   PUBLIC :: phyetat0, phyetat0_get, phyetat0_srf
    7 
    8   INTERFACE phyetat0_get
    9     MODULE PROCEDURE phyetat0_get10, phyetat0_get20, phyetat0_get11, phyetat0_get21
    10   END INTERFACE phyetat0_get
    11   INTERFACE phyetat0_srf
    12     MODULE PROCEDURE phyetat0_srf20, phyetat0_srf30, phyetat0_srf21, phyetat0_srf31
    13   END INTERFACE phyetat0_srf
     6  PUBLIC :: phyetat0
    147
    158CONTAINS
     
    2316  USE pbl_surface_mod,  ONLY : pbl_surface_init
    2417  USE surface_data,     ONLY : type_ocean, version_ocean
     18  USE phyetat0_get_mod, ONLY : phyetat0_get, phyetat0_srf
    2519  USE phys_state_var_mod, ONLY : ancien_ok, clwcon, detr_therm, phys_tstep, &
    2620       qsol, fevap, z0m, z0h, agesno, &
     
    611605END SUBROUTINE phyetat0
    612606
    613 !==============================================================================
    614 LOGICAL FUNCTION phyetat0_get10(field, name, descr, default) RESULT(lFound)
    615 ! Read a field. Check whether reading succeded and use default value if not.
    616   IMPLICIT NONE
    617   REAL,             INTENT(INOUT) :: field(:) ! klon
    618   CHARACTER(LEN=*), INTENT(IN)    :: name
    619   CHARACTER(LEN=*), INTENT(IN)    :: descr
    620   REAL,             INTENT(IN)    :: default
    621 !------------------------------------------------------------------------------
    622   REAL :: fld(SIZE(field),1)
    623   lFound = phyetat0_get21(fld, [name], descr, default); field = fld(:,1)
    624 END FUNCTION phyetat0_get10
    625 !==============================================================================
    626 LOGICAL FUNCTION phyetat0_get20(field, name, descr, default) RESULT(lFound)
    627 ! Same as phyetat0_get11, field on multiple levels.
    628   IMPLICIT NONE
    629   REAL,             INTENT(INOUT) :: field(:,:) ! klon, nlev
    630   CHARACTER(LEN=*), INTENT(IN)    :: name
    631   CHARACTER(LEN=*), INTENT(IN)    :: descr
    632   REAL,             INTENT(IN)    :: default
    633 !-----------------------------------------------------------------------------
    634   lFound = phyetat0_get21(field, [name], descr, default)
    635 END FUNCTION phyetat0_get20
    636 !==============================================================================
    637 LOGICAL FUNCTION phyetat0_get11(field, name, descr, default) RESULT(lFound)
    638 ! Same as phyetat0_get11, multiple names.
    639   IMPLICIT NONE
    640   REAL,             INTENT(INOUT) :: field(:) ! klon
    641   CHARACTER(LEN=*), INTENT(IN)    :: name(:)
    642   CHARACTER(LEN=*), INTENT(IN)    :: descr
    643   REAL,             INTENT(IN)    :: default
    644 !-----------------------------------------------------------------------------
    645   REAL :: fld(SIZE(field),1)
    646   lFound = phyetat0_get21(fld, name, descr, default); field = fld(:,1)
    647 END FUNCTION phyetat0_get11
    648 !==============================================================================
    649 LOGICAL FUNCTION phyetat0_get21(field, name, descr, default, tname) RESULT(lFound)
    650 ! Same as phyetat0_get11, field on multiple levels, multiple names.
    651   USE iostart,           ONLY: get_field
    652   USE print_control_mod, ONLY: lunout
    653   IMPLICIT NONE
    654   REAL,             INTENT(INOUT) :: field(:,:) ! klon, nlev
    655   CHARACTER(LEN=*), INTENT(IN)    :: name(:)
    656   CHARACTER(LEN=*), INTENT(IN)    :: descr
    657   REAL,             INTENT(IN)    :: default
    658   CHARACTER(LEN=*), OPTIONAL, INTENT(OUT) :: tname
    659 !-----------------------------------------------------------------------------
    660   CHARACTER(LEN=LEN(name)) :: tnam
    661   INTEGER :: i
    662   DO i = 1, SIZE(name)
    663     CALL get_field(TRIM(name(i)), field, lFound)
    664     IF(lFound) EXIT
    665     WRITE(lunout,*) "phyetat0: Missing field <",TRIM(name(i)),"> "
    666   END DO
    667   IF(.NOT.lFound) THEN
    668     WRITE(lunout,*) "Slightly distorted start ; continuing."
    669     field(:,:) = default
    670     tnam = name(1)
    671   ELSE
    672     tnam = name(i)
    673   END IF
    674   WRITE(lunout,'(2(a,ES14.7))') 'phyetat0: '//TRIM(tnam)//' ('//TRIM(descr)//') min/max=', &
    675     MINval(field),' ',MAXval(field)
    676   IF(PRESENT(tname)) tname = tnam
    677 END FUNCTION phyetat0_get21
    678 !==============================================================================
    679 LOGICAL FUNCTION phyetat0_srf20(field, name, descr, default) RESULT(lFound)
    680 ! Read a field per sub-surface.
    681 ! Check whether reading succeded and use default value if not.
    682   IMPLICIT NONE
    683   REAL,             INTENT(INOUT) :: field(:,:)
    684   CHARACTER(LEN=*), INTENT(IN)    :: name
    685   CHARACTER(LEN=*), INTENT(IN)    :: descr
    686   REAL,             INTENT(IN)    :: default
    687 !-----------------------------------------------------------------------------
    688   REAL :: fld(SIZE(field,1),1,SIZE(field,2))
    689   lFound = phyetat0_srf31(fld, [name], descr, default); field = fld(:,1,:)
    690 END FUNCTION phyetat0_srf20
    691 
    692 !==============================================================================
    693 LOGICAL FUNCTION phyetat0_srf30(field, name, descr, default) RESULT(lFound)
    694 ! Same as phyetat0_sfr11, multiple names tested one after the other.
    695   IMPLICIT NONE
    696   REAL,             INTENT(INOUT) :: field(:,:,:)
    697   CHARACTER(LEN=*), INTENT(IN)    :: name
    698   CHARACTER(LEN=*), INTENT(IN)    :: descr
    699   REAL,             INTENT(IN)    :: default
    700 !-----------------------------------------------------------------------------
    701   lFound = phyetat0_srf31(field, [name], descr, default)
    702 END FUNCTION phyetat0_srf30
    703 
    704 !==============================================================================
    705 LOGICAL FUNCTION phyetat0_srf21(field, name, descr, default) RESULT(lFound)
    706 ! Same as phyetat0_sfr11, field on multiple levels.
    707   IMPLICIT NONE
    708   REAL,             INTENT(INOUT) :: field(:,:)
    709   CHARACTER(LEN=*), INTENT(IN)    :: name(:)
    710   CHARACTER(LEN=*), INTENT(IN)    :: descr
    711   REAL,             INTENT(IN)    :: default
    712 !-----------------------------------------------------------------------------
    713   REAL :: fld(SIZE(field,1),1,SIZE(field,2))
    714   lFound = phyetat0_srf31(fld, name, descr, default); field = fld(:,1,:)
    715 END FUNCTION phyetat0_srf21
    716 
    717 !==============================================================================
    718 LOGICAL FUNCTION phyetat0_srf31(field, name, descr, default) RESULT(lFound)
    719 ! Same as phyetat0_sfr11, field on multiple levels, multiple names tested one after the other.
    720   USE iostart,           ONLY: get_field
    721   USE print_control_mod, ONLY: lunout
    722   USE strings_mod,       ONLY: int2str, maxlen
    723   IMPLICIT NONE
    724   REAL,             INTENT(INOUT) :: field(:,:,:)
    725   CHARACTER(LEN=*), INTENT(IN)    :: name(:)
    726   CHARACTER(LEN=*), INTENT(IN)    :: descr
    727   REAL,             INTENT(IN)    :: default
    728 !-----------------------------------------------------------------------------
    729   INTEGER :: nsrf, i
    730   CHARACTER(LEN=maxlen) :: nam(SIZE(name)), tname, des
    731   IF(SIZE(field,3)>99) CALL abort_physic("phyetat0", "Too much sub-cells", 1)
    732   DO nsrf = 1, SIZE(field,3)
    733     DO i = 1, SIZE(name); nam(i) = TRIM(name(i))//TRIM(int2str(nsrf,2)); END DO
    734     des = TRIM(descr)//" srf:"//int2str(nsrf,2)
    735     lFound = phyetat0_get21(field(:,:,nsrf), nam, TRIM(des), default, tname)
    736   END DO
    737   WRITE(lunout,'(2(a,ES14.7))') 'phyetat0: '//TRIM(tname)//' ('//TRIM(descr)//') min/max=', &
    738     MINval(field),' ',MAXval(field)
    739 END FUNCTION phyetat0_srf31
    740 
    741607END MODULE phyetat0_mod
    742608
  • LMDZ6/branches/Ocean_skin/libf/phylmd/physiq_mod.F90

    r4368 r4369  
    3434    USE FLOTT_GWD_rando_m, only: FLOTT_GWD_rando
    3535    USE fonte_neige_mod, ONLY  : fonte_neige_get_vars
    36     USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg, longitude,latitude, &
    37          boundslon,boundslat, dx, dy, ind_cell_glo
     36    USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg
    3837    USE ioipsl, only: histbeg, histvert, histdef, histend, histsync, &
    3938         histwrite, ju2ymds, ymds2ju, getin
    4039    USE ioipsl_getin_p_mod, ONLY : getin_p
    4140    USE indice_sol_mod
    42     USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, types_trac, nqCO2
     41    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, types_trac
    4342    USE readTracFiles_mod, ONLY: addPhase
    4443    USE strings_mod,  ONLY: strIdx
     
    7069    USE regr_horiz_time_climoz_m, ONLY: regr_horiz_time_climoz
    7170    USE regr_pr_time_av_m, only: regr_pr_time_av
    72     USE surface_data,     ONLY : type_ocean, ok_veget, landice_opt
    73     USE time_phylmdz_mod, only: annee_ref, current_time, day_ini, day_ref, &
    74           day_step_phy, itau_phy, pdtphys, raz_date, start_time, update_time, ndays
     71    USE surface_data,     ONLY : type_ocean, ok_veget
     72    USE time_phylmdz_mod, only: current_time, itau_phy, pdtphys, raz_date, update_time
    7573    USE tracinca_mod, ONLY: config_inca
    7674    USE tropopause_m,     ONLY: dyn_tropopause
    7775    USE ice_sursat_mod,  ONLY: flight_init, airplane
    7876    USE vampir
    79     USE VERTICAL_LAYERS_MOD, ONLY: aps,bps, ap, bp
    8077    USE write_field_phy
    8178#ifdef CPP_XIOS
     
    10299
    103100
     101#ifdef INCA
     102    USE geometry_mod,      ONLY: longitude, latitude, boundslon, boundslat, ind_cell_glo
     103    USE time_phylmdz_mod,  ONLY: ndays
     104    USE infotrac_phy,      ONLY: nqCO2
     105#endif
    104106#ifdef REPROBUS
    105     USE CHEM_REP, ONLY : Init_chem_rep_xjour, &
    106          d_q_rep,d_ql_rep,d_qi_rep,ptrop,ttrop, &
    107          ztrop, gravit,itroprep, Z1,Z2,fac,B
     107    USE chem_rep, ONLY: Init_chem_rep_xjour, d_q_rep, d_ql_rep, d_qi_rep, &
     108                        ptrop, ttrop, ztrop, gravit, itroprep, Z1, Z2, fac, B
     109#endif
     110#if defined INCA || defined REPROBUS
     111    USE time_phylmdz_mod,    ONLY: annee_ref, day_ini, day_ref, start_time
     112    USE vertical_layers_mod, ONLY: aps, bps, ap, bp
    108113#endif
    109114
     
    111116#ifdef CPP_RRTM
    112117    USE YOERAD, ONLY : NRADLP
    113     USE YOESW, ONLY : RSUN
     118!    USE YOESW, ONLY : RSUN
    114119#endif
    115120
     
    147152       d_t_ajsb,d_q_ajsb, &
    148153       d_t_ajs,d_q_ajs,d_u_ajs,d_v_ajs, &
    149        d_t_ajs_w,d_q_ajs_w, &
    150        d_t_ajs_x,d_q_ajs_x, &
     154!       d_t_ajs_w,d_q_ajs_w, &
     155!       d_t_ajs_x,d_q_ajs_x, &
    151156       !
    152157       d_t_eva,d_q_eva,d_ql_eva,d_qi_eva, &
     
    161166       d_ts, &
    162167       !
    163        d_t_oli,d_u_oli,d_v_oli, &
     168!       d_t_oli,d_u_oli,d_v_oli, &
    164169       d_t_oro,d_u_oro,d_v_oro, &
    165170       d_t_oro_gw,d_u_oro_gw,d_v_oro_gw, &
     
    492497    REAL dtadd(klon,klev)
    493498
    494 !#ifdef CPP_XIOS
    495 !    TYPE(xios_context), SAVE :: g_ctx
    496 !#endif
    497 
    498499#ifndef CPP_XIOS
    499500    REAL, SAVE :: missing_val=nf90_fill_real
     
    522523    !
    523524    !
    524     INTEGER debug
    525525    INTEGER n
    526526    !ym      INTEGER npoints
     
    579579    ! Upmost level reached by deep convection and related variable (jyg)
    580580    !
    581     INTEGER izero
     581!    INTEGER izero
    582582    INTEGER k_upper_cv
    583583    !------------------------------------------------------------------
     
    749749    REAL beta_prec_fisrt(klon,klev) ! taux de conv de l'eau cond (fisrt)
    750750    ! RomP <<<
    751     REAL          :: calday
    752751
    753752    !IM cf FH pour Tiedtke 080604
     
    846845    REAL conv_t(klon,klev) ! convergence de la temperature(K/s)
    847846    !
    848 #ifdef INCA
    849     REAL zxsnow_dummy(klon)
    850 #endif
    851847    REAL zsav_tsol(klon)
    852848    !
     
    863859    real zqsat(klon,klev)
    864860    !
    865     INTEGER i, k, iq, j, nsrf, ll, l, itr
     861    INTEGER i, k, iq, nsrf, l, itr
    866862    !
    867863    REAL t_coup
     
    11791175
    11801176#ifdef INCA
     1177    REAL :: calday, zxsnow_dummy(klon)
    11811178    ! set de variables utilisees pour l'initialisation des valeurs provenant de INCA
    11821179    REAL, DIMENSION(klon,klev,naero_grp,nbands) :: init_tauinca
     
    12251222#ifdef CPP_XIOS
    12261223! switch to XIOS LMDZ physics context
    1227 !!!!$OMP MASTER
    1228 !!!!    WRITE(*,*)'PHYSICS XIOS Context :', g_ctx
    1229 !!!!    CALL wxios_set_context()
    1230 !!!!$OMP END MASTER
    12311224    IF (.NOT. debut .AND. is_omp_master) THEN
    12321225       CALL wxios_set_context()
     
    13021295       CALL strataer_init
    13031296#endif
    1304 
    1305        !!CALL flight_init
    13061297
    13071298       print*, '================================================='
     
    22212212      ENDIF
    22222213    ENDIF
    2223 ! switch to XIOS LMDZ physics context just in case
    2224 !$OMP MASTER
    2225 !!!!#ifdef CPP_XIOS
    2226 !!!!    WRITE(*,*)'PHYSICS XIOS Context :', g_ctx
    2227 !!!!    CALL xios_set_current_context(g_ctx)
    2228 !!!!#endif
    2229 !$OMP END MASTER
    2230 
    22312214    !
    22322215    !
     
    51895172    ENDDO
    51905173    !
    5191     IF (nqtot > nqo) THEN
    5192        itr = 0
    5193        DO iq = 1, nqtot
    5194           IF(.NOT.tracers(iq)%isInPhysics) CYCLE
    5195           itr = itr+1
    5196           DO  k = 1, klev
    5197              DO  i = 1, klon
    5198                 d_qx(i,k,iq) = ( tr_seri(i,k,itr) - qx(i,k,iq) ) / phys_tstep
    5199              ENDDO
     5174    ! DC: All iterations are cycled if nqtot==nqo, so no nqtot>nqo condition required
     5175    itr = 0
     5176    DO iq = 1, nqtot
     5177       IF(.NOT.tracers(iq)%isInPhysics) CYCLE
     5178       itr = itr+1
     5179       DO  k = 1, klev
     5180          DO  i = 1, klon
     5181             d_qx(i,k,iq) = ( tr_seri(i,k,itr) - qx(i,k,iq) ) / phys_tstep
    52005182          ENDDO
    52015183       ENDDO
    5202     ENDIF
     5184    ENDDO
    52035185    !
    52045186    !IM rajout diagnostiques bilan KP pour analyse MJO par Jun-Ichi Yano
  • LMDZ6/branches/Ocean_skin/libf/phylmdiso/isotopes_routines_mod.F90

    r4368 r4369  
    1651816518   USE indice_sol_mod,    ONLY: nbsrf 
    1651916519   USE isotopes_mod,      ONLY: isoName,iso_HDO,iso_eau
    16520    USE phyetat0_mod,      ONLY: phyetat0_get, phyetat0_srf
     16520   USE phyetat0_get_mod,  ONLY: phyetat0_get, phyetat0_srf
    1652116521   USE readTracFiles_mod, ONLY: new2oldH2O
    1652216522   USE strings_mod,       ONLY: strIdx, strHead, strTail, maxlen, msg, int2str
  • LMDZ6/branches/Ocean_skin/libf/phylmdiso/phyetat0_mod.F90

    r4368 r4369  
    44
    55  PRIVATE
    6   PUBLIC :: phyetat0, phyetat0_get, phyetat0_srf
    7 
    8   INTERFACE phyetat0_get
    9     MODULE PROCEDURE phyetat0_get10, phyetat0_get20, phyetat0_get11, phyetat0_get21
    10   END INTERFACE phyetat0_get
    11   INTERFACE phyetat0_srf
    12     MODULE PROCEDURE phyetat0_srf20, phyetat0_srf30, phyetat0_srf21, phyetat0_srf31
    13   END INTERFACE phyetat0_srf
     6  PUBLIC :: phyetat0
    147
    158CONTAINS
     
    2619  USE pbl_surface_mod,  ONLY : pbl_surface_init_iso
    2720#endif
     21  USE phyetat0_get_mod, ONLY : phyetat0_get, phyetat0_srf
    2822  USE surface_data,     ONLY : type_ocean, version_ocean
    2923  USE phys_state_var_mod, ONLY : ancien_ok, clwcon, detr_therm, phys_tstep, &
     
    649643END SUBROUTINE phyetat0
    650644
    651 !==============================================================================
    652 LOGICAL FUNCTION phyetat0_get10(field, name, descr, default) RESULT(lFound)
    653 ! Read a field. Check whether reading succeded and use default value if not.
    654   IMPLICIT NONE
    655   REAL,             INTENT(INOUT) :: field(:) ! klon
    656   CHARACTER(LEN=*), INTENT(IN)    :: name
    657   CHARACTER(LEN=*), INTENT(IN)    :: descr
    658   REAL,             INTENT(IN)    :: default
    659 !------------------------------------------------------------------------------
    660   REAL :: fld(SIZE(field),1)
    661   lFound = phyetat0_get21(fld, [name], descr, default); field = fld(:,1)
    662 END FUNCTION phyetat0_get10
    663 !==============================================================================
    664 LOGICAL FUNCTION phyetat0_get20(field, name, descr, default) RESULT(lFound)
    665 ! Same as phyetat0_get11, field on multiple levels.
    666   IMPLICIT NONE
    667   REAL,             INTENT(INOUT) :: field(:,:) ! klon, nlev
    668   CHARACTER(LEN=*), INTENT(IN)    :: name
    669   CHARACTER(LEN=*), INTENT(IN)    :: descr
    670   REAL,             INTENT(IN)    :: default
    671 !-----------------------------------------------------------------------------
    672   lFound = phyetat0_get21(field, [name], descr, default)
    673 END FUNCTION phyetat0_get20
    674 !==============================================================================
    675 LOGICAL FUNCTION phyetat0_get11(field, name, descr, default) RESULT(lFound)
    676 ! Same as phyetat0_get11, multiple names.
    677   IMPLICIT NONE
    678   REAL,             INTENT(INOUT) :: field(:) ! klon
    679   CHARACTER(LEN=*), INTENT(IN)    :: name(:)
    680   CHARACTER(LEN=*), INTENT(IN)    :: descr
    681   REAL,             INTENT(IN)    :: default
    682 !-----------------------------------------------------------------------------
    683   REAL :: fld(SIZE(field),1)
    684   lFound = phyetat0_get21(fld, name, descr, default); field = fld(:,1)
    685 END FUNCTION phyetat0_get11
    686 !==============================================================================
    687 LOGICAL FUNCTION phyetat0_get21(field, name, descr, default, tname) RESULT(lFound)
    688 ! Same as phyetat0_get11, field on multiple levels, multiple names.
    689   USE iostart,           ONLY: get_field
    690   USE print_control_mod, ONLY: lunout
    691   IMPLICIT NONE
    692   REAL,             INTENT(INOUT) :: field(:,:) ! klon, nlev
    693   CHARACTER(LEN=*), INTENT(IN)    :: name(:)
    694   CHARACTER(LEN=*), INTENT(IN)    :: descr
    695   REAL,             INTENT(IN)    :: default
    696   CHARACTER(LEN=*), OPTIONAL, INTENT(OUT) :: tname
    697 !-----------------------------------------------------------------------------
    698   CHARACTER(LEN=LEN(name)) :: tnam
    699   INTEGER :: i
    700   DO i = 1, SIZE(name)
    701     CALL get_field(TRIM(name(i)), field, lFound)
    702     IF(lFound) EXIT
    703     WRITE(lunout,*) "phyetat0: Missing field <",TRIM(name(i)),"> "
    704   END DO
    705   IF(.NOT.lFound) THEN
    706     WRITE(lunout,*) "Slightly distorted start ; continuing."
    707     field(:,:) = default
    708     tnam = name(1)
    709   ELSE
    710     tnam = name(i)
    711   END IF
    712   WRITE(lunout,'(2(a,ES14.7))') 'phyetat0: '//TRIM(tnam)//' ('//TRIM(descr)//') min/max=', &
    713     MINval(field),' ',MAXval(field)
    714   IF(PRESENT(tname)) tname = tnam
    715 END FUNCTION phyetat0_get21
    716 !==============================================================================
    717 LOGICAL FUNCTION phyetat0_srf20(field, name, descr, default) RESULT(lFound)
    718 ! Read a field per sub-surface.
    719 ! Check whether reading succeded and use default value if not.
    720   IMPLICIT NONE
    721   REAL,             INTENT(INOUT) :: field(:,:)
    722   CHARACTER(LEN=*), INTENT(IN)    :: name
    723   CHARACTER(LEN=*), INTENT(IN)    :: descr
    724   REAL,             INTENT(IN)    :: default
    725 !-----------------------------------------------------------------------------
    726   REAL :: fld(SIZE(field,1),1,SIZE(field,2))
    727   lFound = phyetat0_srf31(fld, [name], descr, default); field = fld(:,1,:)
    728 END FUNCTION phyetat0_srf20
    729 
    730 !==============================================================================
    731 LOGICAL FUNCTION phyetat0_srf30(field, name, descr, default) RESULT(lFound)
    732 ! Same as phyetat0_sfr11, multiple names tested one after the other.
    733   IMPLICIT NONE
    734   REAL,             INTENT(INOUT) :: field(:,:,:)
    735   CHARACTER(LEN=*), INTENT(IN)    :: name
    736   CHARACTER(LEN=*), INTENT(IN)    :: descr
    737   REAL,             INTENT(IN)    :: default
    738 !-----------------------------------------------------------------------------
    739   lFound = phyetat0_srf31(field, [name], descr, default)
    740 END FUNCTION phyetat0_srf30
    741 
    742 !==============================================================================
    743 LOGICAL FUNCTION phyetat0_srf21(field, name, descr, default) RESULT(lFound)
    744 ! Same as phyetat0_sfr11, field on multiple levels.
    745   IMPLICIT NONE
    746   REAL,             INTENT(INOUT) :: field(:,:)
    747   CHARACTER(LEN=*), INTENT(IN)    :: name(:)
    748   CHARACTER(LEN=*), INTENT(IN)    :: descr
    749   REAL,             INTENT(IN)    :: default
    750 !-----------------------------------------------------------------------------
    751   REAL :: fld(SIZE(field,1),1,SIZE(field,2))
    752   lFound = phyetat0_srf31(fld, name, descr, default); field = fld(:,1,:)
    753 END FUNCTION phyetat0_srf21
    754 
    755 !==============================================================================
    756 LOGICAL FUNCTION phyetat0_srf31(field, name, descr, default) RESULT(lFound)
    757 ! Same as phyetat0_sfr11, field on multiple levels, multiple names tested one after the other.
    758   USE iostart,           ONLY: get_field
    759   USE print_control_mod, ONLY: lunout
    760   USE strings_mod,       ONLY: int2str, maxlen
    761   IMPLICIT NONE
    762   REAL,             INTENT(INOUT) :: field(:,:,:)
    763   CHARACTER(LEN=*), INTENT(IN)    :: name(:)
    764   CHARACTER(LEN=*), INTENT(IN)    :: descr
    765   REAL,             INTENT(IN)    :: default
    766 !-----------------------------------------------------------------------------
    767   INTEGER :: nsrf, i
    768   CHARACTER(LEN=maxlen) :: nam(SIZE(name)), tname, des
    769   IF(SIZE(field,3)>99) CALL abort_physic("phyetat0", "Too much sub-cells", 1)
    770   DO nsrf = 1, SIZE(field,3)
    771     DO i = 1, SIZE(name); nam(i) = TRIM(name(i))//TRIM(int2str(nsrf,2)); END DO
    772     des = TRIM(descr)//" srf:"//int2str(nsrf,2)
    773     lFound = phyetat0_get21(field(:,:,nsrf), nam, TRIM(des), default, tname)
    774   END DO
    775   WRITE(lunout,'(2(a,ES14.7))') 'phyetat0: '//TRIM(tname)//' ('//TRIM(descr)//') min/max=', &
    776     MINval(field),' ',MAXval(field)
    777 END FUNCTION phyetat0_srf31
    778 
    779645END MODULE phyetat0_mod
    780646
  • LMDZ6/branches/Ocean_skin/libf/phylmdiso/physiq_mod.F90

    r4368 r4369  
    3939    USE ioipsl_getin_p_mod, ONLY : getin_p
    4040    USE indice_sol_mod
    41     USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, types_trac, nqCO2
     41    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, tracers, types_trac
    4242    USE readTracFiles_mod, ONLY: addPhase
    43     USE strings_mod,  ONLY: strIdx, strStack, int2str
     43    USE strings_mod,  ONLY: strIdx
    4444    USE iophy
    4545    USE limit_read_mod, ONLY : init_limit_read
     
    5656    USE phystokenc_mod, ONLY: offline, phystokenc
    5757    USE phys_cal_mod, only: year_len, mth_len, days_elapsed, jh_1jan, &
    58          year_cur, mth_cur,jD_cur, jH_cur, jD_ref, day_cur, hour
     58         year_cur, mth_cur,jD_cur, jH_cur, jD_ref, day_cur, hour, calend
    5959!!  USE phys_local_var_mod, ONLY : a long list of variables
    6060!!              ==> see below, after "CPP Keys" section
     
    6969    USE regr_horiz_time_climoz_m, ONLY: regr_horiz_time_climoz
    7070    USE regr_pr_time_av_m, only: regr_pr_time_av
    71     USE surface_data,     ONLY : type_ocean, ok_veget, landice_opt
    72     USE time_phylmdz_mod, only: annee_ref, current_time, day_ini, day_ref, &
    73           day_step_phy, itau_phy, pdtphys, raz_date, start_time, update_time
     71    USE surface_data,     ONLY : type_ocean, ok_veget
     72    USE time_phylmdz_mod, only: current_time, itau_phy, pdtphys, raz_date, update_time
    7473    USE tracinca_mod, ONLY: config_inca
    7574    USE tropopause_m,     ONLY: dyn_tropopause
    7675    USE ice_sursat_mod,  ONLY: flight_init, airplane
    7776    USE vampir
    78     USE VERTICAL_LAYERS_MOD, ONLY: aps,bps, ap, bp
    7977    USE write_field_phy
     78#ifdef CPP_XIOS
     79    USE wxios, ONLY: g_ctx, wxios_set_context
     80#endif
    8081    USE lscp_mod, ONLY : lscp
     82    USE wake_ini_mod, ONLY : wake_ini
    8183    USE thermcell_ini_mod, ONLY : thermcell_ini
    8284
     
    9799
    98100
     101#ifdef INCA
     102    USE geometry_mod,      ONLY: longitude, latitude, boundslon, boundslat, ind_cell_glo
     103    USE time_phylmdz_mod,  ONLY: ndays
     104    USE infotrac_phy,      ONLY: nqCO2
     105#endif
    99106#ifdef REPROBUS
    100     USE CHEM_REP, ONLY : Init_chem_rep_xjour, &
    101          d_q_rep,d_ql_rep,d_qi_rep,ptrop,ttrop, &
    102          ztrop, gravit,itroprep, Z1,Z2,fac,B
     107    USE chem_rep, ONLY: Init_chem_rep_xjour, d_q_rep, d_ql_rep, d_qi_rep, &
     108                        ptrop, ttrop, ztrop, gravit, itroprep, Z1, Z2, fac, B
     109#endif
     110#if defined INCA || defined REPROBUS
     111    USE time_phylmdz_mod,    ONLY: annee_ref, day_ini, day_ref, start_time
     112    USE vertical_layers_mod, ONLY: aps, bps, ap, bp
    103113#endif
    104114
     
    106116#ifdef CPP_RRTM
    107117    USE YOERAD, ONLY : NRADLP
    108     USE YOESW, ONLY : RSUN
     118!    USE YOESW, ONLY : RSUN
    109119#endif
    110120
     
    116126
    117127#ifdef CPP_XIOS
    118     USE xios, ONLY: xios_update_calendar, xios_context_finalize, &
    119             xios_get_field_attr, xios_field_is_active
     128    USE xios, ONLY: xios_update_calendar, xios_context_finalize
     129    USE xios, ONLY: xios_get_field_attr, xios_field_is_active, xios_context
     130    USE xios, ONLY: xios_set_current_context
    120131    USE wxios, ONLY: missing_val, missing_val_omp
    121132#endif
     
    180191       d_t_ajsb,d_q_ajsb, &
    181192       d_t_ajs,d_q_ajs,d_u_ajs,d_v_ajs, &
    182        d_t_ajs_w,d_q_ajs_w, &
    183        d_t_ajs_x,d_q_ajs_x, &
     193!       d_t_ajs_w,d_q_ajs_w, &
     194!       d_t_ajs_x,d_q_ajs_x, &
    184195       !
    185196       d_t_eva,d_q_eva,d_ql_eva,d_qi_eva, &
     
    194205       d_ts, &
    195206       !
    196        d_t_oli,d_u_oli,d_v_oli, &
     207!       d_t_oli,d_u_oli,d_v_oli, &
    197208       d_t_oro,d_u_oro,d_v_oro, &
    198209       d_t_oro_gw,d_u_oro_gw,d_v_oro_gw, &
     
    366377#endif
    367378       !
    368 
    369379
    370380    IMPLICIT NONE
     
    579589    !
    580590    !
    581     INTEGER debug
    582591    INTEGER n
    583592    !ym      INTEGER npoints
     
    636645    ! Upmost level reached by deep convection and related variable (jyg)
    637646    !
    638     INTEGER izero
     647!    INTEGER izero
    639648    INTEGER k_upper_cv
    640649    !------------------------------------------------------------------
     
    814823    REAL beta_prec_fisrt(klon,klev) ! taux de conv de l'eau cond (fisrt)
    815824    ! RomP <<<
    816     REAL          :: calday
    817825
    818826    !IM cf FH pour Tiedtke 080604
     
    934942    real zqsat(klon,klev)
    935943    !
    936     INTEGER i, k, iq, j, nsrf, ll, l, itr
     944    INTEGER i, k, iq, nsrf, l, itr
    937945#ifdef ISO
    938946    real zxt_apres(ntraciso,klon)
     
    10561064
    10571065    REAL picefra(klon,klev)
     1066    REAL zrel_mount(klon)
    10581067    !IM cf. AM 081204 END
    10591068    !
     
    12651274
    12661275#ifdef INCA
     1276    REAL :: calday, zxsnow_dummy(klon)
    12671277    ! set de variables utilisees pour l'initialisation des valeurs provenant de INCA
    12681278    REAL, DIMENSION(klon,klev,naero_grp,nbands) :: init_tauinca
     
    13131323    phys_tstep=NINT(pdtphys)
    13141324#ifdef CPP_XIOS
    1315     IF (.NOT. debut .AND. is_omp_master) CALL xios_update_calendar(itap+1)
     1325! switch to XIOS LMDZ physics context
     1326    IF (.NOT. debut .AND. is_omp_master) THEN
     1327       CALL wxios_set_context()
     1328       CALL xios_update_calendar(itap+1)
     1329    ENDIF
    13161330#endif
    13171331
     
    14031417          WRITE (lunout, *) ' ok_ice_sursat=y requires 4 H2O tracers ', &
    14041418               '(H2O_g, H2O_l, H2O_s, H2O_r) but nqo=', nqo, '. Might as well stop here.'
     1419          abort_message='see above'
     1420          CALL abort_physic(modname,abort_message,1)
     1421       ENDIF
     1422
     1423       IF (ok_plane_h2o.AND..NOT.ok_ice_sursat) THEN
     1424          WRITE (lunout, *) ' ok_plane_h2o=y requires ok_ice_sursat=y '
     1425          abort_message='see above'
     1426          CALL abort_physic(modname,abort_message,1)
     1427       ENDIF
     1428
     1429       IF (ok_plane_contrail.AND..NOT.ok_ice_sursat) THEN
     1430          WRITE (lunout, *) ' ok_plane_contrail=y requires ok_ice_sursat=y '
    14051431          abort_message='see above'
    14061432          CALL abort_physic(modname,abort_message,1)
     
    18471873!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    18481874       ! Nouvelle initialisation pour le rayonnement RRTM
    1849        !
    18501875!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    18511876
    18521877       CALL iniradia(klon,klev,paprs(1,1:klev+1))
    18531878
    1854 
    18551879!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1880       CALL wake_ini(rg,rd,rv,prt_level)
    18561881       CALL thermcell_ini(iflag_thermals,prt_level,tau_thermals,lunout, &
    18571882   &    RG,RD,RCPD,RKAPPA,RLVTT,RETV)
     1883
     1884!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     1885
    18581886       !
    18591887!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     
    21512179       !c         ENDDO
    21522180       !
    2153        IF (ANY(types_trac == 'inca') .OR. ANY(types_trac == 'inco')) THEN  ! ModThL
     2181       IF (ANY(types_trac == 'inca') .OR. ANY(types_trac == 'inco')) THEN ! ModThL
    21542182#ifdef INCA
    21552183          CALL VTe(VTphysiq)
     
    21582186          WRITE(lunout,*) 'initial time chemini', days_elapsed, calday
    21592187
    2160           CALL chemini(  &
    2161                rg, &
    2162                ra, &
    2163                cell_area, &
    2164                latitude_deg, &
    2165                longitude_deg, &
    2166                presnivs, &
    2167                calday, &
    2168                klon, &
    2169                nqtot, &
    2170                nqo+nqCO2, &
    2171                pdtphys, &
    2172                annee_ref, &
    2173                year_cur, &
    2174                day_ref,  &
    2175                day_ini, &
    2176                start_time, &
    2177                itau_phy, &
    2178                date0, &
    2179                io_lon, &
    2180                io_lat, &
    2181                chemistry_couple, &
    2182                init_source, &
    2183                init_tauinca, &
    2184                init_pizinca, &
    2185                init_cginca, &
    2186                init_ccminca)
     2188          call init_const_lmdz( &
     2189          ndays, nbsrf, is_oce,is_sic, is_ter,is_lic, calend, &
     2190          config_inca)
     2191
     2192          CALL init_inca_geometry( &
     2193               longitude, latitude, &
     2194               boundslon, boundslat, &
     2195               cell_area, ind_cell_glo)
     2196
     2197          if (grid_type==unstructured) THEN
     2198             CALL chemini(  pplay, &
     2199                  nbp_lon, nbp_lat, &
     2200                  latitude_deg, &
     2201                  longitude_deg, &
     2202                  presnivs, &
     2203                  calday, &
     2204                  klon, &
     2205                  nqtot, &
     2206                  nqo+nqCO2, &
     2207                  pdtphys, &
     2208                  annee_ref, &
     2209                  year_cur, &
     2210                  day_ref,  &
     2211                  day_ini, &
     2212                  start_time, &
     2213                  itau_phy, &
     2214                  date0, &
     2215                  chemistry_couple, &
     2216                  init_source, &
     2217                  init_tauinca, &
     2218                  init_pizinca, &
     2219                  init_cginca, &
     2220                  init_ccminca)
     2221          ELSE
     2222             CALL chemini(  pplay, &
     2223                  nbp_lon, nbp_lat, &
     2224                  latitude_deg, &
     2225                  longitude_deg, &
     2226                  presnivs, &
     2227                  calday, &
     2228                  klon, &
     2229                  nqtot, &
     2230                  nqo+nqCO2, &
     2231                  pdtphys, &
     2232                  annee_ref, &
     2233                  year_cur, &
     2234                  day_ref,  &
     2235                  day_ini, &
     2236                  start_time, &
     2237                  itau_phy, &
     2238                  date0, &
     2239                  chemistry_couple, &
     2240                  init_source, &
     2241                  init_tauinca, &
     2242                  init_pizinca, &
     2243                  init_cginca, &
     2244                  init_ccminca, &
     2245                  io_lon, &
     2246                  io_lat)
     2247          ENDIF
    21872248
    21882249
     
    22862347
    22872348
     2349
    22882350    ENDIF
    22892351    !
     
    23902452          ql_seri(i,k) = qx(i,k,iliq)
    23912453          !CR: ATTENTION, on rajoute la variable glace
    2392           IF (nqo.eq.2) THEN
     2454          IF (nqo.EQ.2) THEN             !--vapour and liquid only
    23932455             qs_seri(i,k) = 0.
    2394           ELSE IF (nqo.eq.3) THEN
     2456             rneb_seri(i,k) = 0.
     2457          ELSE IF (nqo.EQ.3) THEN        !--vapour, liquid and ice
    23952458             qs_seri(i,k) = qx(i,k,isol)
    2396           ELSE IF (nqo.eq.4) THEN
     2459             rneb_seri(i,k) = 0.
     2460          ELSE IF (nqo.EQ.4) THEN        !--vapour, liquid, ice and rneb
    23972461             qs_seri(i,k) = qx(i,k,isol)
    23982462             rneb_seri(i,k) = qx(i,k,irneb)
     
    26582722       ! !! RomP >>>   td dyn traceur
    26592723       IF (nqtot > nqo) d_tr_dyn(:,:,:)= 0.0
     2724       ! !! RomP <<<
    26602725       d_rneb_dyn(:,:)=0.0
    2661        ! !! RomP <<<
    26622726       ancien_ok = .TRUE.
    26632727    ENDIF
     
    46084672    IF (ok_new_lscp) THEN
    46094673
     4674    !--mise à jour de flight_m et flight_h2o dans leur module
     4675    IF (ok_plane_h2o .OR. ok_plane_contrail) THEN
     4676      CALL airplane(debut,pphis,pplay,paprs,t_seri)
     4677    ENDIF
     4678
    46104679    CALL lscp(phys_tstep,missing_val,paprs,pplay, &
    46114680         t_seri, q_seri,ptconv,ratqs, &
     
    46194688
    46204689    ELSE
     4690
    46214691    CALL fisrtilp(phys_tstep,paprs,pplay, &
    46224692         t_seri, q_seri,ptconv,ratqs, &
     
    46904760       ENDDO
    46914761    ENDDO
    4692     IF (nqo==3) THEN
     4762    IF (nqo >= 3) THEN
    46934763    DO k = 1, klev
    46944764       DO i = 1, klon
     
    57325802       DO i=1,klon
    57335803          itest(i)=0
    5734           !        IF ((zstd(i).gt.10.0)) THEN
    5735           IF (((zpic(i)-zmea(i)).GT.100.).AND.(zstd(i).GT.10.0)) THEN
     5804          zrel_mount(i)=zstd(i)/(max(zsig(i),1.E-8)*sqrt(cell_area(i)))
     5805          !zrel_mount: relative mountain height wrt relief explained by mean slope
     5806          ! -> condition on zrel_mount can deactivate the drag on tilted planar terrains
     5807          !    such as ice sheets (work by V. Wiener)
     5808          IF (((zpic(i)-zmea(i)).GT.100.).AND.(zstd(i).GT.10.0).AND.(zrel_mount(i).GE.zrel_mount_t)) THEN
    57365809             itest(i)=1
    57375810             igwd=igwd+1
     
    57865859       DO i=1,klon
    57875860          itest(i)=0
    5788           IF ((zpic(i)-zmea(i)).GT.100.) THEN
     5861          !zrel_mount: relative mountain height wrt relief explained by mean slope
     5862          ! -> condition on zrel_mount can deactivate the lifting on tilted planar terrains
     5863          !    such as ice sheets (work by V. Wiener)
     5864          zrel_mount(i)=zstd(i)/(max(zsig(i),1.E-8)*sqrt(cell_area(i)))
     5865          IF (((zpic(i)-zmea(i)).GT.100.).AND.(zrel_mount(i).GE.zrel_mount_t)) THEN
    57895866             itest(i)=1
    57905867             igwd=igwd+1
     
    62736350    ELSE
    62746351       sh_in(:,:) = qx(:,:,ivap)
    6275        IF (nqo .EQ. 3) THEN
     6352       IF (nqo >= 3) THEN
    62766353          ch_in(:,:) = qx(:,:,iliq) + qx(:,:,isol)
    62776354       ELSE
     
    63606437    ! Calculer le transport de l'eau et de l'energie (diagnostique)
    63616438    !
    6362     CALL transp (paprs, zxtsol, t_seri, q_seri, ql_seri, qs_seri, u_seri, v_seri, zphi, &
     6439    CALL transp (paprs,zxtsol, t_seri, q_seri, ql_seri, qs_seri, u_seri, v_seri, zphi, &
    63636440                 ue, ve, uq, vq, uwat, vwat)
    63646441    !
     
    63666443    IF(1.EQ.0) THEN
    63676444       !
    6368        CALL transp_lay (paprs,zxtsol, &
    6369             t_seri, q_seri, u_seri, v_seri, zphi, &
     6445       CALL transp_lay (paprs,zxtsol, t_seri, q_seri, u_seri, v_seri, zphi, &
    63706446            ve_lay, vq_lay, ue_lay, uq_lay)
    63716447       !
     
    64456521            pphis, &
    64466522            zx_rh, &
    6447             aps, bps, ap, bp)
     6523            aps, bps, ap, bp, lafin)
    64486524
    64496525       CALL VTe(VTinca)
     
    64526528    ENDIF
    64536529
     6530    IF (ANY(types_trac == 'repr')) THEN
     6531#ifdef REPROBUS
     6532        CALL coord_hyb_rep(paprs, pplay, aps, bps, ap, bp, cell_area)
     6533#endif
     6534    ENDIF
    64546535
    64556536    !
     
    64756556          d_qx(i,k,iliq) = ( ql_seri(i,k) - qx(i,k,iliq) ) / phys_tstep
    64766557          !CR: on ajoute le contenu en glace
    6477           IF (nqo.ge.3) THEN
     6558          IF (nqo >= 3) THEN
    64786559             d_qx(i,k,isol) = ( qs_seri(i,k) - qx(i,k,isol) ) / phys_tstep
    64796560          ENDIF
    64806561          !--ice_sursat: nqo=4, on ajoute rneb
    6481           IF (nqo.eq.4) THEN
     6562          IF (nqo == 4) THEN
    64826563             d_qx(i,k,irneb) = ( rneb_seri(i,k) - qx(i,k,irneb) ) / phys_tstep
    64836564          ENDIF
     
    65016582      enddo ! DO k = 1, klev
    65026583    enddo !do ixt=1,ntraciso
    6503 !#ifdef ISOVERIF
    6504 !        write(*,*) 'physiq 6120: d_qx(1,1,:)=',d_qx(1,1,:)
    6505 !        write(*,*) 'qx(1,1,:)=',qx(1,1,:)
    6506 !        write(*,*) 'xt_seri(:,1,1)=',xt_seri(:,1,1)
    6507 !#endif
    6508 #endif
    6509 ! #ifdef ISO
     6584#endif
    65106585    ! DC: All iterations are cycled if nqtot==nqo, so no nqtot>nqo condition required
    65116586    itr = 0
     
    65676642    ql_ancien(:,:) = ql_seri(:,:)
    65686643    qs_ancien(:,:) = qs_seri(:,:)
     6644    rneb_ancien(:,:) = rneb_seri(:,:)
    65696645#ifdef ISO
    65706646    xt_ancien(:,:,:)=xt_seri(:,:,:)
     
    68266902#ifdef CPP_XIOS
    68276903       IF (is_omp_master) CALL xios_context_finalize
     6904
     6905#ifdef INCA
     6906       if (ANY(types_trac == 'inca' )) then
     6907          IF (is_omp_master .and. grid_type==unstructured) THEN
     6908             CALL finalize_inca
     6909          ENDIF
     6910       endif
     6911#endif
     6912
    68286913#endif
    68296914       WRITE(lunout,*) ' physiq fin, nombre de steps ou cvpas = 1 : ', Ncvpaseq1
Note: See TracChangeset for help on using the changeset viewer.