1 | MODULE etat0_mod |
---|
2 | USE icosa |
---|
3 | PRIVATE |
---|
4 | |
---|
5 | CHARACTER(len=255),SAVE :: etat0_type |
---|
6 | !$OMP THREADPRIVATE(etat0_type) |
---|
7 | |
---|
8 | REAL(rstd) :: etat0_temp |
---|
9 | |
---|
10 | PUBLIC :: etat0, etat0_type |
---|
11 | |
---|
12 | CONTAINS |
---|
13 | |
---|
14 | SUBROUTINE etat0(f_ps,f_mass,f_phis,f_theta_rhodz,f_u, f_q) |
---|
15 | USE mpipara, ONLY : is_mpi_root |
---|
16 | USE disvert_mod |
---|
17 | ! New interface |
---|
18 | USE etat0_dcmip5_mod, ONLY : getin_etat0_dcmip5=>getin_etat0 |
---|
19 | USE etat0_williamson_mod, ONLY : getin_etat0_williamson=>getin_etat0 |
---|
20 | ! Old interface |
---|
21 | USE etat0_academic_mod, ONLY : etat0_academic=>etat0 |
---|
22 | USE etat0_dcmip1_mod, ONLY : etat0_dcmip1=>etat0 |
---|
23 | USE etat0_dcmip2_mod, ONLY : etat0_dcmip2=>etat0 |
---|
24 | USE etat0_dcmip3_mod, ONLY : etat0_dcmip3=>etat0 |
---|
25 | USE etat0_dcmip4_mod, ONLY : etat0_dcmip4=>etat0 |
---|
26 | USE etat0_heldsz_mod, ONLY : etat0_heldsz=>etat0 |
---|
27 | USE etat0_start_file_mod, ONLY : etat0_start_file=>etat0 |
---|
28 | |
---|
29 | IMPLICIT NONE |
---|
30 | TYPE(t_field),POINTER :: f_ps(:) |
---|
31 | TYPE(t_field),POINTER :: f_mass(:) |
---|
32 | TYPE(t_field),POINTER :: f_phis(:) |
---|
33 | TYPE(t_field),POINTER :: f_theta_rhodz(:) |
---|
34 | TYPE(t_field),POINTER :: f_u(:) |
---|
35 | TYPE(t_field),POINTER :: f_q(:) |
---|
36 | |
---|
37 | REAL(rstd),POINTER :: ps(:), mass(:,:) |
---|
38 | LOGICAL :: init_mass |
---|
39 | INTEGER :: ind,i,j,ij,l |
---|
40 | |
---|
41 | ! most etat0 routines set ps and not mass |
---|
42 | ! in that case and if caldyn_eta == eta_lag |
---|
43 | ! the initial distribution of mass is taken to be the same |
---|
44 | ! as what the mass coordinate would dictate |
---|
45 | ! however if etat0_XXX defines mass then the flag init_mass must be set to .FALSE. |
---|
46 | ! otherwise mass will be overwritten |
---|
47 | init_mass = (caldyn_eta == eta_lag) |
---|
48 | |
---|
49 | etat0_type='jablonowsky06' |
---|
50 | CALL getin("etat0",etat0_type) |
---|
51 | |
---|
52 | SELECT CASE (TRIM(etat0_type)) |
---|
53 | !------------------- New interface --------------------- |
---|
54 | CASE ('isothermal') |
---|
55 | CALL getin_etat0_isothermal |
---|
56 | CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q) |
---|
57 | CASE ('jablonowsky06') |
---|
58 | CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q) |
---|
59 | CASE ('dcmip5') |
---|
60 | CALL getin_etat0_dcmip5 |
---|
61 | CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q) |
---|
62 | CASE ('williamson91.6') |
---|
63 | init_mass=.FALSE. |
---|
64 | CALL getin_etat0_williamson |
---|
65 | CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q) |
---|
66 | !------------------- Old interface -------------------- |
---|
67 | CASE ('start_file') |
---|
68 | CALL etat0_start_file(f_ps,f_phis,f_theta_rhodz,f_u, f_q) |
---|
69 | CASE ('academic') |
---|
70 | CALL etat0_academic(f_ps,f_phis,f_theta_rhodz,f_u, f_q) |
---|
71 | CASE ('held_suarez') |
---|
72 | PRINT *,"Held & Suarez (1994) test case" |
---|
73 | CALL etat0_heldsz(f_ps,f_phis,f_theta_rhodz,f_u, f_q) |
---|
74 | CASE ('dcmip1') |
---|
75 | CALL etat0_dcmip1(f_ps,f_phis,f_theta_rhodz,f_u, f_q) |
---|
76 | CASE ('dcmip2_mountain','dcmip2_schaer_noshear','dcmip2_schaer_shear') |
---|
77 | CALL etat0_dcmip2(f_ps,f_phis,f_theta_rhodz,f_u, f_q) |
---|
78 | CASE ('dcmip3') |
---|
79 | CALL etat0_dcmip3(f_ps,f_phis,f_theta_rhodz,f_u, f_q) |
---|
80 | CASE ('dcmip4') |
---|
81 | IF(nqtot<2) THEN |
---|
82 | IF (is_mpi_root) THEN |
---|
83 | PRINT *, "nqtot must be at least 2 for test case DCMIP4" |
---|
84 | END IF |
---|
85 | STOP |
---|
86 | END IF |
---|
87 | CALL etat0_dcmip4(f_ps,f_phis,f_theta_rhodz,f_u, f_q) |
---|
88 | CASE DEFAULT |
---|
89 | PRINT*, 'Bad selector for variable etat0 <',etat0_type, & |
---|
90 | '> options are <jablonowsky06>, <academic>, <dcmip[1-4]> ' |
---|
91 | STOP |
---|
92 | END SELECT |
---|
93 | |
---|
94 | IF(init_mass) THEN ! initialize mass distribution using ps |
---|
95 | ! !$OMP BARRIER |
---|
96 | DO ind=1,ndomain |
---|
97 | IF (.NOT. assigned_domain(ind)) CYCLE |
---|
98 | CALL swap_dimensions(ind) |
---|
99 | CALL swap_geometry(ind) |
---|
100 | mass=f_mass(ind); ps=f_ps(ind) |
---|
101 | CALL compute_rhodz(.TRUE., ps, mass) |
---|
102 | END DO |
---|
103 | END IF |
---|
104 | |
---|
105 | END SUBROUTINE etat0 |
---|
106 | |
---|
107 | SUBROUTINE etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_q) |
---|
108 | USE theta2theta_rhodz_mod |
---|
109 | IMPLICIT NONE |
---|
110 | TYPE(t_field),POINTER :: f_ps(:) |
---|
111 | TYPE(t_field),POINTER :: f_mass(:) |
---|
112 | TYPE(t_field),POINTER :: f_phis(:) |
---|
113 | TYPE(t_field),POINTER :: f_theta_rhodz(:) |
---|
114 | TYPE(t_field),POINTER :: f_temp(:) |
---|
115 | TYPE(t_field),POINTER :: f_u(:) |
---|
116 | TYPE(t_field),POINTER :: f_q(:) |
---|
117 | |
---|
118 | REAL(rstd),POINTER :: ps(:) |
---|
119 | REAL(rstd),POINTER :: mass(:,:) |
---|
120 | REAL(rstd),POINTER :: phis(:) |
---|
121 | REAL(rstd),POINTER :: theta_rhodz(:,:) |
---|
122 | REAL(rstd),POINTER :: temp(:,:) |
---|
123 | REAL(rstd),POINTER :: u(:,:) |
---|
124 | REAL(rstd),POINTER :: q(:,:,:) |
---|
125 | INTEGER :: ind |
---|
126 | |
---|
127 | DO ind=1,ndomain |
---|
128 | IF (.NOT. assigned_domain(ind)) CYCLE |
---|
129 | CALL swap_dimensions(ind) |
---|
130 | CALL swap_geometry(ind) |
---|
131 | ps=f_ps(ind) |
---|
132 | mass=f_mass(ind) |
---|
133 | phis=f_phis(ind) |
---|
134 | theta_rhodz=f_theta_rhodz(ind) |
---|
135 | temp=f_temp(ind) |
---|
136 | u=f_u(ind) |
---|
137 | q=f_q(ind) |
---|
138 | |
---|
139 | IF( TRIM(etat0_type)=='williamson91.6' ) THEN |
---|
140 | CALL compute_etat0_collocated(ps,mass, phis, theta_rhodz, u, q) |
---|
141 | ELSE |
---|
142 | CALL compute_etat0_collocated(ps,mass, phis, temp, u, q) |
---|
143 | ENDIF |
---|
144 | ENDDO |
---|
145 | |
---|
146 | IF( TRIM(etat0_type)/='williamson91.6' ) CALL temperature2theta_rhodz(f_ps,f_temp,f_theta_rhodz) |
---|
147 | |
---|
148 | |
---|
149 | END SUBROUTINE etat0_collocated |
---|
150 | |
---|
151 | SUBROUTINE compute_etat0_collocated(ps,mass, phis, temp_i, u, q) |
---|
152 | USE wind_mod |
---|
153 | USE etat0_jablonowsky06_mod, ONLY : compute_jablonowsky06 => compute_etat0 |
---|
154 | USE etat0_dcmip5_mod, ONLY : compute_dcmip5 => compute_etat0 |
---|
155 | USE etat0_williamson_mod, ONLY : compute_w91_6 => compute_etat0 |
---|
156 | IMPLICIT NONE |
---|
157 | REAL(rstd),INTENT(INOUT) :: ps(iim*jjm) |
---|
158 | REAL(rstd),INTENT(INOUT) :: mass(iim*jjm,llm) |
---|
159 | REAL(rstd),INTENT(OUT) :: phis(iim*jjm) |
---|
160 | REAL(rstd),INTENT(OUT) :: temp_i(iim*jjm,llm) |
---|
161 | REAL(rstd),INTENT(OUT) :: u(3*iim*jjm,llm) |
---|
162 | REAL(rstd),INTENT(OUT) :: q(iim*jjm,llm,nqtot) |
---|
163 | |
---|
164 | REAL(rstd) :: lon_i(iim*jjm) |
---|
165 | REAL(rstd) :: lat_i(iim*jjm) |
---|
166 | REAL(rstd) :: ulon_i(iim*jjm,llm) |
---|
167 | REAL(rstd) :: ulat_i(iim*jjm,llm) |
---|
168 | |
---|
169 | REAL(rstd) :: lon_e(3*iim*jjm) |
---|
170 | REAL(rstd) :: lat_e(3*iim*jjm) |
---|
171 | REAL(rstd) :: ps_e(3*iim*jjm) |
---|
172 | REAL(rstd) :: mass_e(3*iim*jjm,llm) |
---|
173 | REAL(rstd) :: phis_e(3*iim*jjm) |
---|
174 | REAL(rstd) :: temp_e(3*iim*jjm,llm) |
---|
175 | REAL(rstd) :: ulon_e(3*iim*jjm,llm) |
---|
176 | REAL(rstd) :: ulat_e(3*iim*jjm,llm) |
---|
177 | REAL(rstd) :: q_e(3*iim*jjm,llm,nqtot) |
---|
178 | |
---|
179 | INTEGER :: l,i,j,ij |
---|
180 | |
---|
181 | SELECT CASE (TRIM(etat0_type)) |
---|
182 | CASE ('isothermal') |
---|
183 | CALL compute_etat0_isothermal(iim*jjm, phis, ps, temp_i, ulon_i, ulat_i, q) |
---|
184 | CALL compute_etat0_isothermal(3*iim*jjm, phis_e, ps_e, temp_e, ulon_e, ulat_e, q_e) |
---|
185 | CASE('jablonowsky06') |
---|
186 | CALL compute_jablonowsky06(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i) |
---|
187 | CALL compute_jablonowsky06(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e) |
---|
188 | CASE('dcmip5') |
---|
189 | CALL compute_dcmip5(iim*jjm,lon_i,lat_i, phis, ps, temp_i, ulon_i, ulat_i, q) |
---|
190 | CALL compute_dcmip5(3*iim*jjm,lon_e,lat_e, phis_e, ps_e, temp_e, ulon_e, ulat_e, q_e) |
---|
191 | CASE('williamson91.6') |
---|
192 | CALL compute_w91_6(iim*jjm,lon_i,lat_i, phis, mass(:,1), temp_i(:,1), ulon_i(:,1), ulat_i(:,1)) |
---|
193 | CALL compute_w91_6(3*iim*jjm,lon_e,lat_e, phis_e, mass_e(:,1), temp_e(:,1), ulon_e(:,1), ulat_e(:,1)) |
---|
194 | END SELECT |
---|
195 | |
---|
196 | CALL compute_wind_perp_from_lonlat_compound(ulon_e, ulat_e, u) |
---|
197 | |
---|
198 | END SUBROUTINE compute_etat0_collocated |
---|
199 | |
---|
200 | !----------------------------- Resting isothermal state -------------------------------- |
---|
201 | |
---|
202 | SUBROUTINE getin_etat0_isothermal |
---|
203 | etat0_temp=300 |
---|
204 | CALL getin("etat0_isothermal_temp",etat0_temp) |
---|
205 | END SUBROUTINE getin_etat0_isothermal |
---|
206 | |
---|
207 | SUBROUTINE compute_etat0_isothermal(ngrid, phis, ps, temp, ulon, ulat, q) |
---|
208 | IMPLICIT NONE |
---|
209 | INTEGER, INTENT(IN) :: ngrid |
---|
210 | REAL(rstd),INTENT(OUT) :: phis(ngrid) |
---|
211 | REAL(rstd),INTENT(OUT) :: ps(ngrid) |
---|
212 | REAL(rstd),INTENT(OUT) :: temp(ngrid,llm) |
---|
213 | REAL(rstd),INTENT(OUT) :: ulon(ngrid,llm) |
---|
214 | REAL(rstd),INTENT(OUT) :: ulat(ngrid,llm) |
---|
215 | REAL(rstd),INTENT(OUT) :: q(ngrid,llm,nqtot) |
---|
216 | phis(:)=0 |
---|
217 | ps(:)=preff |
---|
218 | temp(:,:)=etat0_temp |
---|
219 | ulon(:,:)=0 |
---|
220 | ulat(:,:)=0 |
---|
221 | q(:,:,:)=0 |
---|
222 | END SUBROUTINE compute_etat0_isothermal |
---|
223 | |
---|
224 | END MODULE etat0_mod |
---|