1 | MODULE etat0_mod |
---|
2 | USE icosa |
---|
3 | USE etat0_collocated_mod |
---|
4 | IMPLICIT NONE |
---|
5 | PRIVATE |
---|
6 | |
---|
7 | PUBLIC :: etat0, init_etat0 |
---|
8 | |
---|
9 | ! Important notes for OpenMP |
---|
10 | ! When etat0 is called, vertical OpenMP parallelism is deactivated. |
---|
11 | ! Therefore only the omp_level_master thread must work, i.e. : |
---|
12 | ! !$OMP BARRIER |
---|
13 | ! DO ind=1,ndomain |
---|
14 | ! IF (.NOT. assigned_domain(ind) .OR. .NOT. is_omp_level_master) CYCLE |
---|
15 | ! ... |
---|
16 | ! END DO |
---|
17 | ! !$OMP BARRIER |
---|
18 | ! There MUST be NO OMP BARRIER inside the DO-LOOP or any routine it calls. |
---|
19 | |
---|
20 | CONTAINS |
---|
21 | |
---|
22 | SUBROUTINE init_etat0 |
---|
23 | USE etat0_database_mod, ONLY: init_etat0_database => init_etat0 |
---|
24 | USE etat0_start_file_mod, ONLY: init_etat0_start_file => init_etat0 |
---|
25 | USE etat0_heldsz_mod, ONLY: init_etat0_held_suarez => init_etat0 |
---|
26 | |
---|
27 | CALL getin("etat0",etat0_type) |
---|
28 | |
---|
29 | SELECT CASE (TRIM(etat0_type)) |
---|
30 | CASE ('isothermal') |
---|
31 | CASE ('temperature_profile') |
---|
32 | CASE ('jablonowsky06') |
---|
33 | CASE ('dcmip5') |
---|
34 | CASE ('williamson91.6') |
---|
35 | CASE ('start_file') |
---|
36 | CALL init_etat0_start_file |
---|
37 | CASE ('database') |
---|
38 | CALL init_etat0_database |
---|
39 | CASE ('academic') |
---|
40 | CASE ('held_suarez') |
---|
41 | CALL init_etat0_held_suarez |
---|
42 | CASE ('venus') |
---|
43 | CASE ('dcmip1') |
---|
44 | CASE ('dcmip2_mountain','dcmip2_schaer_noshear','dcmip2_schaer_shear') |
---|
45 | CASE ('dcmip3') |
---|
46 | CASE ('dcmip4') |
---|
47 | CASE ('dcmip2016_baroclinic_wave') |
---|
48 | CASE ('dcmip2016_cyclone') |
---|
49 | CASE ('dcmip2016_supercell') |
---|
50 | CASE ('bubble') |
---|
51 | CASE DEFAULT |
---|
52 | PRINT*, 'Bad selector for variable etat0 <',TRIM(etat0_type),'>'// & |
---|
53 | ' options are <isothermal>, <temperature_profile>, <jablonowsky06>, <dcmip5>, <williamson91.6>,'& |
---|
54 | //' <start_file>, <database>, <academic>, <held_suarez>, <venus>, <dcmip1>,' & |
---|
55 | //' <dcmip2_mountain,dcmip2_schaer_noshear,dcmip2_schaer_shear>, <dcmip3>, <dcmip4>,'& |
---|
56 | //' <dcmip2016_baroclinic_wave>, <dcmip2016_cyclone>, <dcmip2016_supercell>', 'bubble' |
---|
57 | STOP |
---|
58 | END SELECT |
---|
59 | |
---|
60 | END SUBROUTINE init_etat0 |
---|
61 | |
---|
62 | SUBROUTINE etat0(f_ps,f_mass,f_phis,f_theta_rhodz,f_u, f_geopot,f_w, f_q) |
---|
63 | USE omp_para, ONLY : is_omp_level_master |
---|
64 | USE mpipara, ONLY : is_mpi_root |
---|
65 | USE disvert_mod |
---|
66 | ! Generic interface |
---|
67 | USE etat0_isothermal_mod, ONLY : getin_etat0_isothermal=>getin_etat0 |
---|
68 | USE etat0_dcmip1_mod, ONLY : getin_etat0_dcmip1=>getin_etat0 |
---|
69 | USE etat0_dcmip2_mod, ONLY : getin_etat0_dcmip2=>getin_etat0 |
---|
70 | USE etat0_dcmip4_mod, ONLY : getin_etat0_dcmip4=>getin_etat0 |
---|
71 | USE etat0_dcmip5_mod, ONLY : getin_etat0_dcmip5=>getin_etat0 |
---|
72 | USE etat0_bubble_mod, ONLY : getin_etat0_bubble=>getin_etat0 |
---|
73 | USE etat0_williamson_mod, ONLY : getin_etat0_williamson=>getin_etat0 |
---|
74 | USE etat0_temperature_mod, ONLY: getin_etat0_temperature=>getin_etat0 |
---|
75 | USE etat0_dcmip2016_baroclinic_wave_mod, ONLY : getin_etat0_dcmip2016_baroclinic_wave=>getin_etat0 |
---|
76 | USE etat0_dcmip2016_cyclone_mod, ONLY : getin_etat0_dcmip2016_cyclone=>getin_etat0 |
---|
77 | USE etat0_dcmip2016_supercell_mod, ONLY : getin_etat0_dcmip2016_supercell=>getin_etat0 |
---|
78 | ! Ad hoc interfaces |
---|
79 | USE etat0_academic_mod, ONLY : etat0_academic=>etat0 |
---|
80 | USE etat0_heldsz_mod, ONLY : etat0_heldsz=>etat0 |
---|
81 | USE etat0_venus_mod, ONLY : etat0_venus=>etat0 |
---|
82 | USE etat0_database_mod, ONLY : etat0_database=>etat0 |
---|
83 | USE etat0_start_file_mod, ONLY : etat0_start_file=>etat0 |
---|
84 | |
---|
85 | TYPE(t_field),POINTER :: f_ps(:) |
---|
86 | TYPE(t_field),POINTER :: f_mass(:) |
---|
87 | TYPE(t_field),POINTER :: f_phis(:) |
---|
88 | TYPE(t_field),POINTER :: f_theta_rhodz(:) |
---|
89 | TYPE(t_field),POINTER :: f_u(:) |
---|
90 | TYPE(t_field),POINTER :: f_geopot(:) |
---|
91 | TYPE(t_field),POINTER :: f_w(:) |
---|
92 | TYPE(t_field),POINTER :: f_q(:) |
---|
93 | |
---|
94 | REAL(rstd),POINTER :: ps(:), mass(:,:) |
---|
95 | LOGICAL :: autoinit_mass, autoinit_geopot, collocated |
---|
96 | INTEGER :: ind,i,j,ij,l |
---|
97 | |
---|
98 | ! most etat0 routines set ps and not mass |
---|
99 | ! in that case and if caldyn_eta == eta_lag |
---|
100 | ! the initial distribution of mass is taken to be the same |
---|
101 | ! as what the mass coordinate would dictate |
---|
102 | ! however if etat0_XXX defines mass then the flag autoinit_mass must be set to .FALSE. |
---|
103 | ! otherwise mass will be overwritten |
---|
104 | autoinit_mass = (caldyn_eta == eta_lag) |
---|
105 | |
---|
106 | etat0_type='jablonowsky06' |
---|
107 | CALL getin("etat0",etat0_type) |
---|
108 | |
---|
109 | !------------------- Generic interface --------------------- |
---|
110 | collocated=.TRUE. |
---|
111 | SELECT CASE (TRIM(etat0_type)) |
---|
112 | CASE ('isothermal') |
---|
113 | CALL getin_etat0_isothermal |
---|
114 | CASE ('temperature_profile') |
---|
115 | CALL getin_etat0_temperature |
---|
116 | CASE ('jablonowsky06') |
---|
117 | CASE ('dcmip1') |
---|
118 | CALL getin_etat0_dcmip1 |
---|
119 | CASE ('dcmip2_mountain','dcmip2_schaer_noshear','dcmip2_schaer_shear') |
---|
120 | CALL getin_etat0_dcmip2 |
---|
121 | CASE ('dcmip3') |
---|
122 | CASE ('dcmip4') |
---|
123 | CALL getin_etat0_dcmip4 |
---|
124 | CASE ('dcmip5') |
---|
125 | CALL getin_etat0_dcmip5 |
---|
126 | CASE ('bubble') |
---|
127 | CALL getin_etat0_bubble |
---|
128 | CASE ('williamson91.6') |
---|
129 | autoinit_mass=.FALSE. |
---|
130 | CALL getin_etat0_williamson |
---|
131 | CASE ('dcmip2016_baroclinic_wave') |
---|
132 | CALL getin_etat0_dcmip2016_baroclinic_wave |
---|
133 | CASE ('dcmip2016_cyclone') |
---|
134 | CALL getin_etat0_dcmip2016_cyclone |
---|
135 | CASE ('dcmip2016_supercell') |
---|
136 | CALL getin_etat0_dcmip2016_supercell |
---|
137 | CASE DEFAULT |
---|
138 | collocated=.FALSE. |
---|
139 | autoinit_mass = .FALSE. |
---|
140 | END SELECT |
---|
141 | |
---|
142 | !------------------- Ad hoc interfaces -------------------- |
---|
143 | SELECT CASE (TRIM(etat0_type)) |
---|
144 | CASE ('database') |
---|
145 | CALL etat0_database(f_ps,f_phis,f_theta_rhodz,f_u, f_q) |
---|
146 | CASE ('start_file') |
---|
147 | CALL etat0_start_file(f_ps,f_phis,f_theta_rhodz,f_u, f_q) |
---|
148 | CASE ('academic') |
---|
149 | CALL etat0_academic(f_ps,f_phis,f_theta_rhodz,f_u, f_q) |
---|
150 | CASE ('held_suarez') |
---|
151 | PRINT *,"Held & Suarez (1994) test case" |
---|
152 | CALL etat0_heldsz(f_ps,f_phis,f_theta_rhodz,f_u, f_q) |
---|
153 | CASE ('venus') |
---|
154 | CALL etat0_venus(f_ps, f_phis, f_theta_rhodz, f_u, f_q) |
---|
155 | PRINT *, "Venus (Lebonnois et al., 2012) test case" |
---|
156 | CASE DEFAULT |
---|
157 | IF(collocated) THEN |
---|
158 | CALL etat0_collocated(f_phis,f_ps,f_mass,f_theta_rhodz,f_u, f_geopot,f_W, f_q) |
---|
159 | ELSE |
---|
160 | PRINT*, 'Bad selector for variable etat0 <',TRIM(etat0_type),'>'// & |
---|
161 | ' options are <isothermal>, <temperature_profile>, <jablonowsky06>, <dcmip5>, <williamson91.6>,'& |
---|
162 | //' <start_file>, <database>, <academic>, <held_suarez>, <venus>, <dcmip1>,' & |
---|
163 | //' <dcmip2_mountain,dcmip2_schaer_noshear,dcmip2_schaer_shear>, <dcmip3>, <dcmip4>,'& |
---|
164 | //' <dcmip2016_baroclinic_wave>, <dcmip2016_cyclone>, <dcmip2016_supercell>' |
---|
165 | STOP |
---|
166 | END IF |
---|
167 | END SELECT |
---|
168 | |
---|
169 | IF(autoinit_mass) THEN |
---|
170 | DO ind=1,ndomain |
---|
171 | IF (.NOT. assigned_domain(ind) .OR. .NOT. is_omp_level_master) CYCLE |
---|
172 | CALL swap_dimensions(ind) |
---|
173 | CALL swap_geometry(ind) |
---|
174 | mass=f_mass(ind); ps=f_ps(ind) |
---|
175 | CALL compute_rhodz(.TRUE., ps, mass) ! initialize mass distribution using ps |
---|
176 | END DO |
---|
177 | END IF |
---|
178 | |
---|
179 | END SUBROUTINE etat0 |
---|
180 | |
---|
181 | END MODULE etat0_mod |
---|