7 use mpi
, only : mpi_sum, mpi_in_place
16 real(kind=DEFAULT_PRECISION) ::
rnhpts 17 real(kind=DEFAULT_PRECISION),
dimension(:,:),
allocatable ::
bartmp 35 type(model_state_type),
target,
intent(inout) :: current_state
39 rnhpts=1.0_default_precision/
real(current_state%global_grid%size(x_index)*current_state%global_grid%size(y_index))
41 start_x=current_state%local_grid%local_domain_start_index(x_index)
42 end_x=current_state%local_grid%local_domain_end_index(X_INDEX)
43 start_y=current_state%local_grid%local_domain_start_index(y_index)
44 end_y=current_state%local_grid%local_domain_end_index(Y_INDEX)
47 if (.not. current_state%continuation_run)
then 48 allocate(current_state%global_grid%configuration%vertical%olubar(current_state%local_grid%size(z_index)),&
49 current_state%global_grid%configuration%vertical%olzubar(current_state%local_grid%size(z_index)))
51 allocate(current_state%global_grid%configuration%vertical%savolubar(current_state%local_grid%size(z_index)))
55 if (.not. current_state%continuation_run)
then 56 allocate(current_state%global_grid%configuration%vertical%olvbar(current_state%local_grid%size(z_index)),&
57 current_state%global_grid%configuration%vertical%olzvbar(current_state%local_grid%size(z_index)))
59 allocate(current_state%global_grid%configuration%vertical%savolvbar(current_state%local_grid%size(z_index)))
62 if (current_state%th%active)
then 63 if (.not. current_state%continuation_run)
then 64 allocate(current_state%global_grid%configuration%vertical%olthbar(current_state%local_grid%size(z_index)),&
65 current_state%global_grid%configuration%vertical%olzthbar(current_state%local_grid%size(z_index)))
69 if (current_state%number_q_fields .gt. 0)
then 71 if (.not. current_state%continuation_run)
then 72 allocate(current_state%global_grid%configuration%vertical%olqbar(current_state%local_grid%size(z_index), &
73 current_state%number_q_fields), current_state%global_grid%configuration%vertical%olzqbar(&
74 current_state%local_grid%size(z_index), current_state%number_q_fields))
86 type(model_state_type),
target,
intent(inout) :: current_state
88 current_state%global_grid%configuration%vertical%savolubar=current_state%global_grid%configuration%vertical%olubar
89 current_state%global_grid%configuration%vertical%savolvbar=current_state%global_grid%configuration%vertical%olvbar
97 type(model_state_type),
target,
intent(inout) :: current_state
105 type(model_state_type),
target,
intent(inout) :: current_state
107 integer :: bar_index, i
113 current_state%global_grid%configuration%vertical%olubar(:)=
bartmp(:, bar_index)*
rnhpts 114 current_state%global_grid%configuration%vertical%olzubar(:)=
bartmp(:, bar_index+1)*
rnhpts 115 bar_index=bar_index+2
118 current_state%global_grid%configuration%vertical%olvbar(:)=
bartmp(:, bar_index)*
rnhpts 119 current_state%global_grid%configuration%vertical%olzvbar(:)=
bartmp(:, bar_index+1)*
rnhpts 120 bar_index=bar_index+2
122 if (current_state%th%active)
then 123 current_state%global_grid%configuration%vertical%olthbar(:)=
bartmp(:, bar_index)*
rnhpts 124 current_state%global_grid%configuration%vertical%olzthbar(:)=
bartmp(:, bar_index+1)*
rnhpts 125 bar_index=bar_index+2
127 do i=1,current_state%number_q_fields
128 if (current_state%q(i)%active)
then 129 current_state%global_grid%configuration%vertical%olqbar(:, i)=
bartmp(:, bar_index)*
rnhpts 130 current_state%global_grid%configuration%vertical%olzqbar(:, i)=
bartmp(:, bar_index+1)*
rnhpts 131 bar_index=bar_index+2
140 type(model_state_type),
intent(inout) :: current_state
142 integer :: k, n, bar_index, ierr
144 do k=current_state%local_grid%local_domain_start_index(z_index), current_state%local_grid%local_domain_end_index(z_index)
149 bar_index=bar_index+2
154 bar_index=bar_index+2
156 if (current_state%th%active)
then 159 bar_index=bar_index+2
161 do n=1,current_state%number_q_fields
162 if (current_state%q(n)%active)
then 165 bar_index=bar_index+2
170 call mpi_allreduce(mpi_in_place,
bartmp,
bar_fields*current_state%local_grid%size(z_index), precision_type, mpi_sum, &
171 current_state%parallel%monc_communicator, ierr)
subroutine calculate_mean_profiles(current_state)
Calculates the global mean profiles and stores these in the ol bar arrays.
integer, public precision_type
real(kind=default_precision), dimension(:,:), allocatable bartmp
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 init_callback(current_state)
Called on MONC initialisation, will allocate appropriate data structures.
Description of a component.
Calculates the mean profiles of prognostic variables which are then used in smoothing and other areas...
Interfaces and types that MONC components must specify.
type(component_descriptor_type) function, public meanprofiles_get_descriptor()
Returns the component descriptor of the mean profiles module.
subroutine timestep_callback(current_state)
Will recalculate the mean profiles of each prognostic when called (for the entire local domain) ...
Functionality to support the different types of grid and abstraction between global grids and local o...
subroutine calculate_sum_profiles(current_state)
Calculates the sum profiles for the bars for each level globally.
subroutine finalisation_callback(current_state)
Frees up the temporary data for the bars.
The model state which represents the current state of a run.
integer, parameter, public y_index
real(kind=default_precision) rnhpts
integer, parameter, public x_index