101 CALL boundary%InitBoundary(mesh,physics,config,io)
110 TYPE(
dict_typ),
POINTER :: config,io
111 INTEGER :: western, eastern, southern, northern, bottomer, topper
114 INTEGER :: western_std, eastern_std, northern_std, southern_std, &
115 topper_std, bottomer_std
116 LOGICAL,
DIMENSION(3) :: periods = .false.
119 IF (.NOT.physics%Initialized().OR..NOT.mesh%Initialized()) &
120 CALL this%Error(
"InitBoundary",
"physics and/or mesh module uninitialized")
129 IF (mesh%shear_dir.EQ.1)
THEN
136 ELSE IF (mesh%shear_dir.EQ.2)
THEN
145 CALL getattr(config,
"western", western, western_std)
146 CALL getattr(config,
"eastern", eastern, eastern_std)
147 CALL getattr(config,
"southern", southern, northern_std)
148 CALL getattr(config,
"northern", northern, southern_std)
149 CALL getattr(config,
"bottomer", bottomer, bottomer_std)
150 CALL getattr(config,
"topper", topper, topper_std)
154 new(
south) = southern
155 new(
north) = northern
161 IF (mesh%mycoords(1).NE.0) new(
west) =
none
162 IF (mesh%mycoords(1).NE.mesh%dims(1)-1) new(
east) =
none
163 IF (mesh%mycoords(2).NE.0) new(
south) =
none
164 IF (mesh%mycoords(2).NE.mesh%dims(2)-1) new(
north) =
none
166 IF (mesh%mycoords(3).NE.mesh%dims(3)-1) new(
top) =
none
171 IF (.NOT.mesh%shear_dir.EQ.2) &
172 CALL this%Error(
"InitBoundary", &
173 "Please apply shifting in second dimension, when applying shearing boundaries at western/eastern.")
175 CALL this%Error(
"InitBoundary", &
176 "Parallel mode is not allowed with shearing in West-East direction.")
179 IF (.NOT.mesh%shear_dir.EQ.1) &
180 CALL this%Error(
"InitBoundary", &
181 "Please apply shifting in first dimension, when applying shearing boundaries at northern/southern.")
183 CALL this%Error(
"InitBoundary", &
184 "shifting in topper/bottomer direction not allowed.")
190 SELECT CASE(new(dir))
216 CALL this%Error(
"boundary_generic::InitBoundary",
"unknown boundary condition")
219 SELECT TYPE(obj =>
this%Boundary(dir)%p)
221 CALL obj%InitBoundary_absorbing(mesh,physics,dir,config)
223 CALL obj%InitBoundary_axis(mesh,physics,dir,config)
225 CALL obj%InitBoundary_custom(mesh,physics,dir,config)
227 CALL obj%InitBoundary_farfield(mesh,physics,dir,config)
229 CALL obj%InitBoundary_fixed(mesh,physics,dir,config)
231 CALL obj%InitBoundary_nogradients(mesh,physics,dir,config)
233 CALL obj%InitBoundary_noslip(mesh,physics,dir,config)
235 CALL obj%InitBoundary_periodic(mesh,physics,dir,config)
237 CALL obj%InitBoundary_reflecting(mesh,physics,dir,config)
239 CALL obj%InitBoundary_shearing(mesh,physics,dir,config)
242 CALL obj%InitBoundary_inner(mesh,physics,dir,config)
252 CALL this%boundary(
west)%p%Error(
"InitBoundary", &
253 "Opposite boundary should be periodic.")
255 CALL this%boundary(
west)%p%Error(
"InitBoundary", &
256 "Opposite boundary should be shearing.")
262 CALL this%boundary(
south)%p%Error(
"InitBoundary", &
263 "Opposite boundary should be periodic.")
265 CALL this%boundary(
south)%p%Error(
"InitBoundary", &
266 "Opposite boundary should be shearing.")
272 CALL this%boundary(
bottom)%p%Error(
"InitBoundary", &
273 "Opposite boundary should be periodic.")
275 CALL this%boundary(
bottom)%p%Error(
"InitBoundary", &
276 "Opposite boundary should be shearing.")
280 CALL this%InitBoundary_MPI(mesh,physics,periods)
295 REAL,
INTENT(IN) :: time
298 CALL physics%Convert2Primitive(mesh%IMIN,mesh%IMAX,mesh%JMIN, &
299 mesh%JMAX,mesh%KMIN,mesh%KMAX,cvar,pvar)
300 SELECT TYPE(c => cvar)
302 SELECT TYPE(p => pvar)
304 p%fargo_transformation_applied = c%fargo_transformation_applied
310 IF (mesh%INUM.GT.1)
THEN
311 CALL this%Boundary(
west)%p%SetBoundaryData(mesh,physics,time,pvar)
312 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
313 "western boundary condition failed")
314 CALL this%Boundary(
east)%p%SetBoundaryData(mesh,physics,time,pvar)
315 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
316 "eastern boundary condition failed")
327 SELECT TYPE(bound1 =>
this%Boundary(
south)%p)
332 IF (mesh%JNUM.GT.1)
THEN
333 CALL this%Boundary(
south)%p%SetBoundaryData(mesh,physics,time,pvar)
334 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
335 "southern boundary condition failed")
339 SELECT TYPE(bound2 =>
this%Boundary(
north)%p)
344 IF (mesh%JNUM.GT.1)
THEN
345 CALL this%Boundary(
north)%p%SetBoundaryData(mesh,physics,time,pvar)
346 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
347 "northern boundary condition failed")
351 IF (mesh%JNUM.GT.1)
THEN
352 CALL this%Boundary(
south)%p%SetBoundaryData(mesh,physics,time,pvar)
353 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
354 "southern boundary condition failed")
355 CALL this%Boundary(
north)%p%SetBoundaryData(mesh,physics,time,pvar)
356 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
357 "northern boundary condition failed")
362 IF (mesh%KNUM.GT.1)
THEN
363 CALL this%Boundary(
bottom)%p%SetBoundaryData(mesh,physics,time,pvar)
364 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
365 "bottom boundary condition failed")
366 CALL this%Boundary(
top)%p%SetBoundaryData(mesh,physics,time,pvar)
367 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
368 "top boundary condition failed")
379 SELECT TYPE(bound1 =>
this%Boundary(
south)%p)
381 IF (mesh%JNUM.GT.1)
THEN
382 CALL this%Boundary(
south)%p%SetBoundaryData(mesh,physics,time,pvar)
387 SELECT TYPE(bound2 =>
this%Boundary(
north)%p)
389 IF (mesh%JNUM.GT.1)
THEN
390 CALL this%Boundary(
north)%p%SetBoundaryData(mesh,physics,time,pvar)
400 IF (mesh%INUM.GT.1)
THEN
401 CALL physics%Convert2Conservative(mesh%IGMIN,mesh%IMIN-mesh%IP1, &
402 mesh%JGMIN,mesh%JGMAX,mesh%KGMIN,mesh%KGMAX,pvar,cvar)
403 CALL physics%Convert2Conservative(mesh%IMAX+mesh%IP1,mesh%IGMAX, &
404 mesh%JGMIN,mesh%JGMAX,mesh%KGMIN,mesh%KGMAX,pvar,cvar)
406 IF (mesh%JNUM.GT.1)
THEN
407 CALL physics%Convert2Conservative(mesh%IMIN,mesh%IMAX, &
408 mesh%JGMIN,mesh%JMIN-mesh%JP1,mesh%KGMIN,mesh%KGMAX,pvar,cvar)
409 CALL physics%Convert2Conservative(mesh%IMIN,mesh%IMAX, &
410 mesh%JMAX+mesh%JP1,mesh%JGMAX,mesh%KGMIN,mesh%KGMAX,pvar,cvar)
412 IF (mesh%KNUM.GT.1)
THEN
413 CALL physics%Convert2Conservative(mesh%IMIN,mesh%IMAX, &
414 mesh%JMIN,mesh%JMAX,mesh%KGMIN,mesh%KMIN-mesh%KP1,pvar,cvar)
415 CALL physics%Convert2Conservative(mesh%IMIN,mesh%IMAX, &
416 mesh%JMIN,mesh%JMAX,mesh%KMAX+mesh%KP1,mesh%KGMAX,pvar,cvar)
440 REAL,
DIMENSION(Mesh%IGMIN:Mesh%IGMAX,Mesh%JGMIN:Mesh%JGMAX,Mesh%KGMIN:Mesh%KGMAX,Physics%VNUM), &
441 INTENT(INOUT) :: pvar
445 IF ((mesh%INUM.NE.1.AND.mesh%JNUM.NE.1.AND.mesh%KNUM.EQ.1).OR. &
446 (mesh%INUM.NE.1.AND.mesh%JNUM.NE.1.AND.mesh%KNUM.NE.1))
THEN
450 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(2).EQ.0)
THEN
456 pvar(mesh%IMIN-i,mesh%JMIN-j,:,:) = pvar(mesh%IMIN-i,mesh%JMIN-j+1,:,:)
457 pvar(mesh%IMIN-j,mesh%JMIN-i,:,:) = pvar(mesh%IMIN-j+1,mesh%JMIN-i,:,:)
459 pvar(mesh%IMIN-j,mesh%JMIN-j,:,:) = 0.5 * (pvar(mesh%IMIN-j,mesh%JMIN,:,:) &
460 + pvar(mesh%IMIN,mesh%JMIN-j,:,:))
467 IF(mesh%mycoords(1).EQ.mesh%dims(1)-1.AND.mesh%mycoords(2).EQ.0)
THEN
473 pvar(mesh%IMAX+i,mesh%JMIN-j,:,:) = pvar(mesh%IMAX+i,mesh%JMIN-j+1,:,:)
474 pvar(mesh%IMAX+j,mesh%JMIN-i,:,:) = pvar(mesh%IMAX+j-1,mesh%JMIN-i,:,:)
476 pvar(mesh%IMAX+j,mesh%JMIN-j,:,:) = 0.5 * (pvar(mesh%IMAX+j,mesh%JMIN,:,:) &
477 + pvar(mesh%IMAX,mesh%JMIN-j,:,:))
484 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(2).EQ.mesh%dims(2)-1)
THEN
490 pvar(mesh%IMIN-i,mesh%JMAX+j,:,:) = pvar(mesh%IMIN-i,mesh%JMAX+j-1,:,:)
491 pvar(mesh%IMIN-j,mesh%JMAX+i,:,:) = pvar(mesh%IMIN-j+1,mesh%JMAX+i,:,:)
493 pvar(mesh%IMIN-j,mesh%JMAX+j,:,:) = 0.5 * (pvar(mesh%IMIN-j,mesh%JMAX,:,:) &
494 + pvar(mesh%IMIN,mesh%JMAX+j,:,:))
502 IF(mesh%mycoords(1).EQ.mesh%dims(1)-1.AND.mesh%mycoords(2).EQ.mesh%dims(2)-1)
THEN
508 pvar(mesh%IMAX+i,mesh%JMAX+j,:,:) = pvar(mesh%IMAX+i,mesh%JMAX+j-1,:,:)
509 pvar(mesh%IMAX+j,mesh%JMAX+i,:,:) = pvar(mesh%IMAX+j-1,mesh%JMAX+i,:,:)
511 pvar(mesh%IMAX+j,mesh%JMAX+j,:,:) = 0.5 * (pvar(mesh%IMAX+j,mesh%JMAX,:,:) &
512 + pvar(mesh%IMAX,mesh%JMAX+j,:,:))
519 IF ((mesh%INUM.NE.1.AND.mesh%JNUM.EQ.1.AND.mesh%KNUM.NE.1).OR. &
520 (mesh%INUM.NE.1.AND.mesh%JNUM.NE.1.AND.mesh%KNUM.NE.1))
THEN
524 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(3).EQ.0)
THEN
530 pvar(mesh%IMIN-i,:,mesh%KMIN-k,:) = pvar(mesh%IMIN-i+1,:,mesh%KMIN-k,:)
531 pvar(mesh%IMIN-k,:,mesh%KMIN-i,:) = pvar(mesh%IMIN-k,:,mesh%KMIN-i+1,:)
533 pvar(mesh%IMIN-i,:,mesh%KMIN-i,:) = 0.5 * (pvar(mesh%IMIN-i,:,mesh%KMIN,:) &
534 + pvar(mesh%IMIN,:,mesh%KMIN-i,:))
541 IF(mesh%mycoords(1).EQ.mesh%dims(1)-1.AND.mesh%mycoords(3).EQ.0)
THEN
547 pvar(mesh%IMAX+i,:,mesh%KMIN-k,:) = pvar(mesh%IMAX+i-1,:,mesh%KMIN-k,:)
548 pvar(mesh%IMAX+k,:,mesh%KMIN-i,:) = pvar(mesh%IMAX+k,:,mesh%KMIN-i+1,:)
550 pvar(mesh%IMAX+i,:,mesh%KMIN-i,:) = 0.5 * (pvar(mesh%IMAX,:,mesh%KMIN-i,:) &
551 + pvar(mesh%IMAX+i,:,mesh%KMIN,:))
559 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(3).EQ.mesh%dims(3)-1)
THEN
565 pvar(mesh%IMIN-i,:,mesh%KMAX+k,:) = pvar(mesh%IMIN-i+1,:,mesh%KMAX+k,:)
566 pvar(mesh%IMIN-k,:,mesh%KMAX+i,:) = pvar(mesh%IMIN-k,:,mesh%KMAX+i-1,:)
568 pvar(mesh%IMIN-i,:,mesh%KMAX+i,:) = 0.5 * (pvar(mesh%IMIN,:,mesh%KMAX+i,:) &
569 + pvar(mesh%IMIN-i,:,mesh%KMAX,:))
577 IF(mesh%mycoords(1).EQ.mesh%dims(1)-1.AND.mesh%mycoords(3).EQ.mesh%dims(3)-1)
THEN
583 pvar(mesh%IMAX+i,:,mesh%KMAX+k,:) = pvar(mesh%IMAX+i-1,:,mesh%KMAX+k,:)
584 pvar(mesh%IMAX+k,:,mesh%KMAX+i,:) = pvar(mesh%IMAX+k,:,mesh%KMAX+i-1,:)
586 pvar(mesh%IMAX+i,:,mesh%KMAX+i,:) = 0.5 * (pvar(mesh%IMAX,:,mesh%KMAX+i,:) &
587 + pvar(mesh%IMAX+i,:,mesh%KMAX,:))
594 IF ((mesh%INUM.EQ.1.AND.mesh%JNUM.NE.1.AND.mesh%KNUM.NE.1).OR. &
595 (mesh%INUM.NE.1.AND.mesh%JNUM.NE.1.AND.mesh%KNUM.NE.1))
THEN
599 IF(mesh%mycoords(2).EQ.0.AND.mesh%mycoords(3).EQ.0)
THEN
605 pvar(:,mesh%JMIN-j,mesh%KMIN-k,:) = pvar(:,mesh%JMIN-j+1,mesh%KMIN-k,:)
606 pvar(:,mesh%JMIN-k,mesh%KMIN-j,:) = pvar(:,mesh%JMIN-k,mesh%KMIN-j+1,:)
608 pvar(:,mesh%JMIN-j,mesh%KMIN-j,:) = 0.5 * (pvar(:,mesh%JMIN,mesh%KMIN-j,:) &
609 + pvar(:,mesh%JMIN-j,mesh%KMIN,:))
617 IF(mesh%mycoords(2).EQ.mesh%dims(2)-1.AND.mesh%mycoords(3).EQ.0)
THEN
623 pvar(:,mesh%JMAX+j,mesh%KMIN-k,:) = pvar(:,mesh%JMAX+j-1,mesh%KMIN-k,:)
624 pvar(:,mesh%JMAX+k,mesh%KMIN-j,:) = pvar(:,mesh%JMAX+k,mesh%KMIN-j+1,:)
627 pvar(:,mesh%JMAX+j,mesh%KMIN-j,:) = 0.5 * (pvar(:,mesh%JMAX,mesh%KMIN-j,:) &
628 + pvar(:,mesh%JMAX+j,mesh%KMIN,:))
636 IF(mesh%mycoords(2).EQ.0.AND.mesh%mycoords(3).EQ.mesh%dims(3)-1)
THEN
642 pvar(:,mesh%JMIN-j,mesh%KMAX+k,:) = pvar(:,mesh%JMIN-j+1,mesh%KMAX+k,:)
643 pvar(:,mesh%JMIN-k,mesh%KMAX+j,:) = pvar(:,mesh%JMIN-k,mesh%KMAX+j-1,:)
645 pvar(:,mesh%JMIN-j,mesh%KMAX+j,:) = 0.5 * (pvar(:,mesh%JMIN,mesh%KMAX+j,:) &
646 + pvar(:,mesh%JMIN-j,mesh%KMAX,:))
654 IF(mesh%mycoords(2).EQ.mesh%dims(2)-1.AND.mesh%mycoords(3).EQ.mesh%dims(3)-1)
THEN
660 pvar(:,mesh%JMAX+j,mesh%KMAX+k,:) = pvar(:,mesh%JMAX+j-1,mesh%KMAX+k,:)
661 pvar(:,mesh%JMAX+k,mesh%KMAX+j,:) = pvar(:,mesh%JMAX+k,mesh%KMAX+j-1,:)
663 pvar(:,mesh%JMAX+j,mesh%KMAX+j,:) = 0.5 * (pvar(:,mesh%JMAX,mesh%KMAX+j,:) &
664 + pvar(:,mesh%JMAX+j,mesh%KMAX,:))
672 IF (mesh%INUM.NE.1.AND.mesh%JNUM.NE.1.AND.mesh%KNUM.NE.1)
THEN
674 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(2).EQ.0.AND.mesh%mycoords(3).EQ.0)
THEN
678 pvar(mesh%IMIN-i,mesh%JMIN-i,mesh%KMIN-i,:) = (pvar(mesh%IMIN-i,mesh%JMIN,mesh%KMIN,:) &
679 + pvar(mesh%IMIN,mesh%JMIN-i,mesh%KMIN,:) + pvar(mesh%IMIN,mesh%JMIN,mesh%KMIN-i,:))/3.0
685 IF(mesh%mycoords(1).EQ.mesh%dims(1)-1.AND.mesh%mycoords(2).EQ.0.AND.mesh%mycoords(3).EQ.0)
THEN
689 pvar(mesh%IMAX+i,mesh%JMIN-i,mesh%KMIN-i,:) = (pvar(mesh%IMAX+i,mesh%JMIN,mesh%KMIN,:) &
690 + pvar(mesh%IMAX,mesh%JMIN-i,mesh%KMIN,:) + pvar(mesh%IMAX,mesh%JMIN,mesh%KMIN-i,:))/3.0
696 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(2).EQ.mesh%dims(2)-1.AND.mesh%mycoords(3).EQ.0)
THEN
700 pvar(mesh%IMIN-i,mesh%JMAX+i,mesh%KMIN-i,:) = (pvar(mesh%IMIN-i,mesh%JMAX,mesh%KMIN,:) &
701 + pvar(mesh%IMIN,mesh%JMAX+i,mesh%KMIN,:) + pvar(mesh%IMIN,mesh%JMAX,mesh%KMIN-i,:))/3.0
707 IF(mesh%mycoords(1).EQ.mesh%dims(1)-1.AND.mesh%mycoords(2).EQ.mesh%dims(2)-1.AND.mesh%mycoords(3).EQ.0)
THEN
711 pvar(mesh%IMAX+i,mesh%JMAX+i,mesh%KMIN-i,:) = (pvar(mesh%IMAX+i,mesh%JMAX,mesh%KMIN,:) &
712 + pvar(mesh%IMAX,mesh%JMAX+i,mesh%KMIN,:) + pvar(mesh%IMAX,mesh%JMAX,mesh%KMIN-i,:))/3.0
718 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(2).EQ.0.AND.mesh%mycoords(3).EQ.mesh%dims(3)-1)
THEN
722 pvar(mesh%IMIN-i,mesh%JMIN-i,mesh%KMAX+i,:) = (pvar(mesh%IMIN-i,mesh%JMIN,mesh%KMAX,:) &
723 + pvar(mesh%IMIN,mesh%JMIN-i,mesh%KMAX,:) + pvar(mesh%IMIN,mesh%JMIN,mesh%KMAX+i,:))/3.0
729 IF(mesh%mycoords(1).EQ.mesh%dims(1)-1.AND.mesh%mycoords(2).EQ.0.AND.mesh%mycoords(3).EQ.mesh%dims(3)-1)
THEN
733 pvar(mesh%IMAX+i,mesh%JMIN-i,mesh%KMAX+i,:) = (pvar(mesh%IMAX+i,mesh%JMIN,mesh%KMAX,:) &
734 + pvar(mesh%IMAX,mesh%JMIN-i,mesh%KMAX,:) + pvar(mesh%IMAX,mesh%JMIN,mesh%KMAX+i,:))/3.0
740 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(2).EQ.mesh%dims(2)-1.AND.mesh%mycoords(3).EQ.mesh%dims(3)-1)
THEN
744 pvar(mesh%IMIN-i,mesh%JMAX+i,mesh%KMAX+i,:) = (pvar(mesh%IMIN-i,mesh%JMAX,mesh%KMAX,:) &
745 + pvar(mesh%IMIN,mesh%JMAX+i,mesh%KMAX,:) + pvar(mesh%IMIN,mesh%JMAX,mesh%KMAX+i,:))/3.0
751 IF(mesh%mycoords(1).EQ.mesh%dims(1)-1.AND.mesh%mycoords(2).EQ.mesh%dims(2)-1.AND.mesh%mycoords(3).EQ.mesh%dims(3)-1)
THEN
755 pvar(mesh%IMAX+i,mesh%JMAX+i,mesh%KMAX+i,:) = (pvar(mesh%IMAX+i,mesh%JMAX,mesh%KMAX,:) &
756 + pvar(mesh%IMAX,mesh%JMAX+i,mesh%KMAX,:) + pvar(mesh%IMAX,mesh%JMAX,mesh%KMAX+i,:))/3.0
780 LOGICAL,
DIMENSION(3),
INTENT(IN) :: periods
784 LOGICAL,
DIMENSION(SIZE(Mesh%dims)) :: remain_dims = .false.
789 comm_old = mesh%comm_cart
790 CALL mpi_cart_create(comm_old,
SIZE(mesh%dims),mesh%dims,periods,.false.,mesh%comm_cart,ierr)
793 CALL mpi_cart_shift(mesh%comm_cart,0,1,mesh%neighbor(
west),mesh%neighbor(
east),ierr)
794 CALL mpi_cart_shift(mesh%comm_cart,1,1,mesh%neighbor(
south),mesh%neighbor(
north),ierr)
795 CALL mpi_cart_shift(mesh%comm_cart,2,1,mesh%neighbor(
bottom),mesh%neighbor(
top),ierr)
799 remain_dims = (/ .false., .true., .true. /)
800 CALL mpi_cart_sub(mesh%comm_cart,remain_dims,mesh%Icomm,ierr)
801 remain_dims = (/ .true., .false., .true. /)
802 CALL mpi_cart_sub(mesh%comm_cart,remain_dims,mesh%Jcomm,ierr)
803 remain_dims = (/ .true., .true., .false. /)
804 CALL mpi_cart_sub(mesh%comm_cart,remain_dims,mesh%Kcomm,ierr)
808 this%boundary(
west)%p%sendbuf(mesh%GINUM,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
809 this%boundary(
west)%p%recvbuf(mesh%GINUM,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
810 this%boundary(
east)%p%sendbuf(mesh%GINUM,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
811 this%boundary(
east)%p%recvbuf(mesh%GINUM,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
812 this%boundary(
south)%p%sendbuf(mesh%IGMIN:mesh%IGMAX,mesh%GJNUM,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
813 this%boundary(
south)%p%recvbuf(mesh%IGMIN:mesh%IGMAX,mesh%GJNUM,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
814 this%boundary(
north)%p%sendbuf(mesh%IGMIN:mesh%IGMAX,mesh%GJNUM,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
815 this%boundary(
north)%p%recvbuf(mesh%IGMIN:mesh%IGMAX,mesh%GJNUM,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
816 this%boundary(
bottom)%p%sendbuf(mesh%IGMIN:mesh%IGMAX,mesh%JGMIN:mesh%JGMAX,mesh%GKNUM,physics%VNUM), &
817 this%boundary(
bottom)%p%recvbuf(mesh%IGMIN:mesh%IGMAX,mesh%JGMIN:mesh%JGMAX,mesh%GKNUM,physics%VNUM), &
818 this%boundary(
top)%p%sendbuf(mesh%IGMIN:mesh%IGMAX,mesh%JGMIN:mesh%JGMAX,mesh%GKNUM,physics%VNUM), &
819 this%boundary(
top)%p%recvbuf(mesh%IGMIN:mesh%IGMAX,mesh%JGMIN:mesh%JGMAX,mesh%GKNUM,physics%VNUM), &
822 CALL this%boundary(
west)%p%Error(
"boundary_generic::InitBoundary_MPI", &
823 "Unable to allocate memory for data buffers.")
828 this%boundary(dir)%p%recvbuf = 0.
829 this%boundary(dir)%p%sendbuf = 0.
846 REAL,
DIMENSION(Mesh%IGMIN:Mesh%IGMAX,Mesh%JGMIN:Mesh%JGMAX,Mesh%KGMIN:Mesh%KGMAX,Physics%VNUM), &
847 INTENT(INOUT) :: pvar
851#ifdef MPI_USE_SENDRECV
852 INTEGER :: status(MPI_STATUS_SIZE)
854 INTEGER :: status(MPI_STATUS_SIZE,4)
864#ifndef MPI_USE_SENDRECV
866 CALL mpi_irecv(this%Boundary(
east)%p%recvbuf, &
867 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
871 IF (mesh%neighbor(
west).NE.mpi_proc_null) &
872 CALL this%MPIpvar2buffer(mesh,physics,
west,pvar,this%Boundary(
west)%p%sendbuf)
873#ifdef MPI_USE_SENDRECV
875 CALL mpi_sendrecv(this%Boundary(
west)%p%sendbuf, &
876 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
878 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
882 CALL mpi_issend(this%Boundary(
west)%p%sendbuf, &
883 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
887 CALL mpi_irecv(this%Boundary(
west)%p%recvbuf, &
888 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
892 IF (mesh%neighbor(
east).NE.mpi_proc_null) &
893 CALL this%MPIpvar2buffer(mesh,physics,
east,pvar,this%Boundary(
east)%p%sendbuf)
894#ifdef MPI_USE_SENDRECV
896 CALL mpi_sendrecv(this%Boundary(
east)%p%sendbuf, &
897 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
899 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
903 CALL mpi_issend(this%Boundary(
east)%p%sendbuf, &
904 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
907 CALL mpi_waitall(4,req,status,ierr)
910 IF (mesh%neighbor(
west).NE.mpi_proc_null) &
911 CALL this%MPIbuffer2pvar(mesh,physics,
west,this%Boundary(
west)%p%recvbuf,pvar)
912 IF (mesh%neighbor(
east).NE.mpi_proc_null) &
913 CALL this%MPIbuffer2pvar(mesh,physics,
east,this%Boundary(
east)%p%recvbuf,pvar)
916#ifndef MPI_USE_SENDRECV
918 CALL mpi_irecv(this%Boundary(
north)%p%recvbuf, &
919 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
923 IF (mesh%neighbor(
south).NE.mpi_proc_null) &
924 CALL this%MPIpvar2buffer(mesh,physics,
south,pvar,this%Boundary(
south)%p%sendbuf)
925#ifdef MPI_USE_SENDRECV
927 CALL mpi_sendrecv(this%Boundary(
south)%p%sendbuf, &
928 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
930 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
934 CALL mpi_issend(this%Boundary(
south)%p%sendbuf, &
935 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
939 CALL mpi_irecv(this%Boundary(
south)%p%recvbuf, &
940 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
944 IF (mesh%neighbor(
north).NE.mpi_proc_null) &
945 CALL this%MPIpvar2buffer(mesh,physics,
north,pvar,this%Boundary(
north)%p%sendbuf)
946#ifdef MPI_USE_SENDRECV
948 CALL mpi_sendrecv(this%Boundary(
north)%p%sendbuf, &
949 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
951 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
955 CALL mpi_issend(this%Boundary(
north)%p%sendbuf, &
956 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
959 CALL mpi_waitall(4,req,status,ierr)
962 IF (mesh%neighbor(
south).NE.mpi_proc_null) &
963 CALL this%MPIbuffer2pvar(mesh,physics,
south,this%Boundary(
south)%p%recvbuf,pvar)
964 IF (mesh%neighbor(
north).NE.mpi_proc_null) &
965 CALL this%MPIbuffer2pvar(mesh,physics,
north,this%Boundary(
north)%p%recvbuf,pvar)
968#ifndef MPI_USE_SENDRECV
970 CALL mpi_irecv(this%Boundary(
top)%p%recvbuf, &
971 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
975 IF (mesh%neighbor(
bottom).NE.mpi_proc_null) &
976 CALL this%MPIpvar2buffer(mesh,physics,
bottom,pvar,this%Boundary(
bottom)%p%sendbuf)
977#ifdef MPI_USE_SENDRECV
979 CALL mpi_sendrecv(this%Boundary(
bottom)%p%sendbuf,&
980 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
982 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
986 CALL mpi_issend(this%Boundary(
bottom)%p%sendbuf, &
987 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
991 CALL mpi_irecv(this%Boundary(
bottom)%p%recvbuf, &
992 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
996 IF (mesh%neighbor(
top).NE.mpi_proc_null) &
997 CALL this%MPIpvar2buffer(mesh,physics,
top,pvar,this%Boundary(
top)%p%sendbuf)
998#ifdef MPI_USE_SENDRECV
1000 CALL mpi_sendrecv(this%Boundary(
top)%p%sendbuf, &
1001 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
1003 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
1007 CALL mpi_issend(this%Boundary(
top)%p%sendbuf, &
1008 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
1011 CALL mpi_waitall(4,req,status,ierr)
1014 IF (mesh%neighbor(
bottom).NE.mpi_proc_null) &
1015 CALL this%MPIbuffer2pvar(mesh,physics,
bottom,this%Boundary(
bottom)%p%recvbuf,pvar)
1016 IF (mesh%neighbor(
top).NE.mpi_proc_null) &
1017 CALL this%MPIbuffer2pvar(mesh,physics,
top,this%Boundary(
top)%p%recvbuf,pvar)
1027 INTEGER,
INTENT(IN) :: output_dir
1028 REAL,
DIMENSION(:,:,:,:),
INTENT(IN) :: buffer
1029 REAL,
DIMENSION(Mesh%IGMIN:Mesh%IGMAX,Mesh%JGMIN:Mesh%JGMAX,Mesh%KGMIN:Mesh%KGMAX,Physics%VNUM), &
1034 SELECT CASE(output_dir)
1038 DO k=mesh%KGMIN,mesh%KGMAX
1039 DO j=mesh%JGMIN,mesh%JGMAX
1042 pvar(mesh%IGMIN+i-1,j,k,n) = buffer(i,j-mesh%JGMIN+1,k-mesh%KGMIN+1,n)
1050 DO k=mesh%KGMIN,mesh%KGMAX
1051 DO j=mesh%JGMIN,mesh%JGMAX
1054 pvar(mesh%IMAX+i,j,k,n) = buffer(i,j-mesh%JGMIN+1,k-mesh%KGMIN+1,n)
1062 DO k=mesh%KGMIN,mesh%KGMAX
1065 DO i=mesh%IGMIN,mesh%IGMAX
1066 pvar(i,mesh%JGMIN+j-1,k,n) = buffer(i-mesh%IGMIN+1,j,k-mesh%KGMIN+1,n)
1074 DO k=mesh%KGMIN,mesh%KGMAX
1077 DO i=mesh%IGMIN,mesh%IGMAX
1078 pvar(i,mesh%JMAX+j,k,n) = buffer(i-mesh%IGMIN+1,j,k-mesh%KGMIN+1,n)
1088 DO j=mesh%JGMIN,mesh%JGMAX
1089 DO i=mesh%IGMIN,mesh%IGMAX
1090 pvar(i,j,mesh%KGMIN+k-1,n) = buffer(i-mesh%IGMIN+1,j-mesh%JGMIN+1,k,n)
1100 DO j=mesh%JGMIN,mesh%JGMAX
1101 DO i=mesh%IGMIN,mesh%IGMAX
1102 pvar(i,j,mesh%KMAX+k,n) = buffer(i-mesh%IGMIN+1,j-mesh%JGMIN+1,k,n)
1117 INTEGER,
INTENT(IN) :: input_dir
1118 REAL,
DIMENSION(Mesh%IGMIN:Mesh%IGMAX,Mesh%JGMIN:Mesh%JGMAX,Mesh%KGMIN:Mesh%KGMAX,Physics%VNUM), &
1120 REAL,
DIMENSION(:,:,:,:),
INTENT(OUT) :: buffer
1124 SELECT CASE(input_dir)
1128 DO k=mesh%KGMIN,mesh%KGMAX
1129 DO j=mesh%JGMIN,mesh%JGMAX
1132 buffer(i,j-mesh%JGMIN+1,k-mesh%KGMIN+1,n) = pvar(mesh%IMIN+i-1,j,k,n)
1140 DO k=mesh%KGMIN,mesh%KGMAX
1141 DO j=mesh%JGMIN,mesh%JGMAX
1144 buffer(i,j-mesh%JGMIN+1,k-mesh%KGMIN+1,n) = pvar(mesh%IMAX-mesh%GINUM+i,j,k,n)
1152 DO k=mesh%KGMIN,mesh%KGMAX
1155 DO i=mesh%IGMIN,mesh%IGMAX
1156 buffer(i-mesh%IGMIN+1,j,k-mesh%KGMIN+1,n) = pvar(i,mesh%JMIN+j-1,k,n)
1164 DO k=mesh%KGMIN,mesh%KGMAX
1167 DO i=mesh%IGMIN,mesh%IGMAX
1168 buffer(i-mesh%IGMIN+1,j,k-mesh%KGMIN+1,n) = pvar(i,mesh%JMAX-mesh%GJNUM+j,k,n)
1178 DO j=mesh%JGMIN,mesh%JGMAX
1179 DO i=mesh%IGMIN,mesh%IGMAX
1180 buffer(i-mesh%IGMIN+1,j-mesh%JGMIN+1,k,n) = pvar(i,j,mesh%KMIN+k-1,n)
1190 DO j=mesh%JGMIN,mesh%JGMAX
1191 DO i=mesh%IGMIN,mesh%IGMAX
1192 buffer(i-mesh%IGMIN+1,j-mesh%JGMIN+1,k,n) = pvar(i,j,mesh%KMAX-mesh%GKNUM+k,n)
1210 CALL this%boundary(dir)%p%Finalize()
1213 DEALLOCATE(
this%boundary(dir)%p%sendbuf,
this%boundary(dir)%p%recvbuf)
Boundary module for absorbing (non-reflecting) conditions.
Boundary module for axis boundaries.
integer, parameter axis
axis
integer, parameter periodic
connects opposite boundaries
integer, parameter custom
user defined
integer, parameter no_gradients
copy data from last cell in comp. domain in ghost zones
integer, parameter farfield
uses far-field data and Riemann invariants
integer, parameter shearing
periodic with shear for shearing sheet/box
integer, parameter reflecting
reflecting, i.e. wall
integer, parameter absorbing
vanishing characteristic pseudo-variables for incomming waves
integer, parameter noslip
reflecting, but with moving wall
integer, parameter fixed
set fixed boundary data
subroutine initboundary(this, Mesh, Physics, bctype, bcname, dir, config)
Boundary module for custom conditions.
Boundary module for far field conditions.
Boundary module for fixed in/outflow conditions.
subroutine initboundary_mpi(this, Mesh, Physics, periods)
initializes the MPI communication
subroutine, public new_boundary(Boundary, Mesh, Physics, config, IO)
subroutine, private centerboundary(this, Mesh, Physics, time, pvar, cvar)
Sets boundaries in all directions.
subroutine mpipvar2buffer(this, Mesh, Physics, input_dir, pvar, buffer)
Copys ghost cell data to buffer.
subroutine mpiboundarycommunication(this, Mesh, Physics, pvar)
Handles the MPI communication of the inner (and physical periodic) boundaries.
subroutine setcorneredges(this, Mesh, Physics, pvar)
Calculates the corner in 2D and the corners and edges in 3D.
subroutine mpibuffer2pvar(this, Mesh, Physics, output_dir, buffer, pvar)
Copys buffer data to ghost cells.
Boundary module for the inner boundaries (only necessary in parallel runs)
Boundary module for reflecting boundaries.
Boundary module for noslip conditions (see wikipedia )
Boundary module for periodic boundary conditions.
Boundary module for reflecting boundaries.
Boundary module for a shearingsheet/shearingbox. (see e.g. the standard run )
Dictionary for generic data types.
type(logging_base), save this
subroutine finalize(this)
Destructor of logging_base class.
integer, save default_mpi_real
default real type for MPI
derived class for compound of mesh arrays
integer, parameter east
named constant for eastern boundary
integer, parameter bottom
named constant for bottom boundary
integer, parameter south
named constant for southern boundary
integer, parameter top
named constant for top boundary
integer, parameter north
named constant for northern boundary
integer, parameter west
named constant for western boundary
physics module for 1D,2D and 3D isothermal Euler equations