FV3 Bundle
fv3jedi_tlm_interface_mod.F90
Go to the documentation of this file.
1 ! (C) Copyright 2017-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 
7 
9 use config_mod
10 use duration_mod
11 use iso_c_binding
12 
14 use fv3jedi_traj_mod, only: fv3jedi_traj
20 
21 implicit none
22 private
23 
24 public :: fv3jedi_tlm_registry
25 
26 ! ------------------------------------------------------------------------------
27 
28 !> Linked list interface - defines registry_t type
29 #define LISTED_TYPE fv3jedi_tlm
30 #include "linkedList_i.f"
31 type(registry_t) :: fv3jedi_tlm_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_tlm_create(c_conf, c_key_geom, c_key_self) bind (c,name='fv3jedi_tlm_create_f90')
45 
46 implicit none
47 integer(c_int), intent(inout) :: c_key_self !< Key to tlm data
48 integer(c_int), intent(in) :: c_key_geom !< Geometry
49 type(c_ptr), intent(in) :: c_conf !< pointer to object of class Config
50 
51 type(fv3jedi_tlm), pointer :: self
52 type(fv3jedi_geom), pointer :: geom
53 
54 call fv3jedi_geom_registry%get(c_key_geom, geom)
55 call fv3jedi_tlm_registry%init()
56 call fv3jedi_tlm_registry%add(c_key_self)
57 call fv3jedi_tlm_registry%get(c_key_self, self)
58 
59 call tlm_create(self, geom, c_conf)
60 
61 end subroutine c_fv3jedi_tlm_create
62 
63 ! ------------------------------------------------------------------------------
64 
65 subroutine c_fv3jedi_tlm_delete(c_key_self) bind (c,name='fv3jedi_tlm_delete_f90')
66 
67 implicit none
68 integer(c_int), intent(inout) :: c_key_self
69 
70 type(fv3jedi_tlm), pointer :: self
71 
72 call fv3jedi_tlm_registry%get(c_key_self, self)
73 
74 call tlm_delete(self)
75 
76 call fv3jedi_tlm_registry%remove(c_key_self)
77 
78 end subroutine c_fv3jedi_tlm_delete
79 
80 ! ------------------------------------------------------------------------------
81 
82 subroutine c_fv3jedi_tlm_initialize_tl(c_key_geom, c_key_self, c_key_incr) bind(c,name='fv3jedi_tlm_initialize_tl_f90')
83 
84 implicit none
85 integer(c_int), intent(in) :: c_key_geom !< Geometry
86 integer(c_int), intent(in) :: c_key_self !< TLM
87 integer(c_int), intent(in) :: c_key_incr !< Increment
88 
89 type(fv3jedi_geom), pointer :: geom
90 type(fv3jedi_tlm), pointer :: self
91 type(fv3jedi_increment), pointer :: incr
92 
93 call fv3jedi_geom_registry%get(c_key_geom, geom)
94 call fv3jedi_increment_registry%get(c_key_incr,incr)
95 call fv3jedi_tlm_registry%get(c_key_self, self)
96 
97 call tlm_initialize_tl(geom, self, incr)
98 
99 end subroutine c_fv3jedi_tlm_initialize_tl
100 
101 ! ------------------------------------------------------------------------------
102 
103 subroutine c_fv3jedi_tlm_step_tl(c_key_geom, c_key_self, c_key_incr, c_key_traj) bind(c,name='fv3jedi_tlm_step_tl_f90')
105 implicit none
106 integer(c_int), intent(in) :: c_key_self !< TLM
107 integer(c_int), intent(in) :: c_key_incr !< Increment
108 integer(c_int), intent(in) :: c_key_geom !< Geometry
109 integer(c_int), intent(in) :: c_key_traj !< Trajectory
110 
111 type(fv3jedi_geom), pointer :: geom
112 type(fv3jedi_tlm), pointer :: self
113 type(fv3jedi_increment), pointer :: incr
114 type(fv3jedi_traj), pointer :: traj
115 
116 call fv3jedi_geom_registry%get(c_key_geom, geom)
117 call fv3jedi_tlm_registry%get(c_key_self, self)
118 call fv3jedi_increment_registry%get(c_key_incr,incr)
119 call fv3jedi_traj_registry%get(c_key_traj,traj)
120 
121 call tlm_step_tl(geom, self, incr, traj)
122 
123 end subroutine c_fv3jedi_tlm_step_tl
124 
125 ! ------------------------------------------------------------------------------
126 
127 subroutine c_fv3jedi_tlm_finalize_tl(c_key_geom, c_key_self, c_key_incr) bind(c,name='fv3jedi_tlm_finalize_tl_f90')
129 implicit none
130 integer(c_int), intent(in) :: c_key_geom !< Geometry
131 integer(c_int), intent(in) :: c_key_self !< TLM
132 integer(c_int), intent(in) :: c_key_incr !< Increment
133 
134 type(fv3jedi_geom), pointer :: geom
135 type(fv3jedi_tlm), pointer :: self
136 type(fv3jedi_increment), pointer :: incr
137 
138 call fv3jedi_geom_registry%get(c_key_geom, geom)
139 call fv3jedi_increment_registry%get(c_key_incr,incr)
140 call fv3jedi_tlm_registry%get(c_key_self, self)
141 
142 call tlm_finalize_tl(geom, self, incr)
143 
144 end subroutine c_fv3jedi_tlm_finalize_tl
145 
146 ! ------------------------------------------------------------------------------
147 
148 subroutine c_fv3jedi_tlm_initialize_ad(c_key_geom, c_key_self, c_key_incr) bind(c,name='fv3jedi_tlm_initialize_ad_f90')
150 implicit none
151 integer(c_int), intent(in) :: c_key_geom !< Geometry
152 integer(c_int), intent(in) :: c_key_self !< TLM
153 integer(c_int), intent(in) :: c_key_incr !< Increment
154 
155 type(fv3jedi_geom), pointer :: geom
156 type(fv3jedi_tlm), pointer :: self
157 type(fv3jedi_increment), pointer :: incr
158 
159 call fv3jedi_geom_registry%get(c_key_geom, geom)
160 call fv3jedi_increment_registry%get(c_key_incr,incr)
161 call fv3jedi_tlm_registry%get(c_key_self, self)
162 
163 call tlm_initialize_ad(geom, self, incr)
164 
165 end subroutine c_fv3jedi_tlm_initialize_ad
166 
167 ! ------------------------------------------------------------------------------
168 
169 subroutine c_fv3jedi_tlm_step_ad(c_key_geom, c_key_self, c_key_incr, c_key_traj) bind(c,name='fv3jedi_tlm_step_ad_f90')
171 implicit none
172 integer(c_int), intent(in) :: c_key_self !< TLM
173 integer(c_int), intent(in) :: c_key_incr !< Increment
174 integer(c_int), intent(in) :: c_key_geom !< Geometry
175 integer(c_int), intent(in) :: c_key_traj !< Trajectory
176 
177 type(fv3jedi_geom), pointer :: geom
178 type(fv3jedi_tlm), pointer :: self
179 type(fv3jedi_increment), pointer :: incr
180 type(fv3jedi_traj), pointer :: traj
181 
182 call fv3jedi_geom_registry%get(c_key_geom, geom)
183 call fv3jedi_tlm_registry%get(c_key_self, self)
184 call fv3jedi_increment_registry%get(c_key_incr,incr)
185 call fv3jedi_traj_registry%get(c_key_traj,traj)
186 
187 call tlm_step_ad(geom, self, incr, traj)
188 
189 end subroutine c_fv3jedi_tlm_step_ad
190 
191 ! ------------------------------------------------------------------------------
192 
193 subroutine c_fv3jedi_tlm_finalize_ad(c_key_geom, c_key_self, c_key_incr) bind(c,name='fv3jedi_tlm_finalize_ad_f90')
195 implicit none
196 integer(c_int), intent(in) :: c_key_geom !< Geometry
197 integer(c_int), intent(in) :: c_key_self !< TLM
198 integer(c_int), intent(in) :: c_key_incr !< Increment
199 
200 type(fv3jedi_geom), pointer :: geom
201 type(fv3jedi_tlm), pointer :: self
202 type(fv3jedi_increment), pointer :: incr
203 
204 call fv3jedi_geom_registry%get(c_key_geom, geom)
205 call fv3jedi_increment_registry%get(c_key_incr,incr)
206 call fv3jedi_tlm_registry%get(c_key_self, self)
207 
208 call tlm_finalize_ad(geom, self, incr)
209 
210 end subroutine c_fv3jedi_tlm_finalize_ad
211 
212 ! ------------------------------------------------------------------------------
213 
214 end module fv3jedi_tlm_interface_mod
type(registry_t), public fv3jedi_geom_registry
Linked list interface - defines registry_t type.
Fortran derived type to hold FV3JEDI increment.
subroutine c_fv3jedi_tlm_create(c_conf, c_key_geom, c_key_self)
Linked list implementation.
type(registry_t), public fv3jedi_tlm_registry
Linked list interface - defines registry_t type.
subroutine c_fv3jedi_tlm_initialize_tl(c_key_geom, c_key_self, c_key_incr)
subroutine c_fv3jedi_tlm_initialize_ad(c_key_geom, c_key_self, c_key_incr)
subroutine c_fv3jedi_tlm_finalize_tl(c_key_geom, c_key_self, c_key_incr)
subroutine, public tlm_step_tl(geom, self, incr, traj)
subroutine, public tlm_finalize_ad(geom, self, incr)
type(registry_t), public fv3jedi_increment_registry
Linked list interface - defines registry_t type.
subroutine, public tlm_delete(self)
subroutine, public tlm_initialize_ad(geom, self, incr)
subroutine c_fv3jedi_tlm_step_tl(c_key_geom, c_key_self, c_key_incr, c_key_traj)
Fortran derived type to hold geometry data for the FV3JEDI model.
subroutine, public tlm_finalize_tl(geom, self, incr)
subroutine c_fv3jedi_tlm_delete(c_key_self)
subroutine, public tlm_step_ad(geom, self, incr, traj)
subroutine c_fv3jedi_tlm_finalize_ad(c_key_geom, c_key_self, c_key_incr)
subroutine, public tlm_create(self, geom, c_conf)
subroutine, public tlm_initialize_tl(geom, self, incr)
type(registry_t), public fv3jedi_traj_registry
Linked list interface - defines registry_t type.
Handle increment for the FV3JEDI model.
Fortran module handling geometry for the FV3 model.
subroutine c_fv3jedi_tlm_step_ad(c_key_geom, c_key_self, c_key_incr, c_key_traj)
Fortran module handling geometry for the FV3 model.