Ignore:
Timestamp:
Oct 23, 2018, 11:16:41 AM (6 years ago)
Author:
jghattas
Message:

Added all modifications in the model code that were used for the simulations with DYANMICO during the Grand Challeng 2018. Modifications done by Y. Meurdesoif, L. Fairhead and A.K. Traore

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/DYNAMICO-conv-GC/libf/phylmd/physiq_mod.F90

    r3322 r3406  
    2525    USE dimphy
    2626    USE infotrac_phy, ONLY: nqtot, nbtr, nqo, type_trac
    27     USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev, klon_glo
     27    USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev, klon_glo, grid1dTo2d_glo, grid_type, unstructured
    2828    USE mod_phys_lmdz_para
    2929    USE iophy
     
    252252    use ACAMA_GWD_rando_m, only: ACAMA_GWD_rando
    253253    USE VERTICAL_LAYERS_MOD, ONLY: aps,bps
     254    USE etat0_limit_unstruct_mod
     255#ifdef CPP_XIOS
     256    USE xios, ONLY: xios_update_calendar, xios_context_finalize
     257#endif
     258    USE climoz_mod
     259    USE limit_read_mod, ONLY : init_limit_read
     260    USE regr_horiz_time_climoz_m, ONLY: regr_horiz_time_climoz
    254261
    255262
     
    11291136    CALL update_time(pdtphys)
    11301137    phys_tstep=NINT(pdtphys)
     1138#ifdef CPP_XIOS
     1139    IF (.NOT. debut .AND. is_omp_master) CALL xios_update_calendar(itap+1)
     1140#endif
    11311141
    11321142    !======================================================================
     
    11611171
    11621172    IF (first) THEN
     1173       CALL init_etat0_limit_unstruct
     1174       IF (.NOT. create_etat0_limit) CALL init_limit_read(days_elapsed)
    11631175       !CR:nvelles variables convection/poches froides
    11641176
     
    11841196       CALL phys_state_var_init(read_climoz)
    11851197       CALL phys_output_var_init
     1198       IF(read_climoz>=1 .AND. create_etat0_limit) CALL regr_horiz_time_climoz(read_climoz,ok_daily_climoz)
     1199
    11861200       print*, '================================================='
    11871201       !
     
    13941408       CALL init_iophy_new(latitude_deg,longitude_deg)
    13951409
    1396 
     1410          !===================================================================
     1411          !IM stations CFMIP
     1412          nCFMIP=npCFMIP
     1413          OPEN(98,file='npCFMIP_param.data',status='old', &
     1414               form='formatted',iostat=iostat)
     1415          IF (iostat == 0) THEN
     1416             READ(98,*,end=998) nCFMIP
     1417998          CONTINUE
     1418             CLOSE(98)
     1419             CONTINUE
     1420             IF(nCFMIP.GT.npCFMIP) THEN
     1421                print*,'nCFMIP > npCFMIP : augmenter npCFMIP et recompiler'
     1422                CALL abort_physic("physiq", "", 1)
     1423             ELSE
     1424                print*,'physiq npCFMIP=',npCFMIP,'nCFMIP=',nCFMIP
     1425             ENDIF
     1426
     1427             !
     1428             ALLOCATE(tabCFMIP(nCFMIP))
     1429             ALLOCATE(lonCFMIP(nCFMIP), latCFMIP(nCFMIP))
     1430             ALLOCATE(tabijGCM(nCFMIP))
     1431             ALLOCATE(lonGCM(nCFMIP), latGCM(nCFMIP))
     1432             ALLOCATE(iGCM(nCFMIP), jGCM(nCFMIP))
     1433             !
     1434             ! lecture des nCFMIP stations CFMIP, de leur numero
     1435             ! et des coordonnees geographiques lonCFMIP, latCFMIP
     1436             !
     1437             CALL read_CFMIP_point_locations(nCFMIP, tabCFMIP,  &
     1438                  lonCFMIP, latCFMIP)
     1439             !
     1440             ! identification des
     1441             ! 1) coordonnees lonGCM, latGCM des points CFMIP dans la
     1442             ! grille de LMDZ
     1443             ! 2) indices points tabijGCM de la grille physique 1d sur
     1444             ! klon points
     1445             ! 3) indices iGCM, jGCM de la grille physique 2d
     1446             !
     1447             CALL LMDZ_CFMIP_point_locations(nCFMIP, lonCFMIP, latCFMIP, &
     1448                  tabijGCM, lonGCM, latGCM, iGCM, jGCM)
     1449             !
     1450          ELSE
     1451             ALLOCATE(tabijGCM(0))
     1452             ALLOCATE(lonGCM(0), latGCM(0))
     1453             ALLOCATE(iGCM(0), jGCM(0))
     1454          ENDIF
     1455
     1456#ifdef CPP_IOIPSL
     1457
     1458       !$OMP MASTER
     1459       ! FH : if ok_sync=.true. , the time axis is written at each time step
     1460       ! in the output files. Only at the end in the opposite case
     1461       ok_sync_omp=.false.
     1462       CALL getin('ok_sync',ok_sync_omp)
     1463       CALL phys_output_open(longitude_deg,latitude_deg,nCFMIP,tabijGCM, &
     1464            iGCM,jGCM,lonGCM,latGCM, &
     1465            jjmp1,nlevSTD,clevSTD,rlevSTD, phys_tstep,ok_veget, &
     1466            type_ocean,iflag_pbl,iflag_pbl_split,ok_mensuel,ok_journe, &
     1467            ok_hf,ok_instan,ok_LES,ok_ade,ok_aie, &
     1468            read_climoz, phys_out_filestations, &
     1469            new_aod, aerosol_couple, &
     1470            flag_aerosol_strat, pdtphys, paprs, pphis,  &
     1471            pplay, lmax_th, ptconv, ptconvth, ivap,  &
     1472            d_u, d_t, qx, d_qx, zmasse, ok_sync_omp)
     1473       !$OMP END MASTER
     1474       !$OMP BARRIER
     1475       ok_sync=ok_sync_omp
     1476
     1477       freq_outNMC(1) = ecrit_files(7)
     1478       freq_outNMC(2) = ecrit_files(8)
     1479       freq_outNMC(3) = ecrit_files(9)
     1480       WRITE(lunout,*)'OK freq_outNMC(1)=',freq_outNMC(1)
     1481       WRITE(lunout,*)'OK freq_outNMC(2)=',freq_outNMC(2)
     1482       WRITE(lunout,*)'OK freq_outNMC(3)=',freq_outNMC(3)
     1483
     1484#ifndef CPP_XIOS
     1485       CALL ini_paramLMDZ_phy(phys_tstep,nid_ctesGCM)
     1486#endif
     1487
     1488#endif
     1489       ecrit_reg = ecrit_reg * un_jour
     1490       ecrit_tra = ecrit_tra * un_jour
     1491
     1492       !XXXPB Positionner date0 pour initialisation de ORCHIDEE
     1493       date0 = jD_ref
     1494       WRITE(*,*) 'physiq date0 : ',date0
     1495       !
     1496
     1497!       CALL create_climoz(read_climoz)
     1498
     1499       CALL phys_output_write(itap, pdtphys, paprs, pphis,                    &
     1500                              pplay, lmax_th, aerosol_couple,                 &
     1501                              ok_ade, ok_aie, ivap, iliq, isol, new_aod, ok_sync,&
     1502                              ptconv, read_climoz, clevSTD,                   &
     1503                              ptconvth, d_u, d_t, qx, d_qx, zmasse,           &
     1504                              flag_aerosol, flag_aerosol_strat, ok_cdnc)
     1505
     1506#ifdef CPP_XIOS
     1507       IF (is_omp_master) CALL xios_update_calendar(1)
     1508#endif
     1509       IF(read_climoz>=1 .AND. create_etat0_limit) CALL regr_horiz_time_climoz(read_climoz,ok_daily_climoz)
     1510       CALL create_etat0_limit_unstruct
    13971511       CALL phyetat0 ("startphy.nc",clesphy0,tabcntr0)
     1512
    13981513!jyg<
    13991514       IF (klon_glo==1) THEN
     
    14051520            ENDDO
    14061521          ENDDO
     1522        ELSE
     1523          pbl_tke(:,:,is_ave) = 0. !ym missing init : maybe must be initialized in the same way that for klon_glo==1 ??
    14071524!>jyg
    14081525       ENDIF
     
    14211538       ENDIF
    14221539
    1423        CALL printflag( tabcntr0,radpas,ok_journe, &
    1424             ok_instan, ok_region )
    1425        !
    14261540!       IF (ABS(phys_tstep-pdtphys).GT.0.001) THEN
    14271541!          WRITE(lunout,*) 'Pas physique n est pas correct',phys_tstep, &
     
    15061620          !        enddo
    15071621
    1508           !===================================================================
    1509           !IM stations CFMIP
    1510           nCFMIP=npCFMIP
    1511           OPEN(98,file='npCFMIP_param.data',status='old', &
    1512                form='formatted',iostat=iostat)
    1513           IF (iostat == 0) THEN
    1514              READ(98,*,end=998) nCFMIP
    1515 998          CONTINUE
    1516              CLOSE(98)
    1517              CONTINUE
    1518              IF(nCFMIP.GT.npCFMIP) THEN
    1519                 print*,'nCFMIP > npCFMIP : augmenter npCFMIP et recompiler'
    1520                 CALL abort_physic("physiq", "", 1)
    1521              ELSE
    1522                 print*,'physiq npCFMIP=',npCFMIP,'nCFMIP=',nCFMIP
    1523              ENDIF
    1524 
    1525              !
    1526              ALLOCATE(tabCFMIP(nCFMIP))
    1527              ALLOCATE(lonCFMIP(nCFMIP), latCFMIP(nCFMIP))
    1528              ALLOCATE(tabijGCM(nCFMIP))
    1529              ALLOCATE(lonGCM(nCFMIP), latGCM(nCFMIP))
    1530              ALLOCATE(iGCM(nCFMIP), jGCM(nCFMIP))
    1531              !
    1532              ! lecture des nCFMIP stations CFMIP, de leur numero
    1533              ! et des coordonnees geographiques lonCFMIP, latCFMIP
    1534              !
    1535              CALL read_CFMIP_point_locations(nCFMIP, tabCFMIP,  &
    1536                   lonCFMIP, latCFMIP)
    1537              !
    1538              ! identification des
    1539              ! 1) coordonnees lonGCM, latGCM des points CFMIP dans la
    1540              ! grille de LMDZ
    1541              ! 2) indices points tabijGCM de la grille physique 1d sur
    1542              ! klon points
    1543              ! 3) indices iGCM, jGCM de la grille physique 2d
    1544              !
    1545              CALL LMDZ_CFMIP_point_locations(nCFMIP, lonCFMIP, latCFMIP, &
    1546                   tabijGCM, lonGCM, latGCM, iGCM, jGCM)
    1547              !
    1548           ELSE
    1549              ALLOCATE(tabijGCM(0))
    1550              ALLOCATE(lonGCM(0), latGCM(0))
    1551              ALLOCATE(iGCM(0), jGCM(0))
    1552           ENDIF
    1553        ELSE
    1554           ALLOCATE(tabijGCM(0))
    1555           ALLOCATE(lonGCM(0), latGCM(0))
    1556           ALLOCATE(iGCM(0), jGCM(0))
     1622       !ELSE
     1623       !   ALLOCATE(tabijGCM(0))
     1624       !   ALLOCATE(lonGCM(0), latGCM(0))
     1625       !   ALLOCATE(iGCM(0), jGCM(0))
    15571626       ENDIF
    15581627
     
    16421711#endif
    16431712
    1644 #ifdef CPP_IOIPSL
    1645 
    1646        !$OMP MASTER
    1647        ! FH : if ok_sync=.true. , the time axis is written at each time step
    1648        ! in the output files. Only at the end in the opposite case
    1649        ok_sync_omp=.false.
    1650        CALL getin('ok_sync',ok_sync_omp)
    1651        CALL phys_output_open(longitude_deg,latitude_deg,nCFMIP,tabijGCM, &
    1652             iGCM,jGCM,lonGCM,latGCM, &
    1653             jjmp1,nlevSTD,clevSTD,rlevSTD, phys_tstep,ok_veget, &
    1654             type_ocean,iflag_pbl,iflag_pbl_split,ok_mensuel,ok_journe, &
    1655             ok_hf,ok_instan,ok_LES,ok_ade,ok_aie, &
    1656             read_climoz, phys_out_filestations, &
    1657             new_aod, aerosol_couple, &
    1658             flag_aerosol_strat, pdtphys, paprs, pphis,  &
    1659             pplay, lmax_th, ptconv, ptconvth, ivap,  &
    1660             d_u, d_t, qx, d_qx, zmasse, ok_sync_omp)
    1661        !$OMP END MASTER
    1662        !$OMP BARRIER
    1663        ok_sync=ok_sync_omp
    1664 
    1665        freq_outNMC(1) = ecrit_files(7)
    1666        freq_outNMC(2) = ecrit_files(8)
    1667        freq_outNMC(3) = ecrit_files(9)
    1668        WRITE(lunout,*)'OK freq_outNMC(1)=',freq_outNMC(1)
    1669        WRITE(lunout,*)'OK freq_outNMC(2)=',freq_outNMC(2)
    1670        WRITE(lunout,*)'OK freq_outNMC(3)=',freq_outNMC(3)
    1671 
    1672 #ifndef CPP_XIOS
    1673        CALL ini_paramLMDZ_phy(phys_tstep,nid_ctesGCM)
    1674 #endif
    1675 
    1676 #endif
    1677        ecrit_reg = ecrit_reg * un_jour
    1678        ecrit_tra = ecrit_tra * un_jour
    1679 
    1680        !XXXPB Positionner date0 pour initialisation de ORCHIDEE
    1681        date0 = jD_ref
    1682        WRITE(*,*) 'physiq date0 : ',date0
     1713
     1714       CALL printflag( tabcntr0,radpas,ok_journe, &
     1715            ok_instan, ok_region )
    16831716       !
    16841717       !
     
    22072240       !
    22082241       !-------gustiness calculation-------!
     2242       !ym : Warning gustiness non inialized for iflag_gusts=2 & iflag_gusts=3
     2243       gustiness=0  !ym missing init
     2244       
    22092245       IF (iflag_gusts==0) THEN
    22102246          gustiness(1:klon)=0
     
    40344070
    40354071    IF (.not. ok_hines .and. ok_gwd_rando) then
     4072       ! ym missing init for east_gwstress & west_gwstress -> added in phys_local_var_mod
    40364073       CALL acama_GWD_rando(PHYS_TSTEP, pplay, latitude_deg, t_seri, u_seri, &
    40374074            v_seri, rot, zustr_gwd_front, zvstr_gwd_front, du_gwd_front, &
     
    46964733       !         write(97) u_seri,v_seri,t_seri,q_seri
    46974734       !         close(97)
    4698        !$OMP MASTER
     4735!       !$OMP MASTER
    46994736       IF (read_climoz >= 1) THEN
    47004737          IF (is_mpi_root) THEN
     
    47044741          DEALLOCATE(press_cen_climoz) ! pointer
    47054742       ENDIF
    4706        !$OMP END MASTER
     4743!       !$OMP END MASTER
     4744#ifdef CPP_XIOS
     4745       IF (is_omp_master) CALL xios_context_finalize
     4746#endif
    47074747    ENDIF
    47084748
Note: See TracChangeset for help on using the changeset viewer.