FV3 Bundle
c_qg_model.F90
Go to the documentation of this file.
1 ! (C) Copyright 2009-2016 ECMWF.
2 !
3 ! This software is licensed under the terms of the Apache Licence Version 2.0
4 ! which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5 ! In applying this licence, ECMWF does not waive the privileges and immunities
6 ! granted to it by virtue of its status as an intergovernmental organisation nor
7 ! does it submit to any jurisdiction.
8 
9 ! ------------------------------------------------------------------------------
10 !> Setup the QG model
11 
12 !> The C++ code only knows about dimensional variables, whereas the QG model
13 !! is expressed in terms of non-dimensional variables.
14 !! Here, we query the configuration for the dimensional values, calculate the
15 !! equivalent non-dimensional values, and store them in the config structure.
16 !!
17 !! The convention used in the QG model is that a zero is appended to the
18 !! names of dimensional variables, whereas non-dimensional variable names do
19 !! not end in zero. (An exception to this convention are the layer depths:
20 !! D1 and D2.)
21 !!
22 !! The non-dimensionalisation is the usual one:
23 !! \f{eqnarray*}{
24 !!t &=& \tilde t \frac{\overline U}{L} \\\\
25 !!x &=& \frac{\tilde x}{L} \\\\
26 !!y &=& \frac{\tilde y}{L} \\\\
27 !!u &=& \frac{\tilde u}{\overline U} \\\\
28 !!v &=& \frac{\tilde v}{\overline U} \\\\
29 !!F_1 &=& \frac{f_0^2 L^2}{D_1 g \Delta\theta / {\overline\theta}} \\\\
30 !!F_2 &=& \frac{f_0^2 L^2}{D_2 g \Delta\theta / {\overline\theta}} \\\\
31 !!\beta &=& \beta_0 \frac{L^2}{\overline U}
32 !! \f}
33 !! where \f$ \overline U \f$, \f$ L \f$,
34 !! \f$ \Delta\theta / {\overline\theta} \f$, etc. are defined in
35 !! qg_constants.f90 .
36 !!
37 !! The Rossby number is \f$ \epsilon = {\overline U} / f_0 L \f$.
38 
39 subroutine c_qg_setup(c_confspec, c_key_geom, c_key_confdata) bind (c,name='qg_setup_f90')
40 
41 use qg_constants
42 use qg_configs
43 use qg_geom_mod
44 use iso_c_binding
45 use config_mod
46 use duration_mod
47 use kinds
48 use fckit_log_module, only : fckit_log
49 
50 implicit none
51 type(c_ptr), intent(in) :: c_confspec !< pointer to object of class Config
52 integer(c_int), intent(in) :: c_key_geom !< Geometry
53 integer(c_int), intent(inout) :: c_key_confdata !< Key to configuration data
54 
55 type(qg_config), pointer :: config
56 type(qg_geom), pointer :: geom
57 
58 integer :: icentre, jcentre, ii, jj
59 real(kind=kind_real) :: distx, disty
60 type(duration) :: dtstep
61 character(len=20) :: ststep
62 character(len=160) :: record
63 character(len=30) :: otype
64 
65 ! ------------------------------------------------------------------------------
66 
67 call qg_geom_registry%get(c_key_geom, geom)
68 call qg_config_registry%init()
69 call qg_config_registry%add(c_key_confdata)
70 call qg_config_registry%get(c_key_confdata, config)
71 
72 config%nx = geom%nx
73 config%ny = geom%ny
74 write(record,*)'c_qg_setup: nx, ny=',config%nx,config%ny
75 call fckit_log%info(record)
76 
77 config%d1 = config_get_real(c_confspec,"top_layer_depth")
78 config%d2 = config_get_real(c_confspec,"bottom_layer_depth")
79 write(record,*)'c_qg_setup: d1, d2=',config%d1,config%d2
80 call fckit_log%info(record)
81 
82 ststep = config_get_string(c_confspec,len(ststep),"tstep")
83 dtstep = trim(ststep)
84 config%dt0 = duration_seconds(dtstep)
85 write(record,*)'c_qg_setup: dt0=',config%dt0
86 call fckit_log%info(record)
87 
88 config%dt = config%dt0 * ubar/scale_length
89 config%f1 = f0*f0*scale_length*scale_length/(g*dlogtheta*config%d1)
90 config%f2 = f0*f0*scale_length*scale_length/(g*dlogtheta*config%d2)
91 config%rsmax = horog/(rossby_number*config%d2)
92 config%deltax0 = domain_zonal/real(config%nx,kind_real)
93 config%deltay0 = domain_meridional/real(config%ny+1,kind_real)
94 config%deltax = config%deltax0/scale_length
95 config%deltay = config%deltay0/scale_length
96 
97 !--- Orography
98 
99 allocate(config%rs(config%nx,config%ny))
100 
101 if (config_element_exists(c_confspec,"orography")) then
102  otype = trim(config_get_string(c_confspec,len(otype),"orography"))
103 else
104  ! This default value is for backward compatibility
105  otype = "bump"
106 endif
107 
108 write(record,*)"qg_geom_mod: orography = "//otype
109 call fckit_log%info(record)
110 
111 if (otype == "flat") then
112 
113  config%rs=0.0_kind_real
114 
115 else ! we could add other options in the future
116 
117  !--- Gaussian hill centred on (icentre,jcentre)
118  icentre=config%nx/4
119  jcentre=3*config%ny/4
120  do jj=1,config%ny
121  do ii=1,config%nx
122  distx = real(min(icentre-ii,config%nx-(icentre-ii)),kind_real) &
123  & *config%deltax0
124  disty = real(abs(jj-jcentre),kind_real) * config%deltay0
125  config%rs(ii,jj) = config%rsmax &
126  & *exp(-(distx*distx+disty*disty)/(worog*worog))
127  enddo
128  enddo
129 
130 endif
131 
132 return
133 end subroutine c_qg_setup
134 
135 ! ------------------------------------------------------------------------------
136 !> Delete the QG model
137 
138 subroutine c_qg_delete(c_key_conf) bind (c,name='qg_delete_f90')
140 use qg_configs
141 use iso_c_binding
142 
143 implicit none
144 integer(c_int), intent(inout) :: c_key_conf !< Key to configuration structure
145 type(qg_config), pointer :: conf
146 
147 call qg_config_registry%get(c_key_conf, conf)
148 deallocate(conf%rs)
149 call qg_config_registry%remove(c_key_conf)
150 
151 return
152 end subroutine c_qg_delete
153 
154 ! ------------------------------------------------------------------------------
155 !> Prepare for an integration of the QG model.
156 
157 !> At the start of a timestep of the QG model, the state must contain
158 !! streamfunction, potential vorticity and wind components. The control
159 !! variable for the analysis, however, contains only streamfunction.
160 !! This routine calculates potential vorticity and wind from the
161 !! streamfunction, and is called before an integration of the QG model.
162 
163 subroutine c_qg_prepare_integration(c_key_conf, c_key_state) &
164  & bind(c,name='qg_prepare_integration_f90')
166 use iso_c_binding
167 use qg_fields
168 use qg_configs
169 use qg_constants, only: bet
170 use calculate_pv, only : calc_pv
171 
172 implicit none
173 integer(c_int), intent(in) :: c_key_conf !< Configuration structure
174 integer(c_int), intent(in) :: c_key_state !< Model fields
175 
176 type(qg_config), pointer :: conf
177 type(qg_field), pointer :: flds
178 
179 call qg_field_registry%get(c_key_state,flds)
180 call qg_config_registry%get(c_key_conf, conf)
181 
182 ! -- calculate potential vorticity and wind components
183 
184 call calc_pv(flds%geom%nx,flds%geom%ny,flds%q,flds%x,flds%x_north,flds%x_south, &
185  & conf%f1,conf%f2,conf%deltax,conf%deltay,bet,conf%rs)
186 call zonal_wind(flds%u,flds%x,flds%x_north,flds%x_south,flds%geom%nx,flds%geom%ny, &
187  & conf%deltay)
188 call meridional_wind(flds%v,flds%x,flds%geom%nx,flds%geom%ny,conf%deltax)
189 
190 end subroutine c_qg_prepare_integration
191 
192 ! ------------------------------------------------------------------------------
193 !> Prepare for an integration of the QG model - Adjoint.
194 
195 subroutine c_qg_prepare_integration_ad(c_key_conf, c_key_incr) &
196  bind(c,name='qg_prepare_integration_ad_f90')
198 use iso_c_binding
199 use qg_fields
200 use qg_configs
201 use kinds
202 
203 implicit none
204 integer(c_int), intent(in) :: c_key_conf !< Configuration structure
205 integer(c_int), intent(in) :: c_key_incr !< Model fields
206 
207 type(qg_config), pointer :: conf
208 type(qg_field), pointer :: flds
209 
210 call qg_config_registry%get(c_key_conf,conf)
211 call qg_field_registry%get(c_key_incr,flds)
212 
213 ! -- calculate potential vorticity and wind components
214 
215 call meridional_wind_ad(flds%v,flds%x,flds%geom%nx,flds%geom%ny, conf%deltax)
216 call zonal_wind_ad(flds%u,flds%x,flds%geom%nx,flds%geom%ny,conf%deltay)
217 call calc_pv_ad(flds%q,flds%x,flds%geom%nx,flds%geom%ny, &
218  & conf%f1,conf%f2,conf%deltax,conf%deltay)
219 flds%q=0.0_kind_real;
220 flds%u=0.0_kind_real;
221 flds%v=0.0_kind_real;
222 
223 return
224 end subroutine c_qg_prepare_integration_ad
225 
226 ! ------------------------------------------------------------------------------
227 !> Prepare for an integration of the QG model - Tangent Linear
228 
229 subroutine c_qg_prepare_integration_tl(c_key_conf, c_key_incr) &
230  bind(c,name='qg_prepare_integration_tl_f90')
232 use iso_c_binding
233 use qg_fields
234 use qg_configs
235 
236 implicit none
237 integer(c_int), intent(in) :: c_key_conf !< Configuration structure
238 integer(c_int), intent(in) :: c_key_incr !< Model fields
239 
240 type(qg_config), pointer :: conf
241 type(qg_field), pointer :: flds
242 
243 call qg_config_registry%get(c_key_conf, conf)
244 call qg_field_registry%get(c_key_incr, flds)
245 
246 ! -- calculate potential vorticity and wind components
247 
248 call calc_pv_tl(flds%q,flds%x,flds%geom%nx,flds%geom%ny, &
249  & conf%f1,conf%f2,conf%deltax,conf%deltay)
250 call zonal_wind_tl(flds%u,flds%x,flds%geom%nx,flds%geom%ny,conf%deltay)
251 call meridional_wind_tl(flds%v,flds%x,flds%geom%nx,flds%geom%ny, conf%deltax)
252 
253 end subroutine c_qg_prepare_integration_tl
254 
255 ! ------------------------------------------------------------------------------
256 !> Perform a timestep of the QG model
257 
258 subroutine c_qg_propagate(c_key_conf, c_key_state) bind(c,name='qg_propagate_f90')
260 use iso_c_binding
261 use qg_fields
262 use qg_configs
263 
264 implicit none
265 integer(c_int), intent(in) :: c_key_conf !< Config structure
266 integer(c_int), intent(in) :: c_key_state !< Model fields
267 
268 type(qg_config), pointer :: conf
269 type(qg_field), pointer :: flds
270 
271 call qg_config_registry%get(c_key_conf, conf)
272 call qg_field_registry%get(c_key_state,flds)
273 
274 call propagate(flds, conf)
275 
276 return
277 end subroutine c_qg_propagate
278 
279 ! ------------------------------------------------------------------------------
280 !> Perform a timestep of the QG model - Adjoint
281 !> This routine is called from C++ to propagate the adjoint variables
282 
283 subroutine c_qg_propagate_ad(c_key_conf, c_key_incr, c_key_traj) &
284  bind(c,name='qg_propagate_ad_f90')
286 use iso_c_binding
287 use qg_fields
288 use qg_trajectories
289 use qg_configs
290 use qg_constants, only: bet
291 use calculate_pv, only : calc_pv
292 use kinds
293 
294 implicit none
295 integer(c_int), intent(in) :: c_key_conf !< Config structure
296 integer(c_int), intent(in) :: c_key_incr !< Model fields
297 integer(c_int), intent(in) :: c_key_traj !< Trajectory structure
298 
299 type(qg_config), pointer :: conf
300 type(qg_field), pointer :: flds
301 type(qg_trajectory), pointer :: traj
302 
303 real(kind=kind_real), allocatable :: qnew(:,:,:), x_traj(:,:,:)
304 real(kind=kind_real), allocatable :: q_traj(:,:,:), u_traj(:,:,:), v_traj(:,:,:)
305 real(kind=kind_real), allocatable :: qn_traj(:,:), qs_traj(:,:)
306 real(kind=kind_real) :: xn_traj(2), xs_traj(2)
307 
308 call qg_config_registry%get(c_key_conf,conf)
309 call qg_field_registry%get(c_key_incr,flds)
310 call qg_traj_registry%get(c_key_traj,traj)
311 
312 !--- workspace and trajectory
313 allocate(qnew(flds%geom%nx,flds%geom%ny,2))
314 allocate(x_traj(flds%geom%nx,flds%geom%ny,2))
315 allocate(qn_traj(flds%geom%nx,2))
316 allocate(qs_traj(flds%geom%nx,2))
317 allocate(q_traj(flds%geom%nx,flds%geom%ny,2))
318 allocate(u_traj(flds%geom%nx,flds%geom%ny,2))
319 allocate(v_traj(flds%geom%nx,flds%geom%ny,2))
320 call get_traj(traj,flds%geom%nx,flds%geom%ny,x_traj,xn_traj,xs_traj,qn_traj,qs_traj)
321 
322 !--- generate trajectory values for potential vorticity and wind
323 
324 call calc_pv(flds%geom%nx,flds%geom%ny,q_traj,x_traj,xn_traj,xs_traj, &
325  & conf%f1,conf%f2,conf%deltax,conf%deltay,bet,conf%rs)
326 call zonal_wind (u_traj,x_traj,xn_traj,xs_traj,flds%geom%nx,flds%geom%ny, conf%deltay)
327 call meridional_wind (v_traj,x_traj,flds%geom%nx,flds%geom%ny,conf%deltax)
328 
329 ! -- calculate potential vorticity and wind components
330 
331 call meridional_wind_ad(flds%v,flds%x,flds%geom%nx,flds%geom%ny,conf%deltax)
332 call zonal_wind_ad(flds%u,flds%x,flds%geom%nx,flds%geom%ny,conf%deltay)
333 qnew(:,:,:) = flds%q(:,:,:)
334 
335 !--- invert the potential vorticity to determine streamfunction
336 
337 call invert_pv_ad(flds%x,qnew,flds%geom%nx,flds%geom%ny, &
338  & conf%deltax,conf%deltay,conf%f1,conf%f2)
339 
340 !--- advect the potential vorticity
341 
342 call advect_pv_ad(qnew,flds%q,q_traj,qn_traj,qs_traj, &
343  & flds%u,u_traj,flds%v,v_traj,flds%geom%nx,flds%geom%ny, &
344  & conf%deltax,conf%deltay,conf%dt)
345 
346 !--- clean-up
347 deallocate(qnew)
348 deallocate(x_traj)
349 deallocate(qn_traj)
350 deallocate(qs_traj)
351 deallocate(q_traj)
352 deallocate(u_traj)
353 deallocate(v_traj)
354 
355 return
356 end subroutine c_qg_propagate_ad
357 
358 ! ------------------------------------------------------------------------------
359 !> Perform a timestep of the QG model - Tangent Linear
360 !> This routine is called from C++ to propagate the increment
361 
362 subroutine c_qg_propagate_tl(c_key_conf, c_key_incr, c_key_traj) &
363  bind(c,name='qg_propagate_tl_f90')
365 use iso_c_binding
366 use qg_fields
367 use qg_trajectories
368 use qg_configs
369 use qg_constants, only: bet
370 use calculate_pv, only : calc_pv
371 use kinds
372 
373 implicit none
374 integer(c_int), intent(in) :: c_key_conf !< Config structure
375 integer(c_int), intent(in) :: c_key_incr !< Model fields
376 integer(c_int), intent(in) :: c_key_traj !< Trajectory structure
377 
378 type(qg_config), pointer :: conf
379 type(qg_field), pointer :: flds
380 type(qg_trajectory), pointer :: traj
381 
382 real(kind_real), allocatable :: qnew(:,:,:), x_traj(:,:,:)
383 real(kind_real), allocatable :: q_traj(:,:,:), u_traj(:,:,:), v_traj(:,:,:)
384 real(kind_real), allocatable :: qn_traj(:,:), qs_traj(:,:)
385 real(kind_real) :: xn_traj(2), xs_traj(2)
386 
387 call qg_config_registry%get(c_key_conf, conf)
388 call qg_field_registry%get(c_key_incr,flds)
389 call qg_traj_registry%get(c_key_traj,traj)
390 
391 !--- workspace and trajectory
392 allocate(qnew(flds%geom%nx,flds%geom%ny,2))
393 allocate(x_traj(flds%geom%nx,flds%geom%ny,2))
394 allocate(qn_traj(flds%geom%nx,2))
395 allocate(qs_traj(flds%geom%nx,2))
396 allocate(q_traj(flds%geom%nx,flds%geom%ny,2))
397 allocate(u_traj(flds%geom%nx,flds%geom%ny,2))
398 allocate(v_traj(flds%geom%nx,flds%geom%ny,2))
399 call get_traj(traj,flds%geom%nx,flds%geom%ny,x_traj,xn_traj,xs_traj,qn_traj,qs_traj)
400 
401 !--- generate trajectory values for potential vorticity and wind
402 
403 call calc_pv(flds%geom%nx,flds%geom%ny,q_traj,x_traj,xn_traj,xs_traj, &
404  & conf%f1,conf%f2,conf%deltax,conf%deltay,bet,conf%rs)
405 call zonal_wind (u_traj,x_traj,xn_traj,xs_traj,flds%geom%nx,flds%geom%ny, conf%deltay)
406 call meridional_wind (v_traj,x_traj,flds%geom%nx,flds%geom%ny,conf%deltax)
407 
408 !--- advect the potential vorticity
409 
410 qnew(:,:,:)=0.0_kind_real
411 call advect_pv_tl(qnew,flds%q,q_traj,qn_traj,qs_traj, &
412  & flds%u,u_traj,flds%v,v_traj,flds%geom%nx,flds%geom%ny,&
413  & conf%deltax,conf%deltay,conf%dt)
414 
415 !--- invert the potential vorticity to determine streamfunction
416 
417 call invert_pv_tl(flds%x,qnew,flds%geom%nx,flds%geom%ny, &
418  & conf%deltax,conf%deltay,conf%f1,conf%f2)
419 
420 ! -- calculate potential vorticity and wind components
421 
422 flds%q(:,:,:) = qnew(:,:,:)
423 call zonal_wind_tl(flds%u,flds%x,flds%geom%nx,flds%geom%ny,conf%deltay)
424 call meridional_wind_tl(flds%v,flds%x,flds%geom%nx,flds%geom%ny,conf%deltax)
425 
426 !--- clean-up
427 deallocate(qnew)
428 deallocate(x_traj)
429 deallocate(qn_traj)
430 deallocate(qs_traj)
431 deallocate(q_traj)
432 deallocate(u_traj)
433 deallocate(v_traj)
434 
435 return
436 end subroutine c_qg_propagate_tl
437 
438 ! ------------------------------------------------------------------------------
439 !> Save trajectory and perform a timestep of the QG model
440 
441 subroutine c_qg_prop_traj(c_key_conf, c_key_state, c_key_traj) bind(c,name='qg_prop_traj_f90')
443 use iso_c_binding
444 use qg_fields
445 use qg_configs
446 use qg_trajectories
447 
448 implicit none
449 integer(c_int), intent(in) :: c_key_conf !< Config structure
450 integer(c_int), intent(in) :: c_key_state !< Model fields
451 integer(c_int), intent(inout) :: c_key_traj !< Trajectory structure
452 
453 type(qg_config), pointer :: conf
454 type(qg_field), pointer :: flds
455 type(qg_trajectory), pointer :: traj
456 
457 call qg_config_registry%get(c_key_conf,conf)
458 call qg_field_registry%get(c_key_state,flds)
459 
460 call qg_traj_registry%init()
461 call qg_traj_registry%add(c_key_traj)
462 call qg_traj_registry%get(c_key_traj,traj)
463 call set_traj(traj,flds%geom%nx,flds%geom%ny, &
464  & flds%x,flds%x_north,flds%x_south,flds%q_north,flds%q_south)
465 
466 return
467 end subroutine c_qg_prop_traj
468 
469 ! ------------------------------------------------------------------------------
470 !> Wipe out trajectory of the QG model
471 
472 subroutine c_qg_wipe_traj(c_key_traj) bind(c,name='qg_wipe_traj_f90')
474 use iso_c_binding
475 use qg_trajectories
476 
477 implicit none
478 integer(c_int), intent(inout) :: c_key_traj !< Trajectory structure
479 type(qg_trajectory), pointer :: traj
480 
481 call qg_traj_registry%get(c_key_traj,traj)
482 call delete_traj(traj)
483 call qg_traj_registry%remove(c_key_traj)
484 
485 return
486 end subroutine c_qg_wipe_traj
487 
488 ! ------------------------------------------------------------------------------
real(kind=kind_real), parameter domain_meridional
meridional model domain (m)
subroutine advect_pv_tl(qnew, q, q_traj, q_north, q_south, u, u_traj, v, v_traj, nx, ny, deltax, deltay, dt)
Advect potential vorticity - Tangent Linear.
real(kind=kind_real), parameter horog
height of orography (m)
subroutine invert_pv_tl(x, pv, nx, ny, deltax, deltay, F1, F2)
Invert potential vorticity - Tangent Linear.
type(registry_t), public qg_field_registry
Linked list interface - defines registry_t type.
Definition: qg_fields.F90:65
subroutine c_qg_delete(c_key_conf)
Delete the QG model.
Definition: c_qg_model.F90:139
real(kind=kind_real), parameter f0
Coriolis parameter at southern boundary.
Handle the trajectory for the QG model.
real(kind=kind_real), parameter g
gravity (m^2 s^{-2})
subroutine calc_pv_tl(pv, x, nx, ny, f1, f2, deltax, deltay)
Calculate potential vorticity - Tangent Linear.
Definition: calc_pv_tl.f90:12
subroutine, public set_traj(self, kx, ky, px, pxn, pxs, pqn, pqs)
Linked list implementation.
Definition: conf.py:1
subroutine zonal_wind_tl(u, x, nx, ny, deltay)
Calculate zonal wind - Tangent Linear.
type(registry_t), public qg_geom_registry
Linked list interface - defines registry_t type.
Definition: qg_geom_mod.F90:40
Constants for the QG model.
subroutine c_qg_prepare_integration(c_key_conf, c_key_state)
Prepare for an integration of the QG model.
Definition: c_qg_model.F90:165
subroutine, public get_traj(self, kx, ky, px, pxn, pxs, pqn, pqs)
real(kind=kind_real), parameter rossby_number
subroutine c_qg_wipe_traj(c_key_traj)
Wipe out trajectory of the QG model.
Definition: c_qg_model.F90:473
subroutine c_qg_prepare_integration_ad(c_key_conf, c_key_incr)
Prepare for an integration of the QG model - Adjoint.
Definition: c_qg_model.F90:197
subroutine c_qg_propagate(c_key_conf, c_key_state)
Perform a timestep of the QG model.
Definition: c_qg_model.F90:259
real(kind=kind_real), parameter bet
subroutine calc_pv(kx, ky, pv, x, x_north, x_south, f1, f2, deltax, deltay, bet, rs, lbc)
Calculate potential vorticity from streamfunction.
Definition: calc_pv.f90:21
Fortran module handling geometry for the QG model.
Definition: qg_geom_mod.F90:11
subroutine calc_pv_ad(pv, x, nx, ny, f1, f2, deltax, deltay)
Calculate potential vorticity - Adjoint.
Definition: calc_pv_ad.f90:12
type(registry_t), public qg_config_registry
Linked list interface - defines registry_t type.
Definition: qg_configs.F90:45
subroutine c_qg_prop_traj(c_key_conf, c_key_state, c_key_traj)
Save trajectory and perform a timestep of the QG model.
Definition: c_qg_model.F90:442
subroutine invert_pv_ad(x, pv, nx, ny, deltax, deltay, F1, F2)
Invert potential vorticity - Adjoint.
subroutine c_qg_propagate_ad(c_key_conf, c_key_incr, c_key_traj)
Perform a timestep of the QG model - Adjoint This routine is called from C++ to propagate the adjoint...
Definition: c_qg_model.F90:285
subroutine advect_pv_ad(qnew, q, q_traj, q_north, q_south, u, u_traj, v, v_traj, nx, ny, deltax, deltay, dt)
Advect potential vorticity - Adjoint.
subroutine c_qg_setup(c_confspec, c_key_geom, c_key_confdata)
Setup the QG model.
Definition: c_qg_model.F90:40
type(registry_t), public qg_traj_registry
Linked list interface - defines registry_t type.
subroutine c_qg_prepare_integration_tl(c_key_conf, c_key_incr)
Prepare for an integration of the QG model - Tangent Linear.
Definition: c_qg_model.F90:231
subroutine zonal_wind(u, x, x_north, x_south, nx, ny, deltay)
Calculate zonal wind component from the streamfunction.
Definition: zonal_wind.f90:15
subroutine meridional_wind_tl(v, x, nx, ny, deltax)
Calculate meridional wind component - Tangent Linear.
Structure holding configuration variables for the QG model.
Definition: qg_configs.F90:11
Handle fields for the QG model.
Definition: qg_fields.F90:11
subroutine propagate(flds, config)
Perform a timestep of the QG model.
Definition: propagate.f90:25
subroutine c_qg_propagate_tl(c_key_conf, c_key_incr, c_key_traj)
Perform a timestep of the QG model - Tangent Linear This routine is called from C++ to propagate the ...
Definition: c_qg_model.F90:364
subroutine meridional_wind_ad(v, x, nx, ny, deltax)
Calculate meridional wind component - Adjoint.
subroutine zonal_wind_ad(u, x, nx, ny, deltay)
Calculate zonal wind - Adjoint.
real(kind=kind_real), parameter domain_zonal
model domain (m) in zonal direction
real(kind=kind_real), parameter dlogtheta
difference in log(pot. T) across boundary
subroutine meridional_wind(v, x, nx, ny, deltax)
Calculate meridional wind component from the streamfunction.
real(kind=kind_real), parameter ubar
typical verlocity (m/s)
subroutine, public delete_traj(self)
real(kind=kind_real), parameter worog
e-folding width of orography (m)
real(kind=kind_real), parameter scale_length
horizontal length scale (m)