Ignore:
Timestamp:
Apr 17, 2015, 9:51:15 AM (11 years ago)
Author:
millour
Message:

Further cleanup and adaptations:

  • setup iniphusiq to pass on information from dyn to phys.
  • infis (now module inifi_mod) transfers the information and for now also storesthe information. Thus modules control_mod_phys, comconst_phy_mod, comgeom2_phy_mod and temps_phy_mod are now useless.
  • removed q_sat_phy, and put q_sat in misc, since it is quite general.
  • moved information on horizontal and vertical grid to module comgeomphy.F90

EM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • dynamico_lmdz/aquaplanet/LMDZ5/libf/dynlonlat_phylonlat/phylmd/iniphysiq.F90

    r3809 r3816  
    33
    44
    5 SUBROUTINE iniphysiq(iim,jjm,nlayer,punjours, pdayref,ptimestep,         &
    6                      rlatu,rlonv,aire,cu,cv,                             &
     5SUBROUTINE iniphysiq(ii,jj,nlayer,punjours, pdayref,ptimestep,         &
     6                     rlatu,rlatv,rlonu,rlonv,aire,cu,cv,               &
    77                     prad,pg,pr,pcpp,iflag_phys)
    88  USE dimphy, ONLY: klev ! number of atmospheric levels
     
    1414                                klon_mpi_begin ! start indes of columns (on local mpi grid)
    1515  USE comgeomphy, ONLY: initcomgeomphy, &
     16                        initcomgeomphy_vert, &
     17                        initcomgeomphy_horiz,&
    1618                        airephy, & ! physics grid area (m2)
    1719                        cuphy, & ! cu coeff. (u_covariant = cu * u)
     
    1921                        rlond, & ! longitudes
    2022                        rlatd ! latitudes
     23  USE misc_mod, ONLY: debug
     24  USE infotrac, ONLY: nqtot,nqo,nbtr,tname,ttext,type_trac,&
     25                      niadv,conv_flg,pbl_flg,solsym
     26  USE phytrac_mod, ONLY: ini_phytrac_mod
     27  USE control_mod, ONLY: dayref,anneeref,day_step,iphysiq,nday,&
     28                         config_inca,raz_date,offline
     29  USE inifis_mod, ONLY: inifis
     30  USE infotrac_phy, ONLY: init_infotrac_phy
    2131  USE phyaqua_mod, ONLY: iniaqua
    2232  IMPLICIT NONE
     
    2737  ! =======================================================================
    2838
    29   include "YOMCST.h"
     39!  include "YOMCST.h"
     40  include "dimensions.h"
     41  include "comvert.h"
     42  include "comconst.h"
    3043  include "iniprint.h"
     44  include "temps.h"
    3145
    3246  REAL, INTENT (IN) :: prad ! radius of the planet (m)
     
    3650  REAL, INTENT (IN) :: punjours ! length (in s) of a standard day
    3751  INTEGER, INTENT (IN) :: nlayer ! number of atmospheric layers
    38   INTEGER, INTENT (IN) :: iim ! number of atmospheric columns along longitudes
    39   INTEGER, INTENT (IN) :: jjm ! number of atompsheric columns along latitudes
    40   REAL, INTENT (IN) :: rlatu(jjm+1) ! latitudes of the physics grid
    41   REAL, INTENT (IN) :: rlonv(iim+1) ! longitudes of the physics grid
    42   REAL, INTENT (IN) :: aire(iim+1,jjm+1) ! area of the dynamics grid (m2)
    43   REAL, INTENT (IN) :: cu((iim+1)*(jjm+1)) ! cu coeff. (u_covariant = cu * u)
    44   REAL, INTENT (IN) :: cv((iim+1)*jjm) ! cv coeff. (v_covariant = cv * v)
     52  INTEGER, INTENT (IN) :: ii ! number of atmospheric columns along longitudes
     53  INTEGER, INTENT (IN) :: jj ! number of atompsheric columns along latitudes
     54  REAL, INTENT (IN) :: rlatu(jj+1) ! latitudes of the physics grid
     55  REAL, INTENT (IN) :: rlatv(jj) ! latitude boundaries of the physics grid
     56  REAL, INTENT (IN) :: rlonv(ii+1) ! longitudes of the physics grid
     57  REAL, INTENT (IN) :: rlonu(ii+1) ! longitude boundaries of the physics grid
     58  REAL, INTENT (IN) :: aire(ii+1,jj+1) ! area of the dynamics grid (m2)
     59  REAL, INTENT (IN) :: cu((ii+1)*(jj+1)) ! cu coeff. (u_covariant = cu * u)
     60  REAL, INTENT (IN) :: cv((ii+1)*jj) ! cv coeff. (v_covariant = cv * v)
    4561  INTEGER, INTENT (IN) :: pdayref ! reference day of for the simulation
    4662  REAL, INTENT (IN) :: ptimestep !physics time step (s)
     
    7086  END IF
    7187
    72   !call init_phys_lmdz(iim,jjm+1,llm,1,(/(jjm-1)*iim+2/))
     88  !call init_phys_lmdz(ii,jj+1,llm,1,(/(jj-1)*ii+2/))
    7389 
    7490  ! Generate global arrays on full physics grid
     
    8298    cufi(1) = cu(1)
    8399    cvfi(1) = cv(1)
    84     DO j=2,jjm
    85       DO i=1,iim
    86         latfi((j-2)*iim+1+i)= rlatu(j)
    87         lonfi((j-2)*iim+1+i)= rlonv(i)
    88         cufi((j-2)*iim+1+i) = cu((j-1)*iim+1+i)
    89         cvfi((j-2)*iim+1+i) = cv((j-1)*iim+1+i)
     100    DO j=2,jj
     101      DO i=1,ii
     102        latfi((j-2)*ii+1+i)= rlatu(j)
     103        lonfi((j-2)*ii+1+i)= rlonv(i)
     104        cufi((j-2)*ii+1+i) = cu((j-1)*ii+1+i)
     105        cvfi((j-2)*ii+1+i) = cv((j-1)*ii+1+i)
    90106      ENDDO
    91107    ENDDO
    92108    ! South pole
    93     latfi(klon_glo)= rlatu(jjm+1)
     109    latfi(klon_glo)= rlatu(jj+1)
    94110    lonfi(klon_glo)= 0.
    95     cufi(klon_glo) = cu((iim+1)*jjm+1)
    96     cvfi(klon_glo) = cv((iim+1)*jjm-iim)
     111    cufi(klon_glo) = cu((ii+1)*jj+1)
     112    cvfi(klon_glo) = cv((ii+1)*jj-ii)
    97113
    98114    ! build airefi(), mesh area on physics grid
    99     CALL gr_dyn_fi(1,iim+1,jjm+1,klon_glo,aire,airefi)
     115    CALL gr_dyn_fi(1,ii+1,jj+1,klon_glo,aire,airefi)
    100116    ! Poles are single points on physics grid
    101     airefi(1)=sum(aire(1:iim,1))
    102     airefi(klon_glo)=sum(aire(1:iim,jjm+1))
     117    airefi(1)=sum(aire(1:ii,1))
     118    airefi(klon_glo)=sum(aire(1:ii,jj+1))
    103119
    104120    ! Sanity check: do total planet area match between physics and dynamics?
    105     total_area_dyn=sum(aire(1:iim,1:jjm+1))
     121    total_area_dyn=sum(aire(1:ii,1:jj+1))
    106122    total_area_phy=sum(airefi(1:klon_glo))
    107123    IF (total_area_dyn/=total_area_phy) THEN
     
    126142!$OMP PARALLEL
    127143  ! Now generate local lon/lat/cu/cv/area arrays
    128   CALL initcomgeomphy
     144  CALL initcomgeomphy(klon_omp)
    129145
    130146  offset = klon_mpi_begin - 1
     
    135151  rlatd(1:klon_omp) = latfi(offset+klon_omp_begin:offset+klon_omp_end)
    136152
    137     ! suphel => initialize some physical constants (orbital parameters,
    138     !           geoid, gravity, thermodynamical constants, etc.) in the
    139     !           physics
    140   CALL suphel
     153  ! copy over global grid longitudes and latitudes
     154  CALL initcomgeomphy_horiz(iim,jjm,rlonu,rlonv,rlatu,rlatv)
     155 
     156  ! copy over preff , ap(), bp(), etc
     157  CALL initcomgeomphy_vert(nlayer,preff,ap,bp,presnivs,pseudoalt)
    141158
    142 !$OMP END PARALLEL
     159!    ! suphel => initialize some physical constants (orbital parameters,
     160!    !           geoid, gravity, thermodynamical constants, etc.) in the
     161!    !           physics
     162!  CALL suphel
    143163
    144   ! check that physical constants set in 'suphel' are coherent
    145   ! with values set in the dynamics:
    146   IF (rday/=punjours) THEN
    147     WRITE (lunout, *) 'iniphysiq: length of day discrepancy!!!'
    148     WRITE (lunout, *) '  in the dynamics punjours=', punjours
    149     WRITE (lunout, *) '   but in the physics RDAY=', rday
    150     IF (abs(rday-punjours)>0.01*punjours) THEN
    151         ! stop here if the relative difference is more than 1%
    152       abort_message = 'length of day discrepancy'
    153       CALL abort_gcm(modname, abort_message, 1)
    154     END IF
    155   END IF
    156   IF (rg/=pg) THEN
    157     WRITE (lunout, *) 'iniphysiq: gravity discrepancy !!!'
    158     WRITE (lunout, *) '     in the dynamics pg=', pg
    159     WRITE (lunout, *) '  but in the physics RG=', rg
    160     IF (abs(rg-pg)>0.01*pg) THEN
    161         ! stop here if the relative difference is more than 1%
    162       abort_message = 'gravity discrepancy'
    163       CALL abort_gcm(modname, abort_message, 1)
    164     END IF
    165   END IF
    166   IF (ra/=prad) THEN
    167     WRITE (lunout, *) 'iniphysiq: planet radius discrepancy !!!'
    168     WRITE (lunout, *) '   in the dynamics prad=', prad
    169     WRITE (lunout, *) '  but in the physics RA=', ra
    170     IF (abs(ra-prad)>0.01*prad) THEN
    171         ! stop here if the relative difference is more than 1%
    172       abort_message = 'planet radius discrepancy'
    173       CALL abort_gcm(modname, abort_message, 1)
    174     END IF
    175   END IF
    176   IF (rd/=pr) THEN
    177     WRITE (lunout, *) 'iniphysiq: reduced gas constant discrepancy !!!'
    178     WRITE (lunout, *) '     in the dynamics pr=', pr
    179     WRITE (lunout, *) '  but in the physics RD=', rd
    180     IF (abs(rd-pr)>0.01*pr) THEN
    181         ! stop here if the relative difference is more than 1%
    182       abort_message = 'reduced gas constant discrepancy'
    183       CALL abort_gcm(modname, abort_message, 1)
    184     END IF
    185   END IF
    186   IF (rcpd/=pcpp) THEN
    187     WRITE (lunout, *) 'iniphysiq: specific heat discrepancy !!!'
    188     WRITE (lunout, *) '     in the dynamics pcpp=', pcpp
    189     WRITE (lunout, *) '  but in the physics RCPD=', rcpd
    190     IF (abs(rcpd-pcpp)>0.01*pcpp) THEN
    191         ! stop here if the relative difference is more than 1%
    192       abort_message = 'specific heat discrepancy'
    193       CALL abort_gcm(modname, abort_message, 1)
    194     END IF
    195   END IF
     164  ! Initialize tracer names, numbers, etc. for physics
     165  CALL ini_phytrac_phy(nqtot,nqo,nbtr,tname,ttext,type_trac,&
     166                       niadv,conv_flg,pbl_flg,solsym)
     167
     168  ! transfer some flags/infos from dynamics to physics
     169  call inifis(punjours,prad,pg,pr,pcpp,ptimestep,&
     170              day_step,iphysiq,dayref,anneeref,nday,&
     171              annee_ref,day_ini,day_end,&
     172              itau_phy,itaufin,&
     173              start_time,day_ref,jD_ref, &
     174              offline,raz_date,config_inca, &
     175              lunout,prt_level,debug)
     176 
     177!!$OMP END PARALLEL
    196178
    197179  ! Additional initializations for aquaplanets
    198 !$OMP PARALLEL
     180!!$OMP PARALLEL
    199181  IF (iflag_phys>=100) THEN
    200182    CALL iniaqua(klon_omp, rlatd, rlond, iflag_phys)
Note: See TracChangeset for help on using the changeset viewer.