1 | PROGRAM ce0l |
---|
2 | ! |
---|
3 | ! Purpose: Calls etat0, creates initial states and limit_netcdf |
---|
4 | ! |
---|
5 | ! interbar=.T. for barycentric interpolation inter_barxy |
---|
6 | ! extrap =.T. for data extrapolation, like for the SSTs when file does not |
---|
7 | ! contain ocean points only. |
---|
8 | ! oldice =.T. for old-style ice, obtained using grille_m (grid_atob). |
---|
9 | ! masque is created in etat0, passed to limit to ensure consistancy. |
---|
10 | |
---|
11 | USE control_mod, only: DAY_STEP, DAYREF, NSPLIT_PHYS |
---|
12 | USE etat0dyn, only: etat0dyn_netcdf |
---|
13 | USE netcdf, ONLY: NF90_OPEN, NF90_NOWRITE, NF90_CLOSE, NF90_NOERR |
---|
14 | USE ioipsl, ONLY: ioconf_calendar, getin, flininfo, flinopen, flinget, flinclo |
---|
15 | |
---|
16 | USE etat0phys, only: etat0phys_netcdf |
---|
17 | USE dimphy, only: KLON |
---|
18 | USE infotrac, only: TYPE_TRAC, infotrac_init |
---|
19 | USE test_disvert_m, ONLY: test_disvert |
---|
20 | |
---|
21 | IMPLICIT NONE |
---|
22 | |
---|
23 | ! Local variables: |
---|
24 | include "dimensions.h" |
---|
25 | include "paramet.h" |
---|
26 | include "comgeom.h" |
---|
27 | include "comconst.h" |
---|
28 | include "comvert.h" |
---|
29 | include "iniprint.h" |
---|
30 | include "temps.h" |
---|
31 | include "logic.h" |
---|
32 | REAL :: masque(iip1, jjp1) !--- CONTINENTAL MASK |
---|
33 | REAL :: phis (iip1, jjp1) !--- GROUND GEOPOTENTIAL |
---|
34 | CHARACTER(LEN=256) :: modname, fmt, calnd !--- CALENDAR TYPE |
---|
35 | LOGICAL :: use_filtre_fft |
---|
36 | LOGICAL, PARAMETER :: interbar=.TRUE., extrap=.FALSE., oldice=.FALSE. |
---|
37 | |
---|
38 | !--- Local variables for ocean mask reading: |
---|
39 | INTEGER :: nid_o2a, iml_omask, jml_omask, j |
---|
40 | INTEGER :: fid, iret, llm_tmp, ttm_tmp, itaul(1) |
---|
41 | REAL, ALLOCATABLE :: lon_omask(:, :), dlon_omask(:), ocemask(:, :) |
---|
42 | REAL, ALLOCATABLE :: lat_omask(:, :), dlat_omask(:), ocetmp (:, :) |
---|
43 | REAL :: date, lev(1) |
---|
44 | |
---|
45 | !---------------------------------------------------------------------- |
---|
46 | modname="ce0l" |
---|
47 | |
---|
48 | !--- Constants |
---|
49 | pi = 4. * ATAN(1.) |
---|
50 | rad = 6371229. |
---|
51 | daysec = 86400. |
---|
52 | omeg = 2.*pi/daysec |
---|
53 | g = 9.8 |
---|
54 | kappa = 0.2857143 |
---|
55 | cpp = 1004.70885 |
---|
56 | jmp1 = jjm + 1 |
---|
57 | preff = 101325. |
---|
58 | pa = 50000. |
---|
59 | |
---|
60 | CALL conf_gcm( 99, .TRUE. ) |
---|
61 | |
---|
62 | dtvr = daysec/REAL(day_step) |
---|
63 | WRITE(lunout, *)'dtvr', dtvr |
---|
64 | |
---|
65 | CALL iniconst() |
---|
66 | CALL inigeom() |
---|
67 | |
---|
68 | #ifdef CPP_IOIPSL |
---|
69 | calnd='gregorian' |
---|
70 | SELECT CASE(calend) |
---|
71 | CASE('earth_360d') |
---|
72 | CALL ioconf_calendar('360d') |
---|
73 | calnd='with 360 days/year' |
---|
74 | CASE('earth_365d') |
---|
75 | CALL ioconf_calendar('noleap') |
---|
76 | calnd='with no leap year' |
---|
77 | CASE('earth_366d') |
---|
78 | CALL ioconf_calendar('366d') |
---|
79 | calnd='with leap years only' |
---|
80 | CASE('gregorian') |
---|
81 | CALL ioconf_calendar('gregorian') |
---|
82 | CASE('standard') |
---|
83 | CALL ioconf_calendar('gregorian') |
---|
84 | CASE('julian') |
---|
85 | CALL ioconf_calendar('julian') |
---|
86 | calnd='julian' |
---|
87 | CASE('proleptic_gregorian') |
---|
88 | CALL ioconf_calendar('gregorian') |
---|
89 | !--- DC Bof... => IOIPSL a mettre a jour: proleptic_gregorian /= gregorian |
---|
90 | CASE DEFAULT |
---|
91 | CALL abort_gcm('ce0l', 'Bad choice for calendar', 1) |
---|
92 | END SELECT |
---|
93 | WRITE(lunout, *)'CHOSEN CALENDAR: Earth '//TRIM(calnd) |
---|
94 | #endif |
---|
95 | |
---|
96 | use_filtre_fft=.FALSE. |
---|
97 | CALL getin('use_filtre_fft', use_filtre_fft) |
---|
98 | IF(use_filtre_fft) THEN |
---|
99 | WRITE(lunout, *)"FFT filter not available for sequential dynamics." |
---|
100 | WRITE(lunout, *)"Your setting of variable use_filtre_fft is not used." |
---|
101 | ENDIF |
---|
102 | |
---|
103 | !--- LAND MASK. TWO CASES: |
---|
104 | ! 1) read from ocean model file "o2a.nc" (coupled runs) |
---|
105 | ! 2) computed from topography file "Relief.nc" (masque(:, :)=-99999.) |
---|
106 | ! Coupled simulations (case 1) use the ocean model mask to compute the |
---|
107 | ! weights to ensure ocean fractions are the same for atmosphere and ocean. |
---|
108 | |
---|
109 | IF(NF90_OPEN("o2a.nc", NF90_NOWRITE, nid_o2a)/=NF90_NOERR) THEN |
---|
110 | WRITE(lunout, *)'BEWARE !! No ocean mask "o2a.nc" file found' |
---|
111 | WRITE(lunout, *)'Forced run.' |
---|
112 | masque(:, :)=-99999. |
---|
113 | ELSE |
---|
114 | iret=NF90_CLOSE(nid_o2a) |
---|
115 | WRITE(lunout, *)'BEWARE !! Ocean mask "o2a.nc" file found' |
---|
116 | WRITE(lunout, *)'Coupled run.' |
---|
117 | CALL flininfo("o2a.nc", iml_omask, jml_omask, llm_tmp, ttm_tmp, nid_o2a) |
---|
118 | IF(iml_omask/=iim .OR.jml_omask/=jjp1) THEN |
---|
119 | WRITE(lunout, *)'Mismatching dimensions for ocean mask' |
---|
120 | WRITE(lunout, *)'iim = ', iim , ' iml_omask = ', iml_omask |
---|
121 | WRITE(lunout, *)'jjp1 = ', jjp1, ' jml_omask = ', jml_omask |
---|
122 | CALL abort_gcm(modname, '', 1) |
---|
123 | END IF |
---|
124 | ALLOCATE(ocemask(iim, jjp1), lon_omask(iim, jjp1), dlon_omask(iim )) |
---|
125 | ALLOCATE(ocetmp (iim, jjp1), lat_omask(iim, jjp1), dlat_omask(jjp1)) |
---|
126 | CALL flinopen("o2a.nc", .FALSE., iim, jjp1, llm_tmp, lon_omask, & |
---|
127 | lat_omask, lev, ttm_tmp, itaul, date, dt, fid) |
---|
128 | CALL flinget(fid, "OceMask", iim, jjp1, llm_tmp, ttm_tmp, 1, 1, ocetmp) |
---|
129 | CALL flinclo(fid) |
---|
130 | dlon_omask(1:iim ) = lon_omask(1:iim, 1) |
---|
131 | dlat_omask(1:jjp1) = lat_omask(1, 1:jjp1) |
---|
132 | ocemask = ocetmp |
---|
133 | IF(dlat_omask(1)<dlat_omask(jml_omask)) THEN |
---|
134 | DO j=1, jjp1 |
---|
135 | ocemask(:, j) = ocetmp(:, jjp1-j+1) |
---|
136 | END DO |
---|
137 | END IF |
---|
138 | DEALLOCATE(ocetmp, lon_omask, lat_omask, dlon_omask, dlat_omask) |
---|
139 | IF(prt_level>=1) THEN |
---|
140 | WRITE(fmt, "(i4, 'i1)')")iim |
---|
141 | fmt='('//ADJUSTL(fmt) |
---|
142 | WRITE(lunout, *)'OCEAN MASK :' |
---|
143 | WRITE(lunout, fmt) NINT(ocemask) |
---|
144 | END IF |
---|
145 | masque(1:iim, :)=1.-ocemask(:, :) |
---|
146 | masque(iip1 , :)=masque(1, :) |
---|
147 | DEALLOCATE(ocemask) |
---|
148 | END IF |
---|
149 | phis(:, :)=-99999. |
---|
150 | |
---|
151 | CALL Init_Phys_lmdz(iim, jjp1, llm, 1, (/(jjm-1)*iim+2/)) |
---|
152 | WRITE(lunout, *)'---> klon=', klon |
---|
153 | |
---|
154 | call infotrac_init |
---|
155 | CALL iniphysiq(iim, jjm, llm, daysec, dayref, dtphys / nsplit_phys, rlatu, & |
---|
156 | rlonv, aire, cu, cv, rad, g, r, cpp, iflag_phys) |
---|
157 | |
---|
158 | IF(pressure_exner) CALL test_disvert |
---|
159 | |
---|
160 | IF (type_trac == 'inca') THEN |
---|
161 | #ifdef INCA |
---|
162 | CALL init_const_lmdz(nbtr, anneeref, dayref, iphysiq, day_step, nday) |
---|
163 | CALL init_inca_para(iim, jjm+1, klon, 1, klon_mpi_para_nb, 0) |
---|
164 | WRITE(lunout, *)'nbtr =' , nbtr |
---|
165 | #endif |
---|
166 | END IF |
---|
167 | IF(ok_etat0) THEN |
---|
168 | WRITE(lunout, '(//)') |
---|
169 | WRITE(lunout, *) ' ************************ ' |
---|
170 | WRITE(lunout, *) ' *** etat0phy_netcdf *** ' |
---|
171 | WRITE(lunout, *) ' ************************ ' |
---|
172 | WRITE(lunout, '(//)') |
---|
173 | WRITE(lunout, *) ' interbar = ', interbar |
---|
174 | CALL etat0phys_netcdf(interbar, masque, phis) |
---|
175 | END IF |
---|
176 | |
---|
177 | IF(ok_etat0) THEN |
---|
178 | WRITE(lunout, '(//)') |
---|
179 | WRITE(lunout, *) ' ************************ ' |
---|
180 | WRITE(lunout, *) ' *** etat0dyn_netcdf *** ' |
---|
181 | WRITE(lunout, *) ' ************************ ' |
---|
182 | WRITE(lunout, '(//)') |
---|
183 | WRITE(lunout, *) ' interbar = ', interbar |
---|
184 | CALL etat0dyn_netcdf(interbar, masque, phis) |
---|
185 | END IF |
---|
186 | |
---|
187 | IF(ok_limit) THEN |
---|
188 | WRITE(lunout, '(//)') |
---|
189 | WRITE(lunout, *) ' ********************* ' |
---|
190 | WRITE(lunout, *) ' *** Limit_netcdf *** ' |
---|
191 | WRITE(lunout, *) ' ********************* ' |
---|
192 | WRITE(lunout, '(//)') |
---|
193 | CALL limit_netcdf(interbar, extrap, oldice, masque) |
---|
194 | END IF |
---|
195 | |
---|
196 | WRITE(lunout, '(//)') |
---|
197 | WRITE(lunout, *) ' *************************** ' |
---|
198 | WRITE(lunout, *) ' *** grilles_gcm_netcdf *** ' |
---|
199 | WRITE(lunout, *) ' *************************** ' |
---|
200 | WRITE(lunout, '(//)') |
---|
201 | CALL grilles_gcm_netcdf_sub(masque, phis) |
---|
202 | |
---|
203 | END PROGRAM ce0l |
---|