MPAS-JEDI
mpas_model_interface.F90
Go to the documentation of this file.
1 ! (C) Copyright 2017 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 
8 subroutine c_mpas_model_setup(c_conf, c_key_geom, c_key_self) bind (c,name='mpas_model_setup_f90')
9 
10 use fckit_configuration_module, only: fckit_configuration
11 use iso_c_binding
12 use duration_mod
14 use mpas_geom_mod
15 
16 implicit none
17 integer(c_int), intent(inout) :: c_key_self !< Key to model data
18 integer(c_int), intent(in) :: c_key_geom !< Geometry
19 type(c_ptr), value, intent(in) :: c_conf !< pointer to object of class Config
20 
21 type(mpas_model), pointer :: model
22 type(mpas_geom), pointer :: geom
23 type(fckit_configuration) :: f_conf
24 
25 call mpas_geom_registry%get(c_key_geom, geom)
26 call mpas_model_registry%init()
27 call mpas_model_registry%add(c_key_self)
28 call mpas_model_registry%get(c_key_self, model)
29 
30 f_conf = fckit_configuration(c_conf)
31 call model_setup(model, geom, f_conf)
32 
33 end subroutine c_mpas_model_setup
34 
35 ! ------------------------------------------------------------------------------
36 
37 subroutine c_mpas_model_delete(c_key_self) bind (c,name='mpas_model_delete_f90')
38 
40 use iso_c_binding
41 
42 implicit none
43 integer(c_int), intent(inout) :: c_key_self
44 type(mpas_model), pointer :: self
45 
46 call mpas_model_registry%get(c_key_self, self)
47 call model_delete(self)
48 call mpas_model_registry%remove(c_key_self)
49 
50 end subroutine c_mpas_model_delete
51 
52 ! ------------------------------------------------------------------------------
53 
54 subroutine c_mpas_model_prepare_integration(c_key_self, c_key_state) &
55  & bind(c,name='mpas_model_prepare_integration_f90')
56 
57 use iso_c_binding
60 
61 implicit none
62 integer(c_int), intent(in) :: c_key_self !< Model
63 integer(c_int), intent(in) :: c_key_state !< Model fields
64 
65 type(mpas_model), pointer :: self
66 type(mpas_fields), pointer :: state
67 
68 call mpas_fields_registry%get(c_key_state,state)
69 call mpas_model_registry%get(c_key_self, self)
70 
71 call model_prepare_integration(self, state)
72 
74 
75 ! ------------------------------------------------------------------------------
76 
77 subroutine c_mpas_model_prepare_integration_ad(c_key_self, c_key_incr) &
78  bind(c,name='mpas_model_prepare_integration_ad_f90')
79 
80 use iso_c_binding
83 
84 implicit none
85 integer(c_int), intent(in) :: c_key_self !< Model
86 integer(c_int), intent(in) :: c_key_incr !< Model fields
87 
88 type(mpas_model), pointer :: self
89 type(mpas_fields), pointer :: inc
90 
91 call mpas_model_registry%get(c_key_self,self)
92 call mpas_fields_registry%get(c_key_incr,inc)
93 
94 call model_prepare_integration_ad(self, inc)
95 
97 
98 ! ------------------------------------------------------------------------------
99 
100 subroutine c_mpas_model_prepare_integration_tl(c_key_self, c_key_incr) &
101  bind(c,name='mpas_model_prepare_integration_tl_f90')
102 
103 use iso_c_binding
104 use mpas_fields_mod
105 use mpas_model_mod
106 
107 implicit none
108 integer(c_int), intent(in) :: c_key_self !< Model
109 integer(c_int), intent(in) :: c_key_incr !< Model fields
110 
111 type(mpas_model), pointer :: self
112 type(mpas_fields), pointer :: inc
113 
114 call mpas_model_registry%get(c_key_self, self)
115 call mpas_fields_registry%get(c_key_incr, inc)
116 
117 call model_prepare_integration_tl(self, inc)
118 
120 
121 ! ------------------------------------------------------------------------------
122 
123 subroutine c_mpas_model_propagate(c_key_self, c_key_state) bind(c,name='mpas_model_propagate_f90')
124 
125 use iso_c_binding
126 use mpas_fields_mod
127 use mpas_model_mod
128 
129 implicit none
130 integer(c_int), intent(in) :: c_key_self !< Model
131 integer(c_int), intent(in) :: c_key_state !< Model fields
132 
133 type(mpas_model), pointer :: self
134 type(mpas_fields), pointer :: state
135 
136 call mpas_model_registry%get(c_key_self, self)
137 call mpas_fields_registry%get(c_key_state,state)
138 
139 call model_propagate(self, state)
140 
141 end subroutine c_mpas_model_propagate
142 
143 ! ------------------------------------------------------------------------------
144 
145 subroutine c_mpas_model_propagate_ad(c_key_self, c_key_incr, c_key_traj) &
146  bind(c,name='mpas_model_propagate_ad_f90')
147 
148 use iso_c_binding
149 use mpas_fields_mod
151 use mpas_model_mod
152 
153 implicit none
154 integer(c_int), intent(in) :: c_key_self !< Model
155 integer(c_int), intent(in) :: c_key_incr !< Model fields
156 integer(c_int), intent(in) :: c_key_traj !< Trajectory structure
157 
158 type(mpas_model), pointer :: self
159 type(mpas_fields), pointer :: inc
160 type(mpas_trajectory), pointer :: traj
161 
162 call mpas_model_registry%get(c_key_self,self)
163 call mpas_fields_registry%get(c_key_incr,inc)
164 call mpas_traj_registry%get(c_key_traj,traj)
165 
166 call model_propagate_ad(self, inc, traj)
167 
168 end subroutine c_mpas_model_propagate_ad
169 
170 ! ------------------------------------------------------------------------------
171 
172 subroutine c_mpas_model_propagate_tl(c_key_self, c_key_incr, c_key_traj) &
173  bind(c,name='mpas_model_propagate_tl_f90')
174 
175 use iso_c_binding
176 use mpas_fields_mod
178 use mpas_model_mod
179 
180 implicit none
181 integer(c_int), intent(in) :: c_key_self !< Model
182 integer(c_int), intent(in) :: c_key_incr !< Model fields
183 integer(c_int), intent(in) :: c_key_traj !< Trajectory structure
184 
185 type(mpas_model), pointer :: self
186 type(mpas_fields), pointer :: inc
187 type(mpas_trajectory), pointer :: traj
188 
189 call mpas_model_registry%get(c_key_self, self)
190 call mpas_fields_registry%get(c_key_incr,inc)
191 call mpas_traj_registry%get(c_key_traj,traj)
192 
193 call model_propagate_tl(self, inc, traj)
194 
195 end subroutine c_mpas_model_propagate_tl
196 
197 ! ------------------------------------------------------------------------------
198 
199 subroutine c_mpas_model_prop_traj(c_key_self, c_key_state, c_key_traj) bind(c,name='mpas_model_prop_traj_f90')
200 
201 use iso_c_binding
202 use mpas_fields_mod
203 use mpas_model_mod
205 
206 implicit none
207 integer(c_int), intent(in) :: c_key_self !< Model
208 integer(c_int), intent(in) :: c_key_state !< Model fields
209 integer(c_int), intent(inout) :: c_key_traj !< Trajectory structure
210 
211 type(mpas_model), pointer :: self
212 type(mpas_fields), pointer :: state
213 type(mpas_trajectory), pointer :: traj
214 
215 call mpas_model_registry%get(c_key_self,self)
216 call mpas_fields_registry%get(c_key_state,state)
217 
218 call mpas_traj_registry%init()
219 call mpas_traj_registry%add(c_key_traj)
220 call mpas_traj_registry%get(c_key_traj,traj)
221 
222 call model_prop_traj(self, state, traj)
223 
224 end subroutine c_mpas_model_prop_traj
225 
226 ! ------------------------------------------------------------------------------
227 
228 subroutine c_mpas_model_wipe_traj(c_key_traj) bind(c,name='mpas_model_wipe_traj_f90')
229 
230 use iso_c_binding
231 use mpas_model_mod
233 
234 implicit none
235 integer(c_int), intent(inout) :: c_key_traj !< Trajectory structure
236 type(mpas_trajectory), pointer :: traj
237 
238 call mpas_traj_registry%get(c_key_traj,traj)
239 call mpas_traj_registry%remove(c_key_traj)
240 
241 call model_wipe_traj(traj)
242 
243 end subroutine c_mpas_model_wipe_traj
244 
245 ! ------------------------------------------------------------------------------
subroutine c_mpas_model_prop_traj(c_key_self, c_key_state, c_key_traj)
subroutine c_mpas_model_setup(c_conf, c_key_geom, c_key_self)
subroutine c_mpas_model_prepare_integration_ad(c_key_self, c_key_incr)
subroutine c_mpas_model_propagate(c_key_self, c_key_state)
subroutine c_mpas_model_wipe_traj(c_key_traj)
subroutine c_mpas_model_delete(c_key_self)
subroutine c_mpas_model_prepare_integration(c_key_self, c_key_state)
subroutine c_mpas_model_prepare_integration_tl(c_key_self, c_key_incr)
subroutine c_mpas_model_propagate_ad(c_key_self, c_key_incr, c_key_traj)
subroutine c_mpas_model_propagate_tl(c_key_self, c_key_incr, c_key_traj)
type(registry_t), public mpas_fields_registry
Linked list interface - defines registry_t type.
type(registry_t), public mpas_geom_registry
Linked list interface - defines registry_t type.
subroutine, public model_delete(self)
type(registry_t), public mpas_model_registry
Linked list interface - defines registry_t type.
subroutine, public model_propagate(self, jedi_state)
subroutine, public model_prop_traj(self, jedi_state, traj)
subroutine, public model_setup(self, geom, f_conf)
Linked list implementation.
subroutine, public model_prepare_integration_ad(self, inc)
subroutine, public model_propagate_tl(self, inc, traj)
subroutine, public model_prepare_integration_tl(self, inc)
subroutine, public model_prepare_integration(self, jedi_state)
subroutine, public model_wipe_traj(traj)
subroutine, public model_propagate_ad(self, inc, traj)
type(registry_t), public mpas_traj_registry
Linked list interface - defines registry_t type.
Fortran derived type to hold MPAS field.
Fortran derived type to hold geometry definition.
Fortran derived type to hold model definition.
Fortran derived type to hold the model trajectory.