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.MARS/libf/dynphy_lonlat/phymars
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/iniphysiq_mod.F90

    r1541 r1543  
    33CONTAINS
    44
    5 subroutine iniphysiq(ii,jj,nlayer,punjours, pdayref,ptimestep,           &
    6                      rlatu,rlatv,rlonu,rlonv,aire,cu,cv,                 &
     5subroutine iniphysiq(ii,jj,nlayer, &
     6                     nbp, communicator, &
     7                     punjours, pdayref,ptimestep, &
     8                     rlatu,rlatv,rlonu,rlonv,aire,cu,cv, &
    79                     prad,pg,pr,pcpp,iflag_phys)
    810
    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)
     11use dimphy, only : init_dimphy
     12use mod_grid_phy_lmdz, only : klon_glo, & ! number of atmospheric columns (on full grid)
     13                              regular_lonlat  ! regular longitude-latitude grid type
    1214use mod_phys_lmdz_para, only : klon_omp, & ! number of columns (on local omp grid)
    1315                               klon_omp_begin, & ! start index of local omp subgrid
    1416                               klon_omp_end, & ! end index of local omp subgrid
    1517                               klon_mpi_begin ! start indes of columns (on local mpi grid)
    16 
    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)
     18use geometry_mod, only: init_geometry
     19!use comgeomphy, only : initcomgeomphy, &
     20!                       cell_area, & ! physics grid area (m2)
     21!                       dx, & ! cu coeff. (u_covariant = cu * u)
     22!                       dy, & ! cv coeff. (v_covariant = cv * v)
     23!                       longitude, & ! longitudes (rad)
     24!                       latitude ! latitudes (rad)
    2325use infotrac, only : nqtot ! number of advected tracers
    2426use comgeomfi_h, only: ini_fillgeom
    2527use temps_mod, only: day_ini, hour_ini
    2628use phys_state_var_init_mod, only: phys_state_var_init
     29use physics_distribution_mod, only: init_physics_distribution
    2730use regular_lonlat_mod, only: init_regular_lonlat, &
    2831                              east, west, north, south, &
    2932                              north_east, north_west, &
    3033                              south_west, south_east
     34use mod_interface_dyn_phys, only: init_interface_dyn_phys
    3135
    3236implicit none
     
    4347integer,intent(in) :: ii ! number of atmospheric coulumns along longitudes
    4448integer,intent(in) :: jj  ! number of atompsheric columns along latitudes
     49integer,intent(in) :: nbp ! number of physics columns for this MPI process
     50integer,intent(in) :: communicator ! MPI communicator
    4551real,intent(in) :: rlatu(jj+1) ! latitudes of the physics grid
    4652real,intent(in) :: rlatv(jj) ! latitude boundaries of the physics grid
     
    5561
    5662integer :: ibegin,iend,offset
    57 integer :: i,j
     63integer :: i,j,k
    5864character(len=20) :: modname='iniphysiq'
    5965character(len=80) :: abort_message
     
    6672
    6773! global array, on full physics grid:
    68 real,allocatable :: latfi(:)
    69 real,allocatable :: lonfi(:)
    70 real,allocatable :: cufi(:)
    71 real,allocatable :: cvfi(:)
    72 real,allocatable :: airefi(:)
     74real,allocatable :: latfi_glo(:)
     75real,allocatable :: lonfi_glo(:)
     76real,allocatable :: cufi_glo(:)
     77real,allocatable :: cvfi_glo(:)
     78real,allocatable :: airefi_glo(:)
     79real,allocatable :: boundslonfi_glo(:,:)
     80real,allocatable :: boundslatfi_glo(:,:)
     81
     82! local arrays, on given MPI/OpenMP domain:
     83real,allocatable,save :: latfi(:)
     84real,allocatable,save :: lonfi(:)
     85real,allocatable,save :: cufi(:)
     86real,allocatable,save :: cvfi(:)
     87real,allocatable,save :: airefi(:)
     88real,allocatable,save :: boundslonfi(:,:)
     89real,allocatable,save :: boundslatfi(:,:)
     90!$OMP THREADPRIVATE (latfi,lonfi,cufi,cvfi,airefi,boundslonfi,boundslatfi)
     91
    7392
    7493pi=2.*asin(1.0)
    7594
    76 IF (nlayer.NE.klev) THEN
    77   write(*,*) 'STOP in ',trim(modname)
    78   write(*,*) 'Problem with dimensions :'
    79   write(*,*) 'nlayer     = ',nlayer
    80   write(*,*) 'klev   = ',klev
    81   abort_message = ''
    82   CALL abort_gcm (modname,abort_message,1)
    83 ENDIF
    84 
    85 !IF (ngrid.NE.klon_glo) THEN
    86 !  write(*,*) 'STOP in ',trim(modname)
    87 !  write(*,*) 'Problem with dimensions :'
    88 !  write(*,*) 'ngrid     = ',ngrid
    89 !  write(*,*) 'klon   = ',klon_glo
    90 !  abort_message = ''
    91 !  CALL abort_gcm (modname,abort_message,1)
    92 !ENDIF
     95! Initialize Physics distibution and parameters and interface with dynamics
     96CALL init_physics_distribution(regular_lonlat,4, &
     97                                 nbp,ii,jj+1,nlayer,communicator)
     98CALL init_interface_dyn_phys
    9399
    94100! init regular global longitude-latitude grid points and boundaries
     
    115121
    116122! Generate global arrays on full physics grid
    117 allocate(latfi(klon_glo),lonfi(klon_glo),cufi(klon_glo),cvfi(klon_glo))
    118 latfi(1)=rlatu(1)
    119 lonfi(1)=0.
    120 cufi(1) = cu(1)
    121 cvfi(1) = cv(1)
     123allocate(latfi_glo(klon_glo),lonfi_glo(klon_glo))
     124allocate(cufi_glo(klon_glo),cvfi_glo(klon_glo))
     125allocate(airefi_glo(klon_glo))
     126allocate(boundslonfi_glo(klon_glo,4))
     127allocate(boundslatfi_glo(klon_glo,4))
     128
     129! North pole
     130latfi_glo(1)=rlatu(1)
     131lonfi_glo(1)=0.
     132cufi_glo(1) = cu(1)
     133cvfi_glo(1) = cv(1)
     134boundslonfi_glo(1,north_east)=0
     135boundslatfi_glo(1,north_east)=PI/2
     136boundslonfi_glo(1,north_west)=2*PI
     137boundslatfi_glo(1,north_west)=PI/2
     138boundslonfi_glo(1,south_west)=2*PI
     139boundslatfi_glo(1,south_west)=rlatv(1)
     140boundslonfi_glo(1,south_east)=0
     141boundslatfi_glo(1,south_east)=rlatv(1)
    122142DO j=2,jj
    123143  DO i=1,ii
    124     latfi((j-2)*ii+1+i)= rlatu(j)
    125     lonfi((j-2)*ii+1+i)= rlonv(i)
    126     cufi((j-2)*ii+1+i) = cu((j-1)*(ii+1)+i)
    127     cvfi((j-2)*ii+1+i) = cv((j-1)*(ii+1)+i)
     144    k=(j-2)*ii+1+i
     145    latfi_glo((j-2)*ii+1+i)= rlatu(j)
     146    lonfi_glo((j-2)*ii+1+i)= rlonv(i)
     147    cufi_glo((j-2)*ii+1+i) = cu((j-1)*(ii+1)+i)
     148    cvfi_glo((j-2)*ii+1+i) = cv((j-1)*(ii+1)+i)
     149    boundslonfi_glo(k,north_east)=rlonu(i)
     150    boundslatfi_glo(k,north_east)=rlatv(j-1)
     151    boundslonfi_glo(k,north_west)=rlonu(i+1)
     152    boundslatfi_glo(k,north_west)=rlatv(j-1)
     153    boundslonfi_glo(k,south_west)=rlonu(i+1)
     154    boundslatfi_glo(k,south_west)=rlatv(j)
     155    boundslonfi_glo(k,south_east)=rlonu(i)
     156    boundslatfi_glo(k,south_east)=rlatv(j)
    128157  ENDDO
    129158ENDDO
    130 latfi(klon_glo)= rlatu(jj+1)
    131 lonfi(klon_glo)= 0.
    132 cufi(klon_glo) = cu((ii+1)*jj+1)
    133 cvfi(klon_glo) = cv((ii+1)*jj-ii)
     159! South pole
     160latfi_glo(klon_glo)= rlatu(jj+1)
     161lonfi_glo(klon_glo)= 0.
     162cufi_glo(klon_glo) = cu((ii+1)*jj+1)
     163cvfi_glo(klon_glo) = cv((ii+1)*jj-ii)
     164boundslonfi_glo(klon_glo,north_east)= 0
     165boundslatfi_glo(klon_glo,north_east)= rlatv(jj)
     166boundslonfi_glo(klon_glo,north_west)= 2*PI
     167boundslatfi_glo(klon_glo,north_west)= rlatv(jj)
     168boundslonfi_glo(klon_glo,south_west)= 2*PI
     169boundslatfi_glo(klon_glo,south_west)= -PI/2
     170boundslonfi_glo(klon_glo,south_east)= 0
     171boundslatfi_glo(klon_glo,south_east)= -Pi/2
    134172
    135173! build airefi(), mesh area on physics grid
    136 allocate(airefi(klon_glo))
    137 CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi)
     174CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi_glo)
    138175! Poles are single points on physics grid
    139 airefi(1)=sum(aire(1:ii,1))
    140 airefi(klon_glo)=sum(aire(1:ii,jj+1))
     176airefi_glo(1)=sum(aire(1:ii,1))
     177airefi_glo(klon_glo)=sum(aire(1:ii,jj+1))
    141178
    142179! Sanity check: do total planet area match between physics and dynamics?
    143180total_area_dyn=sum(aire(1:ii,1:jj+1))
    144 total_area_phy=sum(airefi(1:klon_glo))
     181total_area_phy=sum(airefi_glo(1:klon_glo))
    145182IF (total_area_dyn/=total_area_phy) THEN
    146183  WRITE (lunout, *) 'iniphysiq: planet total surface discrepancy !!!'
     
    158195!$OMP PARALLEL
    159196! Now generate local lon/lat/cu/cv/area arrays
    160 call initcomgeomphy
    161 
    162 !!!!$OMP PARALLEL PRIVATE(ibegin,iend)
    163 !!!$OMP+         SHARED(parea,pcu,pcv,plon,plat)
     197allocate(latfi(klon_omp),lonfi(klon_omp),cufi(klon_omp),cvfi(klon_omp))
     198allocate(airefi(klon_omp))
     199allocate(boundslonfi(klon_omp,4))
     200allocate(boundslatfi(klon_omp,4))
     201!call initcomgeomphy
    164202     
    165203offset=klon_mpi_begin-1
    166 cell_area(1:klon_omp)=airefi(offset+klon_omp_begin:offset+klon_omp_end)
    167 dx(1:klon_omp)=cufi(offset+klon_omp_begin:offset+klon_omp_end)
    168 dy(1:klon_omp)=cvfi(offset+klon_omp_begin:offset+klon_omp_end)
    169 longitude(1:klon_omp)=lonfi(offset+klon_omp_begin:offset+klon_omp_end)
    170 latitude(1:klon_omp)=latfi(offset+klon_omp_begin:offset+klon_omp_end)
     204airefi(1:klon_omp)=airefi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     205cufi(1:klon_omp)=cufi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     206cvfi(1:klon_omp)=cvfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     207lonfi(1:klon_omp)=lonfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     208latfi(1:klon_omp)=latfi_glo(offset+klon_omp_begin:offset+klon_omp_end)
     209boundslonfi(1:klon_omp,:)=boundslonfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
     210boundslatfi(1:klon_omp,:)=boundslatfi_glo(offset+klon_omp_begin:offset+klon_omp_end,:)
     211
     212! copy over local grid longitudes and latitudes
     213CALL init_geometry(klon_omp,lonfi,latfi,boundslonfi,boundslatfi, &
     214                   airefi,cufi,cvfi)
    171215
    172216! copy some fundamental parameters to physics
    173217! and do some initializations
     218
     219call init_dimphy(klon_omp,nlayer) ! Initialize dimphy module
    174220call phys_state_var_init(klon_omp,nlayer,nqtot, &
    175221                         day_ini,hour_ini,punjours,ptimestep, &
    176222                         prad,pg,pr,pcpp)
    177 call ini_fillgeom(klon_omp,latitude,longitude,cell_area)
     223call ini_fillgeom(klon_omp,latfi,lonfi,airefi)
    178224call conf_phys(klon_omp,nlayer,nqtot)
    179225
  • trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/newstart.F

    r1524 r1543  
    1515c=======================================================================
    1616
    17       use ioipsl_getincom, only: getin
     17      use ioipsl_getincom, only: getin
     18      use mod_phys_lmdz_para, only: is_parallel, is_sequential,
     19     &                              is_mpi_root, is_omp_root,
     20     &                              is_master
    1821      use infotrac, only: infotrac_init, nqtot, tname
    1922      use tracer_mod, only: noms, mmol,
     
    2932      use phyredem, only: physdem0, physdem1
    3033      use iostart, only: open_startphy
    31       use comgeomphy, only: initcomgeomphy
    32 !      use planete_h
    3334      use dimradmars_mod, only: tauscaling
    3435      use turb_mod, only: q2
    35       use comgeomfi_h, only: ini_fillgeom
    3636      use filtreg_mod, only: inifilr
     37      USE mod_const_mpi, ONLY: COMM_LMDZ
    3738      USE comvert_mod, ONLY: ap,bp,pa,preff
    3839      USE comconst_mod, ONLY: lllm,daysec,dtphys,dtvr,
     
    4142      USE temps_mod, ONLY: day_ini,hour_ini
    4243      USE ener_mod, ONLY: etot0,ptot0,ztot0,stot0,ang0
    43       USE phys_state_var_init_mod, ONLY: phys_state_var_init
     44      USE iniphysiq_mod, ONLY: iniphysiq
    4445
    4546      implicit none
    4647
    47 #include "dimensions.h"
     48      include "dimensions.h"
    4849      integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm)
    49 #include "paramet.h"
    50 #include "comgeom2.h"
    51 #include "comdissnew.h"
    52 #include "clesph0.h"
    53 #include "netcdf.inc"
    54 #include "datafile.h"
     50      include "paramet.h"
     51      include "comgeom2.h"
     52      include "comdissnew.h"
     53      include "clesph0.h"
     54      include "netcdf.inc"
     55      include "datafile.h"
    5556c=======================================================================
    5657c   Declarations
     
    181182      planet_type="mars"
    182183
    183 ! initialize "serial/parallel" related stuff
    184       CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
    185       call initcomgeomphy
    186 
     184! initialize "serial/parallel" related stuff:
     185! (required because we call tabfi() below, before calling iniphysiq)
     186      is_sequential=.true.
     187      is_parallel=.false.
     188      is_mpi_root=.true.
     189      is_omp_root=.true.
     190      is_master=.true.
     191     
    187192! Load tracer number and names:
    188 !      call iniadvtrac(nqtot,numvanle)
    189193      call infotrac_init
    190194! allocate arrays
     
    335339      mugaz = p_mugaz
    336340      daysec = p_daysec
    337 !      write(*,*) 'aire',aire
    338341
    339342
     
    349352      idum=0
    350353
    351 c Initialisation coordonnees /aires
    352 c -------------------------------
    353 ! Note: rlatu(:) and rlonv(:) are commons defined in "comgeom.h"
    354 !       rlatu() and rlonv() are given in radians
    355       latfi(1)=rlatu(1)
    356       lonfi(1)=0.
    357       DO j=2,jjm
    358          DO i=1,iim
    359             latfi((j-2)*iim+1+i)=rlatu(j)
    360             lonfi((j-2)*iim+1+i)=rlonv(i)
    361          ENDDO
    362       ENDDO
    363       latfi(ngridmx)=rlatu(jjp1)
    364       lonfi(ngridmx)=0.
    365      
    366       ! build airefi(), mesh area on physics grid
    367       CALL gr_dyn_fi(1,iip1,jjp1,ngridmx,aire,airefi)
    368       ! Poles are single points on physics grid
    369       airefi(1)=sum(aire(1:iim,1))
    370       airefi(ngridmx)=sum(aire(1:iim,jjm+1))
    371 
    372 ! also initialize various physics flags/settings which might be needed
    373 !    (for instance initracer needs to know about some flags, and/or
    374 !      'datafile' path may be changed by user)
    375       call phys_state_var_init(ngridmx,llm,nqtot,
    376      &                         day_ini,hour_ini,daysec,dtphys,
    377      &                         rad,g,r,cpp)
    378       call ini_fillgeom(ngridmx,latfi,lonfi,airefi)
    379       call conf_phys(ngridmx,llm,nqtot)
     354! Initialize the physics
     355         CALL iniphysiq(iim,jjm,llm,
     356     &                  (jjm-1)*iim+2,comm_lmdz,
     357     &                  daysec,day_ini,dtphys,
     358     &                  rlatu,rlatv,rlonu,rlonv,
     359     &                  aire,cu,cv,rad,g,r,cpp,
     360     &                  1)
    380361
    381362c=======================================================================
  • trunk/LMDZ.MARS/libf/dynphy_lonlat/phymars/start2archive.F

    r1433 r1543  
    2323      use surfdat_h, only: ini_surfdat_h, qsurf
    2424      use comsoil_h, only: ini_comsoil_h
    25       use comgeomphy, only: initcomgeomphy
     25!      use comgeomphy, only: initcomgeomphy
    2626      use filtreg_mod, only: inifilr
     27      USE mod_const_mpi, ONLY: COMM_LMDZ
    2728      use control_mod, only: planet_type
    2829      USE comvert_mod, ONLY: ap,bp
    29       USE comconst_mod, ONLY: g,cpp
     30      USE comconst_mod, ONLY: daysec,dtphys,rad,g,r,cpp
    3031      USE logic_mod, ONLY: grireg
    3132      USE temps_mod, ONLY: day_ini,hour_ini
     33      USE iniphysiq_mod, ONLY: iniphysiq
    3234      implicit none
    3335
    34 #include "dimensions.h"
     36      include "dimensions.h"
    3537      integer, parameter :: ngridmx = (2+(jjm-1)*iim - 1/jjm)
    36 #include "paramet.h"
    37 #include "comdissip.h"
    38 #include "comgeom.h"
    39 #include "netcdf.inc"
     38      include "paramet.h"
     39      include "comdissip.h"
     40      include "comgeom.h"
     41      include "netcdf.inc"
    4042
    4143c-----------------------------------------------------------------------
     
    5961c Variable Physiques (grille physique)
    6062c ------------------------------------
    61       REAL tsurf(ngridmx)       ! Surface temperature
     63      REAL tsurf(ngridmx)        ! Surface temperature
    6264      REAL tsoil(ngridmx,nsoilmx) ! Soil temperature
    63       REAL co2ice(ngridmx)      ! CO2 ice layer
     65      REAL co2ice(ngridmx)        ! CO2 ice layer
    6466      REAL tauscaling(ngridmx) ! dust conversion factor
    6567      REAL q2(ngridmx,llm+1)
     
    116118      CALL defrun_new(99, .TRUE. )
    117119      grireg   = .TRUE.
    118 ! initialize "serial/parallel" related stuff
    119       CALL init_phys_lmdz(iim,jjp1,llm,1,(/(jjm-1)*iim+2/))
    120       call initcomgeomphy
     120
    121121      planet_type='mars'
    122122
     
    125125c=======================================================================
    126126! Load tracer number and names:
    127 !      call iniadvtrac(nqtot,numvanle)
    128127      call infotrac_init
    129128
     
    131130      allocate(q(ip1jmp1,llm,nqtot))
    132131      allocate(qsurfS(ip1jmp1,nqtot))
    133       call ini_surfdat_h(ngridmx,nqtot)
    134       call ini_comsoil_h(ngridmx)
    135132     
    136133
     
    139136     .       ps,phis,timedyn)
    140137
     138c-----------------------------------------------------------------------
     139c   Initialisations
     140c-----------------------------------------------------------------------
     141
     142      CALL defrun_new(99, .FALSE. )
     143      call iniconst
     144      call inigeom
     145      call inifilr
     146
     147! Initialize the physics
     148         CALL iniphysiq(iim,jjm,llm,
     149     &                  (jjm-1)*iim+2,comm_lmdz,
     150     &                  daysec,day_ini,dtphys,
     151     &                  rlatu,rlatv,rlonu,rlonv,
     152     &                  aire,cu,cv,rad,g,r,cpp,
     153     &                  1)
    141154
    142155      fichnom = 'startfi.nc'
     
    185198c *****************************************************************
    186199
    187 c-----------------------------------------------------------------------
    188 c   Initialisations
    189 c-----------------------------------------------------------------------
    190 
    191       CALL defrun_new(99, .FALSE. )
    192       call iniconst
    193       call inigeom
    194       call inifilr
    195200      CALL pression(ip1jmp1, ap, bp, ps, p3d)
    196201      call exner_hyb(ip1jmp1, ps, p3d, beta, pks, pk, pkf)
Note: See TracChangeset for help on using the changeset viewer.