FV3 Bundle
fv3jedi_varcha_c2m_interface_mod.F90
Go to the documentation of this file.
1 ! (C) Copyright 2018 UCAR
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 
6 ! ------------------------------------------------------------------------------
7 
9 
10 use iso_c_binding
18 
19 implicit none
20 private
22 
23 ! ------------------------------------------------------------------------------
24 
25 #define LISTED_TYPE fv3jedi_varcha_c2m
26 
27 !> Linked list interface - defines registry_t type
28 #include "linkedList_i.f"
29 
30 !> Global registry
31 type(registry_t) :: fv3jedi_varcha_c2m_registry
32 
33 ! ------------------------------------------------------------------------------
34 
35 contains
36 
37 ! ------------------------------------------------------------------------------
38 
39 !> Linked list implementation
40 #include "linkedList_c.f"
41 
42 ! ------------------------------------------------------------------------------
43 
44 subroutine c_fv3jedi_varcha_c2m_setup(c_key_self, c_key_geom, c_key_state_bg, c_key_state_fg, &
45  c_conf) bind (c,name='fv3jedi_varcha_c2m_setup_f90')
46 
47 implicit none
48 integer(c_int), intent(inout) :: c_key_self !< Change variable structure
49 integer(c_int), intent(in) :: c_key_state_bg !< Background key
50 integer(c_int), intent(in) :: c_key_state_fg !< First guess key
51 integer(c_int), intent(in) :: c_key_geom !< Geom key
52 type(c_ptr), intent(in) :: c_conf !< Configuration
53 
54 type(fv3jedi_varcha_c2m), pointer :: self
55 type(fv3jedi_state), pointer :: bg
56 type(fv3jedi_state), pointer :: fg
57 type(fv3jedi_geom), pointer :: geom
58 
60 call fv3jedi_varcha_c2m_registry%add(c_key_self)
61 call fv3jedi_varcha_c2m_registry%get(c_key_self, self)
62 
63 call fv3jedi_state_registry%get(c_key_state_bg,bg)
64 call fv3jedi_state_registry%get(c_key_state_fg,fg)
65 
66 call fv3jedi_geom_registry%get(c_key_geom,geom)
67 
68 call create(self, bg, fg, geom, c_conf)
69 
70 end subroutine c_fv3jedi_varcha_c2m_setup
71 
72 ! ------------------------------------------------------------------------------
73 
74 subroutine c_fv3jedi_varcha_c2m_delete(c_key_self) &
75  bind(c,name='fv3jedi_varcha_c2m_delete_f90')
76 
77 implicit none
78 integer(c_int), intent(inout) :: c_key_self !< Change variable structure
79 
80 type(fv3jedi_varcha_c2m), pointer :: self
81 
82 call fv3jedi_varcha_c2m_registry%get(c_key_self,self)
83 call delete(self)
84 call fv3jedi_varcha_c2m_registry%remove(c_key_self)
85 
86 end subroutine c_fv3jedi_varcha_c2m_delete
87 
88 ! ------------------------------------------------------------------------------
89 
90 subroutine c_fv3jedi_varcha_c2m_multiply(c_key_self, c_key_geom, c_key_in, c_key_out) &
91  bind(c,name='fv3jedi_varcha_c2m_multiply_f90')
92 
93 implicit none
94 integer(c_int), intent(in) :: c_key_self
95 integer(c_int), intent(in) :: c_key_geom !< Geom key
96 integer(c_int), intent(in) :: c_key_in
97 integer(c_int), intent(in) :: c_key_out
98 
99 type(fv3jedi_varcha_c2m), pointer :: self
100 type(fv3jedi_increment), pointer :: xin
101 type(fv3jedi_increment), pointer :: xout
102 type(fv3jedi_geom), pointer :: geom
103 
104 call fv3jedi_varcha_c2m_registry%get(c_key_self,self)
105 call fv3jedi_increment_registry%get(c_key_in,xin)
106 call fv3jedi_increment_registry%get(c_key_out,xout)
107 call fv3jedi_geom_registry%get(c_key_geom,geom)
108 
109 call multiply(self,geom,xin,xout)
110 
111 end subroutine c_fv3jedi_varcha_c2m_multiply
112 
113 ! ----------------------------------------------------------------------------
114 
115 subroutine c_fv3jedi_varcha_c2m_multiplyadjoint(c_key_self, c_key_geom, c_key_in, &
116  c_key_out) bind (c,name='fv3jedi_varcha_c2m_multiplyadjoint_f90')
118 implicit none
119 integer(c_int), intent(in) :: c_key_self
120 integer(c_int), intent(in) :: c_key_geom !< Geom key
121 integer(c_int), intent(in) :: c_key_in
122 integer(c_int), intent(in) :: c_key_out
123 
124 type(fv3jedi_varcha_c2m), pointer :: self
125 type(fv3jedi_increment), pointer :: xin
126 type(fv3jedi_increment), pointer :: xout
127 type(fv3jedi_geom), pointer :: geom
128 
129 call fv3jedi_varcha_c2m_registry%get(c_key_self,self)
130 call fv3jedi_increment_registry%get(c_key_in,xin)
131 call fv3jedi_increment_registry%get(c_key_out,xout)
132 call fv3jedi_geom_registry%get(c_key_geom,geom)
133 
134 call multiplyadjoint(self,geom,xin,xout)
135 
137 
138 ! ----------------------------------------------------------------------------
139 
140 ! ------------------------------------------------------------------------------
141 
142 subroutine c_fv3jedi_varcha_c2m_multiplyinverse(c_key_self, c_key_geom, c_key_in, c_key_out) &
143  bind(c,name='fv3jedi_varcha_c2m_multiplyinverse_f90')
145 implicit none
146 integer(c_int), intent(in) :: c_key_self
147 integer(c_int), intent(in) :: c_key_geom !< Geom key
148 integer(c_int), intent(in) :: c_key_in
149 integer(c_int), intent(in) :: c_key_out
150 
151 type(fv3jedi_varcha_c2m), pointer :: self
152 type(fv3jedi_increment), pointer :: xin
153 type(fv3jedi_increment), pointer :: xout
154 type(fv3jedi_geom), pointer :: geom
155 
156 call fv3jedi_varcha_c2m_registry%get(c_key_self,self)
157 call fv3jedi_increment_registry%get(c_key_in,xin)
158 call fv3jedi_increment_registry%get(c_key_out,xout)
159 call fv3jedi_geom_registry%get(c_key_geom,geom)
160 
161 call multiplyinverse(self,geom,xin,xout)
162 
164 
165 ! ----------------------------------------------------------------------------
166 
167 subroutine c_fv3jedi_varcha_c2m_multiplyinverseadjoint(c_key_self, c_key_geom, c_key_in, &
168  c_key_out) bind (c,name='fv3jedi_varcha_c2m_multiplyinverseadjoint_f90')
170 implicit none
171 integer(c_int), intent(in) :: c_key_self
172 integer(c_int), intent(in) :: c_key_geom !< Geom key
173 integer(c_int), intent(in) :: c_key_in
174 integer(c_int), intent(in) :: c_key_out
175 
176 type(fv3jedi_varcha_c2m), pointer :: self
177 type(fv3jedi_increment), pointer :: xin
178 type(fv3jedi_increment), pointer :: xout
179 type(fv3jedi_geom), pointer :: geom
180 
181 call fv3jedi_varcha_c2m_registry%get(c_key_self,self)
182 call fv3jedi_increment_registry%get(c_key_in,xin)
183 call fv3jedi_increment_registry%get(c_key_out,xout)
184 call fv3jedi_geom_registry%get(c_key_geom,geom)
185 
186 call multiplyinverseadjoint(self,geom,xin,xout)
187 
189 
190 ! ----------------------------------------------------------------------------
191 
type(registry_t), public fv3jedi_geom_registry
Linked list interface - defines registry_t type.
Fortran derived type to hold FV3JEDI increment.
subroutine c_fv3jedi_varcha_c2m_multiplyinverseadjoint(c_key_self, c_key_geom, c_key_in, c_key_out)
subroutine c_fv3jedi_varcha_c2m_multiply(c_key_self, c_key_geom, c_key_in, c_key_out)
subroutine, public delete(self)
Fortran derived type to hold FV3JEDI state.
subroutine c_fv3jedi_varcha_c2m_multiplyadjoint(c_key_self, c_key_geom, c_key_in, c_key_out)
type(registry_t), public fv3jedi_increment_registry
Linked list interface - defines registry_t type.
Fortran derived type to hold geometry data for the FV3JEDI model.
subroutine c_fv3jedi_varcha_c2m_multiplyinverse(c_key_self, c_key_geom, c_key_in, c_key_out)
subroutine, public multiplyinverse(self, geom, xmod, xctr)
subroutine, public multiplyadjoint(self, geom, xmod, xctl)
subroutine, public multiply(self, geom, xctl, xmod)
Handle state for the FV3JEDI odel.
Handle increment for the FV3JEDI model.
type(registry_t), public fv3jedi_varcha_c2m_registry
Linked list interface - defines registry_t type.
Fortran module handling geometry for the FV3 model.
type(registry_t), public fv3jedi_state_registry
Linked list interface - defines registry_t type.
subroutine c_fv3jedi_varcha_c2m_setup(c_key_self, c_key_geom, c_key_state_bg, c_key_state_fg, c_conf)
Linked list implementation.
subroutine, public multiplyinverseadjoint(self, geom, xctr, xmod)
subroutine, public create(self, bg, fg, geom, c_conf)
Fortran module handling geometry for the FV3 model.