FV3 Bundle
qg_stream_mod.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 !> Fortran module for streamfunction observations for the QG model
11 
12 use iso_c_binding
13 use config_mod
14 use duration_mod
15 use qg_obs_data
18 use qg_vars_mod
19 use qg_locs_mod
20 use qg_goms_mod
21 use kinds
22 
23 implicit none
24 private
25 
26 ! ------------------------------------------------------------------------------
27 contains
28 ! ------------------------------------------------------------------------------
29 
30 subroutine c_qg_stream_setup(c_key_self, c_conf) bind(c,name='qg_stream_setup_f90')
31 implicit none
32 integer(c_int), intent(inout) :: c_key_self
33 type(c_ptr), intent(in) :: c_conf
34 
35 type(qg_obsoper), pointer :: self
36 character(len=1) :: svars(1) = (/"x"/)
37 
38 call qg_obsoper_registry%init()
39 call qg_obsoper_registry%add(c_key_self)
40 call qg_obsoper_registry%get(c_key_self, self)
41 
42 call qg_oper_setup(self, c_conf, svars, 1)
43 
44 end subroutine c_qg_stream_setup
45 
46 ! ------------------------------------------------------------------------------
47 
48 subroutine c_qg_stream_delete(c_key_self) bind(c,name='qg_stream_delete_f90')
49 implicit none
50 integer(c_int), intent(inout) :: c_key_self
51 
52 type(qg_obsoper), pointer :: self
53 
54 call qg_obsoper_registry%get(c_key_self, self)
55 call qg_obsoper_registry%remove(c_key_self)
56 
57 end subroutine c_qg_stream_delete
58 
59 ! ------------------------------------------------------------------------------
60 
61 subroutine qg_stream_equiv(c_key_gom, c_key_hofx, c_bias) &
62  & bind(c,name='qg_stream_equiv_f90')
63 implicit none
64 integer(c_int), intent(in) :: c_key_gom
65 integer(c_int), intent(in) :: c_key_hofx
66 real(c_double), intent(in) :: c_bias
67 type(qg_goms), pointer :: gom
68 type(obs_vect), pointer :: hofx
69 integer :: io, jo
70 
71 call qg_goms_registry%get(c_key_gom, gom)
72 call qg_obs_vect_registry%get(c_key_hofx,hofx)
73 
74 do jo=1,gom%nobs
75  io=gom%indx(jo)
76  hofx%values(1,io)=gom%values(1,jo) + c_bias
77 enddo
78 
79 end subroutine qg_stream_equiv
80 
81 ! ------------------------------------------------------------------------------
82 
83 subroutine qg_stream_equiv_tl(c_key_gom, c_key_hofx, c_bias) &
84  & bind(c,name='qg_stream_equiv_tl_f90')
85 implicit none
86 integer(c_int), intent(in) :: c_key_gom
87 integer(c_int), intent(in) :: c_key_hofx
88 real(c_double), intent(in) :: c_bias
89 type(qg_goms), pointer :: gom
90 type(obs_vect), pointer :: hofx
91 integer :: io, jo
92 
93 call qg_goms_registry%get(c_key_gom, gom)
94 call qg_obs_vect_registry%get(c_key_hofx,hofx)
95 
96 do jo=1,gom%nobs
97  io=gom%indx(jo)
98  hofx%values(1,io)=gom%values(1,jo) + c_bias
99 enddo
100 
101 end subroutine qg_stream_equiv_tl
102 
103 ! ------------------------------------------------------------------------------
104 
105 subroutine qg_stream_equiv_ad(c_key_gom, c_key_hofx, c_bias) &
106  & bind(c,name='qg_stream_equiv_ad_f90')
107 implicit none
108 integer(c_int), intent(in) :: c_key_gom
109 integer(c_int), intent(in) :: c_key_hofx
110 real(c_double), intent(inout) :: c_bias
111 type(qg_goms), pointer :: gom
112 type(obs_vect), pointer :: hofx
113 integer :: io, jo
114 
115 call qg_goms_registry%get(c_key_gom, gom)
116 call qg_obs_vect_registry%get(c_key_hofx,hofx)
117 
118 do jo=1,gom%nobs
119  io=gom%indx(jo)
120  gom%values(1,jo)=hofx%values(1,io)
121  c_bias = c_bias + hofx%values(1,io)
122 enddo
123 
124 end subroutine qg_stream_equiv_ad
125 
126 ! ------------------------------------------------------------------------------
127 
128 end module qg_stream_mod
type(registry_t), public qg_obs_vect_registry
Linked list interface - defines registry_t type.
subroutine c_qg_stream_setup(c_key_self, c_conf)
type(registry_t), public qg_obsoper_registry
Linked list interface - defines registry_t type.
Fortran module for streamfunction observations for the QG model.
subroutine qg_stream_equiv_ad(c_key_gom, c_key_hofx, c_bias)
subroutine c_qg_stream_delete(c_key_self)
subroutine qg_stream_equiv(c_key_gom, c_key_hofx, c_bias)
Fortran module handling observation locations.
Definition: qg_locs_mod.F90:11
Handle observations for the QG model.
Definition: qg_obs_data.F90:11
type(registry_t), public qg_goms_registry
Linked list interface - defines registry_t type.
Definition: qg_goms_mod.F90:42
Fortran module to handle variables for the QG model.
Definition: qg_vars_mod.F90:11
subroutine qg_stream_equiv_tl(c_key_gom, c_key_hofx, c_bias)
subroutine, public qg_oper_setup(self, c_conf, svars, ncol)
Linked list implementation.
Fortran module handling interpolated (to obs locations) model variables.
Definition: qg_goms_mod.F90:11
Fortran module for streamfunction observations for the QG model.
Fortran module handling observation vectors.