Ignore:
Timestamp:
Apr 2, 2016, 4:09:43 PM (9 years ago)
Author:
emillour
Message:

Mars GCM:

  • 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.
  • Added "ioipsl_getin_p_mod.F90" (getin_p routine) in phy_common to correctly read in parameters from *.def files in a parallel environment.

EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/phymars/iniwrite.F

    r1524 r1528  
    1       SUBROUTINE iniwrite(nid,idayref,phis)
     1      SUBROUTINE iniwrite(nid,idayref,phis,area)
    22
    33      use comsoil_h, only: mlayer, nsoilmx
     
    88      USE time_phylmdz_mod, ONLY: hour_ini, daysec, dtphys
    99      USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0
     10      USE regular_lonlat_mod, ONLY: lon_reg, lat_reg
     11      USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, nbp_lev
    1012      IMPLICIT NONE
    1113
     
    2628c   -------------
    2729
    28 #include "dimensions.h"
    29 #include "paramet.h"
    30 #include "comgeom.h"
    31 #include "netcdf.inc"
     30      include "netcdf.inc"
    3231
    3332c   Arguments:
     
    3635      integer,intent(in) :: nid        ! NetCDF file ID
    3736      INTEGER*4,intent(in) :: idayref  ! date (initial date for this run)
    38       real,intent(in) :: phis(ip1jmp1) ! surface geopotential
     37      real,intent(in) :: phis(nbp_lon+1,nbp_lat) ! surface geopotential
     38      real,intent(in) :: area(nbp_lon+1,nbp_lat) ! mesh area (m2)
    3939
    4040c   Local:
     
    4444      REAL tab_cntrl(length) ! run parameters are stored in this array
    4545      INTEGER ierr
    46 
    47       integer :: nvarid,idim_index,idim_rlonu,idim_rlonv
    48       integer :: idim_rlatu,idim_rlatv,idim_llmp1,idim_llm
     46      REAl :: lon_reg_ext(nbp_lon+1) ! extended longitudes
     47
     48      integer :: nvarid,idim_index,idim_rlonv
     49      integer :: idim_rlatu,idim_llmp1,idim_llm
    4950      integer :: idim_nsoilmx ! "subsurface_layers" dimension ID #
    5051      integer, dimension(2) :: id 
     
    5455         tab_cntrl(l)=0.
    5556      ENDDO
    56       tab_cntrl(1)  = real(iim)
    57       tab_cntrl(2)  = real(jjm)
    58       tab_cntrl(3)  = real(llm)
     57      tab_cntrl(1)  = real(nbp_lon)
     58      tab_cntrl(2)  = real(nbp_lat-1)
     59      tab_cntrl(3)  = real(nbp_lev)
    5960      tab_cntrl(4)  = real(idayref)
    6061      tab_cntrl(5)  = rad
     
    101102
    102103      ierr = NF_DEF_DIM (nid, "index", length, idim_index)
    103       ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu)
    104       ierr = NF_DEF_DIM (nid, "latitude", jjp1, idim_rlatu)
    105       ierr = NF_DEF_DIM (nid, "longitude", iip1, idim_rlonv)
    106       ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv)
    107       ierr = NF_DEF_DIM (nid, "interlayer", (llm+1), idim_llmp1)
    108       ierr = NF_DEF_DIM (nid, "altitude", llm, idim_llm)
     104!      ierr = NF_DEF_DIM (nid, "rlonu", iip1, idim_rlonu)
     105      ierr = NF_DEF_DIM (nid, "latitude", nbp_lat, idim_rlatu)
     106      ierr = NF_DEF_DIM (nid, "longitude", nbp_lon+1, idim_rlonv)
     107!      ierr = NF_DEF_DIM (nid, "rlatv", jjm, idim_rlatv)
     108      ierr = NF_DEF_DIM (nid, "interlayer", (nbp_lev+1), idim_llmp1)
     109      ierr = NF_DEF_DIM (nid, "altitude", nbp_lev, idim_llm)
    109110      ierr = NF_DEF_DIM (nid,"subsurface_layers",nsoilmx,idim_nsoilmx)
    110111c
     
    131132c --------------------------
    132133c  longitudes and latitudes
    133       ierr = NF_REDEF (nid)
    134 #ifdef NC_DOUBLE
    135       ierr = NF_DEF_VAR (nid, "rlonu", NF_DOUBLE, 1, idim_rlonu,nvarid)
    136 #else
    137       ierr = NF_DEF_VAR (nid, "rlonu", NF_FLOAT, 1, idim_rlonu,nvarid)
    138 #endif
    139       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21,
    140      .                       "Longitudes at u nodes")
    141       ierr = NF_ENDDEF(nid)
    142 #ifdef NC_DOUBLE
    143       ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu/pi*180)
    144 #else
    145       ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu/pi*180)
    146 #endif
     134!
     135!      ierr = NF_REDEF (nid)
     136!#ifdef NC_DOUBLE
     137!      ierr = NF_DEF_VAR (nid, "rlonu", NF_DOUBLE, 1, idim_rlonu,nvarid)
     138!#else
     139!      ierr = NF_DEF_VAR (nid, "rlonu", NF_FLOAT, 1, idim_rlonu,nvarid)
     140!#endif
     141!      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 21,
     142!     .                       "Longitudes at u nodes")
     143!      ierr = NF_ENDDEF(nid)
     144!#ifdef NC_DOUBLE
     145!      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonu/pi*180)
     146!#else
     147!      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonu/pi*180)
     148!#endif
    147149c
    148150c --------------------------
     
    158160      ierr = NF_ENDDEF(nid)
    159161#ifdef NC_DOUBLE
    160       ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatu/pi*180)
    161 #else
    162       ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatu/pi*180)
    163 #endif
    164 c
    165 c --------------------------
     162      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lat_reg/pi*180)
     163#else
     164      ierr = NF_PUT_VAR_REAL (nid,nvarid,lat_reg/pi*180)
     165#endif
     166c
     167c --------------------------
     168      lon_reg_ext(1:nbp_lon)=lon_reg(1:nbp_lon)
     169      !add extra redundant point (180 degrees, since lon_reg starts at -180
     170      lon_reg_ext(nbp_lon+1)=-lon_reg_ext(1)
     171
    166172      ierr = NF_REDEF (nid)
    167173#ifdef NC_DOUBLE
     
    175181      ierr = NF_ENDDEF(nid)
    176182#ifdef NC_DOUBLE
    177       ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlonv/pi*180)
    178 #else
    179       ierr = NF_PUT_VAR_REAL (nid,nvarid,rlonv/pi*180)
     183      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,lon_reg_ext/pi*180)
     184#else
     185      ierr = NF_PUT_VAR_REAL (nid,nvarid,lon_reg_ext/pi*180)
    180186#endif
    181187c
     
    201207c
    202208c --------------------------
    203       ierr = NF_REDEF (nid)
    204 #ifdef NC_DOUBLE
    205       ierr = NF_DEF_VAR (nid, "rlatv", NF_DOUBLE, 1, idim_rlatv,nvarid)
    206 #else
    207       ierr = NF_DEF_VAR (nid, "rlatv", NF_FLOAT, 1, idim_rlatv,nvarid)
    208 #endif
    209       ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20,
    210      .                       "Latitudes at v nodes")
    211       ierr = NF_ENDDEF(nid)
    212 #ifdef NC_DOUBLE
    213       ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv/pi*180)
    214 #else
    215       ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv/pi*180)
    216 #endif
     209!      ierr = NF_REDEF (nid)
     210!#ifdef NC_DOUBLE
     211!      ierr = NF_DEF_VAR (nid, "rlatv", NF_DOUBLE, 1, idim_rlatv,nvarid)
     212!#else
     213!      ierr = NF_DEF_VAR (nid, "rlatv", NF_FLOAT, 1, idim_rlatv,nvarid)
     214!#endif
     215!      ierr = NF_PUT_ATT_TEXT (nid,nvarid,"title", 20,
     216!     .                       "Latitudes at v nodes")
     217!      ierr = NF_ENDDEF(nid)
     218!#ifdef NC_DOUBLE
     219!      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,rlatv/pi*180)
     220!#else
     221!      ierr = NF_PUT_VAR_REAL (nid,nvarid,rlatv/pi*180)
     222!#endif
    217223c
    218224c --------------------------
     
    276282c  Mesh area and conversion coefficients cov. <-> contra. <--> natural
    277283
    278       id(1)=idim_rlonu
    279       id(2)=idim_rlatu
    280 c
    281       ierr = NF_REDEF (nid)
    282 #ifdef NC_DOUBLE
    283       ierr = NF_DEF_VAR (nid, "cu", NF_DOUBLE, 2, id,nvarid)
    284 #else
    285       ierr = NF_DEF_VAR (nid, "cu", NF_FLOAT, 2, id,nvarid)
    286 #endif
    287       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40,
    288      .             "Conversion coefficients cov <--> natural")
    289       ierr = NF_ENDDEF(nid)
    290 #ifdef NC_DOUBLE
    291       ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu)
    292 #else
    293       ierr = NF_PUT_VAR_REAL (nid,nvarid,cu)
    294 #endif
    295 c
    296       id(1)=idim_rlonv
    297       id(2)=idim_rlatv
    298 c
    299 c --------------------------
    300       ierr = NF_REDEF (nid)
    301 #ifdef NC_DOUBLE
    302       ierr = NF_DEF_VAR (nid, "cv", NF_DOUBLE, 2, id,nvarid)
    303 #else
    304       ierr = NF_DEF_VAR (nid, "cv", NF_FLOAT, 2, id,nvarid)
    305 #endif
    306       ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40,
    307      .             "Conversion coefficients cov <--> natural")
    308       ierr = NF_ENDDEF(nid)
    309 #ifdef NC_DOUBLE
    310       ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv)
    311 #else
    312       ierr = NF_PUT_VAR_REAL (nid,nvarid,cv)
    313 #endif
     284!      id(1)=idim_rlonu
     285!      id(2)=idim_rlatu
     286c
     287!      ierr = NF_REDEF (nid)
     288!#ifdef NC_DOUBLE
     289!      ierr = NF_DEF_VAR (nid, "cu", NF_DOUBLE, 2, id,nvarid)
     290!#else
     291!      ierr = NF_DEF_VAR (nid, "cu", NF_FLOAT, 2, id,nvarid)
     292!#endif
     293!      ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40,
     294!     .             "Conversion coefficients cov <--> natural")
     295!      ierr = NF_ENDDEF(nid)
     296!#ifdef NC_DOUBLE
     297!      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cu)
     298!#else
     299!      ierr = NF_PUT_VAR_REAL (nid,nvarid,cu)
     300!#endif
     301c
     302!      id(1)=idim_rlonv
     303!      id(2)=idim_rlatv
     304c
     305c --------------------------
     306!      ierr = NF_REDEF (nid)
     307!#ifdef NC_DOUBLE
     308!      ierr = NF_DEF_VAR (nid, "cv", NF_DOUBLE, 2, id,nvarid)
     309!#else
     310!      ierr = NF_DEF_VAR (nid, "cv", NF_FLOAT, 2, id,nvarid)
     311!#endif
     312!      ierr = NF_PUT_ATT_TEXT (nid, nvarid, "title", 40,
     313!     .             "Conversion coefficients cov <--> natural")
     314!      ierr = NF_ENDDEF(nid)
     315!#ifdef NC_DOUBLE
     316!      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,cv)
     317!#else
     318!      ierr = NF_PUT_VAR_REAL (nid,nvarid,cv)
     319!#endif
    314320c
    315321      id(1)=idim_rlonv
     
    327333      ierr = NF_ENDDEF(nid)
    328334#ifdef NC_DOUBLE
    329       ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,aire)
    330 #else
    331       ierr = NF_PUT_VAR_REAL (nid,nvarid,aire)
     335      ierr = NF_PUT_VAR_DOUBLE (nid,nvarid,area)
     336#else
     337      ierr = NF_PUT_VAR_REAL (nid,nvarid,area)
    332338#endif
    333339c
     
    352358c
    353359
    354       write(*,*)'iniwrite: iim,jjm,llm,idayref',iim,jjm,llm,idayref
     360      write(*,*)'iniwrite: nbp_lon,nbp_lat,nbp_lev,idayref',
     361     & nbp_lon,nbp_lat,nbp_lev,idayref
    355362      write(*,*)'iniwrite: rad,omeg,g,mugaz,rcp',
    356      s rad,omeg,g,mugaz,rcp
     363     & rad,omeg,g,mugaz,rcp
    357364      write(*,*)'iniwrite: daysec,dtphys',daysec,dtphys
    358365
Note: See TracChangeset for help on using the changeset viewer.