14 use mpi
, only : mpi_request_null
39 type(model_state_type),
target,
intent(inout) :: current_state
41 if (.not. is_component_enabled(current_state%options_database,
"diverr"))
then 42 call log_master_log(log_error,
"The pressure source component requires the diverr component to be enabled")
46 allocate(
send_buffer_x(current_state%local_grid%size(z_index)-1, current_state%local_grid%size(y_index)), &
47 current_state%psrce_recv_buffer_x(current_state%local_grid%size(z_index)-1, current_state%local_grid%size(y_index)))
50 allocate(
send_buffer_y(current_state%local_grid%size(z_index)-1, current_state%local_grid%size(x_index)), &
51 current_state%psrce_recv_buffer_y(current_state%local_grid%size(z_index)-1, current_state%local_grid%size(x_index)))
53 current_state%psrce_x_hs_send_request=mpi_request_null
54 current_state%psrce_y_hs_send_request=mpi_request_null
55 current_state%psrce_x_hs_recv_request=mpi_request_null
56 current_state%psrce_y_hs_recv_request=mpi_request_null
62 type(model_state_type),
target,
intent(inout) :: current_state
65 if (.not. current_state%halo_column)
call calculate_psrce(current_state)
72 type(model_state_type),
target,
intent(inout) :: current_state
75 if (
allocated(current_state%psrce_recv_buffer_x))
deallocate(current_state%psrce_recv_buffer_x)
77 if (
allocated(current_state%psrce_recv_buffer_y))
deallocate(current_state%psrce_recv_buffer_y)
85 type(model_state_type),
target,
intent(inout) :: current_state
87 integer :: k, local_y, local_x, corrected_y, corrected_x
88 logical :: last_x, last_y
90 local_y=current_state%column_local_y
91 local_x=current_state%column_local_x
92 last_y = local_y == current_state%local_grid%local_domain_end_index(y_index)
93 last_x = local_x == current_state%local_grid%local_domain_end_index(x_index)
94 if (last_x .or. last_y)
then 95 corrected_x=local_x-current_state%local_grid%halo_size(x_index)
96 corrected_y=local_y-current_state%local_grid%halo_size(y_index)
98 do k=2,current_state%local_grid%size(z_index)
100 current_state%p%data(k, local_y, local_x)=current_state%p%data(k, local_y, local_x)+&
101 4.0_default_precision*(current_state%global_grid%configuration%vertical%tzc2(k)*&
102 current_state%sw%data(k, local_y, local_x)-&
103 current_state%global_grid%configuration%vertical%tzc1(k)*current_state%sw%data(k-1, local_y, local_x))
106 current_state%p%data(k, local_y, local_x)=current_state%p%data(k, local_y, local_x)+&
107 current_state%global_grid%configuration%horizontal%cx * current_state%su%data(k, local_y, local_x)
110 current_state%p%data(k, local_y, local_x)=current_state%p%data(k, local_y, local_x)+&
111 current_state%global_grid%configuration%horizontal%cy * current_state%sv%data(k, local_y, local_x)
114 if (local_x .gt. 3)
then 115 current_state%p%data(k, local_y, local_x)=current_state%p%data(k, local_y, local_x)-&
116 current_state%global_grid%configuration%horizontal%cx * current_state%su%data(k, local_y, local_x-1)
121 current_state%global_grid%configuration%horizontal%cx * current_state%su%data(k, local_y, local_x)
125 if (local_y .gt. 3 .and. local_x .gt. 3)
then 126 current_state%p%data(k, local_y, local_x)=current_state%p%data(k, local_y, local_x)-&
127 current_state%global_grid%configuration%horizontal%cy * current_state%sv%data(k, local_y-1, local_x)
131 current_state%global_grid%configuration%horizontal%cy * current_state%sv%data(k, local_y, local_x)
140 type(model_state_type),
target,
intent(inout) :: current_state
145 if (current_state%local_grid%neighbours(x_index,3) .eq. current_state%parallel%my_rank)
then 149 10, current_state%parallel%neighbour_comm, current_state%psrce_x_hs_send_request, ierr)
153 if (current_state%local_grid%neighbours(y_index,3) .eq. current_state%parallel%my_rank)
then 157 10, current_state%parallel%neighbour_comm, current_state%psrce_y_hs_send_request, ierr)
165 type(model_state_type),
target,
intent(inout) :: current_state
170 if (current_state%local_grid%neighbours(x_index,2) .ne. current_state%parallel%my_rank)
then 171 call mpi_irecv(current_state%psrce_recv_buffer_x,
size(current_state%psrce_recv_buffer_x), precision_type, &
172 current_state%local_grid%neighbours(x_index,2), 10, current_state%parallel%neighbour_comm, &
173 current_state%psrce_x_hs_recv_request, ierr)
177 if (current_state%local_grid%neighbours(y_index,2) .ne. current_state%parallel%my_rank)
then 178 call mpi_irecv(current_state%psrce_recv_buffer_y,
size(current_state%psrce_recv_buffer_y), precision_type, &
179 current_state%local_grid%neighbours(y_index,2), 10, current_state%parallel%neighbour_comm, &
180 current_state%psrce_y_hs_recv_request, ierr)
integer, public precision_type
subroutine initialisation_callback(current_state)
On initialisation this will allocate the buffer areas required and set communication handles to null...
real(kind=default_precision), dimension(:,:), allocatable send_buffer_y
integer, parameter, public log_error
Only log ERROR messages.
real(kind=default_precision), dimension(:,:), allocatable send_buffer_x
Calculates the gradient of the source flow fields (SU, SV, SW.) This is based upon the P field values...
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.
logical function, public is_component_enabled(options_database, component_name)
Determines whether or not a specific component is registered and enabled.
subroutine, public log_master_log(level, message)
Will log just from the master process.
Description of a component.
subroutine finalisation_callback(current_state)
Frees up the allocated buffers (if such were allocated)
Interfaces and types that MONC components must specify.
subroutine send_neighbouring_pressure_data(current_state)
Sends the computed source pressure data terms to the p+1 process.
subroutine timestep_callback(current_state)
The timestep callback will update the values of P for each column.
Functionality to support the different types of grid and abstraction between global grids and local o...
subroutine register_neighbouring_pressure_data_recv(current_state)
Registers the receive requests for each neighbouring process if that is not local, is recieves from p-1.
type(component_descriptor_type) function, public pressuresource_get_descriptor()
Descriptor of this component for registration.
subroutine calculate_psrce(current_state)
Combines the source fields with the pressure values. For U and V, if this is on the low boundary then...
The model state which represents the current state of a run.
integer, parameter, public y_index
integer, parameter, public x_index