MONC
grids.F90
Go to the documentation of this file.
1 
5 module grids_mod
7  implicit none
8 
9 #ifndef TEST_MODE
10  private
11 #endif
12 
14  integer, parameter, public :: z_index = 1, y_index = 2, x_index = 3
16  integer, parameter, public :: primal_grid=1, dual_grid=2
17 
20  real(kind=DEFAULT_PRECISION) dx, dy
21  real(kind=DEFAULT_PRECISION) cx, cy
22  real(kind=DEFAULT_PRECISION) cx2, cy2
23  real(kind=DEFAULT_PRECISION) cxy
24  real(kind=DEFAULT_PRECISION) tcx, tcy
26 
29  real(kind=DEFAULT_PRECISION), dimension(:), allocatable :: &
30  z,& !< Heights at w levels (m)
31  zn,& !< Heights at pressure levels (m)
32  dz,& !< Vertical spacing between K and K-1 w levels
33  dzn,& !< Vertical spacing between K and K-1 p levels
34  rdz,& !< Reciprocal of DZ
35  rdzn,& !< Reciprocal of DZN
36  rho,& !< Density at w levels (kg/m3)
37  rhon,& !< Density at p levels (kg/m3)
38  thref,& !< Reference potential temperature (K)
39  dthref,& !< Gradient of thref (K)
40  tref,& !< Reference temperature (K)
41  theta_init,& !< Initial profile of theta
42  u_init,& !< Initial profile of u
43  v_init,& !< Initial profile of v
44  prefn,& !< Reference pressure (Pa)
45  pdiff,& !< Difference between pressure levels (Pa)
46  prefrcp,&
47  rprefrcp,&
48  czb,& !< (rho(k-1)/rhon(k))/(dz(k)*dzn(k)) use for diffusion onto p level from below
49  cza,& !< (rho(k)/rhon(k))/(dz(k)*dzn(k+1)) use for diffusion onto p level from above
50  czg,& !< CZB-CZA for tridiagonal solver in POISSON
51  czh,& !< CZB*CZA for tridiagonal solver in POISSON
52  tzc1,& !< 0.25*rdz(k)*rho(k-1)/rhon(k) for advection onto p-level from below
53  tzc2,& !< 0.25*rdz(k)*rho(k)/rhon(k) for advection onto p-level from above
54  tzd1,& !< 0.25*rdzn(k+1)*rhon(k)/rho(k) for advection onto w-level from below
55  tzd2,& !< 0.25*rdzn(k+1)*rhon(k+1)/rho(k) for advection onto w-level from above
56  w_subs,& !< Subsidence velocity
57  olubar,& !< Current U mean
58  savolubar,&
59  olvbar,& !< Current V mean
60  savolvbar,&
61  olthbar,& !< Current theta mean
62  olzubar,& !< Previous timestep U mean
63  olzvbar,& !< Previous timestep V mean
64  olzthbar,& !< Previous theta mean
65  dmpco,& !< Damping coefficient on pressure levels
66  dmpcoz,& !< Damping coefficient on w-levels
67  tstarpr,& ! Temperature about which Taylor Expansion
68  qsat,&
69  dqsatdt,&
70  qsatfac,&
71  rneutml,&
72  rneutml_sq,&
73  buoy_co, &
74  theta_rand, &!< profile of amplitude of theta perturbations
75  theta_force, & !<profile of forcing term for theta
76  u_force, & !<profile of forcing term for u
77  v_force, & !<profile of forcing term for v
78  w_rand
79 
80 
81 
82  real(kind=DEFAULT_PRECISION), dimension(:,:), allocatable :: q_init
83  real(kind=DEFAULT_PRECISION), dimension(:,:), allocatable :: q_rand
84  real(kind=DEFAULT_PRECISION), dimension(:,:), allocatable :: q_force
85 
86  real(kind=DEFAULT_PRECISION), dimension(:,:), allocatable :: olqbar,olzqbar
87  real(kind=DEFAULT_PRECISION), dimension(:), allocatable :: hgd
88  real(kind=DEFAULT_PRECISION) :: czn, zlogm, zlogth, vk_on_zlogm
89  integer, dimension(:), allocatable :: kgd
90  integer :: kdmpmin
92 
94  type, public :: grid_configuration_type
98 
100  type, public :: global_grid_type
101  type(grid_configuration_type) :: configuration
102  real(kind=DEFAULT_PRECISION), dimension(3) :: bottom,& !< Bottom (lowest) bounds in each dimension
103  top,& !< Top (highest) bounds in each dimension
104  resolution
105  integer, dimension(3) :: size
106  logical, dimension(3) :: active = (/ .false., .false., .false. /)
107  integer :: dimensions = 0
108  end type global_grid_type
109 
111  type, public :: local_grid_type
112  integer, dimension(3) :: start,& !< Global start coordinates of local grid
113  end,& !< Global end coordinates of local grid
114  size,& !< Grid points held locally
115  halo_size,& !< Grid point size of the halo (halo_depth)
116  local_domain_start_index,& !< The start index of computation data (local data is halo->data->halo so this precomputes the data start)
117  local_domain_end_index
118  logical, dimension(3) :: active = (/ .false., .false., .false. /)
119  integer, dimension(:,:), allocatable :: neighbours , corner_neighbours
120  integer :: dimensions = 0
121  end type local_grid_type
122 end module grids_mod
integer, parameter, public dual_grid
Definition: grids.F90:16
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
Definition: datadefn.F90:17
integer, parameter, public z_index
Grid index parameters.
Definition: grids.F90:14
Contains common definitions for the data and datatypes used by MONC.
Definition: datadefn.F90:2
Wraps the dimensional configuration types.
Definition: grids.F90:94
The configuration of the grid vertically.
Definition: grids.F90:28
The configuration of the grid horizontally.
Definition: grids.F90:19
Defines the global grid.
Definition: grids.F90:100
Defined the local grid, i.e. the grid held on this process after decomposition.
Definition: grids.F90:111
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
integer, parameter, public y_index
Definition: grids.F90:14
integer, parameter, public x_index
Definition: grids.F90:14