Timestep callback which applies lateral boundary conditions.
55 type(model_state_type),
target,
intent(inout) :: current_state
57 INTEGER :: istart, iend, jstart, jend, kstart, kend
61 LOGICAL :: is_east, is_west, is_north, is_south
63 if (current_state%timestep==1)
return
65 is_west=current_state%parallel%wrapped_around(x_index,1)
66 is_east=current_state%parallel%wrapped_around(x_index,2)
67 is_south=current_state%parallel%wrapped_around(y_index,1)
68 is_north=current_state%parallel%wrapped_around(y_index,2)
71 if (is_west .or. is_east .or. is_north .or. is_south)
then
72 kstart=current_state%local_grid%local_domain_start_index(z_index)
73 kend=current_state%local_grid%local_domain_end_index(z_index)
79 iend=current_state%local_grid%local_domain_end_index(x_index)
80 istart = iend - idepth + 1
81 jstart=current_state%local_grid%local_domain_start_index(y_index)
82 jend=current_state%local_grid%local_domain_end_index(y_index)
84 if (lbc_type_x==lbc_periodic)
then
86 else if (lbc_type_x==lbc_rigid)
then
89 call apply_rigid(current_state,istart,iend,jstart,jend,kstart,kend)
91 do i=iend+1,iend+current_state%local_grid%halo_size(x_index)
92 current_state%u%data(:,:,i) = current_state%u%data(:,:,iend)
93 current_state%zu%data(:,:,i) = current_state%zu%data(:,:,iend)
94 current_state%w%data(:,:,i) = current_state%w%data(:,:,iend)
95 current_state%zw%data(:,:,i) = current_state%zw%data(:,:,iend)
98 else if (lbc_type_x==lbc_blend)
then
107 istart=current_state%local_grid%local_domain_start_index(x_index)
108 iend=istart + idepth - 1
109 jstart=current_state%local_grid%local_domain_start_index(y_index)
110 jend=current_state%local_grid%local_domain_end_index(y_index)
113 if (lbc_type_x==lbc_periodic)
then
115 else if (lbc_type_x==lbc_rigid)
then
118 call apply_rigid(current_state,istart,iend,jstart,jend,kstart,kend)
120 do i=istart-current_state%local_grid%halo_size(x_index),istart-1
121 current_state%u%data(:,:,i) = current_state%u%data(:,:,istart)
122 current_state%zu%data(:,:,i) = current_state%zu%data(:,:,istart)
123 current_state%w%data(:,:,i) = current_state%w%data(:,:,istart)
124 current_state%zw%data(:,:,i) = current_state%zw%data(:,:,istart)
126 else if (lbc_type_x==lbc_blend)
then
135 istart=current_state%local_grid%local_domain_start_index(x_index)
136 iend=current_state%local_grid%local_domain_end_index(x_index)
137 jend=current_state%local_grid%local_domain_end_index(y_index)
138 jstart=jend - jdepth + 1
140 if (lbc_type_y==lbc_periodic)
then
142 else if (lbc_type_y==lbc_rigid)
then
145 call apply_rigid(current_state,istart,iend,jstart,jend,kstart,kend)
146 do j=jend+1,jend+current_state%local_grid%halo_size(y_index)
147 current_state%v%data(:,:,j) = current_state%v%data(:,:,jend)
148 current_state%zv%data(:,:,j) = current_state%zv%data(:,:,jend)
149 current_state%w%data(:,:,j) = current_state%w%data(:,:,jend)
150 current_state%zw%data(:,:,j) = current_state%zw%data(:,:,jend)
152 else if (lbc_type_y==lbc_blend)
then
162 istart=current_state%local_grid%local_domain_start_index(x_index)
163 iend=current_state%local_grid%local_domain_end_index(x_index)
164 jstart=current_state%local_grid%local_domain_start_index(y_index)
165 jend=jstart + jdepth - 1
167 if (lbc_type_y==lbc_periodic)
then
169 else if (lbc_type_y==lbc_rigid)
then
172 call apply_rigid(current_state,istart,iend,jstart,jend,kstart,kend)
173 do j=jstart-current_state%local_grid%halo_size(y_index),jstart-1
174 current_state%v%data(:,:,j) = current_state%v%data(:,:,jstart)
175 current_state%zv%data(:,:,j) = current_state%zv%data(:,:,jstart)
176 current_state%w%data(:,:,j) = current_state%w%data(:,:,jstart)
177 current_state%zw%data(:,:,j) = current_state%zw%data(:,:,jstart)
179 else if (lbc_type_y==lbc_blend)
then