| 1 | ! |
|---|
| 2 | ! $Id: iniphysiq.F90 2225 2015-03-11 14:55:23Z emillour $ |
|---|
| 3 | ! |
|---|
| 4 | MODULE iniphysiq_mod |
|---|
| 5 | |
|---|
| 6 | CONTAINS |
|---|
| 7 | |
|---|
| 8 | SUBROUTINE iniphysiq(ii,jj,nlayer, & |
|---|
| 9 | nbp, communicator, & |
|---|
| 10 | punjours, pdayref,ptimestep, & |
|---|
| 11 | rlatudyn,rlatvdyn,rlonudyn,rlonvdyn, & |
|---|
| 12 | airedyn,cudyn,cvdyn, & |
|---|
| 13 | prad,pg,pr,pcpp,iflag_phys) |
|---|
| 14 | |
|---|
| 15 | USE temps_mod, ONLY: annee_ref, day_ref, day_ini, day_end |
|---|
| 16 | USE comconst_mod, ONLY: cpp |
|---|
| 17 | USE cpdet_phy_mod, ONLY: init_cpdet_phy |
|---|
| 18 | USE infotrac, ONLY: nqtot, tname, ttext |
|---|
| 19 | USE logic_mod, ONLY: iflag_trac |
|---|
| 20 | USE infotrac_phy, ONLY: init_infotrac_phy |
|---|
| 21 | USE time_phylmdz_mod, ONLY: init_time |
|---|
| 22 | USE inigeomphy_mod, ONLY: inigeomphy |
|---|
| 23 | USE control_mod, ONLY: nday |
|---|
| 24 | USE dimphy, ONLY: init_dimphy |
|---|
| 25 | USE mod_phys_lmdz_para, ONLY: klon_omp ! number of columns (on local omp grid) |
|---|
| 26 | IMPLICIT NONE |
|---|
| 27 | |
|---|
| 28 | ! ======================================================================= |
|---|
| 29 | ! Initialisation of the physical constants and some positional and |
|---|
| 30 | ! geometrical arrays for the physics |
|---|
| 31 | ! ======================================================================= |
|---|
| 32 | |
|---|
| 33 | include "YOMCST.h" |
|---|
| 34 | include "iniprint.h" |
|---|
| 35 | |
|---|
| 36 | REAL, INTENT (IN) :: prad ! radius of the planet (m) |
|---|
| 37 | REAL, INTENT (IN) :: pg ! gravitational acceleration (m/s2) |
|---|
| 38 | REAL, INTENT (IN) :: pr ! ! reduced gas constant R/mu |
|---|
| 39 | REAL, INTENT (IN) :: pcpp ! specific heat Cp |
|---|
| 40 | REAL, INTENT (IN) :: punjours ! length (in s) of a standard day |
|---|
| 41 | INTEGER, INTENT (IN) :: nlayer ! number of atmospheric layers |
|---|
| 42 | INTEGER, INTENT (IN) :: ii ! number of atmospheric columns along longitudes |
|---|
| 43 | INTEGER, INTENT (IN) :: jj ! number of atompsheric columns along latitudes |
|---|
| 44 | INTEGER, INTENT(IN) :: nbp ! number of physics columns for this MPI process |
|---|
| 45 | INTEGER, INTENT(IN) :: communicator ! MPI communicator |
|---|
| 46 | REAL, INTENT (IN) :: rlatudyn(jj+1) ! latitudes of the physics grid |
|---|
| 47 | REAL, INTENT (IN) :: rlatvdyn(jj) ! latitude boundaries of the physics grid |
|---|
| 48 | REAL, INTENT (IN) :: rlonvdyn(ii+1) ! longitudes of the physics grid |
|---|
| 49 | REAL, INTENT (IN) :: rlonudyn(ii+1) ! longitude boundaries of the physics grid |
|---|
| 50 | REAL, INTENT (IN) :: airedyn(ii+1,jj+1) ! area of the dynamics grid (m2) |
|---|
| 51 | REAL, INTENT (IN) :: cudyn((ii+1)*(jj+1)) ! cu coeff. (u_covariant = cu * u) |
|---|
| 52 | REAL, INTENT (IN) :: cvdyn((ii+1)*jj) ! cv coeff. (v_covariant = cv * v) |
|---|
| 53 | INTEGER, INTENT (IN) :: pdayref ! reference day of for the simulation |
|---|
| 54 | REAL, INTENT (IN) :: ptimestep !physics time step (s) |
|---|
| 55 | INTEGER, INTENT (IN) :: iflag_phys ! type of physics to be called |
|---|
| 56 | |
|---|
| 57 | CHARACTER (LEN=20) :: modname = 'iniphysiq' |
|---|
| 58 | CHARACTER (LEN=80) :: abort_message |
|---|
| 59 | |
|---|
| 60 | ! the common part for all planetary physics |
|---|
| 61 | !------------------------------------------ |
|---|
| 62 | ! --> initialize physics distribution, global fields and geometry |
|---|
| 63 | ! (i.e. things in phy_common or dynphy_lonlat) |
|---|
| 64 | CALL inigeomphy(ii,jj,nlayer, & |
|---|
| 65 | nbp, communicator, & |
|---|
| 66 | rlatudyn,rlatvdyn, & |
|---|
| 67 | rlonudyn,rlonvdyn, & |
|---|
| 68 | airedyn,cudyn,cvdyn) |
|---|
| 69 | |
|---|
| 70 | ! the distinct part for all planetary physics (ie. things in phytitan) |
|---|
| 71 | !------------------------------------------ |
|---|
| 72 | |
|---|
| 73 | !$OMP PARALLEL |
|---|
| 74 | |
|---|
| 75 | ! Initialize dimphy module |
|---|
| 76 | call init_dimphy(klon_omp,nlayer) |
|---|
| 77 | |
|---|
| 78 | ! Initialize some physical constants |
|---|
| 79 | call suphec |
|---|
| 80 | |
|---|
| 81 | ! Initialize cpdet_phy module |
|---|
| 82 | call init_cpdet_phy(cpp) |
|---|
| 83 | |
|---|
| 84 | ! Initialize some "temporal and calendar" related variables |
|---|
| 85 | CALL init_time(annee_ref,day_ref,day_ini,day_end,nday,ptimestep) |
|---|
| 86 | |
|---|
| 87 | ! Initialize tracers in physics |
|---|
| 88 | CALL init_infotrac_phy(iflag_trac,nqtot,tname,ttext) |
|---|
| 89 | |
|---|
| 90 | !$OMP END PARALLEL |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | ! check that physical constants set in 'suphec' are coherent |
|---|
| 94 | ! with values set in the dynamics: |
|---|
| 95 | IF (rday/=punjours) THEN |
|---|
| 96 | WRITE (lunout, *) 'iniphysiq: length of day discrepancy!!!' |
|---|
| 97 | WRITE (lunout, *) ' in the dynamics punjours=', punjours |
|---|
| 98 | WRITE (lunout, *) ' but in the physics RDAY=', rday |
|---|
| 99 | IF (abs(rday-punjours)>0.01*punjours) THEN |
|---|
| 100 | ! stop here if the relative difference is more than 1% |
|---|
| 101 | abort_message = 'length of day discrepancy' |
|---|
| 102 | CALL abort_gcm(modname, abort_message, 1) |
|---|
| 103 | END IF |
|---|
| 104 | END IF |
|---|
| 105 | |
|---|
| 106 | IF (rg/=pg) THEN |
|---|
| 107 | WRITE (lunout, *) 'iniphysiq: gravity discrepancy !!!' |
|---|
| 108 | WRITE (lunout, *) ' in the dynamics pg=', pg |
|---|
| 109 | WRITE (lunout, *) ' but in the physics RG=', rg |
|---|
| 110 | IF (abs(rg-pg)>0.01*pg) THEN |
|---|
| 111 | ! stop here if the relative difference is more than 1% |
|---|
| 112 | abort_message = 'gravity discrepancy' |
|---|
| 113 | CALL abort_gcm(modname, abort_message, 1) |
|---|
| 114 | END IF |
|---|
| 115 | END IF |
|---|
| 116 | IF (ra/=prad) THEN |
|---|
| 117 | WRITE (lunout, *) 'iniphysiq: planet radius discrepancy !!!' |
|---|
| 118 | WRITE (lunout, *) ' in the dynamics prad=', prad |
|---|
| 119 | WRITE (lunout, *) ' but in the physics RA=', ra |
|---|
| 120 | IF (abs(ra-prad)>0.01*prad) THEN |
|---|
| 121 | ! stop here if the relative difference is more than 1% |
|---|
| 122 | abort_message = 'planet radius discrepancy' |
|---|
| 123 | CALL abort_gcm(modname, abort_message, 1) |
|---|
| 124 | END IF |
|---|
| 125 | END IF |
|---|
| 126 | IF (rd/=pr) THEN |
|---|
| 127 | WRITE (lunout, *) 'iniphysiq: reduced gas constant discrepancy !!!' |
|---|
| 128 | WRITE (lunout, *) ' in the dynamics pr=', pr |
|---|
| 129 | WRITE (lunout, *) ' but in the physics RD=', rd |
|---|
| 130 | IF (abs(rd-pr)>0.01*pr) THEN |
|---|
| 131 | ! stop here if the relative difference is more than 1% |
|---|
| 132 | abort_message = 'reduced gas constant discrepancy' |
|---|
| 133 | CALL abort_gcm(modname, abort_message, 1) |
|---|
| 134 | END IF |
|---|
| 135 | END IF |
|---|
| 136 | IF (rcpd/=pcpp) THEN |
|---|
| 137 | WRITE (lunout, *) 'iniphysiq: specific heat discrepancy !!!' |
|---|
| 138 | WRITE (lunout, *) ' in the dynamics pcpp=', pcpp |
|---|
| 139 | WRITE (lunout, *) ' but in the physics RCPD=', rcpd |
|---|
| 140 | IF (abs(rcpd-pcpp)>0.01*pcpp) THEN |
|---|
| 141 | ! stop here if the relative difference is more than 1% |
|---|
| 142 | abort_message = 'specific heat discrepancy' |
|---|
| 143 | CALL abort_gcm(modname, abort_message, 1) |
|---|
| 144 | END IF |
|---|
| 145 | END IF |
|---|
| 146 | |
|---|
| 147 | END SUBROUTINE iniphysiq |
|---|
| 148 | |
|---|
| 149 | END MODULE iniphysiq_mod |
|---|