Ignore:
Timestamp:
Apr 5, 2016, 10:51:51 AM (9 years ago)
Author:
emillour
Message:

Generic GCM: Towards a cleaner separation between physics and dynamics

  • Got rid of references to "dimensions.h" from physics packages: use nbp_lon (=iim), nbp_lat (=jjp1) and nbp_lev from module mod_grid_phy_lmdz (in phy_common) instead.
  • Removed module "comhdiff_mod.F90", as it is only used by module surf_heat_transp_mod.F90, moved module variables there.
  • Addedin "surf_heat_transp_mod" local versions of some arrays and routines (from dyn3d) required to compute gradient, divergence, etc. on the global dynamics grid. As before, the slab ocean only works in serial.

EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/phystd/writediagspecIR.F

    r1525 r1529  
    4343! Addition by RW (2010) to allow OLR to be saved in .nc format
    4444      use radinc_h, only : L_NSPECTI
    45 !      USE surfdat_h, only : phisfi
    46 #ifdef CPP_PARA
     45      use comgeomphy, only: airephy
    4746      use mod_phys_lmdz_para, only : is_mpi_root, is_master, gather
    48       use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo
    49 #endif
     47      use mod_grid_phy_lmdz, only : klon_glo, Grid1Dto2D_glo,
     48     &                              nbp_lon, nbp_lat
    5049      use time_phylmdz_mod, only: ecritphy, iphysiq, day_step, day_ini
    5150      use callkeys_mod, only: iradia
     
    5352      implicit none
    5453
    55 ! Commons
    56 #include "dimensions.h"
    57 !#include "dimphys.h"
    58 #include "paramet.h"
    59 !#include "control.h"
    60 #include "comgeom.h"
    61 #include "netcdf.inc"
     54      include "netcdf.inc"
    6255
    6356! Arguments on input:
     
    7366!      real dx0
    7467
    75       real date
    76 
    77 !      REAL phis(ip1jmp1)
    78 
    7968      integer irythme
    8069      integer ierr
     
    8271      integer i,j,l,zmax , ig0
    8372
    84       integer zitau
    85       character firstnom*20
    86       SAVE firstnom
    87       SAVE zitau
    88       SAVE date
    89       data firstnom /'1234567890'/
    90       data zitau /0/
     73      integer,save :: zitau=0
     74      character(len=20),save :: firstnom='1234567890'
     75      real,save :: date
    9176!$OMP THREADPRIVATE(firstnom,zitau,date)
    9277
     
    10085      integer, dimension(4) :: edges,corner
    10186
     87      real area((nbp_lon+1),nbp_lat)
    10288! added by RDW for OLR output
    103        real dx3(iip1,jjp1,L_NSPECTI) ! to store the data set
     89       real dx3(nbp_lon+1,nbp_lat,L_NSPECTI) ! to store the data set
    10490
    10591#ifdef CPP_PARA
    10692! Added to work in parallel mode
    10793      real dx3_glop(klon_glo,L_NSPECTI)
    108       real dx3_glo(iim,jjp1,L_NSPECTI) ! to store a global 3D data set
    109 #else
    110       logical,parameter :: is_master=.true.
    111       logical,parameter :: is_mpi_root=.true.
     94      real dx3_glo(nbp_lon,nbp_lat,L_NSPECTI) ! to store a global 3D data set
     95      real areafi_glo(klon_glo) ! mesh area on global physics grid
     96#else
     97      real areafi_glo(ngrid) ! mesh area on global physics grid
    11298#endif
    11399
     
    139125         endif
    140126
     127#ifdef CPP_PARA
     128          ! Gather airephy() mesh area on physics grid
     129          call Gather(airephy,areafi_glo)
     130#else
     131         areafi_glo(:)=airephy(:)
     132#endif
    141133         ! Create the NetCDF file
    142134         if (is_master) then
     
    159151         ierr = NF_ENDDEF(nid)
    160152
    161 !         call gr_fi_dyn(1,size(phisfi_glo),iip1,jjp1,phisfi_glo,phis)
     153         ! Build area()
     154         do i=1,nbp_lon+1 ! poles
     155           ! divide at the poles by nbp_lon
     156           area(i,1)=areafi_glo(1)/nbp_lon
     157           area(i,nbp_lat)=areafi_glo(klon_glo)/nbp_lon
     158         enddo
     159         do j=2,nbp_lat-1
     160           ig0= 1+(j-2)*nbp_lon
     161           do i=1,nbp_lon
     162              area(i,j)=areafi_glo(ig0+i)
     163           enddo
     164           ! handle redundant point in longitude
     165           area(nbp_lon+1,j)=area(1,j)
     166         enddo
     167
    162168         ! write "header" of file (longitudes, latitudes, area, ...)
    163          call iniwrite_specIR(nid,day_ini)
     169         call iniwrite_specIR(nid,day_ini,area)
    164170         endif ! of if (is_master)
    165171
     
    215221             endif
    216222
    217              write(6,*)'WRITEDIAGSPEC: date= ', date
     223             write(6,*)'WRITEDIAGSPECIR: date= ', date
    218224           endif ! of if (is_master)
    219225        end if ! of if (nom.eq.firstnom)
     
    233239            call Grid1Dto2D_glo(dx3_glop,dx3_glo)
    234240            ! copy dx3_glo() to dx3(:) and add redundant longitude
    235             dx3(1:iim,:,:)=dx3_glo(1:iim,:,:)
    236             dx3(iip1,:,:)=dx3(1,:,:)
     241            dx3(1:nbp_lon,:,:)=dx3_glo(1:nbp_lon,:,:)
     242            dx3(nbp_lon+1,:,:)=dx3(1,:,:)
    237243          endif
    238244!$OMP END MASTER
     
    240246#else
    241247           DO l=1,L_NSPECTI
    242              DO i=1,iip1
     248             DO i=1,nbp_lon+1
    243249                dx3(i,1,l)=px(1,l)
    244                 dx3(i,jjp1,l)=px(ngrid,l)
     250                dx3(i,nbp_lat,l)=px(ngrid,l)
    245251             ENDDO
    246              DO j=2,jjm
    247                 ig0= 1+(j-2)*iim
    248                 DO i=1,iim
     252             DO j=2,nbp_lat-1
     253                ig0= 1+(j-2)*nbp_lon
     254                DO i=1,nbp_lon
    249255                   dx3(i,j,l)=px(ig0+i,l)
    250256                ENDDO
    251                 dx3(iip1,j,l)=dx3(1,j,l)
     257                dx3(nbp_lon+1,j,l)=dx3(1,j,l)
    252258             ENDDO
    253259           ENDDO
     
    279285           corner(4)=ntime
    280286
    281            edges(1)=iip1
    282            edges(2)=jjp1
     287           edges(1)=nbp_lon+1
     288           edges(2)=nbp_lat
    283289           edges(3)=L_NSPECTI
    284290           edges(4)=1
Note: See TracChangeset for help on using the changeset viewer.