MONC
Functions/Subroutines
test_stencil_mod Module Reference

Functions/Subroutines

subroutine test_create_stencil
 
subroutine test_calculate_interpolated_cell_value
 

Function/Subroutine Documentation

◆ test_calculate_interpolated_cell_value()

subroutine test_stencil_mod::test_calculate_interpolated_cell_value

Definition at line 49 of file test_stencil.F90.

50  type(model_state_type), target :: current_state
51  type(grid_stencil_type) :: star_stencil
52  type(prognostic_field_ptr_type), dimension(3) :: fields
53  integer, dimension(3, 2) :: sizes
54  type(prognostic_field_type), dimension(:), allocatable :: interpolated_fields
55  integer :: i,num_fields,max_y_point
56  logical, dimension(3) :: interpolate_in_dimension
57  real(kind=default_precision) :: r_value
58  real(kind=default_precision) :: e_value
59 
60 
61  current_state%global_grid%size(z_index) = 2
62  num_fields = 15
63  current_state%local_grid%size(z_index)= 0
64  current_state%local_grid%size(y_index) = 3
65  current_state%local_grid%halo_size(y_index) = 4
66 
67  fields(num_fields)%ptr => current_state%u
68  sizes(num_fields,:) = (/ 2, 2 /)
69 
70  allocate(interpolated_fields(0:num_fields))
71  allocate(interpolated_fields(num_fields)%data(current_state%global_grid%size(z_index),&
72  -1:3, -1:3))
73  max_y_point = (current_state%local_grid%size(y_index)+ &
74  current_state%local_grid%halo_size(y_index) *2)-1
75 
76  interpolated_fields(num_fields)%active=.true.
77  star_stencil = create_stencil(current_state%local_grid, fields, num_fields, 3, &
78  sizes,.true., .false.)
79  e_value = 10_default_precision
80  star_stencil%interpolated_fields(1,1)%data(1,1,1) = e_value
81 
82  call calculate_interpolated_cell_value(current_state%local_grid, 1, 1, (/.true.,.true.,.true./),&
83  star_stencil%fields(1), star_stencil%interpolated_fields(1,1)%data(:,1,1))
84 
85  r_value = star_stencil%interpolated_fields(1,1)%data(1,1,1)
86 
87  call assert_equals(e_value, r_value,"Test")
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_create_stencil()

subroutine test_stencil_mod::test_create_stencil

Definition at line 16 of file test_stencil.F90.

17  type(model_state_type), target :: current_state
18  type(grid_stencil_type) :: star_stencil
19  type(prognostic_field_ptr_type), dimension(3) :: fields
20  integer, dimension(3, 2) :: sizes
21  type(prognostic_field_type), dimension(:), allocatable :: interpolated_fields
22  integer :: i,num_fields,max_y_point
23 
24  call assert_equals(0,star_stencil%nfields,"Test a stencil has been created")
25  current_state%global_grid%size(z_index) = 2
26  num_fields = 15
27  current_state%local_grid%size(y_index) = 3
28  current_state%local_grid%halo_size(y_index) = 4
29 
30  fields(num_fields)%ptr => current_state%u
31  sizes(num_fields,:) = (/ 2, 2 /)
32 
33  allocate(interpolated_fields(0:num_fields))
34  allocate(interpolated_fields(num_fields)%data(current_state%global_grid%size(z_index),&
35  -1:3, -1:3))
36  max_y_point = (current_state%local_grid%size(y_index)+ &
37  current_state%local_grid%halo_size(y_index) *2)-1
38 
39  interpolated_fields(num_fields)%active=.true.
40  star_stencil = create_stencil(current_state%local_grid, fields, num_fields, 3, &
41  sizes,.true., .false.)
42  call assert_equals(max_y_point,star_stencil%max_y_point,"Test max Y point within the stencil")
43  call assert_equals(-1,star_stencil%max_x_point,"Test max X point within the stencil")
44  call assert_equals(num_fields+1,size(interpolated_fields),"Test size of interpolated_fields")
45  call assert_equals(num_fields,star_stencil%nfields,"Test a stencil has been created")
Here is the call graph for this function:
Here is the caller graph for this function:
grids_mod::y_index
integer, parameter, public y_index
Definition: grids.F90:14
grids_mod::z_index
integer, parameter, public z_index
Grid index parameters.
Definition: 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