Ignore:
Timestamp:
Jan 22, 2019, 4:21:59 PM (5 years ago)
Author:
Laurent Fairhead
Message:

"Historic" :-) commit merging the physics branch used for DYNAMICO with the LMDZ trunk.
The same physics branch can now be used seamlessly with the traditional lon-lat LMDZ
dynamical core and DYNAMICO.
Testing consisted in running a lon-lat LMDZ bucket simulation with the NPv6.1 physics package
with the original trunk sources and the merged sources. Tests were succesful in the sense that
numeric continuity was preserved in the restart files from both simulation. Further tests
included running both versions of the physics codes for one year in a LMDZOR setting in which
the restart files also came out identical.

Caution:

  • as the physics package now manages unstructured grids, grid information needs to be transmitted

to the surface scheme ORCHIDEE. This means that the interface defined in surf_land_orchidee_mod.F90
is only compatible with ORCHIDEE version orchidee2.1 and later versions. If previous versions of
ORCHIDEE need to be used, the CPP key ORCHIDEE_NOUNSTRUCT needs to be set at compilation time.
This is done automatically if makelmdz/makelmdz_fcm are called with the veget orchidee2.0 switch

  • due to a limitation in XIOS, the time at which limit conditions will be read in by DYNAMICO will be

delayed by one physic timestep with respect to the time it is read in by the lon-lat model. This is caused
by the line

IF (MOD(itime-1, lmt_pas) == 0 .OR. (jour_lu /= jour .AND. grid_type /= unstructured)) THEN ! time to read

in limit_read_mod.F90

Work still needed on COSP integration and XML files for DYNAMICO

EM, YM, LF

Location:
LMDZ6/trunk/libf/phylmd/rrtm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/trunk/libf/phylmd/rrtm/readaerosolstrato1_rrtm.F90

    r2744 r3435  
    22! $Id: readaerosolstrato1_rrtm.F90 2526 2016-05-26 22:13:40Z oboucher $
    33!
     4
    45SUBROUTINE readaerosolstrato1_rrtm(debut)
    56
     
    910
    1011    USE phys_cal_mod, ONLY : mth_cur
    11     USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, grid2dTo1d_glo
    12     USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
    13     USE mod_phys_lmdz_omp_data, ONLY :  is_omp_root
     12    USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, grid2dTo1d_glo, grid_type, unstructured
    1413    USE mod_phys_lmdz_para
    1514    USE phys_state_var_mod
     
    1918    USE YOERAD, ONLY : NLW
    2019    USE YOMCST
     20    USE xios
    2121
    2222    IMPLICIT NONE
     
    4545    REAL, ALLOCATABLE:: tauaerstrat_mois(:, :, :)
    4646    REAL, ALLOCATABLE:: tauaerstrat_mois_glo(:, :)
     47    REAL, ALLOCATABLE:: tauaerstrat_mpi(:, :)
    4748
    4849! For NetCDF:
     
    102103    n_lat = size(latitude)
    103104    print *, 'LAT aerosol strato=', n_lat, latitude
    104     IF (n_lat.NE.nbp_lat) THEN
    105        print *,'Le nombre de lat n est pas egal a nbp_lat'
    106        STOP
    107     ENDIF
    108 
     105
     106    IF (grid_type/=unstructured) THEN
     107      IF (n_lat.NE.nbp_lat) THEN
     108         print *,'Le nombre de lat n est pas egal a nbp_lat'
     109         STOP
     110      ENDIF
     111    ENDIF
     112   
    109113    CALL nf95_inq_varid(ncid_in, "LON", varid)
    110114    CALL nf95_gw_var(ncid_in, varid, longitude)
    111115    n_lon = size(longitude)
    112116    print *, 'LON aerosol strato=', n_lon, longitude
    113     IF (n_lon.NE.nbp_lon) THEN
    114        print *,'Le nombre de lon n est pas egal a nbp_lon'
    115        STOP
    116     ENDIF
    117 
     117
     118    IF (grid_type/=unstructured) THEN
     119      IF (n_lon.NE.nbp_lon) THEN
     120         print *,'Le nombre de lon n est pas egal a nbp_lon'
     121         STOP
     122      ENDIF
     123    ENDIF
     124   
     125   
    118126    CALL nf95_inq_varid(ncid_in, "TIME", varid)
    119127    CALL nf95_gw_var(ncid_in, varid, time)
     
    144152!---reduce to a klon_glo grid
    145153    CALL grid2dTo1d_glo(tauaerstrat_mois,tauaerstrat_mois_glo)
    146 
     154   
     155    ELSE
     156      ALLOCATE(tauaerstrat_mois(0,0,0))
    147157    ENDIF !--is_mpi_root and is_omp_root
    148158
     
    153163
    154164!--scatter on all proc
    155     CALL scatter(tauaerstrat_mois_glo,tau_aer_strat)
    156 
     165   
     166    IF (grid_type==unstructured) THEN
     167      IF (is_omp_master) THEN
     168        ALLOCATE(tauaerstrat_mpi(klon_mpi,klev))
     169        CALL xios_send_field("taustrat_in",tauaerstrat_mois)
     170        CALL xios_recv_field("taustrat_out",tauaerstrat_mpi)
     171      ELSE
     172        ALLOCATE(tauaerstrat_mpi(0,0))
     173      ENDIF
     174      CALL scatter_omp(tauaerstrat_mpi,tau_aer_strat)
     175    ELSE 
     176      CALL scatter(tauaerstrat_mois_glo,tau_aer_strat)
     177    ENDIF
     178   
    157179    IF (is_mpi_root.AND.is_omp_root) THEN
    158180!
  • LMDZ6/trunk/libf/phylmd/rrtm/readaerosolstrato2_rrtm.F90

    r2744 r3435  
    22! $Id: readaerosolstrato2_rrtm.F90 2526 2016-05-26 22:13:40Z oboucher $
    33!
     4
    45SUBROUTINE readaerosolstrato2_rrtm(debut)
    56
     
    910
    1011    USE phys_cal_mod, ONLY : mth_cur
    11     USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, grid2dTo1d_glo
    12     USE mod_phys_lmdz_mpi_data, ONLY :  is_mpi_root
    13     USE mod_phys_lmdz_omp_data, ONLY :  is_omp_root
     12    USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, grid2dTo1d_glo, grid_type, unstructured
     13    USE mod_phys_lmdz_mpi_data
     14    USE mod_phys_lmdz_omp_data
    1415    USE mod_phys_lmdz_para
    1516    USE phys_state_var_mod
     
    1920    USE YOERAD, ONLY : NLW
    2021    USE YOMCST
    21 
     22    USE xios
    2223    IMPLICIT NONE
    2324
     
    6566    REAL, ALLOCATABLE:: cgaerstrat_mois_glo(:, :, :)
    6667    REAL, ALLOCATABLE:: taulwaerstrat_mois_glo(:, :, :)
     68    REAL, ALLOCATABLE:: tauaerstrat_mpi(:, :, :)
     69    REAL, ALLOCATABLE:: pizaerstrat_mpi(:, :, :)
     70    REAL, ALLOCATABLE:: cgaerstrat_mpi(:, :, :)
     71    REAL, ALLOCATABLE:: taulwaerstrat_mpi(:, :, :)
    6772
    6873! For NetCDF:
     
    107112        CALL nf95_gw_var(ncid_in, varid, latitude)
    108113        n_lat = size(latitude)
    109         IF (n_lat.NE.nbp_lat) THEN
    110            print *, 'latitude=', n_lat, nbp_lat
    111            abort_message='Le nombre de lat n est pas egal a nbp_lat'
    112            CALL abort_physic(modname,abort_message,1)
     114
     115        IF (grid_type/=unstructured) THEN
     116           IF (n_lat.NE.nbp_lat) THEN
     117             print *, 'latitude=', n_lat, nbp_lat
     118             abort_message='Le nombre de lat n est pas egal a nbp_lat'
     119             CALL abort_physic(modname,abort_message,1)
     120           ENDIF
    113121        ENDIF
    114122
     
    134142        ALLOCATE(cgaerstrat(n_lat, n_lev, n_wav, n_month))
    135143
    136         ALLOCATE(tauaerstrat_mois(n_lon, n_lat, n_lev, n_wav))
    137         ALLOCATE(pizaerstrat_mois(n_lon, n_lat, n_lev, n_wav))
    138         ALLOCATE(cgaerstrat_mois(n_lon, n_lat, n_lev, n_wav))
    139 
    140         ALLOCATE(tauaerstrat_mois_glo(klon_glo, n_lev, n_wav))
    141         ALLOCATE(pizaerstrat_mois_glo(klon_glo, n_lev, n_wav))
    142         ALLOCATE(cgaerstrat_mois_glo(klon_glo, n_lev, n_wav))
    143 
    144144!--reading stratospheric aerosol tau per layer
    145145        CALL nf95_inq_varid(ncid_in, "TAU_SUN", varid)
     
    159159        CALL nf95_close(ncid_in)
    160160
     161       
     162        IF (grid_type/=unstructured) THEN
     163          ALLOCATE(tauaerstrat_mois(n_lon, n_lat, n_lev, n_wav))
     164          ALLOCATE(pizaerstrat_mois(n_lon, n_lat, n_lev, n_wav))
     165          ALLOCATE(cgaerstrat_mois(n_lon, n_lat, n_lev, n_wav))
     166
     167          ALLOCATE(tauaerstrat_mois_glo(klon_glo, n_lev, n_wav))
     168          ALLOCATE(pizaerstrat_mois_glo(klon_glo, n_lev, n_wav))
     169          ALLOCATE(cgaerstrat_mois_glo(klon_glo, n_lev, n_wav))
    161170!--select the correct month
    162171!--and copy into 1st longitude
    163         tauaerstrat_mois(1,:,:,:) = tauaerstrat(:,:,:,mth_cur)
    164         pizaerstrat_mois(1,:,:,:) = pizaerstrat(:,:,:,mth_cur)
    165         cgaerstrat_mois(1,:,:,:)  = cgaerstrat(:,:,:,mth_cur)
     172          tauaerstrat_mois(1,:,:,:) = tauaerstrat(:,:,:,mth_cur)
     173          pizaerstrat_mois(1,:,:,:) = pizaerstrat(:,:,:,mth_cur)
     174          cgaerstrat_mois(1,:,:,:)  = cgaerstrat(:,:,:,mth_cur)
    166175
    167176!--copy longitudes
    168         DO i=2, n_lon
    169          tauaerstrat_mois(i,:,:,:) = tauaerstrat_mois(1,:,:,:)
    170          pizaerstrat_mois(i,:,:,:) = pizaerstrat_mois(1,:,:,:)
    171          cgaerstrat_mois(i,:,:,:)  = cgaerstrat_mois(1,:,:,:)
    172         ENDDO
     177          DO i=2, n_lon
     178           tauaerstrat_mois(i,:,:,:) = tauaerstrat_mois(1,:,:,:)
     179           pizaerstrat_mois(i,:,:,:) = pizaerstrat_mois(1,:,:,:)
     180           cgaerstrat_mois(i,:,:,:)  = cgaerstrat_mois(1,:,:,:)
     181          ENDDO
    173182
    174183!---reduce to a klon_glo grid
    175         DO band=1, NSW
    176           CALL grid2dTo1d_glo(tauaerstrat_mois(:,:,:,band),tauaerstrat_mois_glo(:,:,band))
    177           CALL grid2dTo1d_glo(pizaerstrat_mois(:,:,:,band),pizaerstrat_mois_glo(:,:,band))
    178           CALL grid2dTo1d_glo(cgaerstrat_mois(:,:,:,band),cgaerstrat_mois_glo(:,:,band))
    179         ENDDO
    180 
     184          DO band=1, NSW
     185            CALL grid2dTo1d_glo(tauaerstrat_mois(:,:,:,band),tauaerstrat_mois_glo(:,:,band))
     186            CALL grid2dTo1d_glo(pizaerstrat_mois(:,:,:,band),pizaerstrat_mois_glo(:,:,band))
     187            CALL grid2dTo1d_glo(cgaerstrat_mois(:,:,:,band),cgaerstrat_mois_glo(:,:,band))
     188          ENDDO
     189        ENDIF
    181190!--Now LW optical properties
    182191!
     192
    183193        CALL nf95_open("taulwstrat.2D.nc", nf90_nowrite, ncid_in)
    184194
     
    194204        CALL nf95_gw_var(ncid_in, varid, latitude)
    195205        n_lat = size(latitude)
    196         IF (n_lat.NE.nbp_lat) THEN
    197            abort_message='Le nombre de lat n est pas egal a nbp_lat'
    198            CALL abort_physic(modname,abort_message,1)
    199         ENDIF
    200 
     206
     207        IF (grid_type/=unstructured) THEN
     208          IF (n_lat.NE.nbp_lat) THEN
     209             abort_message='Le nombre de lat n est pas egal a nbp_lat'
     210             CALL abort_physic(modname,abort_message,1)
     211          ENDIF
     212        ENDIF
     213       
    201214        CALL nf95_inq_varid(ncid_in, "TIME", varid)
    202215        CALL nf95_gw_var(ncid_in, varid, time)
     
    217230
    218231        ALLOCATE(taulwaerstrat(n_lat, n_lev, n_wav, n_month))
    219         ALLOCATE(taulwaerstrat_mois(n_lon, n_lat, n_lev, n_wav))
    220         ALLOCATE(taulwaerstrat_mois_glo(klon_glo, n_lev, n_wav))
    221232
    222233!--reading stratospheric aerosol lw tau per layer
     
    227238        CALL nf95_close(ncid_in)
    228239
     240        IF (grid_type/=unstructured) THEN
     241
     242          ALLOCATE(taulwaerstrat_mois(n_lon, n_lat, n_lev, n_wav))
     243          ALLOCATE(taulwaerstrat_mois_glo(klon_glo, n_lev, n_wav))
     244
    229245!--select the correct month
    230246!--and copy into 1st longitude
    231         taulwaerstrat_mois(1,:,:,:) = taulwaerstrat(:,:,:,mth_cur)
     247          taulwaerstrat_mois(1,:,:,:) = taulwaerstrat(:,:,:,mth_cur)
    232248!--copy longitudes
    233         DO i=2, n_lon
    234           taulwaerstrat_mois(i,:,:,:) = taulwaerstrat_mois(1,:,:,:)
    235         ENDDO
     249          DO i=2, n_lon
     250            taulwaerstrat_mois(i,:,:,:) = taulwaerstrat_mois(1,:,:,:)
     251          ENDDO
    236252
    237253!---reduce to a klon_glo grid
    238         DO band=1, NLW
    239           CALL grid2dTo1d_glo(taulwaerstrat_mois(:,:,:,band),taulwaerstrat_mois_glo(:,:,band))
    240         ENDDO
    241 
     254          DO band=1, NLW
     255            CALL grid2dTo1d_glo(taulwaerstrat_mois(:,:,:,band),taulwaerstrat_mois_glo(:,:,band))
     256          ENDDO
     257        ENDIF
     258     
    242259      ELSE !--proc other than mpi_root and omp_root
    243260           !--dummy allocation needed for debug mode
     
    248265        ALLOCATE(taulwaerstrat_mois_glo(1,1,1))
    249266
     267        ALLOCATE(tauaerstrat(0,0,0,12))
     268        ALLOCATE(pizaerstrat(0,0,0,12))
     269        ALLOCATE(cgaerstrat(0,0,0,12))
     270        ALLOCATE(taulwaerstrat(0,0,0,12))
     271
     272
    250273      ENDIF !--is_mpi_root and is_omp_root
    251274
     
    255278      mth_pre=mth_cur
    256279
     280      IF (grid_type==unstructured) THEN
     281
     282        IF (is_omp_master) THEN
     283          ALLOCATE(tauaerstrat_mpi(klon_mpi, klev, NSW))
     284          ALLOCATE(pizaerstrat_mpi(klon_mpi, klev, NSW))
     285          ALLOCATE(cgaerstrat_mpi(klon_mpi, klev, NSW))       
     286          ALLOCATE(taulwaerstrat_mpi(klon_mpi, klev, NLW))
     287         
     288          CALL xios_send_field("tauaerstrat_in",SPREAD(tauaerstrat(:,:,:,mth_cur),1,8))
     289          CALL xios_recv_field("tauaerstrat_out",tauaerstrat_mpi)
     290          CALL xios_send_field("pizaerstrat_in",SPREAD(pizaerstrat(:,:,:,mth_cur),1,8))
     291          CALL xios_recv_field("pizaerstrat_out",pizaerstrat_mpi)
     292          CALL xios_send_field("cgaerstrat_in",SPREAD(cgaerstrat(:,:,:,mth_cur),1,8))
     293          CALL xios_recv_field("cgaerstrat_out",cgaerstrat_mpi)
     294          CALL xios_send_field("taulwaerstrat_in",SPREAD(taulwaerstrat(:,:,:,mth_cur),1,8))
     295          CALL xios_recv_field("taulwaerstrat_out",taulwaerstrat_mpi)
     296        ELSE
     297          ALLOCATE(tauaerstrat_mpi(0, 0, 0))
     298          ALLOCATE(pizaerstrat_mpi(0, 0, 0))
     299          ALLOCATE(cgaerstrat_mpi(0, 0, 0))       
     300          ALLOCATE(taulwaerstrat_mpi(0, 0, 0))
     301        ENDIF 
     302       
     303        CALL scatter_omp(tauaerstrat_mpi,tau_aer_strat)
     304        CALL scatter_omp(pizaerstrat_mpi,piz_aer_strat)
     305        CALL scatter_omp(cgaerstrat_mpi,cg_aer_strat)
     306        CALL scatter_omp(taulwaerstrat_mpi,taulw_aer_strat)
     307      ELSE 
     308       
    257309!--scatter on all proc
    258       CALL scatter(tauaerstrat_mois_glo,tau_aer_strat)
    259       CALL scatter(pizaerstrat_mois_glo,piz_aer_strat)
    260       CALL scatter(cgaerstrat_mois_glo,cg_aer_strat)
    261       CALL scatter(taulwaerstrat_mois_glo,taulw_aer_strat)
     310        CALL scatter(tauaerstrat_mois_glo,tau_aer_strat)
     311        CALL scatter(pizaerstrat_mois_glo,piz_aer_strat)
     312        CALL scatter(cgaerstrat_mois_glo,cg_aer_strat)
     313        CALL scatter(taulwaerstrat_mois_glo,taulw_aer_strat)
     314
     315      ENDIF
    262316
    263317      IF (is_mpi_root.AND.is_omp_root) THEN
    264 !
    265         DEALLOCATE(tauaerstrat, pizaerstrat, cgaerstrat)
    266318        DEALLOCATE(tauaerstrat_mois, pizaerstrat_mois, cgaerstrat_mois)
    267         DEALLOCATE(taulwaerstrat,taulwaerstrat_mois)
    268 !
    269       ENDIF !--is_mpi_root and is_omp_root
    270 
    271       DEALLOCATE(tauaerstrat_mois_glo,pizaerstrat_mois_glo,cgaerstrat_mois_glo)
    272       DEALLOCATE(taulwaerstrat_mois_glo)
     319        DEALLOCATE(taulwaerstrat_mois)
     320        DEALLOCATE(tauaerstrat, pizaerstrat, cgaerstrat,taulwaerstrat)
     321      ENDIF
     322     
    273323
    274324!$OMP BARRIER
  • LMDZ6/trunk/libf/phylmd/rrtm/suinit.F90

    r1990 r3435  
    126126ALLOCATE(VDELA  (MAX(JPMXLE,NFLEVG)))
    127127ALLOCATE(VDELB  (MAX(JPMXLE,NFLEVG)))
     128VDELB = 0  !ym missing init
    128129ALLOCATE( VC      (NFLEVG) )
     130VC = 0    !ym missing init
    129131ALLOCATE( NLOEN   (NPROMA) )
    130132ALLOCATE( NLOENG   (NPROMA) )
Note: See TracChangeset for help on using the changeset viewer.