Skip to content

Commit 2e42cc7

Browse files
committed
boundary conditions refactor and MPI fix for elliptic smoothing
1 parent a0ed080 commit 2e42cc7

File tree

12 files changed

+89
-303
lines changed

12 files changed

+89
-303
lines changed

src/simulation/m_boundary_conditions.fpp renamed to src/common/m_boundary_conditions.fpp

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ module m_boundary_conditions
1616

1717
implicit none
1818

19-
private;
20-
public :: s_populate_variables_buffers, &
21-
s_populate_capillary_buffers
19+
#ifdef MFC_SIMULATION
20+
private; public :: s_populate_variables_buffers, s_populate_capillary_buffers
21+
#else
22+
private; public :: s_populate_variables_buffers
23+
#endif
2224

2325
contains
2426

@@ -28,7 +30,8 @@ contains
2830
subroutine s_populate_variables_buffers(q_prim_vf, pb, mv)
2931

3032
type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf
31-
real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv
33+
34+
real(wp), optional, dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: pb, mv
3235

3336
integer :: bc_loc, bc_dir
3437

@@ -66,6 +69,7 @@ contains
6669
q_prim_vf, pb, mv, 1, 1)
6770
end select
6871

72+
#ifdef MFC_SIMULATION
6973
if (qbmm .and. .not. polytropic) then
7074
select case (bc_x%beg)
7175
case (-13:-3) ! Ghost-cell extrap. BC at beginning
@@ -85,8 +89,7 @@ contains
8589
call s_qbmm_extrapolation(pb, mv, 1, 1)
8690
end select
8791
end if
88-
89-
! END: Population of Buffers in x-direction
92+
#endif
9093

9194
! Population of Buffers in y-direction
9295

@@ -126,8 +129,8 @@ contains
126129
q_prim_vf, pb, mv, 2, 1)
127130
end select
128131

132+
#ifdef MFC_SIMULATION
129133
if (qbmm .and. .not. polytropic) then
130-
131134
select case (bc_y%beg)
132135
case (-13:-3) ! Ghost-cell extrap. BC at beginning
133136
call s_qbmm_extrapolation(pb, mv, 2, -1)
@@ -145,10 +148,8 @@ contains
145148
case (-16) ! No-slip wall BC at end
146149
call s_qbmm_extrapolation(pb, mv, 2, 1)
147150
end select
148-
149151
end if
150-
151-
! END: Population of Buffers in y-direction
152+
#endif
152153

153154
! Population of Buffers in z-direction
154155

@@ -186,8 +187,8 @@ contains
186187
q_prim_vf, pb, mv, 3, 1)
187188
end select
188189

190+
#ifdef MFC_SIMULATION
189191
if (qbmm .and. .not. polytropic) then
190-
191192
select case (bc_z%beg)
192193
case (-13:-3) ! Ghost-cell extrap. BC at beginning
193194
call s_qbmm_extrapolation(pb, mv, 3, -1)
@@ -205,17 +206,16 @@ contains
205206
case (-16) ! No-slip wall BC at end
206207
call s_qbmm_extrapolation(pb, mv, 3, 1)
207208
end select
208-
209209
end if
210-
210+
#endif
211211
! END: Population of Buffers in z-direction
212212

213213
end subroutine s_populate_variables_buffers
214214

215215
subroutine s_ghost_cell_extrapolation(q_prim_vf, pb, mv, bc_dir, bc_loc)
216216

217217
type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf
218-
real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv
218+
real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: pb, mv
219219
integer, intent(in) :: bc_dir, bc_loc
220220
integer :: j, k, l, q, i
221221

@@ -325,7 +325,7 @@ contains
325325
subroutine s_symmetry(q_prim_vf, pb, mv, bc_dir, bc_loc)
326326

327327
type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf
328-
real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv
328+
real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: pb, mv
329329
integer, intent(in) :: bc_dir, bc_loc
330330

331331
integer :: j, k, l, q, i
@@ -362,7 +362,7 @@ contains
362362
end do
363363
end do
364364
end do
365-
365+
#ifdef MFC_SIMULATION
366366
if (qbmm .and. .not. polytropic) then
367367
!$acc parallel loop collapse(5) gang vector default(present)
368368
do i = 1, nb
@@ -380,6 +380,7 @@ contains
380380
end do
381381
end do
382382
end if
383+
#endif
383384

384385
else !< bc_x%end
385386

@@ -411,7 +412,7 @@ contains
411412
end do
412413
end do
413414
end do
414-
415+
#ifdef MFC_SIMULATION
415416
if (qbmm .and. .not. polytropic) then
416417
!$acc parallel loop collapse(5) gang vector default(present)
417418
do i = 1, nb
@@ -429,7 +430,7 @@ contains
429430
end do
430431
end do
431432
end if
432-
433+
#endif
433434
end if
434435

435436
!< y-direction
@@ -463,7 +464,7 @@ contains
463464
end do
464465
end do
465466
end do
466-
467+
#ifdef MFC_SIMULATION
467468
if (qbmm .and. .not. polytropic) then
468469
!$acc parallel loop collapse(5) gang vector default(present)
469470
do i = 1, nb
@@ -481,7 +482,7 @@ contains
481482
end do
482483
end do
483484
end if
484-
485+
#endif
485486
else !< bc_y%end
486487

487488
!$acc parallel loop collapse(3) gang vector default(present)
@@ -510,7 +511,7 @@ contains
510511
end do
511512
end do
512513
end do
513-
514+
#ifdef MFC_SIMULATION
514515
if (qbmm .and. .not. polytropic) then
515516
!$acc parallel loop collapse(5) gang vector default(present)
516517
do i = 1, nb
@@ -528,7 +529,7 @@ contains
528529
end do
529530
end do
530531
end if
531-
532+
#endif
532533
end if
533534

534535
!< z-direction
@@ -562,7 +563,7 @@ contains
562563
end do
563564
end do
564565
end do
565-
566+
#ifdef MFC_SIMULATION
566567
if (qbmm .and. .not. polytropic) then
567568
!$acc parallel loop collapse(5) gang vector default(present)
568569
do i = 1, nb
@@ -580,7 +581,7 @@ contains
580581
end do
581582
end do
582583
end if
583-
584+
#endif
584585
else !< bc_z%end
585586

586587
!$acc parallel loop collapse(3) gang vector default(present)
@@ -609,7 +610,7 @@ contains
609610
end do
610611
end do
611612
end do
612-
613+
#ifdef MFC_SIMULATION
613614
if (qbmm .and. .not. polytropic) then
614615
!$acc parallel loop collapse(5) gang vector default(present)
615616
do i = 1, nb
@@ -627,7 +628,7 @@ contains
627628
end do
628629
end do
629630
end if
630-
631+
#endif
631632
end if
632633

633634
end if
@@ -637,7 +638,7 @@ contains
637638
subroutine s_periodic(q_prim_vf, pb, mv, bc_dir, bc_loc)
638639

639640
type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf
640-
real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv
641+
real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: pb, mv
641642
integer, intent(in) :: bc_dir, bc_loc
642643

643644
integer :: j, k, l, q, i
@@ -658,7 +659,7 @@ contains
658659
end do
659660
end do
660661
end do
661-
662+
#ifdef MFC_SIMULATION
662663
if (qbmm .and. .not. polytropic) then
663664
!$acc parallel loop collapse(5) gang vector default(present)
664665
do i = 1, nb
@@ -676,7 +677,7 @@ contains
676677
end do
677678
end do
678679
end if
679-
680+
#endif
680681
else !< bc_x%end
681682

682683
!$acc parallel loop collapse(4) gang vector default(present)
@@ -690,7 +691,7 @@ contains
690691
end do
691692
end do
692693
end do
693-
694+
#ifdef MFC_SIMULATION
694695
if (qbmm .and. .not. polytropic) then
695696
!$acc parallel loop collapse(5) gang vector default(present)
696697
do i = 1, nb
@@ -708,7 +709,7 @@ contains
708709
end do
709710
end do
710711
end if
711-
712+
#endif
712713
end if
713714

714715
!< y-direction
@@ -727,7 +728,7 @@ contains
727728
end do
728729
end do
729730
end do
730-
731+
#ifdef MFC_SIMULATION
731732
if (qbmm .and. .not. polytropic) then
732733
!$acc parallel loop collapse(4) gang vector default(present)
733734
do i = 1, nb
@@ -745,7 +746,7 @@ contains
745746
end do
746747
end do
747748
end if
748-
749+
#endif
749750
else !< bc_y%end
750751

751752
!$acc parallel loop collapse(4) gang vector default(present)
@@ -759,7 +760,7 @@ contains
759760
end do
760761
end do
761762
end do
762-
763+
#ifdef MFC_SIMULATION
763764
if (qbmm .and. .not. polytropic) then
764765
!$acc parallel loop collapse(5) gang vector default(present)
765766
do i = 1, nb
@@ -777,7 +778,7 @@ contains
777778
end do
778779
end do
779780
end if
780-
781+
#endif
781782
end if
782783

783784
!< z-direction
@@ -796,7 +797,7 @@ contains
796797
end do
797798
end do
798799
end do
799-
800+
#ifdef MFC_SIMULATION
800801
if (qbmm .and. .not. polytropic) then
801802
!$acc parallel loop collapse(5) gang vector default(present)
802803
do i = 1, nb
@@ -814,7 +815,7 @@ contains
814815
end do
815816
end do
816817
end if
817-
818+
#endif
818819
else !< bc_z%end
819820

820821
!$acc parallel loop collapse(4) gang vector default(present)
@@ -828,7 +829,7 @@ contains
828829
end do
829830
end do
830831
end do
831-
832+
#ifdef MFC_SIMULATION
832833
if (qbmm .and. .not. polytropic) then
833834
!$acc parallel loop collapse(5) gang vector default(present)
834835
do i = 1, nb
@@ -846,7 +847,7 @@ contains
846847
end do
847848
end do
848849
end if
849-
850+
#endif
850851
end if
851852

852853
end if
@@ -856,7 +857,7 @@ contains
856857
subroutine s_axis(q_prim_vf, pb, mv, bc_dir, bc_loc)
857858

858859
type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf
859-
real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv
860+
real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: pb, mv
860861
integer, intent(in) :: bc_dir, bc_loc
861862

862863
integer :: j, k, l, q, i
@@ -905,7 +906,7 @@ contains
905906
end do
906907
end do
907908
end do
908-
909+
#ifdef MFC_SIMULATION
909910
if (qbmm .and. .not. polytropic) then
910911
!$acc parallel loop collapse(5) gang vector default(present)
911912
do i = 1, nb
@@ -923,13 +924,13 @@ contains
923924
end do
924925
end do
925926
end if
926-
927+
#endif
927928
end subroutine s_axis
928929

929930
subroutine s_slip_wall(q_prim_vf, pb, mv, bc_dir, bc_loc)
930931

931932
type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf
932-
real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv
933+
real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: pb, mv
933934
integer, intent(in) :: bc_dir, bc_loc
934935

935936
integer :: j, k, l, q, i
@@ -1070,7 +1071,7 @@ contains
10701071
subroutine s_no_slip_wall(q_prim_vf, pb, mv, bc_dir, bc_loc)
10711072

10721073
type(scalar_field), dimension(sys_size), intent(inout) :: q_prim_vf
1073-
real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv
1074+
real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: pb, mv
10741075
integer, intent(in) :: bc_dir, bc_loc
10751076

10761077
integer :: j, k, l, q, i
@@ -1246,7 +1247,7 @@ contains
12461247

12471248
subroutine s_qbmm_extrapolation(pb, mv, bc_dir, bc_loc)
12481249

1249-
real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, mv
1250+
real(wp), dimension(idwbuff(1)%beg:, idwbuff(2)%beg:, idwbuff(3)%beg:, 1:, 1:), intent(inout) :: pb, mv
12501251
integer, intent(in) :: bc_dir, bc_loc
12511252

12521253
integer :: j, k, l, q, i
@@ -1378,6 +1379,7 @@ contains
13781379

13791380
end subroutine s_qbmm_extrapolation
13801381

1382+
#ifdef MFC_SIMULATION
13811383
subroutine s_populate_capillary_buffers(c_divs)
13821384

13831385
type(scalar_field), dimension(num_dims + 1), intent(inout) :: c_divs
@@ -1659,5 +1661,6 @@ contains
16591661
end if
16601662

16611663
end subroutine s_populate_capillary_buffers
1664+
#endif
16621665

16631666
end module m_boundary_conditions

0 commit comments

Comments
 (0)