-
Notifications
You must be signed in to change notification settings - Fork 155
/
Copy pathIPD_driver_cap.F90
187 lines (150 loc) · 6.92 KB
/
IPD_driver_cap.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
!
! This work (Common Community Physics Package), identified by NOAA, NCAR,
! CU/CIRES, is free of known copyright restrictions and is placed in the
! public domain.
!
! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
! THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
! IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
! CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
!
!>
!! @brief Semi-auto-generated cap module for the IPD_driver scheme
!!
!
module IPD_driver_cap
use, intrinsic :: iso_c_binding, &
only: c_f_pointer, c_ptr, c_int32_t
use :: ccpp_api, &
only: ccpp_t, &
ccpp_field_get, &
ccpp_error
use :: IPD_typedefs, &
only: IPD_init_type, &
IPD_control_type, &
IPD_data_type, &
IPD_restart_type, &
IPD_diag_type, &
IPD_interstitial_type
use :: IPD_driver, &
only: IPD_initialize, &
IPD_setup_step, &
IPD_finalize
use :: machine, &
only: kind_phys
use :: namelist_soilveg, &
only: salp_data, snupx, max_vegtyp
implicit none
private
public :: ipd_initialize_cap, &
ipd_setup_step_cap, &
ipd_finalize_cap
contains
function ipd_initialize_cap(ptr) bind(c) result(ierr)
integer(c_int32_t) :: ierr
type(c_ptr), intent(inout) :: ptr
integer, allocatable :: dims(:)
type(ccpp_t), pointer :: cdata
type(IPD_control_type), pointer :: IPD_Control
type(IPD_data_type), pointer :: IPD_Data(:)
type(IPD_diag_type), pointer :: IPD_Diag(:)
type(IPD_restart_type), pointer :: IPD_Restart
type(IPD_interstitial_type), pointer :: IPD_Interstitial(:)
type(IPD_init_type), pointer :: Init_parm
type(c_ptr) :: tmp
real(kind=kind_phys), pointer :: l_snupx(:)
real(kind=kind_phys), pointer :: l_salp_data
ierr = 0
call c_f_pointer(ptr, cdata)
call ccpp_field_get(cdata, 'IPD_Control', tmp, ierr)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve IPD_Control')
end if
call c_f_pointer(tmp, IPD_Control)
call ccpp_field_get(cdata, 'IPD_Data', tmp, ierr, dims=dims)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve IPD_Data')
end if
call c_f_pointer(tmp, IPD_Data, dims)
deallocate(dims)
call ccpp_field_get(cdata, 'IPD_Diag', tmp, ierr, dims=dims)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve IPD_Diag')
end if
call c_f_pointer(tmp, IPD_Diag, dims)
deallocate(dims)
call ccpp_field_get(cdata, 'IPD_Restart', tmp, ierr)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve IPD_Restart')
end if
call c_f_pointer(tmp, IPD_Restart)
call ccpp_field_get(cdata, 'IPD_Interstitial', tmp, ierr, dims=dims)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve IPD_Interstitial')
end if
call c_f_pointer(tmp, IPD_Interstitial, dims)
deallocate(dims)
call ccpp_field_get(cdata, 'Init_parm', tmp, ierr)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve Init_parm')
end if
call c_f_pointer(tmp, Init_parm)
call ccpp_field_get(cdata, 'salp_data', l_salp_data, ierr)
call ccpp_field_get(cdata, 'snupx', l_snupx, ierr)
call IPD_initialize(IPD_Control=IPD_Control, &
IPD_Data=IPD_Data, &
IPD_Diag=IPD_Diag, &
IPD_Restart=IPD_Restart, &
IPD_Interstitial=IPD_Interstitial, &
IPD_init_parm=Init_parm)
l_snupx = snupx
l_salp_data = salp_data
end function ipd_initialize_cap
function ipd_setup_step_cap(ptr) bind(c) result(ierr)
integer(c_int32_t) :: ierr
type(c_ptr), intent(inout) :: ptr
integer, allocatable :: dims(:)
type(ccpp_t), pointer :: cdata
type(IPD_control_type), pointer :: IPD_Control
type(IPD_data_type), pointer :: IPD_Data(:)
type(IPD_diag_type), pointer :: IPD_Diag(:)
type(IPD_restart_type), pointer :: IPD_Restart
type(c_ptr) :: tmp
ierr = 0
call c_f_pointer(ptr, cdata)
call ccpp_field_get(cdata, 'IPD_Control', tmp, ierr)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve IPD_Control')
end if
call c_f_pointer(tmp, IPD_Control)
call ccpp_field_get(cdata, 'IPD_Data', tmp, ierr, dims=dims)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve IPD_Data')
end if
call c_f_pointer(tmp, IPD_Data, dims)
deallocate(dims)
call ccpp_field_get(cdata, 'IPD_Diag', tmp, ierr, dims=dims)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve IPD_Diag')
end if
call c_f_pointer(tmp, IPD_Diag, dims)
deallocate(dims)
call ccpp_field_get(cdata, 'IPD_Restart', tmp, ierr)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve IPD_Restart')
end if
call c_f_pointer(tmp, IPD_Restart)
call IPD_setup_step(IPD_Control=IPD_Control, &
IPD_Data=IPD_Data, &
IPD_Diag=IPD_Diag, &
IPD_Restart=IPD_Restart)
end function IPD_setup_step_cap
function ipd_finalize_cap(ptr) bind(c) result(ierr)
integer(c_int32_t) :: ierr
type(c_ptr), intent(inout) :: ptr
ierr = 0
call IPD_finalize()
end function ipd_finalize_cap
end module IPD_driver_cap