98 CALL boundary%InitBoundary(mesh,physics,config,io)
107 TYPE(
dict_typ),
POINTER :: config,io
108 INTEGER :: western, eastern, southern, northern, bottomer, topper
111 INTEGER :: western_std, eastern_std, northern_std, southern_std, &
112 topper_std, bottomer_std
113 LOGICAL,
DIMENSION(3) :: periods = .false.
116 IF (.NOT.physics%Initialized().OR..NOT.mesh%Initialized()) &
117 CALL this%Error(
"InitBoundary",
"physics and/or mesh module uninitialized")
126 IF (mesh%shear_dir.EQ.1)
THEN 127 western_std = periodic
128 eastern_std = periodic
129 southern_std = shearing
130 northern_std = shearing
131 bottomer_std = periodic
132 topper_std = periodic
133 ELSE IF (mesh%shear_dir.EQ.2)
THEN 134 western_std = shearing
135 eastern_std = shearing
136 southern_std = periodic
137 northern_std = periodic
138 bottomer_std = periodic
139 topper_std = periodic
142 CALL getattr(config,
"western", western, western_std)
143 CALL getattr(config,
"eastern", eastern, eastern_std)
144 CALL getattr(config,
"southern", southern, northern_std)
145 CALL getattr(config,
"northern", northern, southern_std)
146 CALL getattr(config,
"bottomer", bottomer, bottomer_std)
147 CALL getattr(config,
"topper", topper, topper_std)
151 new(south) = southern
152 new(north) = northern
153 new(bottom) = bottomer
158 IF (mesh%mycoords(1).NE.0) new(west) =
none 159 IF (mesh%mycoords(1).NE.mesh%dims(1)-1) new(east) =
none 160 IF (mesh%mycoords(2).NE.0) new(south) =
none 161 IF (mesh%mycoords(2).NE.mesh%dims(2)-1) new(north) =
none 162 IF (mesh%mycoords(3).NE.0) new(bottom) =
none 163 IF (mesh%mycoords(3).NE.mesh%dims(3)-1) new(top) =
none 167 IF (western.EQ.shearing.AND.eastern.EQ.shearing)
THEN 168 IF (.NOT.mesh%shear_dir.EQ.2) &
169 CALL this%Error(
"InitBoundary", &
170 "Please apply shifting in second dimension, when applying shearing boundaries at western/eastern.")
172 CALL this%Error(
"InitBoundary", &
173 "Parallel mode is not allowed with shearing in West-East direction.")
175 ELSE IF (southern.EQ.shearing.AND.northern.EQ.shearing)
THEN 176 IF (.NOT.mesh%shear_dir.EQ.1) &
177 CALL this%Error(
"InitBoundary", &
178 "Please apply shifting in first dimension, when applying shearing boundaries at northern/southern.")
179 ELSE IF (bottomer.EQ.shearing.AND.topper.EQ.shearing)
THEN 180 CALL this%Error(
"InitBoundary", &
181 "shifting in topper/bottomer direction not allowed.")
187 SELECT CASE(new(dir))
212 SELECT TYPE(obj =>
this%Boundary(dir)%p)
214 CALL obj%InitBoundary_absorbing(mesh,physics,dir,config)
216 CALL obj%InitBoundary_axis(mesh,physics,dir,config)
218 CALL obj%InitBoundary_custom(mesh,physics,dir,config)
220 CALL obj%InitBoundary_fixed(mesh,physics,dir,config)
222 CALL obj%InitBoundary_nogradients(mesh,physics,dir,config)
224 CALL obj%InitBoundary_noslip(mesh,physics,dir,config)
226 CALL obj%InitBoundary_periodic(mesh,physics,dir,config)
228 CALL obj%InitBoundary_reflecting(mesh,physics,dir,config)
230 CALL obj%InitBoundary_shearing(mesh,physics,dir,config)
233 CALL obj%InitBoundary_inner(mesh,physics,dir,config)
239 IF ((western.EQ.periodic.AND.eastern.EQ.periodic) .OR. &
240 (western.EQ.shearing.AND.eastern.EQ.shearing))
THEN 242 ELSE IF (western.EQ.periodic.NEQV.eastern.EQ.periodic)
THEN 243 CALL this%boundary(west)%p%Error(
"InitBoundary", &
244 "Opposite boundary should be periodic.")
245 ELSE IF (western.EQ.shearing.NEQV.eastern.EQ.shearing)
THEN 246 CALL this%boundary(west)%p%Error(
"InitBoundary", &
247 "Opposite boundary should be shearing.")
249 IF ((southern.EQ.periodic.AND.northern.EQ.periodic) .OR. &
250 (southern.EQ.shearing.AND.northern.EQ.shearing))
THEN 252 ELSE IF (southern.EQ.periodic.NEQV.northern.EQ.periodic)
THEN 253 CALL this%boundary(south)%p%Error(
"InitBoundary", &
254 "Opposite boundary should be periodic.")
255 ELSE IF (southern.EQ.shearing.NEQV.northern.EQ.shearing)
THEN 256 CALL this%boundary(south)%p%Error(
"InitBoundary", &
257 "Opposite boundary should be shearing.")
259 IF ((bottomer.EQ.periodic.AND.topper.EQ.periodic) .OR. &
260 (bottomer.EQ.shearing.AND.topper.EQ.shearing))
THEN 262 ELSE IF (bottomer.EQ.periodic.NEQV.topper.EQ.periodic)
THEN 263 CALL this%boundary(bottom)%p%Error(
"InitBoundary", &
264 "Opposite boundary should be periodic.")
265 ELSE IF (bottomer.EQ.shearing.NEQV.topper.EQ.shearing)
THEN 266 CALL this%boundary(bottom)%p%Error(
"InitBoundary", &
267 "Opposite boundary should be shearing.")
271 CALL this%InitBoundary_MPI(mesh,physics,periods)
285 REAL,
INTENT(IN) :: time
288 CALL physics%Convert2Primitive(mesh%IMIN,mesh%IMAX,mesh%JMIN, &
289 mesh%JMAX,mesh%KMIN,mesh%KMAX,cvar,pvar)
293 IF (mesh%INUM.GT.1)
THEN 294 CALL this%Boundary(west)%p%SetBoundaryData(mesh,physics,time,pvar)
295 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
296 "western boundary condition failed")
297 CALL this%Boundary(east)%p%SetBoundaryData(mesh,physics,time,pvar)
298 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
299 "eastern boundary condition failed")
310 SELECT TYPE(bound1 =>
this%Boundary(south)%p)
315 IF (mesh%JNUM.GT.1)
THEN 316 CALL this%Boundary(south)%p%SetBoundaryData(mesh,physics,time,pvar)
317 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
318 "southern boundary condition failed")
322 SELECT TYPE(bound2 =>
this%Boundary(north)%p)
327 IF (mesh%JNUM.GT.1)
THEN 328 CALL this%Boundary(north)%p%SetBoundaryData(mesh,physics,time,pvar)
329 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
330 "northern boundary condition failed")
334 IF (mesh%JNUM.GT.1)
THEN 335 CALL this%Boundary(south)%p%SetBoundaryData(mesh,physics,time,pvar)
336 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
337 "southern boundary condition failed")
338 CALL this%Boundary(north)%p%SetBoundaryData(mesh,physics,time,pvar)
339 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
340 "northern boundary condition failed")
345 IF (mesh%KNUM.GT.1)
THEN 346 CALL this%Boundary(bottom)%p%SetBoundaryData(mesh,physics,time,pvar)
347 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
348 "bottom boundary condition failed")
349 CALL this%Boundary(top)%p%SetBoundaryData(mesh,physics,time,pvar)
350 IF (
this%err.GT.0)
CALL this%Error(
"boundary_generic::CenterBoundary", &
351 "top boundary condition failed")
362 SELECT TYPE(bound1 =>
this%Boundary(south)%p)
364 IF (mesh%JNUM.GT.1)
THEN 365 CALL this%Boundary(south)%p%SetBoundaryData(mesh,physics,time,pvar)
370 SELECT TYPE(bound2 =>
this%Boundary(north)%p)
372 IF (mesh%JNUM.GT.1)
THEN 373 CALL this%Boundary(north)%p%SetBoundaryData(mesh,physics,time,pvar)
383 IF (mesh%INUM.GT.1)
THEN 384 CALL physics%Convert2Conservative(mesh%IGMIN,mesh%IMIN-mesh%IP1, &
385 mesh%JGMIN,mesh%JGMAX,mesh%KGMIN,mesh%KGMAX,pvar,cvar)
386 CALL physics%Convert2Conservative(mesh%IMAX+mesh%IP1,mesh%IGMAX, &
387 mesh%JGMIN,mesh%JGMAX,mesh%KGMIN,mesh%KGMAX,pvar,cvar)
389 IF (mesh%JNUM.GT.1)
THEN 390 CALL physics%Convert2Conservative(mesh%IMIN,mesh%IMAX, &
391 mesh%JGMIN,mesh%JMIN-mesh%JP1,mesh%KGMIN,mesh%KGMAX,pvar,cvar)
392 CALL physics%Convert2Conservative(mesh%IMIN,mesh%IMAX, &
393 mesh%JMAX+mesh%JP1,mesh%JGMAX,mesh%KGMIN,mesh%KGMAX,pvar,cvar)
395 IF (mesh%KNUM.GT.1)
THEN 396 CALL physics%Convert2Conservative(mesh%IMIN,mesh%IMAX, &
397 mesh%JMIN,mesh%JMAX,mesh%KGMIN,mesh%KMIN-mesh%KP1,pvar,cvar)
398 CALL physics%Convert2Conservative(mesh%IMIN,mesh%IMAX, &
399 mesh%JMIN,mesh%JMAX,mesh%KMAX+mesh%KP1,mesh%KGMAX,pvar,cvar)
420 CLASS(boundary_generic),
INTENT(INOUT) :: this
421 CLASS(mesh_base),
INTENT(IN) :: Mesh
422 CLASS(physics_base),
INTENT(IN) :: Physics
423 REAL,
DIMENSION(Mesh%IGMIN:Mesh%IGMAX,Mesh%JGMIN:Mesh%JGMAX,Mesh%KGMIN:Mesh%KGMAX,Physics%VNUM), &
424 INTENT(INOUT) :: pvar
428 IF ((mesh%INUM.NE.1.AND.mesh%JNUM.NE.1.AND.mesh%KNUM.EQ.1).OR. &
429 (mesh%INUM.NE.1.AND.mesh%JNUM.NE.1.AND.mesh%KNUM.NE.1))
THEN 433 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(2).EQ.0)
THEN 439 pvar(mesh%IMIN-i,mesh%JMIN-j,:,:) = pvar(mesh%IMIN-i,mesh%JMIN-j+1,:,:)
440 pvar(mesh%IMIN-j,mesh%JMIN-i,:,:) = pvar(mesh%IMIN-j+1,mesh%JMIN-i,:,:)
442 pvar(mesh%IMIN-j,mesh%JMIN-j,:,:) = 0.5 * (pvar(mesh%IMIN-j,mesh%JMIN,:,:) &
443 + pvar(mesh%IMIN,mesh%JMIN-j,:,:))
450 IF(mesh%mycoords(1).EQ.mesh%dims(1)-1.AND.mesh%mycoords(2).EQ.0)
THEN 456 pvar(mesh%IMAX+i,mesh%JMIN-j,:,:) = pvar(mesh%IMAX+i,mesh%JMIN-j+1,:,:)
457 pvar(mesh%IMAX+j,mesh%JMIN-i,:,:) = pvar(mesh%IMAX+j-1,mesh%JMIN-i,:,:)
459 pvar(mesh%IMAX+j,mesh%JMIN-j,:,:) = 0.5 * (pvar(mesh%IMAX+j,mesh%JMIN,:,:) &
460 + pvar(mesh%IMAX,mesh%JMIN-j,:,:))
467 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(2).EQ.mesh%dims(2)-1)
THEN 473 pvar(mesh%IMIN-i,mesh%JMAX+j,:,:) = pvar(mesh%IMIN-i,mesh%JMAX+j-1,:,:)
474 pvar(mesh%IMIN-j,mesh%JMAX+i,:,:) = pvar(mesh%IMIN-j+1,mesh%JMAX+i,:,:)
476 pvar(mesh%IMIN-j,mesh%JMAX+j,:,:) = 0.5 * (pvar(mesh%IMIN-j,mesh%JMAX,:,:) &
477 + pvar(mesh%IMIN,mesh%JMAX+j,:,:))
485 IF(mesh%mycoords(1).EQ.mesh%dims(1)-1.AND.mesh%mycoords(2).EQ.mesh%dims(2)-1)
THEN 491 pvar(mesh%IMAX+i,mesh%JMAX+j,:,:) = pvar(mesh%IMAX+i,mesh%JMAX+j-1,:,:)
492 pvar(mesh%IMAX+j,mesh%JMAX+i,:,:) = pvar(mesh%IMAX+j-1,mesh%JMAX+i,:,:)
494 pvar(mesh%IMAX+j,mesh%JMAX+j,:,:) = 0.5 * (pvar(mesh%IMAX+j,mesh%JMAX,:,:) &
495 + pvar(mesh%IMAX,mesh%JMAX+j,:,:))
502 IF ((mesh%INUM.NE.1.AND.mesh%JNUM.EQ.1.AND.mesh%KNUM.NE.1).OR. &
503 (mesh%INUM.NE.1.AND.mesh%JNUM.NE.1.AND.mesh%KNUM.NE.1))
THEN 507 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(3).EQ.0)
THEN 513 pvar(mesh%IMIN-i,:,mesh%KMIN-k,:) = pvar(mesh%IMIN-i+1,:,mesh%KMIN-k,:)
514 pvar(mesh%IMIN-k,:,mesh%KMIN-i,:) = pvar(mesh%IMIN-k,:,mesh%KMIN-i+1,:)
516 pvar(mesh%IMIN-i,:,mesh%KMIN-i,:) = 0.5 * (pvar(mesh%IMIN-i,:,mesh%KMIN,:) &
517 + pvar(mesh%IMIN,:,mesh%KMIN-i,:))
524 IF(mesh%mycoords(1).EQ.mesh%dims(1)-1.AND.mesh%mycoords(3).EQ.0)
THEN 530 pvar(mesh%IMAX+i,:,mesh%KMIN-k,:) = pvar(mesh%IMAX+i-1,:,mesh%KMIN-k,:)
531 pvar(mesh%IMAX+k,:,mesh%KMIN-i,:) = pvar(mesh%IMAX+k,:,mesh%KMIN-i+1,:)
533 pvar(mesh%IMAX+i,:,mesh%KMIN-i,:) = 0.5 * (pvar(mesh%IMAX,:,mesh%KMIN-i,:) &
534 + pvar(mesh%IMAX+i,:,mesh%KMIN,:))
542 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(3).EQ.mesh%dims(3)-1)
THEN 548 pvar(mesh%IMIN-i,:,mesh%KMAX+k,:) = pvar(mesh%IMIN-i+1,:,mesh%KMAX+k,:)
549 pvar(mesh%IMIN-k,:,mesh%KMAX+i,:) = pvar(mesh%IMIN-k,:,mesh%KMAX+i-1,:)
551 pvar(mesh%IMIN-i,:,mesh%KMAX+i,:) = 0.5 * (pvar(mesh%IMIN,:,mesh%KMAX+i,:) &
552 + pvar(mesh%IMIN-i,:,mesh%KMAX,:))
560 IF(mesh%mycoords(1).EQ.mesh%dims(1)-1.AND.mesh%mycoords(3).EQ.mesh%dims(3)-1)
THEN 566 pvar(mesh%IMAX+i,:,mesh%KMAX+k,:) = pvar(mesh%IMAX+i-1,:,mesh%KMAX+k,:)
567 pvar(mesh%IMAX+k,:,mesh%KMAX+i,:) = pvar(mesh%IMAX+k,:,mesh%KMAX+i-1,:)
569 pvar(mesh%IMAX+i,:,mesh%KMAX+i,:) = 0.5 * (pvar(mesh%IMAX,:,mesh%KMAX+i,:) &
570 + pvar(mesh%IMAX+i,:,mesh%KMAX,:))
577 IF ((mesh%INUM.EQ.1.AND.mesh%JNUM.NE.1.AND.mesh%KNUM.NE.1).OR. &
578 (mesh%INUM.NE.1.AND.mesh%JNUM.NE.1.AND.mesh%KNUM.NE.1))
THEN 582 IF(mesh%mycoords(2).EQ.0.AND.mesh%mycoords(3).EQ.0)
THEN 588 pvar(:,mesh%JMIN-j,mesh%KMIN-k,:) = pvar(:,mesh%JMIN-j+1,mesh%KMIN-k,:)
589 pvar(:,mesh%JMIN-k,mesh%KMIN-j,:) = pvar(:,mesh%JMIN-k,mesh%KMIN-j+1,:)
591 pvar(:,mesh%JMIN-j,mesh%KMIN-j,:) = 0.5 * (pvar(:,mesh%JMIN,mesh%KMIN-j,:) &
592 + pvar(:,mesh%JMIN-j,mesh%KMIN,:))
600 IF(mesh%mycoords(2).EQ.mesh%dims(2)-1.AND.mesh%mycoords(3).EQ.0)
THEN 606 pvar(:,mesh%JMAX+j,mesh%KMIN-k,:) = pvar(:,mesh%JMAX+j-1,mesh%KMIN-k,:)
607 pvar(:,mesh%JMAX+k,mesh%KMIN-j,:) = pvar(:,mesh%JMAX+k,mesh%KMIN-j+1,:)
610 pvar(:,mesh%JMAX+j,mesh%KMIN-j,:) = 0.5 * (pvar(:,mesh%JMAX,mesh%KMIN-j,:) &
611 + pvar(:,mesh%JMAX+j,mesh%KMIN,:))
619 IF(mesh%mycoords(2).EQ.0.AND.mesh%mycoords(3).EQ.mesh%dims(3)-1)
THEN 625 pvar(:,mesh%JMIN-j,mesh%KMAX+k,:) = pvar(:,mesh%JMIN-j+1,mesh%KMAX+k,:)
626 pvar(:,mesh%JMIN-k,mesh%KMAX+j,:) = pvar(:,mesh%JMIN-k,mesh%KMAX+j-1,:)
628 pvar(:,mesh%JMIN-j,mesh%KMAX+j,:) = 0.5 * (pvar(:,mesh%JMIN,mesh%KMAX+j,:) &
629 + pvar(:,mesh%JMIN-j,mesh%KMAX,:))
637 IF(mesh%mycoords(2).EQ.mesh%dims(2)-1.AND.mesh%mycoords(3).EQ.mesh%dims(3)-1)
THEN 643 pvar(:,mesh%JMAX+j,mesh%KMAX+k,:) = pvar(:,mesh%JMAX+j-1,mesh%KMAX+k,:)
644 pvar(:,mesh%JMAX+k,mesh%KMAX+j,:) = pvar(:,mesh%JMAX+k,mesh%KMAX+j-1,:)
646 pvar(:,mesh%JMAX+j,mesh%KMAX+j,:) = 0.5 * (pvar(:,mesh%JMAX,mesh%KMAX+j,:) &
647 + pvar(:,mesh%JMAX+j,mesh%KMAX,:))
655 IF (mesh%INUM.NE.1.AND.mesh%JNUM.NE.1.AND.mesh%KNUM.NE.1)
THEN 657 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(2).EQ.0.AND.mesh%mycoords(3).EQ.0)
THEN 661 pvar(mesh%IMIN-i,mesh%JMIN-i,mesh%KMIN-i,:) = (pvar(mesh%IMIN-i,mesh%JMIN,mesh%KMIN,:) &
662 + pvar(mesh%IMIN,mesh%JMIN-i,mesh%KMIN,:) + pvar(mesh%IMIN,mesh%JMIN,mesh%KMIN-i,:))/3.0
668 IF(mesh%mycoords(1).EQ.mesh%dims(1)-1.AND.mesh%mycoords(2).EQ.0.AND.mesh%mycoords(3).EQ.0)
THEN 672 pvar(mesh%IMAX+i,mesh%JMIN-i,mesh%KMIN-i,:) = (pvar(mesh%IMAX+i,mesh%JMIN,mesh%KMIN,:) &
673 + pvar(mesh%IMAX,mesh%JMIN-i,mesh%KMIN,:) + pvar(mesh%IMAX,mesh%JMIN,mesh%KMIN-i,:))/3.0
679 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(2).EQ.mesh%dims(2)-1.AND.mesh%mycoords(3).EQ.0)
THEN 683 pvar(mesh%IMIN-i,mesh%JMAX+i,mesh%KMIN-i,:) = (pvar(mesh%IMIN-i,mesh%JMAX,mesh%KMIN,:) &
684 + pvar(mesh%IMIN,mesh%JMAX+i,mesh%KMIN,:) + pvar(mesh%IMIN,mesh%JMAX,mesh%KMIN-i,:))/3.0
690 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 694 pvar(mesh%IMAX+i,mesh%JMAX+i,mesh%KMIN-i,:) = (pvar(mesh%IMAX+i,mesh%JMAX,mesh%KMIN,:) &
695 + pvar(mesh%IMAX,mesh%JMAX+i,mesh%KMIN,:) + pvar(mesh%IMAX,mesh%JMAX,mesh%KMIN-i,:))/3.0
701 IF(mesh%mycoords(1).EQ.0.AND.mesh%mycoords(2).EQ.0.AND.mesh%mycoords(3).EQ.mesh%dims(3)-1)
THEN 705 pvar(mesh%IMIN-i,mesh%JMIN-i,mesh%KMAX+i,:) = (pvar(mesh%IMIN-i,mesh%JMIN,mesh%KMAX,:) &
706 + pvar(mesh%IMIN,mesh%JMIN-i,mesh%KMAX,:) + pvar(mesh%IMIN,mesh%JMIN,mesh%KMAX+i,:))/3.0
712 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 716 pvar(mesh%IMAX+i,mesh%JMIN-i,mesh%KMAX+i,:) = (pvar(mesh%IMAX+i,mesh%JMIN,mesh%KMAX,:) &
717 + pvar(mesh%IMAX,mesh%JMIN-i,mesh%KMAX,:) + pvar(mesh%IMAX,mesh%JMIN,mesh%KMAX+i,:))/3.0
723 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 727 pvar(mesh%IMIN-i,mesh%JMAX+i,mesh%KMAX+i,:) = (pvar(mesh%IMIN-i,mesh%JMAX,mesh%KMAX,:) &
728 + pvar(mesh%IMIN,mesh%JMAX+i,mesh%KMAX,:) + pvar(mesh%IMIN,mesh%JMAX,mesh%KMAX+i,:))/3.0
734 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 738 pvar(mesh%IMAX+i,mesh%JMAX+i,mesh%KMAX+i,:) = (pvar(mesh%IMAX+i,mesh%JMAX,mesh%KMAX,:) &
739 + pvar(mesh%IMAX,mesh%JMAX+i,mesh%KMAX,:) + pvar(mesh%IMAX,mesh%JMAX,mesh%KMAX+i,:))/3.0
760 CLASS(boundary_generic),
INTENT(INOUT) :: this
761 CLASS(mesh_base),
INTENT(INOUT) :: Mesh
762 CLASS(physics_base),
INTENT(IN) :: Physics
763 LOGICAL,
DIMENSION(3),
INTENT(IN) :: periods
767 LOGICAL,
DIMENSION(SIZE(Mesh%dims)) :: remain_dims = .false.
772 comm_old = mesh%comm_cart
773 CALL mpi_cart_create(comm_old,
SIZE(mesh%dims),mesh%dims,periods,.false.,mesh%comm_cart,ierr)
776 CALL mpi_cart_shift(mesh%comm_cart,0,1,mesh%neighbor(west),mesh%neighbor(east),ierr)
777 CALL mpi_cart_shift(mesh%comm_cart,1,1,mesh%neighbor(south),mesh%neighbor(north),ierr)
778 CALL mpi_cart_shift(mesh%comm_cart,2,1,mesh%neighbor(bottom),mesh%neighbor(top),ierr)
782 remain_dims = (/ .false., .true., .true. /)
783 CALL mpi_cart_sub(mesh%comm_cart,remain_dims,mesh%Icomm,ierr)
784 remain_dims = (/ .true., .false., .true. /)
785 CALL mpi_cart_sub(mesh%comm_cart,remain_dims,mesh%Jcomm,ierr)
786 remain_dims = (/ .true., .true., .false. /)
787 CALL mpi_cart_sub(mesh%comm_cart,remain_dims,mesh%Kcomm,ierr)
791 this%boundary(west)%p%sendbuf(mesh%GINUM,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
792 this%boundary(west)%p%recvbuf(mesh%GINUM,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
793 this%boundary(east)%p%sendbuf(mesh%GINUM,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
794 this%boundary(east)%p%recvbuf(mesh%GINUM,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
795 this%boundary(south)%p%sendbuf(mesh%IGMIN:mesh%IGMAX,mesh%GJNUM,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
796 this%boundary(south)%p%recvbuf(mesh%IGMIN:mesh%IGMAX,mesh%GJNUM,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
797 this%boundary(north)%p%sendbuf(mesh%IGMIN:mesh%IGMAX,mesh%GJNUM,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
798 this%boundary(north)%p%recvbuf(mesh%IGMIN:mesh%IGMAX,mesh%GJNUM,mesh%KGMIN:mesh%KGMAX,physics%VNUM), &
799 this%boundary(bottom)%p%sendbuf(mesh%IGMIN:mesh%IGMAX,mesh%JGMIN:mesh%JGMAX,mesh%GKNUM,physics%VNUM), &
800 this%boundary(bottom)%p%recvbuf(mesh%IGMIN:mesh%IGMAX,mesh%JGMIN:mesh%JGMAX,mesh%GKNUM,physics%VNUM), &
801 this%boundary(top)%p%sendbuf(mesh%IGMIN:mesh%IGMAX,mesh%JGMIN:mesh%JGMAX,mesh%GKNUM,physics%VNUM), &
802 this%boundary(top)%p%recvbuf(mesh%IGMIN:mesh%IGMAX,mesh%JGMIN:mesh%JGMAX,mesh%GKNUM,physics%VNUM), &
805 CALL this%boundary(west)%p%Error(
"boundary_generic::InitBoundary_MPI", &
806 "Unable to allocate memory for data buffers.")
811 this%boundary(dir)%p%recvbuf = 0.
812 this%boundary(dir)%p%sendbuf = 0.
826 CLASS(boundary_generic),
INTENT(INOUT) :: this
827 CLASS(mesh_base),
INTENT(IN) :: Mesh
828 CLASS(physics_base),
INTENT(IN) :: Physics
829 REAL,
DIMENSION(Mesh%IGMIN:Mesh%IGMAX,Mesh%JGMIN:Mesh%JGMAX,Mesh%KGMIN:Mesh%KGMAX,Physics%VNUM), &
830 INTENT(INOUT) :: pvar
834 #ifdef MPI_USE_SENDRECV 835 INTEGER :: status(MPI_STATUS_SIZE)
837 INTEGER :: status(MPI_STATUS_SIZE,4)
845 #ifdef MPI_USE_SENDRECV 847 IF (mesh%neighbor(west).NE.mpi_proc_null)
THEN 848 this%Boundary(west)%p%sendbuf(:,:,:,:) = pvar(mesh%IMIN:mesh%IMIN+mesh%GINUM-1, &
849 mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM)
851 CALL mpi_sendrecv(this%Boundary(west)%p%sendbuf, &
852 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
853 default_mpi_real,mesh%neighbor(west),10+west,this%Boundary(east)%p%recvbuf, &
854 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
855 default_mpi_real,mesh%neighbor(east),mpi_any_tag,mesh%comm_cart,status,ierr)
856 IF (mesh%neighbor(east).NE.mpi_proc_null)
THEN 857 pvar(mesh%IMAX+1:mesh%IGMAX,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM) = &
858 this%Boundary(east)%p%recvbuf(:,:,:,:)
862 CALL mpi_irecv(this%Boundary(east)%p%recvbuf, &
863 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
866 IF (mesh%neighbor(west).NE.mpi_proc_null)
THEN 867 this%Boundary(west)%p%sendbuf(:,:,:,:) = &
868 pvar(mesh%IMIN:mesh%IMIN+mesh%GINUM-1,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM)
871 CALL mpi_issend(this%Boundary(west)%p%sendbuf, &
872 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
875 #ifdef MPI_USE_SENDRECV 877 IF (mesh%neighbor(east).NE.mpi_proc_null)
THEN 878 this%Boundary(east)%p%sendbuf(:,:,:,:) = pvar(mesh%IMAX-mesh%GINUM+1:mesh%IMAX, &
879 mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM)
881 CALL mpi_sendrecv(this%Boundary(east)%p%sendbuf, &
882 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
883 default_mpi_real,mesh%neighbor(east),10+east,this%Boundary(west)%p%recvbuf, &
884 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
885 default_mpi_real,mesh%neighbor(west),mpi_any_tag,mesh%comm_cart,status,ierr)
886 IF (mesh%neighbor(west).NE.mpi_proc_null)
THEN 887 pvar(mesh%IGMIN:mesh%IMIN-1,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM) = &
888 this%Boundary(west)%p%recvbuf(:,:,:,:)
892 CALL mpi_irecv(this%Boundary(west)%p%recvbuf, &
893 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
896 IF (mesh%neighbor(east).NE.mpi_proc_null)
THEN 897 this%Boundary(east)%p%sendbuf(:,:,:,:) = &
898 pvar(mesh%IMAX-mesh%GINUM+1:mesh%IMAX,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM)
901 CALL mpi_issend(this%Boundary(east)%p%sendbuf, &
902 mesh%GINUM*(mesh%JGMAX-mesh%JGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
905 #ifndef MPI_USE_SENDRECV 907 CALL mpi_waitall(4,req,status,ierr)
909 IF (mesh%neighbor(west).NE.mpi_proc_null)
THEN 910 pvar(mesh%IGMIN:mesh%IMIN-1,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM) = &
911 this%Boundary(west)%p%recvbuf(:,:,:,:)
913 IF (mesh%neighbor(east).NE.mpi_proc_null)
THEN 914 pvar(mesh%IMAX+1:mesh%IGMAX,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM) = &
915 this%Boundary(east)%p%recvbuf(:,:,:,:)
920 #ifdef MPI_USE_SENDRECV 922 IF (mesh%neighbor(south).NE.mpi_proc_null)
THEN 923 this%Boundary(south)%p%sendbuf(:,:,:,:) = pvar(mesh%IGMIN:mesh%IGMAX, &
924 mesh%JMIN:mesh%JMIN+mesh%GJNUM-1,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM)
926 CALL mpi_sendrecv(this%Boundary(south)%p%sendbuf, &
927 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
928 default_mpi_real,mesh%neighbor(south),10+south,this%Boundary(north)%p%recvbuf, &
929 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
930 default_mpi_real,mesh%neighbor(north),mpi_any_tag,mesh%comm_cart,status,ierr)
931 IF (mesh%neighbor(north).NE.mpi_proc_null)
THEN 932 pvar(mesh%IGMIN:mesh%IGMAX,mesh%JMAX+1:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM) = &
933 this%Boundary(north)%p%recvbuf(:,:,:,:)
937 CALL mpi_irecv(this%Boundary(north)%p%recvbuf, &
938 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
941 IF (mesh%neighbor(south).NE.mpi_proc_null)
THEN 942 this%Boundary(south)%p%sendbuf(:,:,:,:) = pvar(mesh%IGMIN:mesh%IGMAX, &
943 mesh%JMIN:mesh%JMIN+mesh%GJNUM-1,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM)
946 CALL mpi_issend(this%Boundary(south)%p%sendbuf, &
947 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
950 #ifdef MPI_USE_SENDRECV 952 IF (mesh%neighbor(north).NE.mpi_proc_null)
THEN 953 this%Boundary(north)%p%sendbuf(:,:,:,:) = pvar(mesh%IGMIN:mesh%IGMAX, &
954 mesh%JMAX-mesh%GJNUM+1:mesh%JMAX,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM)
956 CALL mpi_sendrecv(this%Boundary(north)%p%sendbuf, &
957 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
958 default_mpi_real,mesh%neighbor(north),10+north,this%Boundary(south)%p%recvbuf, &
959 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
960 default_mpi_real,mesh%neighbor(south),mpi_any_tag,mesh%comm_cart,status,ierr)
961 IF (mesh%neighbor(south).NE.mpi_proc_null)
THEN 962 pvar(mesh%IGMIN:mesh%IGMAX,mesh%JGMIN:mesh%JMIN-1,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM) = &
963 this%Boundary(south)%p%recvbuf(:,:,:,:)
967 CALL mpi_irecv(this%Boundary(south)%p%recvbuf, &
968 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
971 IF (mesh%neighbor(north).NE.mpi_proc_null)
THEN 972 this%Boundary(north)%p%sendbuf(:,:,:,:) = pvar(mesh%IGMIN:mesh%IGMAX, &
973 mesh%JMAX-mesh%GJNUM+1:mesh%JMAX,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM)
976 CALL mpi_issend(this%Boundary(north)%p%sendbuf, &
977 mesh%GJNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%KGMAX-mesh%KGMIN+1)*physics%VNUM, &
980 #ifndef MPI_USE_SENDRECV 982 CALL mpi_waitall(4,req,status,ierr)
983 IF (mesh%neighbor(south).NE.mpi_proc_null)
THEN 984 pvar(mesh%IGMIN:mesh%IGMAX,mesh%JGMIN:mesh%JMIN-1,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM) = &
985 this%Boundary(south)%p%recvbuf(:,:,:,:)
987 IF (mesh%neighbor(north).NE.mpi_proc_null)
THEN 988 pvar(mesh%IGMIN:mesh%IGMAX,mesh%JMAX+1:mesh%JGMAX,mesh%KGMIN:mesh%KGMAX,1:physics%VNUM) = &
989 this%Boundary(north)%p%recvbuf(:,:,:,:)
994 #ifdef MPI_USE_SENDRECV 996 IF (mesh%neighbor(bottom).NE.mpi_proc_null)
THEN 997 this%Boundary(bottom)%p%sendbuf(:,:,:,:) = pvar(mesh%IGMIN:mesh%IGMAX, &
998 mesh%JGMIN:mesh%JGMAX,mesh%KMIN:mesh%KMIN+mesh%GKNUM-1,1:physics%VNUM)
1000 CALL mpi_sendrecv(this%Boundary(bottom)%p%sendbuf,&
1001 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
1002 default_mpi_real,mesh%neighbor(bottom),10+bottom,this%Boundary(top)%p%recvbuf, &
1003 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
1004 default_mpi_real,mesh%neighbor(top),mpi_any_tag,mesh%comm_cart,status,ierr)
1005 IF (mesh%neighbor(top).NE.mpi_proc_null)
THEN 1006 pvar(mesh%IGMIN:mesh%IGMAX,mesh%JGMIN:mesh%JGMAX,mesh%KMAX+1:mesh%KGMAX,1:physics%VNUM) = &
1007 this%Boundary(top)%p%recvbuf(:,:,:,:)
1011 CALL mpi_irecv(this%Boundary(top)%p%recvbuf, &
1012 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
1015 IF (mesh%neighbor(bottom).NE.mpi_proc_null)
THEN 1016 this%Boundary(bottom)%p%sendbuf(:,:,:,:) = pvar(mesh%IGMIN:mesh%IGMAX, &
1017 mesh%JGMIN:mesh%JGMAX,mesh%KMIN:mesh%KMIN+mesh%GKNUM-1,1:physics%VNUM)
1020 CALL mpi_issend(this%Boundary(bottom)%p%sendbuf, &
1021 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
1022 default_mpi_real,mesh%neighbor(bottom),10+bottom,mesh%comm_cart,req(2),ierr)
1024 #ifdef MPI_USE_SENDRECV 1026 IF (mesh%neighbor(top).NE.mpi_proc_null)
THEN 1027 this%Boundary(top)%p%sendbuf(:,:,:,:) = pvar(mesh%IGMIN:mesh%IGMAX, &
1028 mesh%JGMIN:mesh%JGMAX,mesh%KMAX-mesh%GKNUM+1:mesh%KMAX,1:physics%VNUM)
1030 CALL mpi_sendrecv(this%Boundary(top)%p%sendbuf, &
1031 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
1032 default_mpi_real,mesh%neighbor(top),10+top,this%Boundary(bottom)%p%recvbuf, &
1033 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
1034 default_mpi_real,mesh%neighbor(bottom),mpi_any_tag,mesh%comm_cart,status,ierr)
1035 IF (mesh%neighbor(bottom).NE.mpi_proc_null)
THEN 1036 pvar(mesh%IGMIN:mesh%IGMAX,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KMIN-1,1:physics%VNUM) = &
1037 this%Boundary(bottom)%p%recvbuf(:,:,:,:)
1041 CALL mpi_irecv(this%Boundary(bottom)%p%recvbuf, &
1042 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
1045 IF (mesh%neighbor(top).NE.mpi_proc_null)
THEN 1046 this%Boundary(top)%p%sendbuf(:,:,:,:) = pvar(mesh%IGMIN:mesh%IGMAX, &
1047 mesh%JGMIN:mesh%JGMAX,mesh%KMAX-mesh%GKNUM+1:mesh%KMAX,1:physics%VNUM)
1050 CALL mpi_issend(this%Boundary(top)%p%sendbuf, &
1051 mesh%GKNUM*(mesh%IGMAX-mesh%IGMIN+1)*(mesh%JGMAX-mesh%JGMIN+1)*physics%VNUM, &
1054 #ifndef MPI_USE_SENDRECV 1056 CALL mpi_waitall(4,req,status,ierr)
1057 IF (mesh%neighbor(bottom).NE.mpi_proc_null)
THEN 1058 pvar(mesh%IGMIN:mesh%IGMAX,mesh%JGMIN:mesh%JGMAX,mesh%KGMIN:mesh%KMIN-1,1:physics%VNUM) = &
1059 this%Boundary(bottom)%p%recvbuf(:,:,:,:)
1061 IF (mesh%neighbor(top).NE.mpi_proc_null)
THEN 1062 pvar(mesh%IGMIN:mesh%IGMAX,mesh%JGMIN:mesh%JGMAX,mesh%KMAX+1:mesh%KGMAX,1:physics%VNUM) = &
1063 this%Boundary(top)%p%recvbuf(:,:,:,:)
1081 DEALLOCATE(
this%boundary(dir)%p%sendbuf,
this%boundary(dir)%p%recvbuf)
subroutine finalize(this)
Destructor of common class.
integer, save default_mpi_real
default real type for MPI
Boundary module for reflecting boundaries.
type(logging_base), save this
derived class for compound of mesh arrays
subroutine initboundary(this, Mesh, Physics, bctype, bcname, dir, config)
Boundary module for noslip conditions (see wikipedia )
subroutine initboundary_mpi(this, Mesh, Physics, periods)
initializes the MPI communication
subroutine, public new_boundary(Boundary, Mesh, Physics, config, IO)
Boundary module for the inner boundaries (only necessary in parallel runs)
Boundary module for reflecting boundaries.
subroutine mpiboundarycommunication(this, Mesh, Physics, pvar)
Handles the MPI communication of the inner (and physical periodic) boundaries.
Boundary module for absorbing (non-reflecting) conditions.
named integer constants for flavour of state vectors
Dictionary for generic data types.
subroutine setcorneredges(this, Mesh, Physics, pvar)
Calculates the corner in 2D and the corners and edges in 3D.
integer, parameter none
periodic with shear for shearing sheet/box
Boundary module for axis boundaries.
subroutine, private centerboundary(this, Mesh, Physics, time, pvar, cvar)
Sets boundaries in all directions.
Boundary module for periodic boundary conditions.
Boundary module for a shearingsheet/shearingbox. (see e.g. the standard run )
Boundary module for custom conditions.
Boundary module for fixed in/outflow conditions.