MONC
test_grids.F90
Go to the documentation of this file.
1 ! Tests the logging_mod utility functions
3 
4  use fruit, only : assert_equals, assert_not_equals, assert_true
8  implicit none
9 
10 contains
11 
12  ! Test index parameters
13  subroutine test_xyz_index
14  call assert_equals(1, z_index, "Z_INDEX is 1")
15  call assert_equals(2, y_index, "Y_INDEX is 2")
16  call assert_equals(3, x_index, "X_INDEX is 3")
17  end subroutine test_xyz_index
18 
19  ! Test type parameters
21  call assert_equals(1, primal_grid, "PRIMAL_GRID is 1")
22  call assert_equals(2, dual_grid, "DUAL_GRID is 2")
23  end subroutine test_type_parameters
24 
25  ! Test dimensions status of global_grid
27  type(global_grid_type) :: global_grid
28  logical, dimension(3) :: expected = (/ .true., .true., .true. /)
29  integer :: i
30  do i = 1,3
31  call assert_not_equals(expected(i), global_grid%active(i), &
32  "Test the status of the dimensions after creating a global_grid_type object")
33  end do
34 end subroutine test_global_active_dimensions
35 
36  ! Test dimensions status of local_grid
38  type(local_grid_type) :: local_grid
39  logical, dimension(3) :: expected = (/ .true., .true., .true. /)
40  integer :: i
41  do i = 1,3
42  call assert_not_equals(expected(i), local_grid%active(i), &
43  "Test the status of the dimensions after creating a local_grid_type object")
44  end do
45 end subroutine test_local_active_dimensions
46 
47 end module test_grid_mod
48 
49 
50 
51  ! Driver for maths_mod utility tests
53  use fruit, only : init_fruit, run_test_case, fruit_summary
56 
57  implicit none
58 
59  call init_fruit
60  call run_test_case(test_xyz_index, "Test expected XYZ index values")
61  call run_test_case(test_type_parameters, "Test expected grid type parameters values")
62  call run_test_case(test_global_active_dimensions, "Test dimension status when difining global_type object")
63  call run_test_case(test_local_active_dimensions, "Test dimension status when difining local_type object")
64  call fruit_summary
65  end program test_grid_driver
grids_mod::dual_grid
integer, parameter, public dual_grid
Definition: grids.F90:16
grids_mod::x_index
integer, parameter, public x_index
Definition: grids.F90:14
grids_mod::y_index
integer, parameter, public y_index
Definition: grids.F90:14
grids_mod::global_grid_type
Defines the global grid.
Definition: grids.F90:107
test_grid_mod::test_type_parameters
subroutine test_type_parameters
Definition: test_grids.F90:21
grids_mod::z_index
integer, parameter, public z_index
Grid index parameters.
Definition: grids.F90:14
test_grid_mod
Definition: test_grids.F90:2
grids_mod::primal_grid
integer, parameter, public primal_grid
Grid type parameters (usually applied to each dimension of a prognostic)
Definition: grids.F90:16
grids_mod::local_grid_type
Defined the local grid, i.e. the grid held on this process after decomposition.
Definition: grids.F90:118
test_grid_mod::test_local_active_dimensions
subroutine test_local_active_dimensions
Definition: test_grids.F90:38
datadefn_mod
Contains common definitions for the data and datatypes used by MONC.
Definition: datadefn.F90:2
test_grid_mod::test_global_active_dimensions
subroutine test_global_active_dimensions
Definition: test_grids.F90:27
test_grid_driver
program test_grid_driver
Definition: test_grids.F90:52
grids_mod
Functionality to support the different types of grid and abstraction between global grids and local o...
Definition: grids.F90:5
test_grid_mod::test_xyz_index
subroutine test_xyz_index
Definition: test_grids.F90:14
datadefn_mod::default_precision
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
Definition: datadefn.F90:17