2 |
|
|
3 |
IMPLICIT NONE |
IMPLICIT NONE |
4 |
|
|
5 |
INTEGER day_ini |
INTEGER day_ini |
6 |
|
! day number at the beginning of the run, based on value 1 on January |
7 |
|
! 1st of annee_ref |
8 |
|
|
9 |
|
integer:: day_ref = 1 ! jour de l'année de l'état initial |
10 |
|
! (= 350 si 20 décembre par exemple) |
11 |
|
|
12 |
|
integer:: annee_ref = 1998 ! Annee de l'etat initial (avec 4 chiffres) |
13 |
|
|
14 |
contains |
contains |
15 |
|
|
16 |
SUBROUTINE dynetat0(vcov, ucov, teta, q, masse, ps, phis, time_0) |
SUBROUTINE dynetat0(vcov, ucov, teta, q, masse, ps, phis) |
17 |
|
|
18 |
! From dynetat0.F, version 1.2, 2004/06/22 11:45:30 |
! From dynetat0.F, version 1.2, 2004/06/22 11:45:30 |
19 |
! Authors: P. Le Van, L. Fairhead |
! Authors: P. Le Van, L. Fairhead |
20 |
! This procedure reads the initial state of the atmosphere. |
! This procedure reads the initial state of the atmosphere. |
21 |
|
|
22 |
use comconst, only: im, dtvr, jm, lllm |
use comconst, only: dtvr |
23 |
use comgeom, only: rlonu, rlatu, rlonv, rlatv, cu_2d, cv_2d, aire_2d |
use comgeom, only: rlonu, rlatu, rlonv, rlatv, cu_2d, cv_2d, aire_2d |
24 |
use conf_gcm_m, only: fxyhypb, ysinus |
use conf_gcm_m, only: raz_date |
25 |
use dimens_m, only: iim, jjm, llm, nqmx |
use dimens_m, only: iim, jjm, llm, nqmx |
26 |
use disvert_m, only: pa |
use disvert_m, only: pa |
27 |
use ener, only: etot0, ang0, ptot0, stot0, ztot0 |
use ener, only: etot0, ang0, ptot0, stot0, ztot0 |
30 |
use netcdf95, only: NF95_GET_VAR, nf95_open, nf95_inq_varid, NF95_CLOSE, & |
use netcdf95, only: NF95_GET_VAR, nf95_open, nf95_inq_varid, NF95_CLOSE, & |
31 |
NF95_Gw_VAR |
NF95_Gw_VAR |
32 |
use nr_util, only: assert |
use nr_util, only: assert |
33 |
use serre, only: clon, clat, grossismy, grossismx |
use serre, only: clon, clat, grossismy, grossismx, dzoomx, dzoomy, taux, & |
34 |
use temps, only: day_ref, itau_dyn, annee_ref |
tauy |
35 |
|
use temps, only: itau_dyn |
36 |
|
use unit_nml_m, only: unit_nml |
37 |
|
|
38 |
REAL, intent(out):: vcov(: , :, :) ! (iim + 1, jjm, llm) |
REAL, intent(out):: vcov(: , :, :) ! (iim + 1, jjm, llm) |
39 |
REAL, intent(out):: ucov(:, :, :) ! (iim + 1, jjm + 1, llm) |
REAL, intent(out):: ucov(:, :, :) ! (iim + 1, jjm + 1, llm) |
42 |
REAL, intent(out):: masse(:, :, :) ! (iim + 1, jjm + 1, llm) |
REAL, intent(out):: masse(:, :, :) ! (iim + 1, jjm + 1, llm) |
43 |
REAL, intent(out):: ps(:, :) ! (iim + 1, jjm + 1) in Pa |
REAL, intent(out):: ps(:, :) ! (iim + 1, jjm + 1) in Pa |
44 |
REAL, intent(out):: phis(:, :) ! (iim + 1, jjm + 1) |
REAL, intent(out):: phis(:, :) ! (iim + 1, jjm + 1) |
|
REAL, intent(out):: time_0 |
|
45 |
|
|
46 |
! Local variables: |
! Local variables: |
47 |
INTEGER iq |
INTEGER iq |
48 |
REAL, pointer:: tab_cntrl(:) ! tableau des paramètres du run |
REAL, pointer:: tab_cntrl(:) ! tableau des paramètres du run |
49 |
INTEGER ierr, ncid, varid |
INTEGER ierr, ncid, varid |
50 |
|
|
51 |
|
namelist /dynetat0_nml/ day_ref, annee_ref |
52 |
|
|
53 |
!----------------------------------------------------------------------- |
!----------------------------------------------------------------------- |
54 |
|
|
55 |
print *, "Call sequence information: dynetat0" |
print *, "Call sequence information: dynetat0" |
69 |
call nf95_inq_varid(ncid, "controle", varid) |
call nf95_inq_varid(ncid, "controle", varid) |
70 |
call NF95_Gw_VAR(ncid, varid, tab_cntrl) |
call NF95_Gw_VAR(ncid, varid, tab_cntrl) |
71 |
|
|
72 |
im = int(tab_cntrl(1)) |
call assert(int(tab_cntrl(1)) == iim, "dynetat0 tab_cntrl iim") |
73 |
jm = int(tab_cntrl(2)) |
call assert(int(tab_cntrl(2)) == jjm, "dynetat0 tab_cntrl jjm") |
74 |
lllm = int(tab_cntrl(3)) |
call assert(int(tab_cntrl(3)) == llm, "dynetat0 tab_cntrl llm") |
75 |
call assert(im == iim, "dynetat0 im iim") |
|
76 |
call assert(jm == jjm, "dynetat0 jm jjm") |
IF (dtvr /= tab_cntrl(12)) THEN |
77 |
call assert(lllm == llm, "dynetat0 lllm llm") |
print *, 'Warning: the time steps from day_step and "start.nc" ' // & |
78 |
|
'are different.' |
79 |
day_ref = int(tab_cntrl(4)) |
print *, 'dtvr from day_step: ', dtvr |
80 |
annee_ref = int(tab_cntrl(5)) |
print *, 'dtvr from "start.nc": ', tab_cntrl(12) |
81 |
dtvr = tab_cntrl(12) |
print *, 'Using the value from day_step.' |
82 |
|
ENDIF |
83 |
|
|
84 |
etot0 = tab_cntrl(13) |
etot0 = tab_cntrl(13) |
85 |
ptot0 = tab_cntrl(14) |
ptot0 = tab_cntrl(14) |
86 |
ztot0 = tab_cntrl(15) |
ztot0 = tab_cntrl(15) |
87 |
stot0 = tab_cntrl(16) |
stot0 = tab_cntrl(16) |
88 |
ang0 = tab_cntrl(17) |
ang0 = tab_cntrl(17) |
89 |
pa = tab_cntrl(18) |
pa = tab_cntrl(18) |
90 |
|
|
91 |
clon = tab_cntrl(20) |
clon = tab_cntrl(20) |
92 |
clat = tab_cntrl(21) |
clat = tab_cntrl(21) |
93 |
grossismx = tab_cntrl(22) |
grossismx = tab_cntrl(22) |
94 |
grossismy = tab_cntrl(23) |
grossismy = tab_cntrl(23) |
95 |
fxyhypb = tab_cntrl(24) == 1. |
dzoomx = tab_cntrl(25) |
96 |
if (.not. fxyhypb) ysinus = tab_cntrl(27) == 1. |
dzoomy = tab_cntrl(26) |
97 |
itau_dyn = tab_cntrl(31) |
taux = tab_cntrl(28) |
98 |
|
tauy = tab_cntrl(29) |
99 |
|
|
100 |
|
print *, "Enter namelist 'dynetat0_nml'." |
101 |
|
read(unit=*, nml=dynetat0_nml) |
102 |
|
write(unit_nml, nml=dynetat0_nml) |
103 |
|
|
104 |
|
if (raz_date) then |
105 |
|
print *, 'On réinitialise à la date lue dans la namelist.' |
106 |
|
day_ini = day_ref |
107 |
|
itau_dyn = 0 |
108 |
|
else |
109 |
|
day_ref = tab_cntrl(4) |
110 |
|
annee_ref = tab_cntrl(5) |
111 |
|
itau_dyn = tab_cntrl(31) |
112 |
|
day_ini = tab_cntrl(30) |
113 |
|
end if |
114 |
|
|
115 |
|
print *, "day_ini = ", day_ini |
116 |
|
|
117 |
|
deallocate(tab_cntrl) ! pointer |
118 |
|
|
119 |
call NF95_INQ_VARID (ncid, "rlonu", varid) |
call NF95_INQ_VARID (ncid, "rlonu", varid) |
120 |
call NF95_GET_VAR(ncid, varid, rlonu) |
call NF95_GET_VAR(ncid, varid, rlonu) |
140 |
call NF95_INQ_VARID (ncid, "phisinit", varid) |
call NF95_INQ_VARID (ncid, "phisinit", varid) |
141 |
call NF95_GET_VAR(ncid, varid, phis) |
call NF95_GET_VAR(ncid, varid, phis) |
142 |
|
|
|
call NF95_INQ_VARID (ncid, "temps", varid) |
|
|
call NF95_GET_VAR(ncid, varid, time_0) |
|
|
|
|
|
day_ini = tab_cntrl(30) + INT(time_0) |
|
|
time_0 = time_0 - INT(time_0) |
|
|
! {0 <= time0 < 1} |
|
|
|
|
|
deallocate(tab_cntrl) ! pointer |
|
|
|
|
143 |
call NF95_INQ_VARID (ncid, "ucov", varid) |
call NF95_INQ_VARID (ncid, "ucov", varid) |
144 |
call NF95_GET_VAR(ncid, varid, ucov) |
call NF95_GET_VAR(ncid, varid, ucov) |
145 |
|
|
165 |
|
|
166 |
call NF95_INQ_VARID (ncid, "ps", varid) |
call NF95_INQ_VARID (ncid, "ps", varid) |
167 |
call NF95_GET_VAR(ncid, varid, ps) |
call NF95_GET_VAR(ncid, varid, ps) |
168 |
|
! Check that there is a single value at each pole: |
169 |
|
call assert(ps(1, 1) == ps(2:, 1), "dynetat0 ps north pole") |
170 |
|
call assert(ps(1, jjm + 1) == ps(2:, jjm + 1), "dynetat0 ps south pole") |
171 |
|
|
172 |
call NF95_CLOSE(ncid) |
call NF95_CLOSE(ncid) |
173 |
|
|