Ignore:
Timestamp:
Apr 22, 2016, 9:02:11 AM (9 years ago)
Author:
emillour
Message:

All models: Further adaptations to keep up with changes in LMDZ5 concerning
physics/dynamics separation:

  • dyn3d:
  • adapted gcm.F so that all physics initializations are now done in iniphysiq.
  • dyn3dpar:
  • adapted gcm.F so that all physics initializations are now done in iniphysiq.
  • updated calfis_p.F to follow up with changes.
  • copied over updated "bands.F90" from LMDZ5.
  • dynphy_lonlat:
  • calfis_p.F90, mod_interface_dyn_phys.F90, follow up of changes in phy_common/mod_* routines
  • phy_common:
  • added "geometry_mod.F90" to store information about the grid (replaces phy*/comgeomphy.F90) and give variables friendlier names: rlond => longitude , rlatd => latitude, airephy => cell_area, cuphy => dx , cvphy => dy
  • added "physics_distribution_mod.F90"
  • updated "mod_grid_phy_lmdz.F90", "mod_phys_lmdz_mpi_data.F90", "mod_phys_lmdz_para.F90", "mod_phys_lmdz_mpi_transfert.F90", "mod_grid_phy_lmdz.F90", "mod_phys_lmdz_omp_data.F90", "mod_phys_lmdz_omp_transfert.F90", "write_field_phy.F90" and "ioipsl_getin_p_mod.F90" to LMDZ5 versions.
  • phy[venus/titan/mars/std]:
  • removed "init_phys_lmdz.F90", "comgeomphy.F90"; adapted routines to use geometry_mod (longitude, latitude, cell_area, etc.)

EM

Location:
trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/iniphysiq_mod.F90

    r1542 r1543  
    33CONTAINS
    44
    5 subroutine iniphysiq(ii,jj,nlayer,punjours, pdayref,ptimestep,           &
    6                rlatudyn,rlatvdyn,rlonudyn,rlonvdyn,airedyn,cudyn,cvdyn,  &
     5subroutine iniphysiq(ii,jj,nlayer, &
     6                     nbp, communicator, &
     7                     punjours, pdayref,ptimestep, &
     8                     rlatudyn,rlatvdyn,rlonudyn,rlonvdyn, &
     9                     airedyn,cudyn,cvdyn, &
    710                     prad,pg,pr,pcpp,iflag_phys)
    811
    9 use dimphy, only : klev ! number of atmospheric levels
    10 use mod_grid_phy_lmdz, only : klon_glo ! number of atmospheric columns
    11                                        ! (on full grid)
     12use dimphy, only : init_dimphy
     13use mod_grid_phy_lmdz, only : klon_glo, & ! number of atmospheric columns (on full grid)
     14                              regular_lonlat  ! regular longitude-latitude grid type
    1215use mod_phys_lmdz_para, only : klon_omp, & ! number of columns (on local omp grid)
    1316                               klon_omp_begin, & ! start index of local omp subgrid
     
    1518                               klon_mpi_begin ! start indes of columns (on local mpi grid)
    1619use control_mod, only: nday
    17 use comgeomphy, only : initcomgeomphy, &
    18                        cell_area, & ! physics grid area (m2)
    19                        dx, & ! cu coeff. (u_covariant = cu * u)
    20                        dy, & ! cv coeff. (v_covariant = cv * v)
    21                        longitude, & ! longitudes (rad)
    22                        latitude ! latitudes (rad)
     20use geometry_mod, only: init_geometry, &
     21                        cell_area, & ! physics grid area (m2)
     22                        longitude, & ! longitudes (rad)
     23                        latitude ! latitudes (rad)
     24!use comgeomphy, only : initcomgeomphy, &
     25!                       cell_area, & ! physics grid area (m2)
     26!                       dx, & ! cu coeff. (u_covariant = cu * u)
     27!                       dy, & ! cv coeff. (v_covariant = cv * v)
     28!                       longitude, & ! longitudes (rad)
     29!                       latitude ! latitudes (rad)
    2330use surf_heat_transp_mod, only: ini_surf_heat_transp
    2431use infotrac, only : nqtot ! number of advected tracers
     
    2633USE comvert_mod, ONLY: ap,bp,preff
    2734use inifis_mod, only: inifis
     35use physics_distribution_mod, only: init_physics_distribution
    2836use regular_lonlat_mod, only: init_regular_lonlat, &
    2937                              east, west, north, south, &
    3038                              north_east, north_west, &
    3139                              south_west, south_east
     40use mod_interface_dyn_phys, only: init_interface_dyn_phys
    3241use ioipsl_getin_p_mod, only: getin_p
    3342
     
    4756integer,intent(in) :: ii ! number of atmospheric coulumns along longitudes
    4857integer,intent(in) :: jj  ! number of atompsheric columns along latitudes
     58integer,intent(in) :: nbp ! number of physics columns for this MPI process
     59integer,intent(in) :: communicator ! MPI communicator
    4960real,intent(in) :: rlatudyn(jj+1) ! latitudes of the physics grid
    5061real,intent(in) :: rlatvdyn(jj) ! latitude boundaries of the physics grid
     
    5970
    6071integer :: ibegin,iend,offset
    61 integer :: i,j
     72integer :: i,j,k
    6273character(len=20) :: modname='iniphysiq'
    6374character(len=80) :: abort_message
     
    7182
    7283! global array, on full physics grid:
    73 real,allocatable :: latfi(:)
    74 real,allocatable :: lonfi(:)
    75 real,allocatable :: cufi(:)
    76 real,allocatable :: cvfi(:)
    77 real,allocatable :: airefi(:)
     84real,allocatable :: latfi_glo(:)
     85real,allocatable :: lonfi_glo(:)
     86real,allocatable :: cufi_glo(:)
     87real,allocatable :: cvfi_glo(:)
     88real,allocatable :: airefi_glo(:)
     89real,allocatable :: boundslonfi_glo(:,:)
     90real,allocatable :: boundslatfi_glo(:,:)
     91
     92! local arrays, on given MPI/OpenMP domain:
     93real,allocatable,save :: latfi(:)
     94real,allocatable,save :: lonfi(:)
     95real,allocatable,save :: cufi(:)
     96real,allocatable,save :: cvfi(:)
     97real,allocatable,save :: airefi(:)
     98real,allocatable,save :: boundslonfi(:,:)
     99real,allocatable,save :: boundslatfi(:,:)
     100!$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)
    78101
    79102pi=2.*asin(1.0)
    80103
    81 IF (nlayer.NE.klev) THEN
    82   write(*,*) 'STOP in ',trim(modname)
    83   write(*,*) 'Problem with dimensions :'
    84   write(*,*) 'nlayer     = ',nlayer
    85   write(*,*) 'klev   = ',klev
    86   abort_message = ''
    87   CALL abort_gcm (modname,abort_message,1)
    88 ENDIF
    89 
    90 !IF (ngrid.NE.klon_glo) THEN
    91 !  write(*,*) 'STOP in ',trim(modname)
    92 !  write(*,*) 'Problem with dimensions :'
    93 !  write(*,*) 'ngrid     = ',ngrid
    94 !  write(*,*) 'klon   = ',klon_glo
    95 !  abort_message = ''
    96 !  CALL abort_gcm (modname,abort_message,1)
    97 !ENDIF
    98 
    99 !call init_phys_lmdz(iim,jjm+1,llm,1,(/(jjm-1)*iim+2/))
     104! Initialize Physics distibution and parameters and interface with dynamics
     105CALL init_physics_distribution(regular_lonlat,4, &
     106                                 nbp,ii,jj+1,nlayer,communicator)
     107CALL init_interface_dyn_phys
    100108
    101109! init regular global longitude-latitude grid points and boundaries
     
    122130
    123131! Generate global arrays on full physics grid
    124 allocate(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo))
    125 latfi(1)=rlatudyn(1)
    126 lonfi(1)=0.
    127 cufi(1) = cudyn(1)
    128 cvfi(1) = cvdyn(1)
     132allocate(latfi_glo(klon_glo),lonfi_glo(klon_glo))
     133allocate(cufi_glo(klon_glo),cvfi_glo(klon_glo))
     134allocate(airefi_glo(klon_glo))
     135allocate(boundslonfi_glo(klon_glo,4))
     136allocate(boundslatfi_glo(klon_glo,4))
     137
     138! North pole
     139latfi_glo(1)=rlatudyn(1)
     140lonfi_glo(1)=0.
     141cufi_glo(1) = cudyn(1)
     142cvfi_glo(1) = cvdyn(1)
     143boundslonfi_glo(1,north_east)=0
     144boundslatfi_glo(1,north_east)=PI/2
     145boundslonfi_glo(1,north_west)=2*PI
     146boundslatfi_glo(1,north_west)=PI/2
     147boundslonfi_glo(1,south_west)=2*PI
     148boundslatfi_glo(1,south_west)=rlatvdyn(1)
     149boundslonfi_glo(1,south_east)=0
     150boundslatfi_glo(1,south_east)=rlatvdyn(1)
    129151DO j=2,jj
    130152  DO i=1,ii
    131     latfi((j-2)*ii+1+i)= rlatudyn(j)
    132     lonfi((j-2)*ii+1+i)= rlonvdyn(i)
    133     cufi((j-2)*ii+1+i) = cudyn((j-1)*(ii+1)+i)
    134     cvfi((j-2)*ii+1+i) = cvdyn((j-1)*(ii+1)+i)
     153    k=(j-2)*ii+1+i
     154    latfi_glo((j-2)*ii+1+i)= rlatudyn(j)
     155    lonfi_glo((j-2)*ii+1+i)= rlonvdyn(i)
     156    cufi_glo((j-2)*ii+1+i) = cudyn((j-1)*(ii+1)+i)
     157    cvfi_glo((j-2)*ii+1+i) = cvdyn((j-1)*(ii+1)+i)
     158    boundslonfi_glo(k,north_east)=rlonudyn(i)
     159    boundslatfi_glo(k,north_east)=rlatvdyn(j-1)
     160    boundslonfi_glo(k,north_west)=rlonudyn(i+1)
     161    boundslatfi_glo(k,north_west)=rlatvdyn(j-1)
     162    boundslonfi_glo(k,south_west)=rlonudyn(i+1)
     163    boundslatfi_glo(k,south_west)=rlatvdyn(j)
     164    boundslonfi_glo(k,south_east)=rlonudyn(i)
     165    boundslatfi_glo(k,south_east)=rlatvdyn(j)
    135166  ENDDO
    136167ENDDO
    137 latfi(klon_glo)= rlatudyn(jj+1)
    138 lonfi(klon_glo)= 0.
    139 cufi(klon_glo) = cudyn((ii+1)*jj+1)
    140 cvfi(klon_glo) = cvdyn((ii+1)*jj-ii)
     168! South pole
     169latfi_glo(klon_glo)= rlatudyn(jj+1)
     170lonfi_glo(klon_glo)= 0.
     171cufi_glo(klon_glo) = cudyn((ii+1)*jj+1)
     172cvfi_glo(klon_glo) = cvdyn((ii+1)*jj-ii)
     173boundslonfi_glo(klon_glo,north_east)= 0
     174boundslatfi_glo(klon_glo,north_east)= rlatvdyn(jj)
     175boundslonfi_glo(klon_glo,north_west)= 2*PI
     176boundslatfi_glo(klon_glo,north_west)= rlatvdyn(jj)
     177boundslonfi_glo(klon_glo,south_west)= 2*PI
     178boundslatfi_glo(klon_glo,south_west)= -PI/2
     179boundslonfi_glo(klon_glo,south_east)= 0
     180boundslatfi_glo(klon_glo,south_east)= -Pi/2
    141181
    142182! build airefi(), mesh area on physics grid
    143 allocate(airefi(klon_glo))
    144 CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,airedyn,airefi)
     183CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,airedyn,airefi_glo)
    145184! Poles are single points on physics grid
    146 airefi(1)=sum(airedyn(1:ii,1))
    147 airefi(klon_glo)=sum(airedyn(1:ii,jj+1))
     185airefi_glo(1)=sum(airedyn(1:ii,1))
     186airefi_glo(klon_glo)=sum(airedyn(1:ii,jj+1))
    148187
    149188! Sanity check: do total planet area match between physics and dynamics?
    150189total_area_dyn=sum(airedyn(1:ii,1:jj+1))
    151 total_area_phy=sum(airefi(1:klon_glo))
     190total_area_phy=sum(airefi_glo(1:klon_glo))
    152191IF (total_area_dyn/=total_area_phy) THEN
    153192  WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'
     
    164203!$OMP PARALLEL
    165204! Now generate local lon/lat/cu/cv/area arrays
    166 call initcomgeomphy
    167 
    168 !!!!$OMP PARALLEL PRIVATE(ibegin,iend) &
    169 !!!     !$OMP SHARED(airefi,cufi,cvfi,lonfi,latfi)
     205allocate(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))
     206allocate(airefi(klon_omp))
     207allocate(boundslonfi(klon_omp,4))
     208allocate(boundslatfi(klon_omp,4))
     209!call initcomgeomphy
    170210
    171211offset=klon_mpi_begin-1
    172 cell_area(1:klon_omp)=airefi(offset+klon_omp_begin:offset+klon_omp_end)
    173 dx(1:klon_omp)=cufi(offset+klon_omp_begin:offset+klon_omp_end)
    174 dy(1:klon_omp)=cvfi(offset+klon_omp_begin:offset+klon_omp_end)
    175 longitude(1:klon_omp)=lonfi(offset+klon_omp_begin:offset+klon_omp_end)
    176 latitude(1:klon_omp)=latfi(offset+klon_omp_begin:offset+klon_omp_end)
     212airefi(1:klon_omp)=airefi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     213cufi(1:klon_omp)=cufi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     214cvfi(1:klon_omp)=cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     215lonfi(1:klon_omp)=lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     216latfi(1:klon_omp)=latfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     217boundslonfi(1:klon_omp,:)=boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
     218boundslatfi(1:klon_omp,:)=boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
     219
     220! copy over local grid longitudes and latitudes
     221CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &
     222                   airefi,cufi,cvfi)
     223
     224call init_dimphy(klon_omp,nlayer) ! Initialize dimphy module
    177225
    178226! copy over preff , ap() and bp()
  • trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/newstart.F

    r1524 r1543  
    1515c=======================================================================
    1616
     17      use mod_phys_lmdz_para, only: is_parallel, is_sequential,
     18     &                              is_mpi_root, is_omp_root,
     19     &                              is_master
    1720      use infotrac, only: infotrac_init, nqtot, tname
    1821      USE tracer_h, ONLY: igcm_co2_ice, igcm_h2o_vap, igcm_h2o_ice
     
    2023      USE surfdat_h, ONLY: phisfi, albedodat,
    2124     &                     zmea, zstd, zsig, zgam, zthe
    22       USE comgeomfi_h, ONLY: lati, long, area
    2325      use datafile_mod, only: datadir, surfdir
    2426      use ioipsl_getin_p_mod, only: getin_p
     
    2628      use phyredem, only: physdem0, physdem1
    2729      use iostart, only: open_startphy
    28       use comgeomphy, only: initcomgeomphy
    2930      use slab_ice_h, only:noceanmx
    3031      use filtreg_mod, only: inifilr
     32      USE mod_const_mpi, ONLY: COMM_LMDZ
    3133      USE comvert_mod, ONLY: ap,bp,aps,bps,pa,preff
    3234      USE comconst_mod, ONLY: lllm,daysec,dtvr,dtphys,cpp,kappa,
    33      .                  rad,omeg,g,r,pi
     35     .                        rad,omeg,g,r,pi
    3436      USE serre_mod, ONLY: alphax
    3537      USE temps_mod, ONLY: day_ini
    3638      USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0
    37       use inifis_mod, only: inifis
     39      use iniphysiq_mod, only: iniphysiq
    3840      implicit none
    3941
    40 #include "dimensions.h"
    41 !#include "dimphys.h"
     42      include "dimensions.h"
    4243      integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm)
    43 !#include "planete.h"
    44 #include "paramet.h"
    45 #include "comgeom2.h"
    46 !#include "control.h"
    47 #include "comdissnew.h"
    48 #include "netcdf.inc"
    49 !#include "advtrac.h"
     44      include "paramet.h"
     45      include "comgeom2.h"
     46      include "comdissnew.h"
     47      include "netcdf.inc"
     48
    5049c=======================================================================
    5150c   Declarations
     
    5453c Variables dimension du fichier "start_archive"
    5554c------------------------------------
    56       CHARACTER relief*3
     55      CHARACTER        relief*3
    5756
    5857
     
    9493c variable physique
    9594c------------------
    96       REAL tsurf(ngridmx)       ! surface temperature
    97       REAL tsoil(ngridmx,nsoilmx) ! soil temperature
    98 !      REAL co2ice(ngridmx)     ! CO2 ice layer
    99       REAL emis(ngridmx)        ! surface emissivity
     95      REAL tsurf(ngridmx)        ! surface temperature
     96      REAL,ALLOCATABLE :: tsoil(:,:) ! soil temperature
     97!      REAL co2ice(ngridmx)        ! CO2 ice layer
     98      REAL emis(ngridmx)        ! surface emissivity
    10099      real emisread             ! added by RW
    101100      REAL,ALLOCATABLE :: qsurf(:,:)
     
    103102!      REAL rnaturfi(ngridmx)
    104103      real alb(iip1,jjp1),albfi(ngridmx) ! albedos
    105       real ith(iip1,jjp1,nsoilmx),ithfi(ngridmx,nsoilmx) ! thermal inertia (3D)
     104      real,ALLOCATABLE :: ith(:,:,:),ithfi(:,:) ! thermal inertia (3D)
    106105      real surfith(iip1,jjp1),surfithfi(ngridmx) ! surface thermal inertia (2D)
    107106      REAL latfi(ngridmx),lonfi(ngridmx),airefi(ngridmx)
     
    113112
    114113      REAL rnat(ngridmx)
    115       REAL tslab(ngridmx,nsoilmx) ! slab ocean temperature
     114      REAL,ALLOCATABLE :: tslab(:,:) ! slab ocean temperature
    116115      REAL pctsrf_sic(ngridmx) ! sea ice cover
    117116      REAL tsea_ice(ngridmx) ! temperature sea_ice
     
    145144      character*80      fichnom
    146145      character*250  filestring
    147       integer Lmodif,iq,thermo
     146      integer Lmodif,iq
    148147      character modif*20
    149148      real z_reel(iip1,jjp1)
     
    155154      real val, val2, val3, val4 ! to store temporary variables
    156155      real :: iceith=2000 ! thermal inertia of subterranean ice
    157       integer iref,jref
    158156
    159157      INTEGER :: itau
    160158     
    161       INTEGER :: nq,numvanle
    162159      character(len=20) :: txt ! to store some text
    163160      character(len=50) :: surfacefile ! "surface.nc" (or equivalent file)
     
    166163      real :: profile(llm+1) ! to store an atmospheric profile + surface value
    167164
    168 !     added by RW for test
    169       real pmean, phi0
    170 
    171165!     added by BC for equilibrium temperature startup
    172166      real teque
     
    193187                  ! make deliberate choice of these values elsewhere.
    194188
     189      planet_type="generic"
     190
    195191! initialize "serial/parallel" related stuff
    196       CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
    197       call initcomgeomphy
     192! (required because we call tabfi() below, before calling iniphysiq)
     193      is_sequential=.true.
     194      is_parallel=.false.
     195      is_mpi_root=.true.
     196      is_omp_root=.true.
     197      is_master=.true.
     198     
    198199! Load tracer number and names:
    199 !      call iniadvtrac(nqtot,numvanle)
    200200      call infotrac_init
    201201! allocate arrays
     
    203203      allocate(qsurf(ngridmx,nqtot))
    204204     
    205       planet_type="generic"
    206 
     205! get value of nsoilmx and allocate corresponding arrays
     206      nsoilmx=18 ! default value
     207      call getin_p("nsoilmx",nsoilmx)
     208     
     209      allocate(tsoil(ngridmx,nsoilmx))
     210      allocate(ith(iip1,jjp1,nsoilmx),ithfi(ngridmx,nsoilmx))
     211      allocate(tslab(ngridmx,nsoilmx))
     212     
    207213c=======================================================================
    208214c   Choice of the start file(s) to use
     
    284290      IF (.not. ALLOCATED(zgam)) ALLOCATE(zgam(ngridmx))
    285291      IF (.not. ALLOCATED(zthe)) ALLOCATE(zthe(ngridmx))
    286       ! ALLOCATE ARRAYS in comsoil_h (if not already done)
    287       IF (.not.ALLOCATED(layer))
    288      . ALLOCATE(layer(nsoilmx))
    289       IF (.not.ALLOCATED(mlayer))
    290      . ALLOCATE(mlayer(0:nsoilmx-1))
    291       IF (.not.ALLOCATED(inertiedat))
    292      . ALLOCATE(inertiedat(ngridmx,nsoilmx))
    293       ! ALLOCATE ARRAYS IN comgeomfi_h (done in inifis usually)
    294       IF (.not. ALLOCATED(lati)) ALLOCATE(lati(ngridmx))
    295       IF (.not. ALLOCATED(long)) ALLOCATE(long(ngridmx))
    296       IF (.not. ALLOCATED(area)) ALLOCATE(area(ngridmx))
    297292
    298293c-----------------------------------------------------------------------
     
    337332          write(*,*) i,tab_cntrl(i)
    338333        enddo
    339        
     334       
    340335        ! Lmodif set to 0 to disable modifications possibility in phyeta0                           
    341336        write(*,*) 'Reading file START'
     
    355350        do i=1,ngridmx
    356351          albfi(i) = albedodat(i)
    357           do j=1,nsoilmx
     352          do j=1,nsoilmx
    358353           ithfi(i,j) = inertiedat(i,j)
    359           enddo
     354          enddo
    360355        ! build a surfithfi(:) using 1st layer of ithfi(:), which might
    361356        ! be needed later on if reinitializing soil thermal inertia
     
    371366      endif
    372367c-----------------------------------------------------------------------
    373 c               Initialisation des constantes dynamique
     368c                Initialisation des constantes dynamique
    374369c-----------------------------------------------------------------------
    375370
     
    451446      idum=0
    452447
    453 c Initialisation coordonnees /aires
    454 c -------------------------------
    455 ! Note: rlatu(:) and rlonv(:) are commons defined in "comgeom.h"
    456 !       rlatu() and rlonv() are given in radians
    457       latfi(1)=rlatu(1)
    458       lonfi(1)=0.
    459       DO j=2,jjm
    460          DO i=1,iim
    461             latfi((j-2)*iim+1+i)=rlatu(j)
    462             lonfi((j-2)*iim+1+i)=rlonv(i)
    463          ENDDO
    464       ENDDO
    465       latfi(ngridmx)=rlatu(jjp1)
    466       lonfi(ngridmx)=0.
    467        
    468       ! build airefi(), mesh area on physics grid
    469       CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,aire,airefi)
    470       ! Poles are single points on physics grid
    471       airefi(1)=sum(aire(1:iim,1))
    472       airefi(ngridmx)=sum(aire(1:iim,jjm+1))
    473 
    474 ! also initialize various physics flags/settings which might be needed
    475 !    (for instance initracer needs to know about some flags, and/or
    476 !      'datafile' path may be changed by user)
    477       call inifis(ngridmx,llm,nqtot,day_ini,daysec,dtphys,
    478      &                latfi,lonfi,airefi,rad,g,r,cpp)
     448! Initialize the physics
     449         CALL iniphysiq(iim,jjm,llm,
     450     &                  (jjm-1)*iim+2,comm_lmdz,
     451     &                  daysec,day_ini,dtphys,
     452     &                  rlatu,rlatv,rlonu,rlonv,
     453     &                  aire,cu,cv,rad,g,r,cpp,
     454     &                  1)
    479455
    480456c=======================================================================
     
    560536     &   rnat,pctsrf_sic,tslab,tsea_ice,sea_ice)
    561537        write(*,*) "OK, read start_archive file"
    562         ! copy soil thermal inertia
    563         ithfi(:,:)=inertiedat(:,:)
    564        
     538        ! copy soil thermal inertia
     539        ithfi(:,:)=inertiedat(:,:)
     540       
    565541        ierr= NF_CLOSE(nid)
    566542
     
    727703          DO j=1,jjp1
    728704             DO i=1,iip1
    729                 alb(i,j) = alb_bb       ! albedo
    730                 do isoil=1,nsoilmx
    731                   ith(i,j,isoil) = ith_bb       ! thermal inertia
    732                 enddo
     705                alb(i,j) = alb_bb        ! albedo
     706                do isoil=1,nsoilmx
     707                  ith(i,j,isoil) = ith_bb        ! thermal inertia
     708                enddo
    733709             END DO
    734710          END DO
     
    867843         if (yes.eq.'y') then
    868844           write(*,*) 'Value?'
    869                 read(*,*,iostat=ierr) psea
     845                read(*,*,iostat=ierr) psea
    870846             DO i=1,iip1
    871847               DO j=1,jjp1
     
    874850                  ENDDO
    875851               ENDDO
    876                 write(*,*) 'psea=',psea
     852                write(*,*) 'psea=',psea
    877853          else
    878854            write(*,*) 'no'
     
    14671443!       ----------------------------------------------------------------------
    14681444
    1469         else if (trim(modif) .eq. 'therm_ini_s') then
     1445        else if (trim(modif) .eq. 'therm_ini_s') then
    14701446!          write(*,*)"surfithfi(1):",surfithfi(1)
    1471           do isoil=1,nsoilmx
    1472             inertiedat(1:ngridmx,isoil)=surfithfi(1:ngridmx)
    1473           enddo
     1447          do isoil=1,nsoilmx
     1448            inertiedat(1:ngridmx,isoil)=surfithfi(1:ngridmx)
     1449          enddo
    14741450          write(*,*)'OK: Soil thermal inertia has been reset to referenc
    14751451     &e surface values'
    1476 !         write(*,*)"inertiedat(1,1):",inertiedat(1,1)
    1477           ithfi(:,:)=inertiedat(:,:)
    1478         ! recast ithfi() onto ith()
    1479         call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,ithfi,ith)
     1452!          write(*,*)"inertiedat(1,1):",inertiedat(1,1)
     1453          ithfi(:,:)=inertiedat(:,:)
     1454        ! recast ithfi() onto ith()
     1455        call gr_fi_dyn(nsoilmx,ngridmx,iip1,jjp1,ithfi,ith)
    14801456! Check:
    14811457!         do i=1,iip1
     
    14851461!             enddo
    14861462!           enddo
    1487 !        enddo
     1463!        enddo
    14881464
    14891465
     
    16601636
    16611637c=======================================================================
    1662 c       Formats
     1638c        Formats
    16631639c=======================================================================
    16641640
  • trunk/LMDZ.GENERIC/libf/dynphy_lonlat/phystd/start2archive.F

    r1478 r1543  
    2121      use infotrac, only: infotrac_init, nqtot, tname
    2222      USE comsoil_h
    23       USE comgeomfi_h, ONLY: lati, long, area
     23     
     24!      USE comgeomfi_h, ONLY: lati, long, area
    2425!      use control_mod
    25       use comgeomphy, only: initcomgeomphy
     26!      use comgeomphy, only: initcomgeomphy
    2627      use slab_ice_h, only: noceanmx
    2728! to use  'getin'
    2829      USE ioipsl_getincom
    2930      USE planete_mod, only: year_day
     31      USE mod_const_mpi, ONLY: COMM_LMDZ
    3032      USE control_mod, only: planet_type
    3133      USE callkeys_mod, ONLY: ok_slab_ocean
    3234      use filtreg_mod, only: inifilr
    3335      USE comvert_mod, ONLY: ap,bp
    34       USE comconst_mod, ONLY: cpp,g
     36      USE comconst_mod, ONLY: daysec,dtphys,rad,g,r,cpp
    3537      USE logic_mod, ONLY: grireg
    3638      USE temps_mod, ONLY: day_ini
     39      USE iniphysiq_mod, ONLY: iniphysiq
    3740      implicit none
    3841
    39 #include "dimensions.h"
     42      include "dimensions.h"
    4043      integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm)
    41 #include "paramet.h"
    42 #include "comdissip.h"
    43 #include "comgeom.h"
     44      include "paramet.h"
     45      include "comdissip.h"
     46      include "comgeom.h"
    4447!#include "control.h"
    4548
     
    4750!#include "planete.h"
    4851!#include"advtrac.h"
    49 #include "netcdf.inc"
     52      include "netcdf.inc"
    5053c-----------------------------------------------------------------------
    5154c   Declarations
     
    6871c Variable Physiques (grille physique)
    6972c ------------------------------------
    70       REAL tsurf(ngridmx)       ! Surface temperature
    71       REAL tsoil(ngridmx,nsoilmx) ! Soil temperature
    72       REAL co2ice(ngridmx)      ! CO2 ice layer
     73      REAL tsurf(ngridmx)        ! Surface temperature
     74      REAL,ALLOCATABLE :: tsoil(:,:) ! Soil temperature
     75      REAL co2ice(ngridmx)        ! CO2 ice layer
    7376      REAL q2(ngridmx,llm+1)
    7477      REAL,ALLOCATABLE :: qsurf(:,:)
     
    9396      REAL T(ip1jmp1,llm),us(ip1jmp1,llm),vs(ip1jmp1,llm)
    9497      REAL tsurfS(ip1jmp1)
    95       REAL tsoilS(ip1jmp1,nsoilmx)
    96       REAL ithS(ip1jmp1,nsoilmx) ! Soil Thermal Inertia
     98      REAL,ALLOCATABLE :: tsoilS(:,:)
     99      REAL,ALLOCATABLE :: ithS(:,:) ! Soil Thermal Inertia
    97100      REAL co2iceS(ip1jmp1)
    98101      REAL q2S(ip1jmp1,llm+1)
     
    144147      grireg   = .TRUE.
    145148
    146 ! initialize "serial/parallel" related stuff
    147       CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
    148       call initcomgeomphy
    149 
    150       ! ALLOCATE ARRAYS IN comgeomfi_h (usually done in inifis)
    151       ! this must be here for start2archive to work
    152       IF (.not. ALLOCATED(lati)) ALLOCATE(lati(ngridmx))
    153       IF (.not. ALLOCATED(long)) ALLOCATE(long(ngridmx))
    154       IF (.not. ALLOCATED(area)) ALLOCATE(area(ngridmx))
    155 
    156149      planet_type="generic"
    157150
     
    160153c=======================================================================
    161154! Load tracer number and names:
    162 !      call iniadvtrac(nqtot,numvanle)
    163155      call infotrac_init
    164156
     
    168160      allocate(qsurfS(ip1jmp1,nqtot))
    169161! other array allocations:
    170       call ini_comsoil_h(ngridmx)
     162!      call ini_comsoil_h(ngridmx) ! done via iniphysiq
    171163
    172164      fichnom = 'start.nc'
     
    198190
    199191      ierr = NF_CLOSE(nid1)
     192
     193! Get value of the "subsurface_layers" dimension from physics start file
     194      fichnom = 'startfi.nc'
     195      ierr = NF_OPEN (fichnom, NF_NOWRITE,nid1)
     196       IF (ierr.NE.NF_NOERR) THEN
     197         write(6,*)' Pb d''ouverture du fichier'//trim(fichnom)
     198        CALL ABORT
     199       ENDIF
     200      ierr = NF_INQ_DIMID(nid1,"subsurface_layers",varid)
     201      IF (ierr .NE. NF_NOERR) THEN
     202       PRINT*, "start2archive: No subsurface_layers dimension!!"
     203       CALL abort
     204      ENDIF
     205      ierr = NF_INQ_DIMLEN(nid1,varid,nsoilmx)
     206      IF (ierr .NE. NF_NOERR) THEN
     207       PRINT*, "start2archive: Failed reading subsurface_layers value!!"
     208       CALL abort
     209      ENDIF
     210      ierr = NF_CLOSE(nid1)
    200211     
     212      ! allocate arrays of nsoilmx size
     213      allocate(tsoil(ngridmx,nsoilmx))
     214      allocate(tsoilS(ip1jmp1,nsoilmx))
     215      allocate(ithS(ip1jmp1,nsoilmx))
     216
     217c-----------------------------------------------------------------------
     218c   Initialisations
     219c-----------------------------------------------------------------------
     220
     221      CALL defrun_new(99, .FALSE. )
     222      call iniconst
     223      call inigeom
     224      call inifilr
     225
     226! Initialize the physics
     227         CALL iniphysiq(iim,jjm,llm,
     228     &                  (jjm-1)*iim+2,comm_lmdz,
     229     &                  daysec,day_ini,dtphys,
     230     &                  rlatu,rlatv,rlonu,rlonv,
     231     &                  aire,cu,cv,rad,g,r,cpp,
     232     &                  1)
    201233
    202234      fichnom = 'startfi.nc'
     
    256288c *****************************************************************
    257289
    258 c-----------------------------------------------------------------------
    259 c   Initialisations
    260 c-----------------------------------------------------------------------
    261 
    262       CALL defrun_new(99, .FALSE. )
    263       call iniconst
    264       call inigeom
    265       call inifilr
    266290      CALL pression(ip1jmp1, ap, bp, ps, p3d)
    267291      call exner_hyb(ip1jmp1, ps, p3d, beta, pks, pk, pkf)
Note: See TracChangeset for help on using the changeset viewer.