Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix. #6

Merged
merged 1 commit into from
Sep 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 41 additions & 13 deletions IPD_layer/IPD_driver_cap.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ module IPD_driver_cap
IPD_radiation_step, &
IPD_physics_step1, &
IPD_physics_step2
use :: namelist_soilveg, &
only: salp_data, snupx, max_vegtyp
implicit none

private
Expand All @@ -60,7 +62,9 @@ subroutine ipd_initialize_cap(ptr) bind(c)
type(IPD_diag_type), pointer :: IPD_Diag(:) => null()
type(IPD_restart_type), pointer :: IPD_Restart => null()
type(IPD_init_type), pointer :: Init_parm => null()
type(c_ptr), pointer :: tmp => null()
type(c_ptr) :: tmp
real, pointer :: l_snupx(:) => null()
real, pointer :: l_salp_data => null()

call c_f_pointer(ptr, cdata)

Expand Down Expand Up @@ -103,11 +107,17 @@ subroutine ipd_initialize_cap(ptr) bind(c)
deallocate(dims)
end if

call ccpp_fields_get(cdata, 'salp_data', l_salp_data, ierr)
call ccpp_fields_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_init_parm=Init_parm)

l_snupx = snupx
l_salp_data = salp_data
end subroutine ipd_initialize_cap

subroutine ipd_setup_step_cap(ptr) bind(c)
Expand All @@ -121,7 +131,7 @@ subroutine ipd_setup_step_cap(ptr) bind(c)
type(IPD_data_type), pointer :: IPD_Data(:) => null()
type(IPD_diag_type), pointer :: IPD_Diag(:) => null()
type(IPD_restart_type), pointer :: IPD_Restart => null()
type(c_ptr), pointer :: tmp => null()
type(c_ptr) :: tmp

call c_f_pointer(ptr, cdata)

Expand Down Expand Up @@ -175,11 +185,17 @@ subroutine ipd_radiation_step_cap(ptr) bind(c)
type(IPD_data_type), pointer :: IPD_Data(:) => null()
type(IPD_diag_type), pointer :: IPD_Diag(:) => null()
type(IPD_restart_type), pointer :: IPD_Restart => null()
integer, pointer :: nblks => null()
type(c_ptr), pointer :: tmp => null()
integer, pointer :: nblks
type(c_ptr) :: tmp

call c_f_pointer(ptr, cdata)

call ccpp_fields_get(cdata, 'nblks', nblks, ierr)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve nblks')
return
end if

call ccpp_fields_get(cdata, 'IPD_Control', tmp, ierr)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve IPD_Control')
Expand All @@ -192,7 +208,7 @@ subroutine ipd_radiation_step_cap(ptr) bind(c)
call ccpp_error('Unable to retrieve IPD_Data')
return
end if
call c_f_pointer(tmp, IPD_Data)
call c_f_pointer(tmp, IPD_Data, [nblks])

call ccpp_fields_get(cdata, 'IPD_Diag', tmp, ierr)
if (ierr /= 0) then
Expand Down Expand Up @@ -238,12 +254,18 @@ subroutine ipd_physics_step1_cap(ptr) bind(c)
type(IPD_data_type), pointer :: IPD_Data(:) => null()
type(IPD_diag_type), pointer :: IPD_Diag(:) => null()
type(IPD_restart_type), pointer :: IPD_Restart => null()
integer, pointer :: nblks => null()
type(c_ptr), pointer :: tmp => null()
integer, pointer :: nblks
type(c_ptr) :: tmp

call c_f_pointer(ptr, cdata)

call ccpp_fields_get_ptr(cdata, 'IPD_Control', tmp, ierr)
call ccpp_fields_get(cdata, 'nblks', nblks, ierr)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve nblks')
return
end if

call ccpp_fields_get(cdata, 'IPD_Control', tmp, ierr)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve IPD_Control')
return
Expand All @@ -255,7 +277,7 @@ subroutine ipd_physics_step1_cap(ptr) bind(c)
call ccpp_error('Unable to retrieve IPD_Data')
return
end if
call c_f_pointer(tmp, IPD_Data, dims)
call c_f_pointer(tmp, IPD_Data, [nblks])

call ccpp_fields_get(cdata, 'IPD_Diag', tmp, ierr, dims=dims)
if (ierr /= 0) then
Expand Down Expand Up @@ -301,12 +323,18 @@ subroutine ipd_physics_step2_cap(ptr) bind(c)
type(IPD_data_type), pointer :: IPD_Data(:) => null()
type(IPD_diag_type), pointer :: IPD_Diag(:) => null()
type(IPD_restart_type), pointer :: IPD_Restart => null()
integer, pointer :: nblks => null()
type(c_ptr), pointer :: tmp => null()
integer, pointer :: nblks
type(c_ptr) :: tmp

call c_f_pointer(ptr, cdata)

call ccpp_fields_get_ptr(cdata, 'IPD_Control', tmp, ierr)
call ccpp_fields_get(cdata, 'nblks', nblks, ierr)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve nblks')
return
end if

call ccpp_fields_get(cdata, 'IPD_Control', tmp, ierr)
if (ierr /= 0) then
call ccpp_error('Unable to retrieve IPD_Control')
return
Expand All @@ -318,7 +346,7 @@ subroutine ipd_physics_step2_cap(ptr) bind(c)
call ccpp_error('Unable to retrieve IPD_Data')
return
end if
call c_f_pointer(tmp, IPD_Data, dims)
call c_f_pointer(tmp, IPD_Data, [nblks])

call ccpp_fields_get(cdata, 'IPD_Diag', tmp, ierr, dims=dims)
if (ierr /= 0) then
Expand Down