30 type(model_state_type),
intent(inout),
target :: current_state
33 if (.not. current_state%initialised)
then 34 current_state%dtm=options_get_real(current_state%options_database,
"dtm")
35 current_state%dtm_new=current_state%dtm
36 call create_grid(current_state, current_state%global_grid)
39 current_state%initialised=.true.
46 type(model_state_type),
intent(inout) :: current_state
48 integer :: alloc_z, alloc_y, alloc_x, i
50 alloc_z=current_state%local_grid%size(z_index) + current_state%local_grid%halo_size(z_index) * 2
51 alloc_y=current_state%local_grid%size(y_index) + current_state%local_grid%halo_size(y_index) * 2
52 alloc_x=current_state%local_grid%size(x_index) + current_state%local_grid%halo_size(x_index) * 2
55 call allocate_prognostic(current_state%u, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, primal_grid)
56 call allocate_prognostic(current_state%zu, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, primal_grid)
57 call allocate_prognostic(current_state%su, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, primal_grid)
58 call allocate_prognostic(current_state%savu, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, primal_grid)
61 call allocate_prognostic(current_state%v, alloc_z, alloc_y, alloc_x, dual_grid, primal_grid, dual_grid)
62 call allocate_prognostic(current_state%zv, alloc_z, alloc_y, alloc_x, dual_grid, primal_grid, dual_grid)
63 call allocate_prognostic(current_state%sv, alloc_z, alloc_y, alloc_x, dual_grid, primal_grid, dual_grid)
64 call allocate_prognostic(current_state%savv, alloc_z, alloc_y, alloc_x, dual_grid, primal_grid, dual_grid)
67 call allocate_prognostic(current_state%w, alloc_z, alloc_y, alloc_x, primal_grid, dual_grid, dual_grid)
68 call allocate_prognostic(current_state%zw, alloc_z, alloc_y, alloc_x, primal_grid, dual_grid, dual_grid)
69 call allocate_prognostic(current_state%sw, alloc_z, alloc_y, alloc_x, primal_grid, dual_grid, dual_grid)
70 call allocate_prognostic(current_state%savw, alloc_z, alloc_y, alloc_x, primal_grid, dual_grid, dual_grid)
74 call allocate_prognostic(current_state%th, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, dual_grid)
75 call allocate_prognostic(current_state%zth, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, dual_grid)
76 call allocate_prognostic(current_state%sth, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, dual_grid)
78 if (current_state%number_q_fields .gt. 0)
then 79 allocate(current_state%q(current_state%number_q_fields), &
80 current_state%zq(current_state%number_q_fields), current_state%sq(current_state%number_q_fields))
81 do i=1, current_state%number_q_fields
82 call allocate_prognostic(current_state%q(i), alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, dual_grid)
83 call allocate_prognostic(current_state%zq(i), alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, dual_grid)
84 call allocate_prognostic(current_state%sq(i), alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, dual_grid)
88 current_state%water_vapour_mixing_ratio_index=get_q_index(standard_q_names%VAPOUR,
'simplesetup')
89 current_state%liquid_water_mixing_ratio_index=get_q_index(standard_q_names%CLOUD_LIQUID_MASS,
'simplesetup')
96 type(prognostic_field_type),
intent(inout) :: field
97 integer,
intent(in) :: alloc_z, alloc_y, alloc_x, z_grid, y_grid, x_grid
100 field%grid(z_index) = z_grid
101 field%grid(y_index) = y_grid
102 field%grid(x_index) = x_grid
103 allocate(field%data(alloc_z, alloc_y, alloc_x))
104 field%data=0.0_default_precision
108 type(model_state_type),
intent(inout) :: current_state
110 if (
associated(current_state%parallel%decomposition_procedure))
then 111 call current_state%parallel%decomposition_procedure(current_state)
113 call log_log(log_error,
"No decomposition specified")
117 subroutine create_grid(current_state, specific_grid)
118 type(model_state_type),
intent(inout) :: current_state
119 type(global_grid_type),
intent(inout) :: specific_grid
121 integer,
parameter :: KGD_SIZE=20
122 integer :: number_kgd, i, kgd(kgd_size)
123 real(kind=DEFAULT_PRECISION) :: hgd(kgd_size)
127 call options_get_integer_array(current_state%options_database,
"kgd", kgd)
128 call options_get_real_array(current_state%options_database,
"hgd", hgd)
131 if (hgd(1)/=0.0_default_precision)
then 132 call log_log(log_error,
"Lowest level is assumed to lie at the surface, check hgd(1)")
134 kgd(1:kgd_size-1) = kgd(2:)
135 hgd(1:kgd_size-1) = hgd(2:)
140 if (kgd(i) == -1)
exit 144 if (number_kgd .gt. 0)
then 145 allocate(current_state%global_grid%configuration%vertical%kgd(number_kgd), &
146 current_state%global_grid%configuration%vertical%hgd(number_kgd))
147 current_state%global_grid%configuration%vertical%kgd=kgd(1:number_kgd)
148 current_state%global_grid%configuration%vertical%hgd=hgd(1:number_kgd)
151 specific_grid%bottom(z_index) = 0
152 specific_grid%bottom(y_index) = 0
153 specific_grid%bottom(x_index) = 0
155 specific_grid%top(z_index) =
zztop 156 specific_grid%top(y_index) =
dyy *
y_size 157 specific_grid%top(x_index) =
dxx *
x_size 160 specific_grid%resolution(y_index) =
dyy 161 specific_grid%resolution(x_index) =
dxx 163 specific_grid%size(z_index) =
z_size 164 specific_grid%size(y_index) =
y_size 165 specific_grid%size(x_index) =
x_size 167 specific_grid%active(z_index) = .true.
168 specific_grid%active(y_index) = .true.
169 specific_grid%active(x_index) = .true.
171 specific_grid%dimensions = 3
175 type(model_state_type),
intent(inout),
target :: current_state
177 current_state%rhobous=options_get_real(current_state%options_database,
"rhobous")
178 current_state%thref0=options_get_real(current_state%options_database,
"thref0")
179 current_state%number_q_fields=options_get_integer(current_state%options_database,
"number_q_fields")
180 current_state%surface_pressure=options_get_real(current_state%options_database,
"surface_pressure")
181 current_state%surface_reference_pressure=options_get_real(current_state%options_database,
"surface_reference_pressure")
183 current_state%use_anelastic_equations=options_get_logical(current_state%options_database,
"use_anelastic_equations")
185 current_state%origional_vertical_grid_setup=options_get_logical(current_state%options_database, &
186 "origional_vertical_grid_setup")
187 current_state%passive_q=options_get_logical(current_state%options_database,
"passive_q")
188 current_state%passive_th=options_get_logical(current_state%options_database,
"passive_th")
189 current_state%rmlmax=options_get_real(current_state%options_database,
"rmlmax")
190 current_state%calculate_th_and_q_init=options_get_logical(current_state%options_database,
"calculate_th_and_q_init")
191 current_state%use_viscosity_and_diffusion=options_get_logical(current_state%options_database,
"use_viscosity_and_diffusion")
192 current_state%backscatter=options_get_logical(current_state%options_database,
"backscatter")
194 x_size=options_get_integer(current_state%options_database,
"x_size")
195 y_size=options_get_integer(current_state%options_database,
"y_size")
196 z_size=options_get_integer(current_state%options_database,
"z_size")
197 dxx=options_get_real(current_state%options_database,
"dxx")
198 dyy=options_get_real(current_state%options_database,
"dyy")
199 zztop=options_get_real(current_state%options_database,
"zztop")
200 enable_theta=options_get_logical(current_state%options_database,
"enable_theta")
202 if (current_state%rmlmax<=0.0)current_state%rmlmax=0.23 * max(
dxx,
dyy)
205 if ( current_state%number_q_fields == 0) current_state%passive_q=.true.
207 current_state%galilean_transformation=options_get_logical(current_state%options_database,
"galilean_transformation")
208 if (current_state%galilean_transformation)
then 209 current_state%fix_ugal=options_get_logical(current_state%options_database,
"fix_ugal")
210 current_state%fix_vgal=options_get_logical(current_state%options_database,
"fix_vgal")
211 if (current_state%fix_ugal)current_state%ugal=options_get_real(current_state%options_database,
"ugal")
212 if (current_state%fix_vgal)current_state%vgal=options_get_real(current_state%options_database,
"vgal")
subroutine decompose_grid(current_state)
type(standard_q_names_type), public standard_q_names
integer, parameter, public dual_grid
subroutine initialisation_callback(current_state)
integer, parameter, public log_error
Only log ERROR messages.
Contains prognostic field definitions and functions.
A prognostic field which is assumed to be 3D.
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
integer, parameter, public z_index
Grid index parameters.
Contains common definitions for the data and datatypes used by MONC.
The ModelState which represents the current state of a run.
subroutine, public options_get_integer_array(options_database, key, array_data, from, to)
Retrieves an entire (or subset) integer array.
Description of a component.
integer, parameter, public prescribed_surface_fluxes
subroutine allocate_prognostic(field, alloc_z, alloc_y, alloc_x, z_grid, y_grid, x_grid)
subroutine, public log_log(level, message, str)
Logs a message at the specified level. If the level is above the current level then the message is ig...
This manages the Q variables and specifically the mapping between names and the index that they are s...
real(kind=default_precision) dyy
Interfaces and types that MONC components must specify.
type(component_descriptor_type) function, public simplesetup_get_descriptor()
Defined the local grid, i.e. the grid held on this process after decomposition.
real(kind=default_precision) dxx
integer, parameter, public primal_grid
Grid type parameters (usually applied to each dimension of a prognostic)
real(kind=default_precision) function, public options_get_real(options_database, key, index)
Retrieves a real value from the database that matches the provided key.
Functionality to support the different types of grid and abstraction between global grids and local o...
subroutine create_grid(current_state, specific_grid)
subroutine allocate_prognostics(current_state)
integer function, public options_get_integer(options_database, key, index)
Retrieves an integer value from the database that matches the provided key.
Manages the options database. Contains administration functions and deduce runtime options from the c...
logical function, public options_get_logical(options_database, key, index)
Retrieves a logical value from the database that matches the provided key.
subroutine, public options_get_real_array(options_database, key, array_data, from, to)
Retrieves an entire (or subset) real array.
subroutine read_configuration(current_state)
The model state which represents the current state of a run.
integer, parameter, public y_index
real(kind=default_precision) zztop
integer, parameter, public x_index
integer function, public get_q_index(name, assigning_component)
Add in a new entry into the register if the name does not already exist or return the index of the pr...