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/writediagspecVI.F

    r1525 r1529  
    4343! Addition by RW (2010) to allow OSR to be saved in .nc format
    4444      use radinc_h, only : L_NSPECTV
    45 !      USE surfdat_h
    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 OSR output
    103        real dx3(iip1,jjp1,L_NSPECTV) ! to store the data set
     89       real dx3(nbp_lon+1,nbp_lat,L_NSPECTV) ! to store the data set
    10490
    10591#ifdef CPP_PARA
    10692! Added to work in parallel mode
    10793      real dx3_glop(klon_glo,L_NSPECTV)
    108       real dx3_glo(iim,jjp1,L_NSPECTV) ! 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_NSPECTV) ! 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
     
    138124         endif
    139125
     126#ifdef CPP_PARA
     127          ! Gather airephy() mesh area on physics grid
     128          call Gather(airephy,areafi_glo)
     129#else
     130         areafi_glo(:)=airephy(:)
     131#endif
    140132         ! Create the NetCDF file
    141133         if (is_master) then
     
    158150         ierr = NF_ENDDEF(nid)
    159151
     152         ! Build area()
     153         do i=1,nbp_lon+1 ! poles
     154           ! divide at the poles by nbp_lon
     155           area(i,1)=areafi_glo(1)/nbp_lon
     156           area(i,nbp_lat)=areafi_glo(klon_glo)/nbp_lon
     157         enddo
     158         do j=2,nbp_lat-1
     159           ig0= 1+(j-2)*nbp_lon
     160           do i=1,nbp_lon
     161              area(i,j)=areafi_glo(ig0+i)
     162           enddo
     163           ! handle redundant point in longitude
     164           area(nbp_lon+1,j)=area(1,j)
     165         enddo
     166
    160167         ! write "header" of file (longitudes, latitudes, geopotential, ...)
    161 !         call gr_fi_dyn(1,ngrid,iip1,jjp1,phisfi,phis)
    162 !         call iniwrite(nid,day_ini,phis)
    163          call iniwrite_specVI(nid,day_ini)
     168         call iniwrite_specVI(nid,day_ini,area)
    164169         endif ! of if (is_master)
    165170
     
    215220             endif
    216221
    217              write(6,*)'WRITEDIAGSPEC: date= ', date
     222             write(6,*)'WRITEDIAGSPECVI: date= ', date
    218223           endif ! of if (is_master)
    219224        end if ! of if (nom.eq.firstnom)
     
    233238            call Grid1Dto2D_glo(dx3_glop,dx3_glo)
    234239            ! copy dx3_glo() to dx3(:) and add redundant longitude
    235             dx3(1:iim,:,:)=dx3_glo(1:iim,:,:)
    236             dx3(iip1,:,:)=dx3(1,:,:)
     240            dx3(1:nbp_lon,:,:)=dx3_glo(1:nbp_lon,:,:)
     241            dx3(nbp_lon+1,:,:)=dx3(1,:,:)
    237242          endif
    238243!$OMP END MASTER
     
    240245#else
    241246           DO l=1,L_NSPECTV
    242              DO i=1,iip1
     247             DO i=1,nbp_lon+1
    243248                dx3(i,1,l)=px(1,l)
    244                 dx3(i,jjp1,l)=px(ngrid,l)
     249                dx3(i,nbp_lat,l)=px(ngrid,l)
    245250             ENDDO
    246              DO j=2,jjm
    247                 ig0= 1+(j-2)*iim
    248                 DO i=1,iim
     251             DO j=2,nbp_lat-1
     252                ig0= 1+(j-2)*nbp_lon
     253                DO i=1,nbp_lon
    249254                   dx3(i,j,l)=px(ig0+i,l)
    250255                ENDDO
    251                 dx3(iip1,j,l)=dx3(1,j,l)
     256                dx3(nbp_lon+1,j,l)=dx3(1,j,l)
    252257             ENDDO
    253258           ENDDO
     
    279284           corner(4)=ntime
    280285
    281            edges(1)=iip1
    282            edges(2)=jjp1
     286           edges(1)=nbp_lon+1
     287           edges(2)=nbp_lat
    283288           edges(3)=L_NSPECTV
    284289           edges(4)=1
Note: See TracChangeset for help on using the changeset viewer.