32 type(model_state_type),
intent(inout),
target :: current_state
35 if (.not. current_state%initialised)
then
36 current_state%dtm=options_get_real(current_state%options_database,
"dtm")
37 current_state%dtm_new=current_state%dtm
38 call create_grid(current_state, current_state%global_grid)
41 current_state%initialised=.true.
48 type(model_state_type),
intent(inout) :: current_state
50 integer :: alloc_z, alloc_y, alloc_x, i
52 alloc_z=current_state%local_grid%size(z_index) + current_state%local_grid%halo_size(z_index) * 2
53 alloc_y=current_state%local_grid%size(y_index) + current_state%local_grid%halo_size(y_index) * 2
54 alloc_x=current_state%local_grid%size(x_index) + current_state%local_grid%halo_size(x_index) * 2
57 call allocate_prognostic(current_state%u, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, primal_grid)
58 call allocate_prognostic(current_state%zu, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, primal_grid)
59 call allocate_prognostic(current_state%su, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, primal_grid)
60 call allocate_prognostic(current_state%savu, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, primal_grid)
63 call allocate_prognostic(current_state%v, alloc_z, alloc_y, alloc_x, dual_grid, primal_grid, dual_grid)
64 call allocate_prognostic(current_state%zv, alloc_z, alloc_y, alloc_x, dual_grid, primal_grid, dual_grid)
65 call allocate_prognostic(current_state%sv, alloc_z, alloc_y, alloc_x, dual_grid, primal_grid, dual_grid)
66 call allocate_prognostic(current_state%savv, alloc_z, alloc_y, alloc_x, dual_grid, primal_grid, dual_grid)
69 call allocate_prognostic(current_state%w, alloc_z, alloc_y, alloc_x, primal_grid, dual_grid, dual_grid)
70 call allocate_prognostic(current_state%zw, alloc_z, alloc_y, alloc_x, primal_grid, dual_grid, dual_grid)
71 call allocate_prognostic(current_state%sw, alloc_z, alloc_y, alloc_x, primal_grid, dual_grid, dual_grid)
72 call allocate_prognostic(current_state%savw, alloc_z, alloc_y, alloc_x, primal_grid, dual_grid, dual_grid)
76 call allocate_prognostic(current_state%th, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, dual_grid)
77 call allocate_prognostic(current_state%zth, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, dual_grid)
78 call allocate_prognostic(current_state%sth, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, dual_grid)
80 if (current_state%number_q_fields .gt. 0)
then
81 allocate(current_state%q(current_state%number_q_fields), &
82 current_state%zq(current_state%number_q_fields), current_state%sq(current_state%number_q_fields))
83 do i=1, current_state%number_q_fields
84 call allocate_prognostic(current_state%q(i), alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, dual_grid)
85 call allocate_prognostic(current_state%zq(i), alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, dual_grid)
86 call allocate_prognostic(current_state%sq(i), alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, dual_grid)
90 current_state%water_vapour_mixing_ratio_index=get_q_index(standard_q_names%VAPOUR,
'simplesetup')
91 current_state%liquid_water_mixing_ratio_index=get_q_index(standard_q_names%CLOUD_LIQUID_MASS,
'simplesetup')
95 call allocate_prognostic(current_state%sth_lw, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, dual_grid)
96 call allocate_prognostic(current_state%sth_sw, alloc_z, alloc_y, alloc_x, dual_grid, dual_grid, dual_grid)
101 type(prognostic_field_type),
intent(inout) :: field
102 integer,
intent(in) :: alloc_z, alloc_y, alloc_x, z_grid, y_grid, x_grid
105 field%grid(z_index) = z_grid
106 field%grid(y_index) = y_grid
107 field%grid(x_index) = x_grid
108 allocate(field%data(alloc_z, alloc_y, alloc_x))
109 field%data=0.0_default_precision
113 type(model_state_type),
intent(inout) :: current_state
115 if (
associated(current_state%parallel%decomposition_procedure))
then
116 call current_state%parallel%decomposition_procedure(current_state)
118 call log_log(log_error,
"No decomposition specified")
123 type(model_state_type),
intent(inout) :: current_state
124 type(global_grid_type),
intent(inout) :: specific_grid
126 integer,
parameter :: KGD_SIZE=200
127 integer :: number_kgd, i, kgd(KGD_SIZE)
128 real(kind=default_precision) :: hgd(kgd_size)
132 call options_get_integer_array(current_state%options_database,
"kgd", kgd)
133 call options_get_real_array(current_state%options_database,
"hgd", hgd)
136 if (hgd(1)/=0.0_default_precision)
then
137 call log_log(log_error,
"Lowest level is assumed to lie at the surface, check hgd(1)")
139 kgd(1:kgd_size-1) = kgd(2:)
140 hgd(1:kgd_size-1) = hgd(2:)
145 if (kgd(i) == -1)
exit
149 if (number_kgd .gt. 0)
then
150 allocate(current_state%global_grid%configuration%vertical%kgd(number_kgd), &
151 current_state%global_grid%configuration%vertical%hgd(number_kgd))
152 current_state%global_grid%configuration%vertical%kgd=kgd(1:number_kgd)
153 current_state%global_grid%configuration%vertical%hgd=hgd(1:number_kgd)
156 specific_grid%bottom(z_index) = 0
157 specific_grid%bottom(y_index) = 0
158 specific_grid%bottom(x_index) = 0
160 specific_grid%top(z_index) =
zztop
161 specific_grid%top(y_index) =
dyy *
y_size
162 specific_grid%top(x_index) =
dxx *
x_size
165 specific_grid%resolution(y_index) =
dyy
166 specific_grid%resolution(x_index) =
dxx
168 specific_grid%size(z_index) =
z_size
169 specific_grid%size(y_index) =
y_size
170 specific_grid%size(x_index) =
x_size
172 specific_grid%active(z_index) = .true.
173 specific_grid%active(y_index) = .true.
174 specific_grid%active(x_index) = .true.
176 specific_grid%dimensions = 3
180 type(model_state_type),
intent(inout),
target :: current_state
182 current_state%rhobous=options_get_real(current_state%options_database,
"rhobous")
183 current_state%thref0=options_get_real(current_state%options_database,
"thref0")
184 current_state%number_q_fields=options_get_integer(current_state%options_database,
"number_q_fields")
185 current_state%surface_pressure=options_get_real(current_state%options_database,
"surface_pressure")
186 current_state%surface_reference_pressure=options_get_real(current_state%options_database,
"surface_reference_pressure")
188 current_state%use_anelastic_equations=options_get_logical(current_state%options_database,
"use_anelastic_equations")
190 current_state%origional_vertical_grid_setup=options_get_logical(current_state%options_database, &
191 "origional_vertical_grid_setup")
192 current_state%passive_q=options_get_logical(current_state%options_database,
"passive_q")
193 current_state%passive_th=options_get_logical(current_state%options_database,
"passive_th")
194 current_state%rmlmax=options_get_real(current_state%options_database,
"rmlmax")
195 current_state%calculate_th_and_q_init=options_get_logical(current_state%options_database,
"calculate_th_and_q_init")
196 current_state%use_viscosity_and_diffusion=options_get_logical(current_state%options_database,
"use_viscosity_and_diffusion")
197 current_state%backscatter=options_get_logical(current_state%options_database,
"backscatter")
199 x_size=options_get_integer(current_state%options_database,
"x_size")
200 y_size=options_get_integer(current_state%options_database,
"y_size")
201 z_size=options_get_integer(current_state%options_database,
"z_size")
202 dxx=options_get_real(current_state%options_database,
"dxx")
203 dyy=options_get_real(current_state%options_database,
"dyy")
204 zztop=options_get_real(current_state%options_database,
"zztop")
205 enable_theta=options_get_logical(current_state%options_database,
"enable_theta")
207 if (current_state%rmlmax<=0.0)current_state%rmlmax=0.23 * max(
dxx,
dyy)
210 if ( current_state%number_q_fields == 0) current_state%passive_q=.true.
212 current_state%galilean_transformation=options_get_logical(current_state%options_database,
"galilean_transformation")
213 if (current_state%galilean_transformation)
then
214 current_state%fix_ugal=options_get_logical(current_state%options_database,
"fix_ugal")
215 current_state%fix_vgal=options_get_logical(current_state%options_database,
"fix_vgal")
216 if (current_state%fix_ugal)current_state%ugal=options_get_real(current_state%options_database,
"ugal")
217 if (current_state%fix_vgal)current_state%vgal=options_get_real(current_state%options_database,
"vgal")