Skip to content

Commit 23bbd4f

Browse files
authored
Fix segfault in 3D cylindrical post-process boundary conditions (#1356)
1 parent cf13fa1 commit 23bbd4f

1 file changed

Lines changed: 29 additions & 24 deletions

File tree

src/common/m_boundary_common.fpp

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ contains
101101
call s_dirichlet(q_prim_vf, 1, -1, k, l)
102102
end select
103103

104-
if (qbmm .and. (.not. polytropic) .and. (bc_type(1, 1)%sf(0, k, l) <= BC_GHOST_EXTRAP)) then
104+
if (qbmm .and. (.not. polytropic) .and. present(pb_in) .and. present(mv_in) .and. (bc_type(1, 1)%sf(0, k, &
105+
& l) <= BC_GHOST_EXTRAP)) then
105106
call s_qbmm_extrapolation(1, -1, k, l, pb_in, mv_in)
106107
end if
107108
end do
@@ -130,7 +131,8 @@ contains
130131
call s_dirichlet(q_prim_vf, 1, 1, k, l)
131132
end select
132133

133-
if (qbmm .and. (.not. polytropic) .and. (bc_type(1, 2)%sf(0, k, l) <= BC_GHOST_EXTRAP)) then
134+
if (qbmm .and. (.not. polytropic) .and. present(pb_in) .and. present(mv_in) .and. (bc_type(1, 2)%sf(0, k, &
135+
& l) <= BC_GHOST_EXTRAP)) then
134136
call s_qbmm_extrapolation(1, 1, k, l, pb_in, mv_in)
135137
end if
136138
end do
@@ -166,8 +168,8 @@ contains
166168
call s_dirichlet(q_prim_vf, 2, -1, k, l)
167169
end select
168170

169-
if (qbmm .and. (.not. polytropic) .and. (bc_type(2, 1)%sf(k, 0, l) <= BC_GHOST_EXTRAP) .and. (bc_type(2, &
170-
& 1)%sf(k, 0, l) /= BC_AXIS)) then
171+
if (qbmm .and. (.not. polytropic) .and. present(pb_in) .and. present(mv_in) .and. (bc_type(2, 1)%sf(k, 0, &
172+
& l) <= BC_GHOST_EXTRAP) .and. (bc_type(2, 1)%sf(k, 0, l) /= BC_AXIS)) then
171173
call s_qbmm_extrapolation(2, -1, k, l, pb_in, mv_in)
172174
end if
173175
end do
@@ -196,7 +198,8 @@ contains
196198
call s_dirichlet(q_prim_vf, 2, 1, k, l)
197199
end select
198200

199-
if (qbmm .and. (.not. polytropic) .and. (bc_type(2, 2)%sf(k, 0, l) <= BC_GHOST_EXTRAP)) then
201+
if (qbmm .and. (.not. polytropic) .and. present(pb_in) .and. present(mv_in) .and. (bc_type(2, 2)%sf(k, 0, &
202+
& l) <= BC_GHOST_EXTRAP)) then
200203
call s_qbmm_extrapolation(2, 1, k, l, pb_in, mv_in)
201204
end if
202205
end do
@@ -231,7 +234,8 @@ contains
231234
call s_dirichlet(q_prim_vf, 3, -1, k, l)
232235
end select
233236

234-
if (qbmm .and. (.not. polytropic) .and. (bc_type(3, 1)%sf(k, l, 0) <= BC_GHOST_EXTRAP)) then
237+
if (qbmm .and. (.not. polytropic) .and. present(pb_in) .and. present(mv_in) .and. (bc_type(3, 1)%sf(k, l, &
238+
& 0) <= BC_GHOST_EXTRAP)) then
235239
call s_qbmm_extrapolation(3, -1, k, l, pb_in, mv_in)
236240
end if
237241
end do
@@ -260,7 +264,8 @@ contains
260264
call s_dirichlet(q_prim_vf, 3, 1, k, l)
261265
end select
262266

263-
if (qbmm .and. (.not. polytropic) .and. (bc_type(3, 2)%sf(k, l, 0) <= BC_GHOST_EXTRAP)) then
267+
if (qbmm .and. (.not. polytropic) .and. present(pb_in) .and. present(mv_in) .and. (bc_type(3, 2)%sf(k, l, &
268+
& 0) <= BC_GHOST_EXTRAP)) then
264269
call s_qbmm_extrapolation(3, 1, k, l, pb_in, mv_in)
265270
end if
266271
end do
@@ -361,7 +366,7 @@ contains
361366
end if
362367
end do
363368

364-
if (qbmm .and. .not. polytropic) then
369+
if (qbmm .and. .not. polytropic .and. present(pb_in) .and. present(mv_in)) then
365370
do i = 1, nb
366371
do q = 1, nnode
367372
do j = 1, buff_size
@@ -394,7 +399,7 @@ contains
394399
q_prim_vf(xibeg)%sf(m + j, k, l) = -q_prim_vf(xibeg)%sf(m - (j - 1), k, l)
395400
end if
396401
end do
397-
if (qbmm .and. .not. polytropic) then
402+
if (qbmm .and. .not. polytropic .and. present(pb_in) .and. present(mv_in)) then
398403
do i = 1, nb
399404
do q = 1, nnode
400405
do j = 1, buff_size
@@ -430,7 +435,7 @@ contains
430435
end if
431436
end do
432437

433-
if (qbmm .and. .not. polytropic) then
438+
if (qbmm .and. .not. polytropic .and. present(pb_in) .and. present(mv_in)) then
434439
do i = 1, nb
435440
do q = 1, nnode
436441
do j = 1, buff_size
@@ -464,7 +469,7 @@ contains
464469
end if
465470
end do
466471

467-
if (qbmm .and. .not. polytropic) then
472+
if (qbmm .and. .not. polytropic .and. present(pb_in) .and. present(mv_in)) then
468473
do i = 1, nb
469474
do q = 1, nnode
470475
do j = 1, buff_size
@@ -500,7 +505,7 @@ contains
500505
end if
501506
end do
502507

503-
if (qbmm .and. .not. polytropic) then
508+
if (qbmm .and. .not. polytropic .and. present(pb_in) .and. present(mv_in)) then
504509
do i = 1, nb
505510
do q = 1, nnode
506511
do j = 1, buff_size
@@ -534,7 +539,7 @@ contains
534539
end if
535540
end do
536541

537-
if (qbmm .and. .not. polytropic) then
542+
if (qbmm .and. .not. polytropic .and. present(pb_in) .and. present(mv_in)) then
538543
do i = 1, nb
539544
do q = 1, nnode
540545
do j = 1, buff_size
@@ -567,7 +572,7 @@ contains
567572
end do
568573
end do
569574

570-
if (qbmm .and. .not. polytropic) then
575+
if (qbmm .and. .not. polytropic .and. present(pb_in) .and. present(mv_in)) then
571576
do i = 1, nb
572577
do q = 1, nnode
573578
do j = 1, buff_size
@@ -584,7 +589,7 @@ contains
584589
end do
585590
end do
586591

587-
if (qbmm .and. .not. polytropic) then
592+
if (qbmm .and. .not. polytropic .and. present(pb_in) .and. present(mv_in)) then
588593
do i = 1, nb
589594
do q = 1, nnode
590595
do j = 1, buff_size
@@ -603,7 +608,7 @@ contains
603608
end do
604609
end do
605610

606-
if (qbmm .and. .not. polytropic) then
611+
if (qbmm .and. .not. polytropic .and. present(pb_in) .and. present(mv_in)) then
607612
do i = 1, nb
608613
do q = 1, nnode
609614
do j = 1, buff_size
@@ -620,7 +625,7 @@ contains
620625
end do
621626
end do
622627

623-
if (qbmm .and. .not. polytropic) then
628+
if (qbmm .and. .not. polytropic .and. present(pb_in) .and. present(mv_in)) then
624629
do i = 1, nb
625630
do q = 1, nnode
626631
do j = 1, buff_size
@@ -639,7 +644,7 @@ contains
639644
end do
640645
end do
641646

642-
if (qbmm .and. .not. polytropic) then
647+
if (qbmm .and. .not. polytropic .and. present(pb_in) .and. present(mv_in)) then
643648
do i = 1, nb
644649
do q = 1, nnode
645650
do j = 1, buff_size
@@ -656,7 +661,7 @@ contains
656661
end do
657662
end do
658663

659-
if (qbmm .and. .not. polytropic) then
664+
if (qbmm .and. .not. polytropic .and. present(pb_in) .and. present(mv_in)) then
660665
do i = 1, nb
661666
do q = 1, nnode
662667
do j = 1, buff_size
@@ -675,10 +680,10 @@ contains
675680
subroutine s_axis(q_prim_vf, pb_in, mv_in, k, l)
676681

677682
$:GPU_ROUTINE(parallelism='[seq]')
678-
type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf
679-
real(stp), dimension(idwbuff(1)%beg:,idwbuff(2)%beg:,idwbuff(3)%beg:,1:,1:), intent(inout) :: pb_in, mv_in
680-
integer, intent(in) :: k, l
681-
integer :: j, q, i
683+
type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf
684+
real(stp), dimension(idwbuff(1)%beg:,idwbuff(2)%beg:,idwbuff(3)%beg:,1:,1:), optional, intent(inout) :: pb_in, mv_in
685+
integer, intent(in) :: k, l
686+
integer :: j, q, i
682687

683688
do j = 1, buff_size
684689
if (z_cc(l) < pi) then
@@ -708,7 +713,7 @@ contains
708713
end if
709714
end do
710715

711-
if (qbmm .and. .not. polytropic) then
716+
if (qbmm .and. .not. polytropic .and. present(pb_in) .and. present(mv_in)) then
712717
do i = 1, nb
713718
do q = 1, nnode
714719
do j = 1, buff_size

0 commit comments

Comments
 (0)