MONC
test_prognostics.F90
Go to the documentation of this file.
1 ! Tests the logging_mod utility functions
3  use fruit, only : assert_equals, assert_not_equals, assert_true
4  use mpi, only : mpi_request_null
8  use grids_mod, only : primal_grid
9  implicit none
10 
11 contains
12 
13  ! Test async default value
14  subroutine test_async_flux_value
15  type(prognostic_field_type) :: field
16  call assert_equals(mpi_request_null, field%async_flux_handle , "Test async_flux_handle")
17  end subroutine test_async_flux_value
18 
19 
20  ! Test get_field_interpolation_index
22  type(prognostic_field_type) :: field
23  logical, dimension(3) :: get_field_index
24  integer :: i
25  get_field_index = get_field_interpolation_index(field)
26  do i=1,3
27  call assert_equals(.false., get_field_index(i) , "Test interpolation index is false")
28  enddo
29 
30  field%grid(1) = primal_grid
31  get_field_index = get_field_interpolation_index(field)
32  do i=1,3
33  if (i == 1) then
34  call assert_equals(.true., get_field_index(i) , " Should be true")
35  else
36  call assert_equals(.false., get_field_index(i) , "Should be false")
37  endif
38  enddo
39 
40  field%grid(1) = 10
41  field%grid(2) = 20
42  field%grid(3) = 30
43  get_field_index = get_field_interpolation_index(field)
44  do i=1,3
45  call assert_equals(.false., get_field_index(i) , "Should be false")
46  enddo
47 
49 
50 
51 
52  end module test_prognostic_mod
53 
54 
55 
56  ! Driver for maths_mod utility tests
58  use fruit, only : init_fruit, run_test_case, fruit_summary
59  use maths_mod, only : random
61 
62  implicit none
63 
64  call init_fruit
65  call run_test_case(test_async_flux_value, "Test async default value")
66  call run_test_case(test_get_field_interpolation_index, "Test get_interpolation_index whith empty grid")
67  call fruit_summary
68  end program test_prognostic_driver
A pointer to the prognostic field. This is so we can wrap prognostics up in an array and still refer ...
Definition: prognostics.F90:24
Contains prognostic field definitions and functions.
Definition: prognostics.F90:2
program test_prognostic_driver
A prognostic field which is assumed to be 3D.
Definition: prognostics.F90:13
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
Definition: datadefn.F90:17
Contains common definitions for the data and datatypes used by MONC.
Definition: datadefn.F90:2
logical function, dimension(3), public get_field_interpolation_index(field)
Retrieves the index(s) that require interpolation to go from the primal the dual grid.
Definition: prognostics.F90:34
subroutine test_get_field_interpolation_index
real(kind=default_precision) function, public random(idum)
returns a scalar random number, the initial seed idum must be negative usage: idum = -k !(set idum < ...
Definition: maths.F90:23
subroutine test_async_flux_value
integer, parameter, public primal_grid
Grid type parameters (usually applied to each dimension of a prognostic)
Definition: grids.F90:16
Functionality to support the different types of grid and abstraction between global grids and local o...
Definition: grids.F90:5