7 double precision,
dimension(:^D&,:),
allocatable :: w
60 integer,
private :: itag
126 integer :: nghostcellsCo, interpolation_order
127 integer :: nx^D, nxCo^D, ixG^L, i^D, ic^D, inc^D, idir
130 ixm^l=ixg^l^lsubnghostcells;
134 ixcogsmax^d=ixcogmax^d;
138 nx^d=ixmmax^d-ixmmin^d+1;
142 interpolation_order=1
144 interpolation_order=2
148 if (nghostcellsco+interpolation_order-1>
nghostcells)
then
149 call mpistop(
"interpolation order for prolongation in getbc too high")
158 ixs_srl_min^d(:,-1)=ixmmin^d
159 ixs_srl_min^d(:, 0)=ixmmin^d
162 ixs_srl_max^d(:, 0)=ixmmax^d
163 ixs_srl_max^d(:, 1)=ixmmax^d
165 ixr_srl_min^d(:,-1)=1
166 ixr_srl_min^d(:, 0)=ixmmin^d
167 ixr_srl_min^d(:, 1)=ixmmax^d+1
169 ixr_srl_max^d(:, 0)=ixmmax^d
170 ixr_srl_max^d(:, 1)=ixgmax^d
172 ixs_r_min^d(:,-1)=ixcommin^d
173 ixs_r_min^d(:, 0)=ixcommin^d
176 ixs_r_max^d(:, 0)=ixcommax^d
177 ixs_r_max^d(:, 1)=ixcommax^d
180 ixr_r_min^d(:, 1)=ixmmin^d
181 ixr_r_min^d(:, 2)=ixmmin^d+nxco^d
182 ixr_r_min^d(:, 3)=ixmmax^d+1
184 ixr_r_max^d(:, 1)=ixmmin^d-1+nxco^d
185 ixr_r_max^d(:, 2)=ixmmax^d
186 ixr_r_max^d(:, 3)=ixgmax^d
188 ixs_p_min^d(:, 0)=ixmmin^d-(interpolation_order-1)
189 ixs_p_min^d(:, 1)=ixmmin^d-(interpolation_order-1)
190 ixs_p_min^d(:, 2)=ixmmin^d+nxco^d-nghostcellsco-(interpolation_order-1)
191 ixs_p_min^d(:, 3)=ixmmax^d+1-nghostcellsco-(interpolation_order-1)
192 ixs_p_max^d(:, 0)=ixmmin^d-1+nghostcellsco+(interpolation_order-1)
193 ixs_p_max^d(:, 1)=ixmmin^d-1+nxco^d+nghostcellsco+(interpolation_order-1)
194 ixs_p_max^d(:, 2)=ixmmax^d+(interpolation_order-1)
195 ixs_p_max^d(:, 3)=ixmmax^d+(interpolation_order-1)
199 ixs_p_min^d(:, 0)=ixmmin^d
200 ixs_p_max^d(:, 3)=ixmmax^d
201 ixs_p_max^d(:, 1)=ixmmin^d-1+nxco^d+(interpolation_order-1)
202 ixs_p_min^d(:, 2)=ixmmin^d+nxco^d-(interpolation_order-1)
205 ixr_p_min^d(:, 0)=ixcommin^d-nghostcellsco-(interpolation_order-1)
206 ixr_p_min^d(:, 1)=ixcommin^d-(interpolation_order-1)
207 ixr_p_min^d(:, 2)=ixcommin^d-nghostcellsco-(interpolation_order-1)
208 ixr_p_min^d(:, 3)=ixcommax^d+1-(interpolation_order-1)
209 ixr_p_max^d(:, 0)=
nghostcells+(interpolation_order-1)
210 ixr_p_max^d(:, 1)=ixcommax^d+nghostcellsco+(interpolation_order-1)
211 ixr_p_max^d(:, 2)=ixcommax^d+(interpolation_order-1)
212 ixr_p_max^d(:, 3)=ixcommax^d+nghostcellsco+(interpolation_order-1)
216 ixr_p_min^d(:, 3)=ixcommax^d+1
217 ixr_p_max^d(:, 1)=ixcommax^d+(interpolation_order-1)
218 ixr_p_min^d(:, 2)=ixcommin^d-(interpolation_order-1)
224 allocate(pole_buf%ws(ixgs^t,nws))
227 { ixs_srl_stg_min^d(idir,-1)=ixmmin^d-
kr(idir,^d)
229 ixs_srl_stg_min^d(idir,0) =ixmmin^d-
kr(idir,^d)
230 ixs_srl_stg_max^d(idir,0) =ixmmax^d
231 ixs_srl_stg_min^d(idir,1) =ixmmax^d-
nghostcells+1-
kr(idir,^d)
232 ixs_srl_stg_max^d(idir,1) =ixmmax^d
234 ixr_srl_stg_min^d(idir,-1)=1-
kr(idir,^d)
236 ixr_srl_stg_min^d(idir,0) =ixmmin^d-
kr(idir,^d)
237 ixr_srl_stg_max^d(idir,0) =ixmmax^d
238 ixr_srl_stg_min^d(idir,1) =ixmmax^d+1-
kr(idir,^d)
239 ixr_srl_stg_max^d(idir,1) =ixgmax^d
241 ixs_r_stg_min^d(idir,-1)=ixcommin^d-
kr(idir,^d)
243 ixs_r_stg_min^d(idir,0) =ixcommin^d-
kr(idir,^d)
244 ixs_r_stg_max^d(idir,0) =ixcommax^d
245 ixs_r_stg_min^d(idir,1) =ixcommax^d+1-
nghostcells-
kr(idir,^d)
246 ixs_r_stg_max^d(idir,1) =ixcommax^d
248 ixr_r_stg_min^d(idir,0)=1-
kr(idir,^d)
250 ixr_r_stg_min^d(idir,1)=ixmmin^d-
kr(idir,^d)
251 ixr_r_stg_max^d(idir,1)=ixmmin^d-1+nxco^d
252 ixr_r_stg_min^d(idir,2)=ixmmin^d+nxco^d-
kr(idir,^d)
253 ixr_r_stg_max^d(idir,2)=ixmmax^d
254 ixr_r_stg_min^d(idir,3)=ixmmax^d+1-
kr(idir,^d)
255 ixr_r_stg_max^d(idir,3)=ixgmax^d
260 ixs_p_stg_min^d(idir,0)=ixmmin^d-1
261 ixs_p_stg_max^d(idir,0)=ixmmin^d-1+nghostcellsco
262 ixs_p_stg_min^d(idir,1)=ixmmin^d-1
263 ixs_p_stg_max^d(idir,1)=ixmmin^d-1+nxco^d+nghostcellsco
264 ixs_p_stg_min^d(idir,2)=ixmmax^d-nxco^d-nghostcellsco
265 ixs_p_stg_max^d(idir,2)=ixmmax^d
266 ixs_p_stg_min^d(idir,3)=ixmmax^d-nghostcellsco
267 ixs_p_stg_max^d(idir,3)=ixmmax^d
269 ixr_p_stg_min^d(idir,0)=ixcommin^d-1-nghostcellsco
270 ixr_p_stg_max^d(idir,0)=ixcommin^d-1
271 ixr_p_stg_min^d(idir,1)=ixcommin^d-1
272 ixr_p_stg_max^d(idir,1)=ixcommax^d+nghostcellsco
273 ixr_p_stg_min^d(idir,2)=ixcommin^d-1-nghostcellsco
274 ixr_p_stg_max^d(idir,2)=ixcommax^d
275 ixr_p_stg_min^d(idir,3)=ixcommax^d+1-1
276 ixr_p_stg_max^d(idir,3)=ixcommax^d+nghostcellsco
281 ixs_p_stg_min^d(idir,0)=ixmmin^d
282 ixs_p_stg_max^d(idir,0)=ixmmin^d-1+nghostcellsco+(interpolation_order-1)
283 ixs_p_stg_min^d(idir,1)=ixmmin^d
284 ixs_p_stg_max^d(idir,1)=ixmmin^d-1+nxco^d+nghostcellsco+(interpolation_order-1)
285 ixs_p_stg_min^d(idir,2)=ixmmax^d+1-nxco^d-nghostcellsco-(interpolation_order-1)
286 ixs_p_stg_max^d(idir,2)=ixmmax^d
287 ixs_p_stg_min^d(idir,3)=ixmmax^d+1-nghostcellsco-(interpolation_order-1)
288 ixs_p_stg_max^d(idir,3)=ixmmax^d
290 ixr_p_stg_min^d(idir,0)=ixcommin^d-nghostcellsco-(interpolation_order-1)
291 ixr_p_stg_max^d(idir,0)=ixcommin^d-1
292 ixr_p_stg_min^d(idir,1)=ixcommin^d
293 ixr_p_stg_max^d(idir,1)=ixcommax^d+nghostcellsco+(interpolation_order-1)
294 ixr_p_stg_min^d(idir,2)=ixcommin^d-nghostcellsco-(interpolation_order-1)
295 ixr_p_stg_max^d(idir,2)=ixcommax^d
296 ixr_p_stg_min^d(idir,3)=ixcommax^d+1
297 ixr_p_stg_max^d(idir,3)=ixcommax^d+nghostcellsco+(interpolation_order-1)
306 sizes_srl_send_stg(idir,i^d)={(ixs_srl_stg_max^d(idir,i^d)-ixs_srl_stg_min^d(idir,i^d)+1)|*}
307 sizes_srl_recv_stg(idir,i^d)={(ixr_srl_stg_max^d(idir,i^d)-ixr_srl_stg_min^d(idir,i^d)+1)|*}
308 sizes_r_send_stg(idir,i^d)={(ixs_r_stg_max^d(idir,i^d)-ixs_r_stg_min^d(idir,i^d)+1)|*}
318 sizes_r_recv_stg(idir,i^d)={(ixr_r_stg_max^d(idir,i^d)-ixr_r_stg_min^d(idir,i^d)+1)|*}
319 sizes_p_send_stg(idir,i^d)={(ixs_p_stg_max^d(idir,i^d)-ixs_p_stg_min^d(idir,i^d)+1)|*}
320 sizes_p_recv_stg(idir,i^d)={(ixr_p_stg_max^d(idir,i^d)-ixr_p_stg_min^d(idir,i^d)+1)|*}
327 if(.not.stagger_grid .or. physics_type==
'mf')
then
330 ixs_srl_min^d(-1,0)=1
331 ixs_srl_min^d( 1,0)=ixmmin^d
332 ixs_srl_min^d( 2,0)=1
333 ixs_srl_max^d(-1,0)=ixmmax^d
334 ixs_srl_max^d( 1,0)=ixgmax^d
335 ixs_srl_max^d( 2,0)=ixgmax^d
337 ixr_srl_min^d(-1,0)=1
338 ixr_srl_min^d( 1,0)=ixmmin^d
339 ixr_srl_min^d( 2,0)=1
340 ixr_srl_max^d(-1,0)=ixmmax^d
341 ixr_srl_max^d( 1,0)=ixgmax^d
342 ixr_srl_max^d( 2,0)=ixgmax^d
345 ixs_r_min^d( 1,0)=ixcommin^d
346 ixs_r_max^d(-1,0)=ixcommax^d
347 ixs_r_max^d( 1,0)=ixcogmax^d
350 ixr_r_max^d(-1,1)=ixmmin^d-1+nxco^d
351 ixr_r_min^d( 1,2)=ixmmin^d+nxco^d
352 ixr_r_max^d( 1,2)=ixgmax^d
355 ixs_p_max^d( 1,2)=ixgmax^d
358 ixr_p_max^d( 1,2)=ixcogmax^d
367 integer,
intent(in) :: nwstart, nwbc
368 integer :: i^D, ic^D, inc^D, iib^D
371 if (i^d==0|.and.) cycle
375 if (iib^d==2|.or.) cycle
377 {
do ic^db=1+int((1-i^db)/2),2-int((1+i^db)/2)
378 inc^db=2*i^db+ic^db\}
391 integer,
intent(inout) :: comm_type
392 integer,
intent(in) :: ix^L, ixG^L, nwstart, nwbc
394 integer,
dimension(ndim+1) :: fullsize, subsize, start
396 ^
d&fullsize(^
d)=ixgmax^
d;
398 ^
d&subsize(^
d)=ixmax^
d-ixmin^
d+1;
400 ^
d&start(^
d)=ixmin^
d-1;
401 start(
ndim+1)=nwstart-1
403 call mpi_type_create_subarray(
ndim+1,fullsize,subsize,start,mpi_order_fortran, &
404 mpi_double_precision,comm_type,
ierrmpi)
405 call mpi_type_commit(comm_type,
ierrmpi)
412 integer :: i^D, ic^D, inc^D, iib^D
415 if (i^d==0|.and.) cycle
420 if (iib^d==2|.or.) cycle
422 {
do ic^db=1+int((1-i^db)/2),2-int((1+i^db)/2)
423 inc^db=2*i^db+ic^db\}
434 subroutine getbc(time,qdt,psb,nwstart,nwbc,req_diag)
441 double precision,
intent(in) :: time, qdt
442 type(state),
target :: psb(max_blocks)
443 integer,
intent(in) :: nwstart
444 integer,
intent(in) :: nwbc
445 logical,
intent(in),
optional :: req_diag
447 double precision :: time_bcin
448 integer :: ipole, nwhead, nwtail
449 integer :: iigrid, igrid, ineighbor, ipe_neighbor, isizes
450 integer :: ixR^L, ixS^L
451 integer :: i^D, n_i^D, ic^D, inc^D, n_inc^D, iib^D, idir
453 integer :: idphyb(ndim,max_blocks)
454 integer :: isend_buf(npwbuf), ipwbuf, nghostcellsco
456 integer :: ibuf_start, ibuf_next
458 integer,
dimension(1) :: shapes
459 logical :: req_diagonal
462 time_bcin=mpi_wtime()
465 nwtail=nwstart+nwbc-1
467 req_diagonal = .true.
468 if (
present(req_diag)) req_diagonal = req_diag
478 do iigrid=1,igridstail; igrid=igrids(iigrid);
487 do iigrid=1,igridstail; igrid=igrids(iigrid);
488 if(any(neighbor_type(:^d&,igrid)==neighbor_coarse))
then
505 if(stagger_grid)
then
521 do iigrid=1,igridstail; igrid=igrids(iigrid);
523 ^d&idphyb(^d,igrid)=iib^d;
526 select case (neighbor_type(i^d,igrid))
527 case (neighbor_sibling)
536 do iigrid=1,igridstail; igrid=igrids(iigrid);
537 ^d&iib^d=idphyb(^d,igrid);
540 select case (neighbor_type(i^d,igrid))
541 case (neighbor_sibling)
543 case (neighbor_coarse)
551 do iigrid=1,igridstail; igrid=igrids(iigrid);
552 ^d&iib^d=idphyb(^d,igrid);
555 select case (neighbor_type(i^d,igrid))
556 case(neighbor_sibling)
558 case(neighbor_coarse)
568 if(stagger_grid)
then
576 do iigrid=1,igridstail; igrid=igrids(iigrid);
577 ^d&iib^d=idphyb(^d,igrid);
580 select case (neighbor_type(i^d,igrid))
581 case (neighbor_sibling)
591 if (isend_buf(ipwbuf)/=0)
deallocate(pwbuf(ipwbuf)%w)
600 do iigrid=1,igridstail; igrid=igrids(iigrid);
601 ^d&iib^d=idphyb(^d,igrid);
608 do iigrid=1,igridstail; igrid=igrids(iigrid);
609 ^d&iib^d=idphyb(^d,igrid);
618 do iigrid=1,igridstail; igrid=igrids(iigrid);
619 ^d&iib^d=idphyb(^d,igrid);
622 if (neighbor_type(i^d,igrid)==neighbor_fine)
call bc_fill_prolong(igrid,i^d,iib^d)
630 if(stagger_grid)
then
636 do iigrid=1,igridstail; igrid=igrids(iigrid);
637 ^d&iib^d=idphyb(^d,igrid);
646 do iigrid=1,igridstail; igrid=igrids(iigrid);
652 if (isend_buf(ipwbuf)/=0)
deallocate(pwbuf(ipwbuf)%w)
656 if(
bcphys.and.stagger_grid)
then
658 do iigrid=1,igridstail; igrid=igrids(iigrid);
659 if(.not.phyboundblock(igrid)) cycle
666 if(
bcphys.and.
associated(phys_boundary_adjust))
then
668 do iigrid=1,igridstail; igrid=igrids(iigrid);
669 if(.not.phyboundblock(igrid)) cycle
670 call phys_boundary_adjust(igrid,psb)
675 time_bc=time_bc+(mpi_wtime()-time_bcin)
680 integer,
intent(in) :: dir(^nd)
682 if (all(dir == 0))
then
684 else if (.not. req_diagonal .and. count(dir /= 0) > 1)
then
694 integer,
intent(in) :: igrid
696 integer :: idims,iside,i^D,k^L,ixB^L
699 ^d&dxlevel(^d)=rnode(rpdx^d_,igrid);
705 kmin^d=merge(0, 1, idims==^d)
706 kmax^d=merge(0, 1, idims==^d)
707 ixbmin^d=ixglo^d+kmin^d*nghostcells
708 ixbmax^d=ixghi^d-kmax^d*nghostcells
711 if(idims > 1 .and. neighbor_type(-1,0,igrid)==neighbor_boundary) ixbmin1=ixglo1
712 if(idims > 1 .and. neighbor_type( 1,0,igrid)==neighbor_boundary) ixbmax1=ixghi1}
714 if(idims > 1 .and. neighbor_type(-1,0,0,igrid)==neighbor_boundary) ixbmin1=ixglo1
715 if(idims > 1 .and. neighbor_type( 1,0,0,igrid)==neighbor_boundary) ixbmax1=ixghi1
716 if(idims > 2 .and. neighbor_type(0,-1,0,igrid)==neighbor_boundary) ixbmin2=ixglo2
717 if(idims > 2 .and. neighbor_type(0, 1,0,igrid)==neighbor_boundary) ixbmax2=ixghi2}
719 i^d=kr(^d,idims)*(2*iside-3);
720 if (aperiodb(idims))
then
721 if (neighbor_type(i^d,igrid) /= neighbor_boundary .and. &
722 .not. psb(igrid)%is_physical_boundary(2*idims-2+iside)) cycle
724 if (neighbor_type(i^d,igrid) /= neighbor_boundary) cycle
726 call bc_phys(iside,idims,time,qdt,psb(igrid),ixg^ll,ixb^l)
735 integer,
intent(in) :: igrid
737 integer :: idims,iside,i^D,k^L,ixB^L
740 ^d&dxlevel(^d)=rnode(rpdx^d_,igrid);
747 kmin2=merge(1, 0, idims .lt. 2 .and. neighbor_type(0,-1,igrid)==1)
748 kmax2=merge(1, 0, idims .lt. 2 .and. neighbor_type(0, 1,igrid)==1)}
750 kmin2=merge(1, 0, idims .lt. 2 .and. neighbor_type(0,-1,0,igrid)==1)
751 kmax2=merge(1, 0, idims .lt. 2 .and. neighbor_type(0, 1,0,igrid)==1)
752 kmin3=merge(1, 0, idims .lt. 3 .and. neighbor_type(0,0,-1,igrid)==1)
753 kmax3=merge(1, 0, idims .lt. 3 .and. neighbor_type(0,0, 1,igrid)==1)}
754 ixbmin^d=ixglo^d+kmin^d*nghostcells;
755 ixbmax^d=ixghi^d-kmax^d*nghostcells;
757 i^d=kr(^d,idims)*(2*iside-3);
758 if (aperiodb(idims))
then
759 if (neighbor_type(i^d,igrid) /= neighbor_boundary .and. &
760 .not. psb(igrid)%is_physical_boundary(2*idims-2+iside)) cycle
762 if (neighbor_type(i^d,igrid) /= neighbor_boundary) cycle
764 call bc_phys(iside,idims,time,qdt,psb(igrid),ixg^ll,ixb^l)
773 ipe_neighbor=neighbor(2,i^d,igrid)
774 if (ipe_neighbor/=mype)
then
776 itag=(3**^nd+4**^nd)*(igrid-1)+{(i^d+1)*3**(^d-1)+}
779 if(stagger_grid)
then
792 {
do ic^db=1+int((1-i^db)/2),2-int((1+i^db)/2)
793 inc^db=2*i^db+ic^db\}
794 ipe_neighbor=neighbor_child(2,inc^d,igrid)
795 if (ipe_neighbor/=mype)
then
797 itag=(3**^nd+4**^nd)*(igrid-1)+3**^nd+{inc^d*4**(^d-1)+}
798 call mpi_irecv(psb(igrid)%w,1,
type_recv_r(iib^d,inc^d), &
800 if(stagger_grid)
then
803 mpi_double_precision,ipe_neighbor,itag, &
815 ipe_neighbor=neighbor(2,i^d,igrid)
817 if(ipe_neighbor/=mype)
then
818 ineighbor=neighbor(1,i^d,igrid)
819 ipole=neighbor_pole(i^d,igrid)
823 itag=(3**^nd+4**^nd)*(ineighbor-1)+{(n_i^d+1)*3**(^d-1)+}
826 if(stagger_grid)
then
833 reshape(psb(igrid)%ws(ixs^s,idir),shapes)
845 n_i^d=i^d^d%n_i^dd=-i^dd;\}
847 if (isend_buf(ipwbuf)/=0)
then
850 deallocate(pwbuf(ipwbuf)%w)
852 allocate(pwbuf(ipwbuf)%w(ixs^s,nwhead:nwtail))
853 call pole_buffer(pwbuf(ipwbuf)%w,ixs^
l,ixs^
l,psb(igrid)%w,ixg^ll,ixs^
l)
856 itag=(3**^nd+4**^nd)*(ineighbor-1)+{(n_i^d+1)*3**(^d-1)+}
857 isizes={(ixsmax^d-ixsmin^d+1)*}*nwbc
858 call mpi_isend(pwbuf(ipwbuf)%w,isizes,mpi_double_precision, &
860 ipwbuf=1+modulo(ipwbuf,
npwbuf)
861 if(stagger_grid)
then
868 reshape(psb(igrid)%ws(ixs^s,idir),shapes)
882 integer,
intent(in) :: igrid,i^D,iib^D
883 integer :: ineighbor,ipe_neighbor,ipole,ixS^L,ixR^L,n_i^D,idir
885 ipe_neighbor=neighbor(2,i^d,igrid)
886 if(ipe_neighbor==mype)
then
887 ineighbor=neighbor(1,i^d,igrid)
888 ipole=neighbor_pole(i^d,igrid)
893 psb(ineighbor)%w(ixr^s,nwhead:nwtail)=&
894 psb(igrid)%w(ixs^s,nwhead:nwtail)
895 if(stagger_grid)
then
899 psb(ineighbor)%ws(ixr^s,idir)=psb(igrid)%ws(ixs^s,idir)
906 n_i^d=i^d^d%n_i^dd=-i^dd;\}
909 call pole_copy(psb(ineighbor)%w,ixg^ll,ixr^l,psb(igrid)%w,ixg^ll,ixs^l,ipole)
910 if(stagger_grid)
then
914 call pole_copy_stg(psb(ineighbor)%ws,ixgs^ll,ixr^l,psb(igrid)%ws,ixgs^ll,ixs^l,idir,ipole)
923 integer,
intent(in) :: igrid,i^D
925 integer :: idims,iside,k^L,ixB^L,ii^D
927 if(phyboundblock(igrid).and..not.stagger_grid.and.
bcphys)
then
936 {kmin^d=merge(0, 1, idims==^d)
937 kmax^d=merge(0, 1, idims==^d)
938 ixbmin^d=ixcogmin^d+kmin^d*nghostcells
939 ixbmax^d=ixcogmax^d-kmax^d*nghostcells\}
941 if(idims > 1 .and. neighbor_type(-1,0,igrid)==neighbor_boundary) ixbmin1=ixcogmin1
942 if(idims > 1 .and. neighbor_type( 1,0,igrid)==neighbor_boundary) ixbmax1=ixcogmax1}
944 if(idims > 1 .and. neighbor_type(-1,0,0,igrid)==neighbor_boundary) ixbmin1=ixcogmin1
945 if(idims > 1 .and. neighbor_type( 1,0,0,igrid)==neighbor_boundary) ixbmax1=ixcogmax1
946 if(idims > 2 .and. neighbor_type(0,-1,0,igrid)==neighbor_boundary) ixbmin2=ixcogmin2
947 if(idims > 2 .and. neighbor_type(0, 1,0,igrid)==neighbor_boundary) ixbmax2=ixcogmax2}
949 ixbmin^d=ixcogmin^d+nghostcells
950 ixbmax^d=ixcogmin^d+2*nghostcells-1
952 ixbmin^d=ixcogmax^d-2*nghostcells+1
953 ixbmax^d=ixcogmax^d-nghostcells
956 ii^d=kr(^d,idims)*(2*iside-3);
957 if ({abs(i^d)==1.and.abs(ii^d)==1|.or.}) cycle
958 if (neighbor_type(ii^d,igrid)/=neighbor_boundary) cycle
959 call bc_phys(iside,idims,time,0.d0,psc(igrid),
ixcog^
l,ixb^
l)
969 ipe_neighbor=neighbor(2,i^d,igrid)
970 if(ipe_neighbor/=mype)
then
971 ic^d=1+modulo(node(pig^d_,igrid)-1,2);
972 if({.not.(i^d==0.or.i^d==2*ic^d-3)|.or.})
return
973 ineighbor=neighbor(1,i^d,igrid)
974 ipole=neighbor_pole(i^d,igrid)
978 itag=(3**^nd+4**^nd)*(ineighbor-1)+3**^nd+{n_inc^d*4**(^d-1)+}
979 call mpi_isend(psc(igrid)%w,1,
type_send_r(iib^d,i^d), &
981 if(stagger_grid)
then
988 reshape(psc(igrid)%ws(ixs^s,idir),shapes)
993 mpi_double_precision,ipe_neighbor,itag, &
1001 n_inc^d=2*i^d+(3-ic^d)^d%n_inc^dd=-2*i^dd+ic^dd;\}
1003 if(isend_buf(ipwbuf)/=0)
then
1006 deallocate(pwbuf(ipwbuf)%w)
1008 allocate(pwbuf(ipwbuf)%w(ixs^s,nwhead:nwtail))
1012 itag=(3**^nd+4**^nd)*(ineighbor-1)+3**^nd+{n_inc^d*4**(^d-1)+}
1013 isizes={(ixsmax^d-ixsmin^d+1)*}*nwbc
1014 call mpi_isend(pwbuf(ipwbuf)%w,isizes,mpi_double_precision, &
1016 ipwbuf=1+modulo(ipwbuf,
npwbuf)
1017 if(stagger_grid)
then
1024 reshape(psc(igrid)%ws(ixs^s,idir),shapes)
1025 ibuf_start=ibuf_next
1029 mpi_double_precision,ipe_neighbor,itag, &
1040 integer,
intent(in) :: igrid,i^D,iib^D
1042 integer :: ic^D,n_inc^D,ixS^L,ixR^L,ipe_neighbor,ineighbor,ipole,idir
1044 ipe_neighbor=neighbor(2,i^d,igrid)
1045 if(ipe_neighbor==mype)
then
1046 ic^d=1+modulo(node(pig^d_,igrid)-1,2);
1047 if({.not.(i^d==0.or.i^d==2*ic^d-3)|.or.})
return
1048 ineighbor=neighbor(1,i^d,igrid)
1049 ipole=neighbor_pole(i^d,igrid)
1051 n_inc^d=-2*i^d+ic^d;
1052 ixs^l=
ixs_r_^l(iib^d,i^d);
1053 ixr^l=
ixr_r_^l(iib^d,n_inc^d);
1054 psb(ineighbor)%w(ixr^s,nwhead:nwtail)=&
1055 psc(igrid)%w(ixs^s,nwhead:nwtail)
1056 if(stagger_grid)
then
1060 psb(ineighbor)%ws(ixr^s,idir)=psc(igrid)%ws(ixs^s,idir)
1064 ixs^l=
ixs_r_^l(iib^d,i^d);
1067 n_inc^d=2*i^d+(3-ic^d)^d%n_inc^dd=-2*i^dd+ic^dd;\}
1069 ixr^l=
ixr_r_^l(iib^d,n_inc^d);
1070 call pole_copy(psb(ineighbor)%w,ixg^ll,ixr^l,psc(igrid)%w,
ixcog^l,ixs^l,ipole)
1071 if(stagger_grid)
then
1076 call pole_copy_stg(psb(ineighbor)%ws,ixgs^ll,ixr^l,psc(igrid)%ws,
ixcogs^l,ixs^l,idir,ipole)
1086 double precision :: tmp(ixGs^T)
1087 integer :: ixS^L,ixR^L,n_i^D,ixSsync^L,ixRsync^L
1090 ipe_neighbor=neighbor(2,i^d,igrid)
1091 if(ipe_neighbor/=mype)
then
1092 ineighbor=neighbor(1,i^d,igrid)
1093 ipole=neighbor_pole(i^d,igrid)
1105 psb(igrid)%ws(ixr^s,idir) = tmp(ixs^s)
1111 n_i^d=i^d^d%n_i^dd=-i^dd;\}
1119 shape=shape(psb(igrid)%ws(ixs^s,idir)))
1121 call pole_copy_stg(psb(igrid)%ws,ixgs^ll,ixr^l,pole_buf%ws,ixgs^ll,ixs^l,idir,ipole)
1129 integer,
intent(in) :: i^D,idir
1130 integer,
intent(inout) :: ixR^L,ixS^L
1131 integer,
intent(out) :: ixRsync^L,ixSsync^L
1137 if (i^d == -1 .and. idir == ^d)
then
1138 ixrsyncmin^d = ixrmax^d
1139 ixrsyncmax^d = ixrmax^d
1140 ixssyncmin^d = ixsmax^d
1141 ixssyncmax^d = ixsmax^d
1142 ixrmax^d = ixrmax^d - 1
1143 ixsmax^d = ixsmax^d - 1
1144 else if (i^d == 1 .and. idir == ^d)
then
1145 ixrsyncmin^d = ixrmin^d
1146 ixrsyncmax^d = ixrmin^d
1147 ixssyncmin^d = ixsmin^d
1148 ixssyncmax^d = ixsmin^d
1149 ixrmin^d = ixrmin^d + 1
1150 ixsmin^d = ixsmin^d + 1
1159 ipole=neighbor_pole(i^d,igrid)
1162 {
do ic^db=1+int((1-i^db)/2),2-int((1+i^db)/2)
1163 inc^db=2*i^db+ic^db\}
1164 ipe_neighbor=neighbor_child(2,inc^d,igrid)
1165 if(ipe_neighbor/=mype)
then
1166 ineighbor=neighbor_child(1,inc^d,igrid)
1173 shape=shape(psb(igrid)%ws(ixr^s,idir)))
1179 {
do ic^db=1+int((1-i^db)/2),2-int((1+i^db)/2)
1180 inc^db=2*i^db+ic^db\}
1181 ipe_neighbor=neighbor_child(2,inc^d,igrid)
1182 if(ipe_neighbor/=mype)
then
1183 ineighbor=neighbor_child(1,inc^d,igrid)
1186 n_i^d=i^d^d%n_i^dd=-i^dd;\}
1196 shape=shape(psb(igrid)%ws(ixr^s,idir)))
1197 call pole_copy_stg(psb(igrid)%ws,ixgs^ll,ixr^
l,pole_buf%ws,ixgs^ll,ixr^
l,idir,ipole)
1209 ic^d=1+modulo(node(pig^d_,igrid)-1,2);
1210 if ({.not.(i^d==0.or.i^d==2*ic^d-3)|.or.})
return
1212 ipe_neighbor=neighbor(2,i^d,igrid)
1213 if (ipe_neighbor/=mype)
then
1216 itag=(3**^nd+4**^nd)*(igrid-1)+3**^nd+{inc^d*4**(^d-1)+}
1217 call mpi_irecv(psc(igrid)%w,1,
type_recv_p(iib^d,inc^d), &
1219 if(stagger_grid)
then
1222 mpi_double_precision,ipe_neighbor,itag,&
1234 ipole=neighbor_pole(i^d,igrid)
1236 {
do ic^db=1+int((1-i^db)/2),2-int((1+i^db)/2)
1237 inc^db=2*i^db+ic^db\}
1238 ipe_neighbor=neighbor_child(2,inc^d,igrid)
1239 if(ipe_neighbor/=mype)
then
1241 ineighbor=neighbor_child(1,inc^d,igrid)
1246 itag=(3**^nd+4**^nd)*(ineighbor-1)+3**^nd+{n_inc^d*4**(^d-1)+}
1247 call mpi_isend(psb(igrid)%w,1,
type_send_p(iib^d,inc^d), &
1249 if(stagger_grid)
then
1256 reshape(psb(igrid)%ws(ixs^s,idir),shapes)
1257 ibuf_start=ibuf_next
1261 mpi_double_precision,ipe_neighbor,itag, &
1268 n_inc^d=inc^d^d%n_inc^dd=ic^dd-i^dd;\}
1270 if(isend_buf(ipwbuf)/=0)
then
1273 deallocate(pwbuf(ipwbuf)%w)
1275 allocate(pwbuf(ipwbuf)%w(ixs^s,nwhead:nwtail))
1276 call pole_buffer(pwbuf(ipwbuf)%w,ixs^
l,ixs^
l,psb(igrid)%w,ixg^ll,ixs^
l)
1279 itag=(3**^nd+4**^nd)*(ineighbor-1)+3**^nd+{n_inc^d*4**(^d-1)+}
1280 isizes={(ixsmax^d-ixsmin^d+1)*}*nwbc
1281 call mpi_isend(pwbuf(ipwbuf)%w,isizes,mpi_double_precision, &
1283 ipwbuf=1+modulo(ipwbuf,
npwbuf)
1284 if(stagger_grid)
then
1291 reshape(psb(igrid)%ws(ixs^s,idir),shapes)
1292 ibuf_start=ibuf_next
1296 mpi_double_precision,ipe_neighbor,itag, &
1308 integer,
intent(in) :: igrid,i^D,iib^D
1310 integer :: ipe_neighbor,ineighbor,ixS^L,ixR^L,ic^D,inc^D,ipole,idir
1312 ipole=neighbor_pole(i^d,igrid)
1315 {
do ic^db=1+int((1-i^db)/2),2-int((1+i^db)/2)
1316 inc^db=2*i^db+ic^db\}
1317 ipe_neighbor=neighbor_child(2,inc^d,igrid)
1318 if(ipe_neighbor==mype)
then
1319 ixs^l=
ixs_p_^l(iib^d,inc^d);
1320 ineighbor=neighbor_child(1,inc^d,igrid)
1321 ipole=neighbor_pole(i^d,igrid)
1324 ixr^l=
ixr_p_^l(iib^d,n_inc^d);
1325 psc(ineighbor)%w(ixr^s,nwhead:nwtail) &
1326 =psb(igrid)%w(ixs^s,nwhead:nwtail)
1327 if(stagger_grid)
then
1331 psc(ineighbor)%ws(ixr^s,idir)=psb(igrid)%ws(ixs^s,idir)
1337 {
do ic^db=1+int((1-i^db)/2),2-int((1+i^db)/2)
1338 inc^db=2*i^db+ic^db\}
1339 ipe_neighbor=neighbor_child(2,inc^d,igrid)
1340 if(ipe_neighbor==mype)
then
1342 ineighbor=neighbor_child(1,inc^d,igrid)
1343 ipole=neighbor_pole(i^d,igrid)
1346 n_inc^d=inc^d^d%n_inc^dd=ic^dd-i^dd;\}
1350 if(stagger_grid)
then
1363 integer,
intent(in) :: igrid
1365 integer :: iib^D,i^D,idims,iside
1366 logical,
dimension(-1:1^D&) :: NeedProlong
1368 ^d&iib^d=idphyb(^d,igrid);
1372 if (neighbor_type(i^d,igrid)==neighbor_coarse)
then
1374 needprolong(i^d)=.true.
1377 if(stagger_grid)
then
1388 if (needprolong(i^dd))
call bc_prolong_stg(igrid,i^dd,iib^dd,needprolong)
1399 if (needprolong(i^d))
call bc_prolong_stg(igrid,i^d,iib^d,needprolong)
1405 if (needprolong(i^d))
call bc_prolong_stg(igrid,i^d,iib^d,needprolong)
1411 if (needprolong(i^d))
call bc_prolong_stg(igrid,i^d,iib^d,needprolong)
1417 if (needprolong(i^d))
call bc_prolong_stg(igrid,i^d,iib^d,needprolong)
1424 ic^d=1+modulo(node(pig^d_,igrid)-1,2);
1425 if ({.not.(i^d==0.or.i^d==2*ic^d-3)|.or.})
return
1427 ipe_neighbor=neighbor(2,i^d,igrid)
1428 if(ipe_neighbor/=mype)
then
1429 ineighbor=neighbor(1,i^d,igrid)
1430 ipole=neighbor_pole(i^d,igrid)
1439 shape=shape(psc(igrid)%ws(ixr^s,idir)))
1446 n_inc^d=2*i^d+(3-ic^d)^d%n_inc^dd=-2*i^dd+ic^dd;\}
1454 shape=shape(psc(igrid)%ws(ixr^s,idir)))
1467 integer :: i^D,iib^D,igrid
1468 integer :: ixFi^L,ixCo^L,ii^D, idims,iside,ixB^L
1469 double precision :: dxFi^D, dxCo^D, xFimin^D, xComin^D, invdxCo^D
1472 dxfi^d=rnode(rpdx^d_,igrid);
1474 invdxco^d=1.d0/dxco^d;
1480 xfimin^d=rnode(rpxmin^d_,igrid)-dble(nghostcells)*dxfi^d;
1481 xcomin^d=rnode(rpxmin^d_,igrid)-dble(nghostcells)*dxco^d;
1483 if(stagger_grid.and.phyboundblock(igrid).and.
bcphys)
then
1486 ixcomin^d=int((xfimin^d+(dble(ixfimin^d)-half)*dxfi^d-xcomin^d)*invdxco^d)+1-1;
1487 ixcomax^d=int((xfimin^d+(dble(ixfimax^d)-half)*dxfi^d-xcomin^d)*invdxco^d)+1+1;
1491 if(neighbor_type(-1,0,0,igrid)==neighbor_boundary .or. &
1492 neighbor_type(1,0,0,igrid)==neighbor_boundary)
then
1493 if(neighbor_type(0,-1,0,igrid)==neighbor_boundary) ixcomin2=ixcommin2
1494 if(neighbor_type(0,0,-1,igrid)==neighbor_boundary) ixcomin3=ixcommin3
1495 if(neighbor_type(0,1,0,igrid)==neighbor_boundary) ixcomax2=ixcommax2
1496 if(neighbor_type(0,0,1,igrid)==neighbor_boundary) ixcomax3=ixcommax3
1498 else if(idims == 2)
then
1499 if(neighbor_type(0,-1,0,igrid)==neighbor_boundary .or. &
1500 neighbor_type(0,1,0,igrid)==neighbor_boundary)
then
1501 if(neighbor_type(0,0,-1,igrid)==neighbor_boundary) ixcomin3=ixcommin3
1502 if(neighbor_type(0,0,1,igrid)==neighbor_boundary) ixcomax3=ixcommax3
1507 ii^d=kr(^d,idims)*(2*iside-3);
1508 if(neighbor_type(ii^d,igrid)/=neighbor_boundary) cycle
1509 if(( {(iside==1.and.idims==^d.and.ixcomin^d<ixcogmin^d+nghostcells)|.or.} ) &
1510 .or.( {(iside==2.and.idims==^d.and.ixcomax^d>ixcogmax^d-nghostcells)|.or. }))
then
1511 {ixbmin^d=merge(ixcogmin^d,ixcomin^d,idims==^d);}
1512 {ixbmax^d=merge(ixcogmax^d,ixcomax^d,idims==^d);}
1513 call bc_phys(iside,idims,time,0.d0,psc(igrid),
ixcog^l,ixb^l)
1519 if(prolongprimitive)
then
1526 ixcomin^d=int((xfimin^d+(dble(ixfimin^d)-half)*dxfi^d-xcomin^d)*invdxco^d)+1-1;
1527 ixcomax^d=int((xfimin^d+(dble(ixfimax^d)-half)*dxfi^d-xcomin^d)*invdxco^d)+1+1;
1537 if(prolongprimitive)
then
1546 integer :: igrid,i^D,iib^D
1547 logical,
dimension(-1:1^D&) :: NeedProlong
1548 logical :: fine_^Lin
1549 integer :: ixFi^L,ixCo^L
1550 double precision :: dxFi^D,dxCo^D,xFimin^D,xComin^D,invdxCo^D
1554 if(i^d>-1) fine_min^din=(.not.needprolong(i^dd-kr(^d,^dd)).and.neighbor_type(i^dd-kr(^d,^dd),igrid)/=1)
1555 if(i^d<1) fine_max^din=(.not.needprolong(i^dd+kr(^d,^dd)).and.neighbor_type(i^dd+kr(^d,^dd),igrid)/=1)
1560 dxfi^d=rnode(rpdx^d_,igrid);
1562 invdxco^d=1.d0/dxco^d;
1564 xfimin^d=rnode(rpxmin^d_,igrid)-dble(nghostcells)*dxfi^d;
1565 xcomin^d=rnode(rpxmin^d_,igrid)-dble(nghostcells)*dxco^d;
1570 ixcomin^d=int((xfimin^d+(dble(ixfimin^d)-half)*dxfi^d-xcomin^d)*invdxco^d)+1-1;
1571 ixcomax^d=int((xfimin^d+(dble(ixfimax^d)-half)*dxfi^d-xcomin^d)*invdxco^d)+1+1;
1573 if(prolongprimitive)
call phys_to_primitive(ixg^ll,ixfi^l,psb(igrid)%w,psb(igrid)%x)
1575 call prolong_2nd_stg(psc(igrid),psb(igrid),ixco^l,ixfi^l,dxco^d,xcomin^d,dxfi^d,xfimin^d,.true.,fine_^lin)
1577 if(prolongprimitive)
call phys_to_conserved(ixg^ll,ixfi^l,psb(igrid)%w,psb(igrid)%x)
1580 needprolong(i^d)=.false.
1585 dxCo^D,invdxCo^D,xComin^D)
1587 integer,
intent(in) :: igrid, ixFi^L
1588 double precision,
intent(in) :: dxFi^D, xFimin^D,dxCo^D, invdxCo^D, xComin^D
1590 integer :: ixCo^D, jxCo^D, hxCo^D, ixFi^D, ix^D, iw, idims, nwmin,nwmax
1591 double precision :: xCo^D, xFi^D, eta^D
1592 double precision :: slopeL, slopeR, slopeC, signC, signR
1593 double precision :: slope(1:nw,ndim)
1595 double precision :: signedfactorhalf^D
1600 if(prolongprimitive)
then
1608 {
do ixfi^db = ixfi^lim^db
1611 xfi^db=xfimin^db+(dble(ixfi^db)-half)*dxfi^db
1616 ixco^db=int((xfi^db-xcomin^db)*invdxco^db)+1
1620 xco^db=xcomin^db+(dble(ixco^db)-half)*dxco^db \}
1626 if(slab_uniform)
then
1635 eta^d=(xfi^d-xco^d)*invdxco^d;
1669 ix^d=2*int((ixfi^d+ixmlo^d)/2)-ixmlo^d;
1670 {
if(xfi^d>xco^d)
then
1671 signedfactorhalf^d=0.5d0
1673 signedfactorhalf^d=-0.5d0
1675 eta^d=signedfactorhalf^d*(one-psb(igrid)%dvolume(ixfi^dd) &
1676 /sum(psb(igrid)%dvolume(ix^d:ix^d+1^d%ixFi^dd))) \}
1683 hxco^d=ixco^d-kr(^d,idims)\
1684 jxco^d=ixco^d+kr(^d,idims)\
1687 slopel=psc(igrid)%w(ixco^d,iw)-psc(igrid)%w(hxco^d,iw)
1688 sloper=psc(igrid)%w(jxco^d,iw)-psc(igrid)%w(ixco^d,iw)
1689 slopec=half*(sloper+slopel)
1692 signr=sign(one,sloper)
1693 signc=sign(one,slopec)
1711 slope(iw,idims)=signc*max(zero,min(dabs(slopec), &
1712 signc*slopel,signc*sloper))
1718 psb(igrid)%w(ixfi^d,nwmin:nwmax)=psc(igrid)%w(ixco^d,nwmin:nwmax)+&
1719 {(slope(nwmin:nwmax,^d)*eta^d)+}
1723 if(prolongprimitive)
then
1725 call phys_to_conserved(ixg^ll,ixfi^
l,psb(igrid)%w,psb(igrid)%x)
1731 dxCo^D,invdxCo^D,xComin^D)
1733 integer,
intent(in) :: igrid, ixFi^L
1734 double precision,
intent(in) :: dxFi^D, xFimin^D,dxCo^D, invdxCo^D, xComin^D
1736 integer :: ixCo^D, ixFi^D, nwmin,nwmax
1737 double precision :: xFi^D
1739 if(prolongprimitive)
then
1747 {
do ixfi^db = ixfi^lim^db
1749 xfi^db=xfimin^db+(dble(ixfi^db)-half)*dxfi^db
1753 ixco^db=int((xfi^db-xcomin^db)*invdxco^db)+1\}
1756 psb(igrid)%w(ixfi^d,nwmin:nwmax)=psc(igrid)%w(ixco^d,nwmin:nwmax)
1760 if(prolongprimitive)
call phys_to_conserved(ixg^ll,ixfi^
l,psb(igrid)%w,psb(igrid)%x)
1764 subroutine pole_copy(wrecv,ixIR^L,ixR^L,wsend,ixIS^L,ixS^L,ipole)
1766 integer,
intent(in) :: ixIR^L,ixR^L,ixIS^L,ixS^L,ipole
1767 double precision :: wrecv(ixIR^S,1:nw), wsend(ixIS^S,1:nw)
1769 integer :: iw, iside, iB
1773 iside=int((i^d+3)/2)
1776 select case (typeboundary(iw,ib))
1778 wrecv(ixr^s,iw) = wsend(ixsmax^d:ixsmin^d:-1^d%ixS^s,iw)
1780 wrecv(ixr^s,iw) =-wsend(ixsmax^d:ixsmin^d:-1^d%ixS^s,iw)
1782 call mpistop(
"Pole boundary condition should be symm or asymm")
1791 integer,
intent(in) :: ixIR^L,ixR^L,ixIS^L,ixS^L,idirs,ipole
1793 double precision :: wrecv(ixIR^S,1:nws), wsend(ixIS^S,1:nws)
1794 integer :: iB, iside
1798 iside=int((i^d+3)/2)
1800 select case (typeboundary(iw_mag(idirs),ib))
1802 wrecv(ixr^s,idirs) = wsend(ixsmax^d:ixsmin^d:-1^d%ixS^s,idirs)
1804 wrecv(ixr^s,idirs) =-wsend(ixsmax^d:ixsmin^d:-1^d%ixS^s,idirs)
1806 call mpistop(
"Pole boundary condition should be symm or asymm")
1815 integer,
intent(in) :: ixIR^L,ixR^L,ixIS^L,ixS^L
1816 double precision :: wrecv(ixIR^S,nwhead:nwtail), wsend(ixIS^S,1:nw)
1818 integer :: iw, iside, iB
1822 iside=int((i^d+3)/2)
1825 select case (typeboundary(iw,ib))
1827 wrecv(ixr^s,iw) = wsend(ixsmax^d:ixsmin^d:-1^d%ixS^s,iw)
1829 wrecv(ixr^s,iw) =-wsend(ixsmax^d:ixsmin^d:-1^d%ixS^s,iw)
1831 call mpistop(
"Pole boundary condition should be symm or asymm")
1838 end subroutine getbc
1844 integer,
intent(out) :: iib^D
1847 if(s%is_physical_boundary(2*^d) .and. &
1848 s%is_physical_boundary(2*^d-1))
then
1850 else if(s%is_physical_boundary(2*^d-1))
then
1852 else if(s%is_physical_boundary(2*^d))
then
subroutine bc_recv_restrict
Receive from fine neighbor.
subroutine gc_prolong(igrid)
subroutine interpolation_linear(igrid, ixFiL, dxFiD, xFiminD, dxCoD, invdxCoD, xCominD)
subroutine bc_prolong(igrid, iD, iibD)
do prolongation for fine blocks after receipt data from coarse neighbors
subroutine indices_for_syncing(idir, iD, ixRL, ixSL, ixRsyncL, ixSsyncL)
subroutine bc_fill_srl_stg
fill siblings ghost cells with received data
subroutine pole_copy(wrecv, ixIRL, ixRL, wsend, ixISL, ixSL, ipole)
subroutine bc_recv_prolong
Receive from coarse neighbor.
subroutine bc_fill_prolong(igrid, iD, iibD)
Send to finer neighbor.
subroutine bc_recv_srl
Receive from sibling at same refinement level.
subroutine bc_fill_restrict(igrid, iD, iibD)
fill coarser neighbor's ghost cells
subroutine fill_coarse_boundary(igrid, iD)
subroutine interpolation_copy(igrid, ixFiL, dxFiD, xFiminD, dxCoD, invdxCoD, xCominD)
subroutine pole_copy_stg(wrecv, ixIRL, ixRL, wsend, ixISL, ixSL, idirs, ipole)
subroutine bc_send_restrict
Send to coarser neighbor.
subroutine pole_buffer(wrecv, ixIRL, ixRL, wsend, ixISL, ixSL)
subroutine fill_boundary_before_gc(igrid)
Physical boundary conditions.
subroutine bc_fill_srl(igrid, iD, iibD)
subroutine bc_fill_restrict_stg
fill restricted ghost cells after receipt
subroutine bc_send_srl
Send to sibling at same refinement level.
subroutine fill_boundary_after_gc(igrid)
Physical boundary conditions.
logical function skip_direction(dir)
subroutine bc_send_prolong
Send to finer neighbor.
subroutine bc_fill_prolong_stg
fill coarser representative with data from coarser neighbors
subroutine bc_prolong_stg(igrid, iD, iibD, NeedProlong)
subroutine, public prolong_2nd_stg(sCo, sFi, ixCoLin, ixFiLin, dxCoD, xCominD, dxFiD, xFiminD, ghost, fine_Lin)
This subroutine performs a 2nd order prolongation for a staggered field F, preserving the divergence ...
subroutine, public getintbc(time, ixGL)
fill inner boundary values
subroutine, public bc_phys(iside, idims, time, qdt, s, ixGL, ixBL)
fill ghost cells at a physical boundary
subroutine, public coarsen_grid(sFi, ixFiGL, ixFiL, sCo, ixCoGL, ixCoL)
coarsen one grid to its coarser representative
subroutine, public mpistop(message)
Exit MPI-AMRVAC with an error message.
update ghost cells of all blocks including physical boundaries
integer, dimension(-1:2^d &,-1:1^d &), target type_recv_srl_f
integer, dimension(-1:1^d &) sizes_r_send_total
integer, dimension(-1:1^d &, 0:3^d &), target type_recv_p_p1
integer, dimension(-1:2^d &,-1:1^d &), target type_recv_srl_p2
integer, dimension(-1:1^d &,-1:1^d &), target type_send_r_p2
integer, dimension(^nd, 0:3) l
integer, dimension(:), allocatable sendrequest_c_p
integer, dimension(^nd,-1:1) ixs_r_stg_
integer, dimension(^nd,-1:1) ixs_srl_stg_
subroutine get_bc_comm_type(comm_type, ixL, ixGL, nwstart, nwbc)
integer, dimension(^nd, 0:3^d &) sizes_p_send_stg
integer, dimension(-1:1^d &) sizes_srl_send_total
integer, dimension(-1:1^d &, 0:3^d &), target type_send_p_p1
subroutine identifyphysbound(s, iibD)
integer, dimension(^nd, 0:3) ixr_r_stg_
integer, dimension(:), allocatable sendrequest_r
integer, dimension(-1:2^d &,-1:1^d &), target type_send_srl_p1
integer, dimension(:), allocatable recvrequest_r
double precision, dimension(:), allocatable sendbuffer_p
integer, dimension(:,:), allocatable sendstatus_c_p
integer, dimension(^nd,-1:1^d &) sizes_r_send_stg
integer, dimension(-1:1^d &, 0:3^d &), target type_send_p_f
integer, dimension(-1:2,-1:1) ixr_srl_
integer, dimension(:^d &,:^d &), pointer type_recv_srl
integer, dimension(:,:), allocatable sendstatus_c_sr
integer, dimension(-1:1^d &, 0:3^d &), target type_recv_r_p2
double precision, dimension(:), allocatable recvbuffer_r
integer, dimension(:), allocatable recvrequest_c_p
subroutine create_bc_mpi_datatype(nwstart, nwbc)
integer, dimension(:), allocatable recvrequest_c_sr
integer, dimension(-1:2^d &,-1:1^d &), target type_recv_srl_p1
integer, dimension(:), allocatable sendrequest_c_sr
integer, dimension(-1:2^d &,-1:1^d &), target type_send_srl_p2
integer, dimension(-1:2,-1:1) ixs_srl_
double precision, dimension(:), allocatable recvbuffer_srl
integer, dimension(:^d &,:^d &), pointer type_send_srl
integer, dimension(:,:), allocatable recvstatus_p
integer, dimension(^nd, 0:3) ixs_p_stg_
integer, dimension(^nd, 0:3^d &) sizes_p_recv_stg
integer, dimension(-1:1^d &, 0:3^d &), target type_recv_p_p2
integer, dimension(-1:1^d &, 0:3^d &), target type_recv_r_f
integer, dimension(:^d &,:^d &), pointer type_recv_r
integer, dimension(:^d &,:^d &), pointer type_send_r
integer, dimension(^nd,-1:1^d &) sizes_srl_recv_stg
double precision, dimension(:), allocatable recvbuffer_p
integer, dimension(^nd,-1:1) ixr_srl_stg_
integer, dimension(-1:1^d &, 0:3^d &), target type_recv_r_p1
double precision, dimension(:), allocatable sendbuffer_r
integer, dimension(-1:1^d &, 0:3^d &), target type_recv_p_f
integer, dimension(-1:1, 0:3) ixr_p_
integer, dimension(-1:1, 0:3) ixr_r_
integer, dimension(0:3^d &) sizes_p_recv_total
integer, dimension(:,:), allocatable recvstatus_c_sr
integer, dimension(0:3^d &) sizes_r_recv_total
integer, parameter npwbuf
integer, dimension(-1:1, 0:3) ixs_p_
integer, dimension(:), allocatable sendrequest_p
integer, dimension(^nd, 0:3^d &) sizes_r_recv_stg
subroutine getbc(time, qdt, psb, nwstart, nwbc, req_diag)
do update ghost cells of all blocks including physical boundaries
subroutine put_bc_comm_types()
double precision, dimension(:), allocatable sendbuffer_srl
integer, dimension(-1:1^d &, 0:3^d &), target type_send_p_p2
integer, dimension(:,:), allocatable sendstatus_srl
integer, dimension(:,:), allocatable recvstatus_srl
integer, dimension(:), allocatable sendrequest_srl
integer, dimension(-1:2^d &,-1:1^d &), target type_send_srl_f
integer, dimension(:,:), allocatable recvstatus_r
integer, dimension(-1:1,-1:1) ixs_r_
integer, dimension(-1:1^d &,-1:1^d &), target type_send_r_p1
integer, dimension(0:3^d &) sizes_p_send_total
integer, dimension(:^d &,:^d &), pointer type_recv_p
integer, dimension(^nd, 0:3) ixr_p_stg_
integer, dimension(:^d &,:^d &), pointer type_send_p
integer, dimension(:,:), allocatable sendstatus_r
integer, dimension(:,:), allocatable sendstatus_p
integer, dimension(-1:1^d &) sizes_srl_recv_total
integer, dimension(-1:1^d &,-1:1^d &), target type_send_r_f
integer, dimension(:), allocatable recvrequest_p
integer, dimension(:), allocatable recvrequest_srl
integer, dimension(^nd,-1:1^d &) sizes_srl_send_stg
integer, dimension(:,:), allocatable recvstatus_c_p
This module contains definitions of global parameters and variables and some generic functions/subrou...
logical internalboundary
if there is an internal boundary
integer ixghi
Upper index of grid block arrays.
integer, dimension(3, 3) kr
Kronecker delta tensor.
integer, parameter ndim
Number of spatial dimensions for grid variables.
logical stagger_grid
True for using stagger grid.
logical, dimension(:), allocatable phyboundblock
True if a block has any physical boundary.
integer, dimension(:), allocatable, parameter d
logical ghost_copy
whether copy values instead of interpolation in ghost cells of finer blocks
integer ierrmpi
A global MPI error return code.
integer nghostcells
Number of ghost cells surrounding a grid.
This module defines the procedures of a physics module. It contains function pointers for the various...
procedure(sub_convert), pointer phys_to_primitive
logical phys_req_diagonal
Whether the physics routines require diagonal ghost cells, for example for computing a curl.
procedure(sub_convert), pointer phys_to_conserved
character(len=name_len) physics_type
String describing the physics type of the simulation.