FV3 Bundle
qg_localization_matrix.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 
10 use iso_c_binding
11 use qg_fields
12 use kinds
13 use qg_constants
14 use qg_geom_mod
15 use config_mod
17 
18 ! ------------------------------------------------------------------------------
19 contains
20 ! ------------------------------------------------------------------------------
21 
22 subroutine qg_localization_mult(c_key_conf, c_key_xincr) bind(c,name='qg_localization_mult_f90')
23 implicit none
24 integer(c_int), intent(in) :: c_key_conf
25 integer(c_int), intent(in) :: c_key_xincr
26 
27 type(qg_3d_covar_config), pointer :: conf !< Config structure
28 type(qg_field), pointer :: xincr
29 real(kind=kind_real), allocatable :: xctl(:,:,:) ! Control vector
30 
31 call qg_3d_cov_registry%get(c_key_conf,conf)
32 call qg_field_registry%get(c_key_xincr,xincr)
33 
34 allocate(xctl(conf%nx, conf%ny, 2))
35 
36 xctl(:,:,:)=0.0_kind_real
37 call qg_3d_covar_sqrt_mult_ad(conf%nx,conf%ny,xincr,xctl,conf)
38 call zeros(xincr)
39 call qg_3d_covar_sqrt_mult(conf%nx,conf%ny,xincr,xctl,conf)
40 
41 deallocate(xctl)
42 end subroutine qg_localization_mult
43 
44 ! ------------------------------------------------------------------------------
45 
46 subroutine qg_localization_setup(c_key_conf, c_model, c_key_geom) bind(c,name='qg_localization_setup_f90')
47 implicit none
48 integer(c_int), intent(inout) :: c_key_conf
49 type(c_ptr), intent(in) :: c_model !< The configuration
50 integer(c_int), intent(in) :: c_key_geom !< Geometry
51 type(qg_3d_covar_config), pointer :: conf !< covar structure
52 type(qg_geom), pointer :: geom !< Geometry
53 
54 call qg_3d_cov_registry%init()
55 call qg_3d_cov_registry%add(c_key_conf)
56 call qg_3d_cov_registry%get(c_key_conf, conf)
57 call qg_geom_registry%get(c_key_geom, geom)
58 call qg_3d_covar_setup(c_model, geom, conf)
59 
60 return
61 end subroutine qg_localization_setup
62 
63 ! ------------------------------------------------------------------------------
64 
65 subroutine qg_localization_delete(c_key_self) bind(c,name='qg_localization_delete_f90')
66 implicit none
67 integer(c_int), intent(inout) :: c_key_self
68 type(qg_3d_covar_config), pointer :: self
69 
70 call qg_3d_cov_registry%get(c_key_self, self)
71 call qg_3d_covar_delete(self)
72 
73 end subroutine qg_localization_delete
74 
75 ! ------------------------------------------------------------------------------
76 
77 end module qglocalization
type(registry_t), public qg_field_registry
Linked list interface - defines registry_t type.
Definition: qg_fields.F90:65
Structure holding configuration variables for the 3d error covariance matrices of the QG analysis...
Definition: conf.py:1
subroutine qg_3d_covar_delete(self)
Delete for the QG model&#39;s 3d error covariance matrices.
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 qg_localization_mult(c_key_conf, c_key_xincr)
Fortran module handling geometry for the QG model.
Definition: qg_geom_mod.F90:11
subroutine qg_localization_delete(c_key_self)
subroutine qg_3d_covar_setup(c_model, geom, config)
Linked list implementation.
subroutine qg_3d_covar_sqrt_mult(kx, ky, xincr, xctl, config)
Multiply streamfunction by sqrt(C), where C is a 3d covariance matrix.
type(registry_t) qg_3d_cov_registry
Linked list interface - defines registry_t type.
subroutine qg_localization_setup(c_key_conf, c_model, c_key_geom)
Handle fields for the QG model.
Definition: qg_fields.F90:11
subroutine, public zeros(self)
Definition: qg_fields.F90:151
subroutine qg_3d_covar_sqrt_mult_ad(kx, ky, xincr, xctl, config)
Multiply streamfunction by sqrt(C) - Adjoint.