Skip to content

Commit 6ed4357

Browse files
committed
More pure subroutines and removed some module variables
1 parent 0cdc1e1 commit 6ed4357

File tree

6 files changed

+25
-11
lines changed

6 files changed

+25
-11
lines changed

src/common/m_helper.fpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@ contains
248248
end subroutine s_int_to_str
249249

250250
!> Computes the Simpson weights for quadrature
251-
subroutine s_simpson
251+
subroutine s_simpson(weight, R0)
252+
253+
real(wp), dimension(:), intent(inout) :: weight
254+
real(wp), dimension(:), intent(inout) :: R0
252255

253256
integer :: ir
254257
real(wp) :: R0mn, R0mx, dphi, tmp, sd

src/post_process/m_start_up.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ impure subroutine s_initialize_modules
676676
! needed to properly setup the modules
677677
call s_initialize_global_parameters_module()
678678
if (bubbles_euler .and. nb > 1) then
679-
call s_simpson
679+
call s_simpson(weight, R0)
680680
end if
681681
if (bubbles_euler .and. .not. polytropic) then
682682
call s_initialize_nonpoly()

src/pre_process/m_start_up.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,7 @@ contains
767767
call s_initialize_global_parameters_module()
768768
!Quadrature weights and nodes for polydisperse simulations
769769
if (bubbles_euler .and. nb > 1) then
770-
call s_simpson
770+
call s_simpson(weight, R0)
771771
end if
772772
!Initialize variables for non-polytropic (Preston) model
773773
if (bubbles_euler .and. .not. polytropic) then

src/simulation/m_ibm.fpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ contains
8989

9090
!$acc update host(ib_markers%sf)
9191

92-
call s_find_num_ghost_points()
92+
call s_find_num_ghost_points(num_gps, num_inner_gps)
9393

9494
!$acc update device(num_gps, num_inner_gps)
9595
@:ALLOCATE(ghost_points(1:num_gps))
@@ -342,7 +342,7 @@ contains
342342
!! @param ghost_points Ghost Points
343343
!! @param levelset Closest distance from each grid cell to IB
344344
!! @param levelset_norm Vector pointing in the direction of the closest distance
345-
subroutine s_compute_image_points(ghost_points, levelset, levelset_norm)
345+
impure subroutine s_compute_image_points(ghost_points, levelset, levelset_norm)
346346

347347
type(ghost_point), dimension(num_gps), intent(INOUT) :: ghost_points
348348
type(levelset_field), intent(IN) :: levelset
@@ -426,13 +426,18 @@ contains
426426

427427
!> Function that finds the number of ghost points, used for allocating
428428
!! memory.
429-
subroutine s_find_num_ghost_points()
429+
pure subroutine s_find_num_ghost_points(num_gps, num_inner_gps)
430+
431+
integer, intent(out) :: num_gps
432+
integer, intent(out) :: num_inner_gps
433+
430434
integer, dimension(2*gp_layers + 1, 2*gp_layers + 1) &
431435
:: subsection_2D
432436
integer, dimension(2*gp_layers + 1, 2*gp_layers + 1, 2*gp_layers + 1) &
433437
:: subsection_3D
434438
integer :: i, j, k, l, q !< Iterator variables
435439

440+
436441
num_gps = 0
437442
num_inner_gps = 0
438443

@@ -470,7 +475,7 @@ contains
470475
end subroutine s_find_num_ghost_points
471476

472477
!> Function that finds the ghost points
473-
subroutine s_find_ghost_points(ghost_points, inner_points)
478+
pure subroutine s_find_ghost_points(ghost_points, inner_points)
474479

475480
type(ghost_point), dimension(num_gps), intent(INOUT) :: ghost_points
476481
type(ghost_point), dimension(num_inner_gps), intent(INOUT) :: inner_points
@@ -585,7 +590,7 @@ contains
585590
end subroutine s_find_ghost_points
586591

587592
!> Function that computes the interpolation coefficients of image points
588-
subroutine s_compute_interpolation_coeffs(ghost_points)
593+
pure subroutine s_compute_interpolation_coeffs(ghost_points)
589594

590595
type(ghost_point), dimension(num_gps), intent(INOUT) :: ghost_points
591596

src/simulation/m_start_up.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ contains
14651465
call s_initialize_global_parameters_module()
14661466
!Quadrature weights and nodes for polydisperse simulations
14671467
if (bubbles_euler .and. nb > 1 .and. R0_type == 1) then
1468-
call s_simpson
1468+
call s_simpson(weight, R0)
14691469
end if
14701470
!Initialize variables for non-polytropic (Preston) model
14711471
if (bubbles_euler .and. .not. polytropic) then

src/simulation/m_surface_tension.fpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ module m_surface_tension
4040
type(int_bounds_info) :: is1, is2, is3, iv
4141
!$acc declare create(is1, is2, is3, iv)
4242

43-
integer :: j, k, l, i
4443

4544
contains
4645

4746
impure subroutine s_initialize_surface_tension_module
4847

48+
integer :: j
49+
4950
@:ALLOCATE(c_divs(1:num_dims + 1))
5051

5152
do j = 1, num_dims + 1
@@ -65,7 +66,7 @@ contains
6566
end if
6667
end subroutine s_initialize_surface_tension_module
6768

68-
subroutine s_compute_capilary_source_flux(q_prim_vf, &
69+
pure subroutine s_compute_capilary_source_flux(q_prim_vf, &
6970
vSrc_rsx_vf, vSrc_rsy_vf, vSrc_rsz_vf, &
7071
flux_src_vf, &
7172
id, isx, isy, isz)
@@ -83,6 +84,8 @@ contains
8384
real(wp), dimension(num_dims, num_dims) :: Omega
8485
real(wp) :: w1L, w1R, w2L, w2R, w3L, w3R, w1, w2, w3
8586
real(wp) :: normWL, normWR, normW
87+
integer :: j, k, l, i
88+
8689

8790
if (id == 1) then
8891
!$acc parallel loop collapse(3) gang vector default(present) private(Omega, &
@@ -231,6 +234,8 @@ contains
231234
type(integer_field), dimension(1:num_dims, -1:1), intent(in) :: bc_type
232235

233236
type(int_bounds_info) :: isx, isy, isz
237+
integer :: j, k, l, i
238+
234239

235240
isx%beg = -1; isy%beg = 0; isz%beg = 0
236241

@@ -377,6 +382,7 @@ contains
377382
end subroutine s_reconstruct_cell_boundary_values_capillary
378383

379384
impure subroutine s_finalize_surface_tension_module
385+
integer :: j
380386

381387
do j = 1, num_dims
382388
@:DEALLOCATE(c_divs(j)%sf)

0 commit comments

Comments
 (0)