Skip to content

Commit

Permalink
test_prebuild/test_blocked_data: 'use, intrinsic :: iso_fortran_env, …
Browse files Browse the repository at this point in the history
…only: error_unit'
  • Loading branch information
climbfuji committed Dec 4, 2023
1 parent d2e446e commit 4ec1cba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
12 changes: 7 additions & 5 deletions test_prebuild/test_blocked_data/blocked_data_scheme.F90
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

module blocked_data_scheme

use, intrinsic :: iso_fortran_env, only: error_unit
implicit none

private
public :: blocked_data_scheme_init, &
blocked_data_scheme_timestep_init, &
Expand All @@ -28,7 +30,7 @@ subroutine blocked_data_scheme_init(data_array, errmsg, errflg)
errmsg = ''
errflg = 0
! Check size of data array
write(0,'(a,i3)') 'In blocked_data_scheme_init: checking size of data array to be', sum(data_array_sizes)
write(error_unit,'(a,i3)') 'In blocked_data_scheme_init: checking size of data array to be', sum(data_array_sizes)
if (size(data_array)/=sum(data_array_sizes)) then
write(errmsg,'(2(a,i3))') "Error, expected size(data_array)==", sum(data_array_sizes), "but got ", size(data_array)
errflg = 1
Expand All @@ -47,7 +49,7 @@ subroutine blocked_data_scheme_timestep_init(data_array, errmsg, errflg)
errmsg = ''
errflg = 0
! Check size of data array
write(0,'(a,i3)') 'In blocked_data_scheme_timestep_init: checking size of data array to be', sum(data_array_sizes)
write(error_unit,'(a,i3)') 'In blocked_data_scheme_timestep_init: checking size of data array to be', sum(data_array_sizes)
if (size(data_array)/=sum(data_array_sizes)) then
write(errmsg,'(2(a,i3))') "Error, expected size(data_array)==", sum(data_array_sizes), " but got ", size(data_array)
errflg = 1
Expand All @@ -67,7 +69,7 @@ subroutine blocked_data_scheme_run(nb, data_array, errmsg, errflg)
errmsg = ''
errflg = 0
! Check size of data array
write(0,'(2(a,i3))') 'In blocked_data_scheme_run: checking size of data array for block', nb, ' to be', data_array_sizes(nb)
write(error_unit,'(2(a,i3))') 'In blocked_data_scheme_run: checking size of data array for block', nb, ' to be', data_array_sizes(nb)
if (size(data_array)/=data_array_sizes(nb)) then
write(errmsg,'(a,i4)') "Error in blocked_data_scheme_run, expected size(data_array)==6, got ", size(data_array)
errflg = 1
Expand All @@ -86,7 +88,7 @@ subroutine blocked_data_scheme_timestep_finalize(data_array, errmsg, errflg)
errmsg = ''
errflg = 0
! Check size of data array
write(0,'(a,i3)') 'In blocked_data_scheme_timestep_finalize: checking size of data array to be', sum(data_array_sizes)
write(error_unit,'(a,i3)') 'In blocked_data_scheme_timestep_finalize: checking size of data array to be', sum(data_array_sizes)
if (size(data_array)/=sum(data_array_sizes)) then
write(errmsg,'(2(a,i3))') "Error, expected size(data_array)==", sum(data_array_sizes), "but got ", size(data_array)
errflg = 1
Expand All @@ -105,7 +107,7 @@ subroutine blocked_data_scheme_finalize(data_array, errmsg, errflg)
errmsg = ''
errflg = 0
! Check size of data array
write(0,'(a,i3)') 'In blocked_data_scheme_finalize: checking size of data array to be', sum(data_array_sizes)
write(error_unit,'(a,i3)') 'In blocked_data_scheme_finalize: checking size of data array to be', sum(data_array_sizes)
if (size(data_array)/=sum(data_array_sizes)) then
write(errmsg,'(2(a,i3))') "Error, expected size(data_array)==", sum(data_array_sizes), "but got ", size(data_array)
errflg = 1
Expand Down
24 changes: 13 additions & 11 deletions test_prebuild/test_blocked_data/main.F90
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
program test_blocked_data

use, intrinsic :: iso_fortran_env, only: error_unit

use ccpp_types, only: ccpp_t
use data, only: nblks, blksz, ncols
use data, only: ccpp_data_domain, ccpp_data_blocks, &
Expand Down Expand Up @@ -35,7 +37,7 @@ program test_blocked_data

do ib=1,size(blocked_data_instance)
allocate(blocked_data_instance(ib)%array_data(blksz(ib)))
write(0,'(2(a,i3))') "Allocated array_data for block", ib, " to size", size(blocked_data_instance(ib)%array_data)
write(error_unit,'(2(a,i3))') "Allocated array_data for block", ib, " to size", size(blocked_data_instance(ib)%array_data)
end do

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Expand All @@ -45,8 +47,8 @@ program test_blocked_data
cdata => ccpp_data_domain
call ccpp_physics_init(cdata, suite_name=trim(ccpp_suite), ierr=ierr)
if (ierr/=0) then
write(0,'(a)') "An error occurred in ccpp_physics_init:"
write(0,'(a)') trim(cdata%errmsg)
write(error_unit,'(a)') "An error occurred in ccpp_physics_init:"
write(error_unit,'(a)') trim(cdata%errmsg)
stop 1
end if

Expand All @@ -57,8 +59,8 @@ program test_blocked_data
cdata => ccpp_data_domain
call ccpp_physics_timestep_init(cdata, suite_name=trim(ccpp_suite), ierr=ierr)
if (ierr/=0) then
write(0,'(a)') "An error occurred in ccpp_physics_timestep_init:"
write(0,'(a)') trim(cdata%errmsg)
write(error_unit,'(a)') "An error occurred in ccpp_physics_timestep_init:"
write(error_unit,'(a)') trim(cdata%errmsg)
stop 1
end if

Expand All @@ -70,8 +72,8 @@ program test_blocked_data
cdata => ccpp_data_blocks(ib)
call ccpp_physics_run(cdata, suite_name=trim(ccpp_suite), ierr=ierr)
if (ierr/=0) then
write(0,'(a,i3,a)') "An error occurred in ccpp_physics_run for block", ib, ":"
write(0,'(a)') trim(cdata%errmsg)
write(error_unit,'(a,i3,a)') "An error occurred in ccpp_physics_run for block", ib, ":"
write(error_unit,'(a)') trim(cdata%errmsg)
stop 1
end if
end do
Expand All @@ -83,8 +85,8 @@ program test_blocked_data
cdata => ccpp_data_domain
call ccpp_physics_timestep_finalize(cdata, suite_name=trim(ccpp_suite), ierr=ierr)
if (ierr/=0) then
write(0,'(a)') "An error occurred in ccpp_physics_timestep_init:"
write(0,'(a)') trim(cdata%errmsg)
write(error_unit,'(a)') "An error occurred in ccpp_physics_timestep_init:"
write(error_unit,'(a)') trim(cdata%errmsg)
stop 1
end if

Expand All @@ -95,8 +97,8 @@ program test_blocked_data
cdata => ccpp_data_domain
call ccpp_physics_finalize(cdata, suite_name=trim(ccpp_suite), ierr=ierr)
if (ierr/=0) then
write(0,'(a)') "An error occurred in ccpp_physics_timestep_init:"
write(0,'(a)') trim(cdata%errmsg)
write(error_unit,'(a)') "An error occurred in ccpp_physics_timestep_init:"
write(error_unit,'(a)') trim(cdata%errmsg)
stop 1
end if

Expand Down

0 comments on commit 4ec1cba

Please sign in to comment.