FV3 Bundle
propagate.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 !> Perform a timestep of the QG model
10 
11 !> This routine is called from C++ to propagate the state.
12 !!
13 !!
14 !! The timestep starts by advecting the potential vorticity using
15 !! a semi-Lagrangian method. The potential vorticity is then inverted
16 !! to determine the streamfunction. Velocity components are then
17 !! calculated, which are used at the next timestep to advect the
18 !! potential vorticity.
19 !!
20 !! Note that the state visible to C++ contains potential vorticity and
21 !! wind components, in addition to streamfunction. This makes these
22 !! fields available for use in the observation operators.
23 
24 subroutine propagate(flds,config)
25 
26 use qg_fields
27 use qg_configs
28 use qg_constants, only: bet
29 use kinds
30 
31 implicit none
32 type(qg_field), intent(inout) :: flds
33 type(qg_config), intent(in) :: config
34 
35 real(kind=kind_real), allocatable :: qnew(:,:,:)
36 
37 ! ------------------------------------------------------------------------------
38 
39 allocate(qnew(flds%geom%nx,flds%geom%ny,2))
40 
41 !--- advect the potential vorticity
42 
43 call advect_pv(qnew,flds%q,flds%q_north,flds%q_south,flds%u,flds%v, &
44  & flds%geom%nx,flds%geom%ny,config%deltax,config%deltay,config%dt)
45 
46 !--- invert the potential vorticity to determine streamfunction
47 
48 call invert_pv(flds%x,qnew,flds%x_north,flds%x_south,config%rs, &
49  & flds%geom%nx,flds%geom%ny,config%deltax,config%deltay, &
50  & config%f1,config%f2,bet)
51 
52 ! -- calculate potential vorticity and wind components
53 
54 flds%q(:,:,:) = qnew(:,:,:)
55 call zonal_wind(flds%u,flds%x,flds%x_north,flds%x_south, &
56  & flds%geom%nx,flds%geom%ny,config%deltay)
57 call meridional_wind(flds%v,flds%x, flds%geom%nx,flds%geom%ny,config%deltax)
58 
59 deallocate(qnew)
60 ! ------------------------------------------------------------------------------
61 return
62 end subroutine propagate
Constants for the QG model.
subroutine invert_pv(x, pv, x_north, x_south, rs, nx, ny, deltax, deltay, F1, F2, bet)
Invert potential vorticity, returning streamfunction.
Definition: invert_pv.f90:16
real(kind=kind_real), parameter bet
subroutine zonal_wind(u, x, x_north, x_south, nx, ny, deltay)
Calculate zonal wind component from the streamfunction.
Definition: zonal_wind.f90:15
Structure holding configuration variables for the QG model.
Definition: qg_configs.F90:11
subroutine advect_pv(qnew, q, q_north, q_south, u, v, nx, ny, deltax, deltay, dt)
Advect potential vorticity.
Definition: advect_pv.f90:18
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 meridional_wind(v, x, nx, ny, deltax)
Calculate meridional wind component from the streamfunction.