-
Notifications
You must be signed in to change notification settings - Fork 64
/
ccpp_types.F90
92 lines (76 loc) · 3.28 KB
/
ccpp_types.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
!
! This work (Common Community Physics Package), identified by NOAA, NCAR,
! CU/CIRES, is free of known copyright restrictions and is placed in the
! public domain.
!
! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
! IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
! THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
! IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
! CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
!
!>
!! @brief Type definitions module.
!!
!! @details The types module provides definitions for
!! atmospheric driver to call the CCPP.
!
module ccpp_types
use mpi_f08, only: MPI_Comm
!! \section arg_table_ccpp_types
!! \htmlinclude ccpp_types.html
!!
implicit none
private
public :: ccpp_t, one
public :: MPI_Comm
!> @var Definition of constant one
integer, parameter :: one = 1
!> @var The default loop counter indicating outside of a subcycle loop
integer, parameter :: CCPP_DEFAULT_LOOP_CNT = -999
integer, parameter :: CCPP_DEFAULT_LOOP_MAX = -999
!> @var The default values for block, chunk and thread numbers indicating invalid data
integer, parameter :: CCPP_DEFAULT_BLOCK_NUMBER = -999
integer, parameter :: CCPP_DEFAULT_CHUNK_NUMBER = -999
integer, parameter :: CCPP_DEFAULT_THREAD_NUMBER = -999
!> @var The default maximum number of threads for CCPP
integer, parameter :: CCPP_DEFAULT_THREAD_COUNT = -999
!! \section arg_table_ccpp_t
!! \htmlinclude ccpp_t.html
!!
!>
!! @brief CCPP physics type.
!!
!! Generic type that contains all components to run the CCPP.
!!
!! - Array of fields to all the data needing to go
!! the physics drivers.
!! - The suite definitions in a ccpp_suite_t type.
!
type :: ccpp_t
! CCPP-internal variables for physics schemes
integer :: errflg = 0
character(len=512) :: errmsg = ''
integer :: loop_cnt = CCPP_DEFAULT_LOOP_CNT
integer :: loop_max = CCPP_DEFAULT_LOOP_MAX
integer :: blk_no = CCPP_DEFAULT_BLOCK_NUMBER
integer :: chunk_no = CCPP_DEFAULT_CHUNK_NUMBER
integer :: thrd_no = CCPP_DEFAULT_THREAD_NUMBER
integer :: thrd_cnt = CCPP_DEFAULT_THREAD_COUNT
integer :: ccpp_instance = 1
contains
procedure :: initialized => ccpp_t_initialized
end type ccpp_t
contains
function ccpp_t_initialized(ccpp_d) result(initialized)
implicit none
!
class(ccpp_t) :: ccpp_d
logical :: initialized
!
initialized = ccpp_d%thrd_no /= CCPP_DEFAULT_THREAD_NUMBER .or. &
ccpp_d%blk_no /= CCPP_DEFAULT_BLOCK_NUMBER .or. &
ccpp_d%chunk_no /= CCPP_DEFAULT_CHUNK_NUMBER
end function ccpp_t_initialized
end module ccpp_types