Skip to content

Commit 0cdc1e1

Browse files
committed
Going through second pass of marking subroutines
1 parent 24d2b65 commit 0cdc1e1

File tree

10 files changed

+52
-51
lines changed

10 files changed

+52
-51
lines changed

src/common/m_checker_common.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ contains
170170

171171
!> Checks constraints on the Immersed Boundaries parameters.
172172
!! Called by s_check_inputs_common for pre-processing and simulation
173-
subroutine s_check_inputs_ibm
173+
impure subroutine s_check_inputs_ibm
174174
@:PROHIBIT(ib .and. n <= 0, "Immersed Boundaries do not work in 1D")
175175
@:PROHIBIT(ib .and. (num_ibs <= 0 .or. num_ibs > num_patches_max), "num_ibs must be between 1 and num_patches_max")
176176
@:PROHIBIT((.not. ib) .and. num_ibs > 0, "num_ibs is set, but ib is not enabled")

src/post_process/m_data_input.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module m_data_input
3535

3636
!> Subroutine for reading data files
3737
!! @param t_step Current time-step to input
38-
subroutine s_read_abstract_data_files(t_step)
38+
impure subroutine s_read_abstract_data_files(t_step)
3939

4040
implicit none
4141

src/pre_process/m_compute_levelset.fpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@ module m_compute_levelset
2323
s_cuboid_levelset, &
2424
s_sphere_levelset
2525

26-
real(wp) :: x_centroid, y_centroid, z_centroid
27-
real(wp) :: length_x, length_y, length_z
28-
real(wp) :: radius
29-
30-
type(bounds_info) :: x_boundary, y_boundary, z_boundary !<
31-
!! These variables combine the centroid and length parameters associated with
32-
!! a particular patch to yield the locations of the patch boundaries in the
33-
!! x-, y- and z-coordinate directions. They are used as a means to concisely
34-
!! perform the actions necessary to lay out a particular patch on the grid.
35-
3626
contains
3727

3828
pure subroutine s_circle_levelset(levelset, levelset_norm, ib_patch_id)
@@ -165,6 +155,8 @@ contains
165155
real(wp) :: x_centroid, y_centroid, z_centroid, lz, z_max, z_min, x_act, y_act, theta
166156
real(wp), dimension(3) :: dist_vec
167157

158+
real(wp) :: length_z
159+
168160
integer :: i, j, k, l !< Loop index variables
169161

170162
x_centroid = patch_ib(ib_patch_id)%x_centroid
@@ -256,7 +248,7 @@ contains
256248
end subroutine s_3D_airfoil_levelset
257249

258250
!> Initialize IBM module
259-
subroutine s_rectangle_levelset(levelset, levelset_norm, ib_patch_id)
251+
pure subroutine s_rectangle_levelset(levelset, levelset_norm, ib_patch_id)
260252

261253
type(levelset_field), intent(INOUT) :: levelset
262254
type(levelset_norm_field), intent(INOUT) :: levelset_norm
@@ -266,6 +258,9 @@ contains
266258
real(wp) :: x, y, min_dist
267259
real(wp) :: side_dists(4)
268260

261+
real(wp) :: x_centroid, y_centroid
262+
real(wp) :: length_x, length_y
263+
269264
integer :: i, j, k !< Loop index variables
270265
integer :: idx !< Shortest path direction indicator
271266

@@ -350,7 +345,7 @@ contains
350345

351346
end subroutine s_rectangle_levelset
352347

353-
subroutine s_cuboid_levelset(levelset, levelset_norm, ib_patch_id)
348+
pure subroutine s_cuboid_levelset(levelset, levelset_norm, ib_patch_id)
354349

355350
type(levelset_field), intent(INOUT) :: levelset
356351
type(levelset_norm_field), intent(INOUT) :: levelset_norm
@@ -359,6 +354,9 @@ contains
359354
real(wp) :: Right, Left, Bottom, Top, Front, Back
360355
real(wp) :: x, y, z, min_dist
361356
real(wp) :: side_dists(6)
357+
358+
real(wp) :: x_centroid, y_centroid, z_centroid
359+
real(wp) :: length_x, length_y, length_z
362360

363361
integer :: i, j, k !< Loop index variables
364362

src/pre_process/m_grid.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module m_grid
3535

3636
abstract interface
3737

38-
subroutine s_generate_abstract_grid
38+
impure subroutine s_generate_abstract_grid
3939

4040
end subroutine s_generate_abstract_grid
4141

src/pre_process/m_initial_condition.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ contains
173173
!! on the grid using the primitive variables included with
174174
!! the patch parameters. The subroutine is complete once the
175175
!! primitive variables are converted to conservative ones.
176-
subroutine s_generate_initial_condition
176+
impure subroutine s_generate_initial_condition
177177

178178
integer :: i !< Generic loop operator
179179

src/pre_process/m_start_up.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ module m_start_up
7676

7777
abstract interface
7878

79-
subroutine s_read_abstract_grid_data_files
79+
impure subroutine s_read_abstract_grid_data_files
8080

8181
end subroutine s_read_abstract_grid_data_files
8282

8383
!! @param q_cons_vf Conservative variables
8484
!! @param ib_markers track if a cell is within the immersed boundary
85-
subroutine s_read_abstract_ic_data_files(q_cons_vf, ib_markers)
85+
impure subroutine s_read_abstract_ic_data_files(q_cons_vf, ib_markers)
8686

8787
import :: scalar_field, integer_field, sys_size, pres_field
8888

src/simulation/m_bubbles.fpp

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -314,11 +314,13 @@ contains
314314
!> Subroutine that computes bubble wall properties for vapor bubbles
315315
!! @param pb Internal bubble pressure
316316
!! @param iR0 Current bubble size index
317-
subroutine s_bwproperty(pb, iR0)
317+
pure elemental subroutine s_bwproperty(pb, iR0, chi_vw, k_mw, rho_mw)
318318
!$acc routine seq
319319
real(wp), intent(in) :: pb
320320
integer, intent(in) :: iR0
321-
321+
real(wp), intent(out) :: chi_vw !< Bubble wall properties (Ando 2010)
322+
real(wp), intent(out) :: k_mw !< Bubble wall properties (Ando 2010)
323+
real(wp), intent(out) :: rho_mw !< Bubble wall properties (Ando 2010)
322324
real(wp) :: x_vw
323325

324326
! mass fraction of vapor
@@ -342,21 +344,21 @@ contains
342344
!! @param fbeta_c Mass transfer coefficient (EL)
343345
!! @param fR_m Mixture gas constant (EL)
344346
!! @param fgamma_m Mixture gamma (EL)
345-
function f_vflux(fR, fV, fpb, fmass_v, iR0, fmass_n, fbeta_c, fR_m, fgamma_m)
347+
pure elemental subroutine s_vflux(fR, fV, fpb, fmass_v, iR0, vflux, fmass_n, fbeta_c, fR_m, fgamma_m)
346348
!$acc routine seq
347349
real(wp), intent(in) :: fR
348350
real(wp), intent(in) :: fV
349351
real(wp), intent(in) :: fpb
350352
real(wp), intent(in) :: fmass_v
351353
integer, intent(in) :: iR0
354+
real(wp), intent(out) :: vflux
352355
real(wp), intent(in), optional :: fmass_n, fbeta_c
353356
real(wp), intent(out), optional :: fR_m, fgamma_m
354357

355358
real(wp) :: chi_bar
356359
real(wp) :: rho_mw_lag
357360
real(wp) :: grad_chi
358361
real(wp) :: conc_v
359-
real(wp) :: f_vflux
360362

361363
if (thermal == 3) then !transfer
362364
! constant transfer model
@@ -373,21 +375,21 @@ contains
373375
chi_bar = fmass_v/(fmass_v + fmass_n)
374376
grad_chi = (chi_bar - conc_v)
375377
rho_mw_lag = (fmass_n + fmass_v)/(4._wp/3._wp*pi*fR**3._wp)
376-
f_vflux = 0._wp
378+
vflux = 0._wp
377379
if (lag_params%massTransfer_model) then
378-
f_vflux = -fbeta_c*rho_mw_lag*grad_chi/(1._wp - conc_v)/fR
380+
vflux = -fbeta_c*rho_mw_lag*grad_chi/(1._wp - conc_v)/fR
379381
end if
380382
else
381383
chi_bar = fmass_v/(fmass_v + mass_n0(iR0))
382384
grad_chi = -Re_trans_c(iR0)*(chi_bar - chi_vw)
383-
f_vflux = rho_mw*grad_chi/Pe_c/(1._wp - chi_vw)/fR
385+
vflux = rho_mw*grad_chi/Pe_c/(1._wp - chi_vw)/fR
384386
end if
385387
else
386388
! polytropic
387-
f_vflux = pv*fV/(R_v*Tw)
389+
vflux = pv*fV/(R_v*Tw)
388390
end if
389391

390-
end function f_vflux
392+
end subroutine s_vflux
391393

392394
!> Function that computes the time derivative of
393395
!! the internal bubble pressure
@@ -457,7 +459,7 @@ contains
457459
!! @param fbeta_t Heat transfer coefficient (EL)
458460
!! @param fCson Speed of sound (EL)
459461
!! @param adap_dt_stop Fail-safe exit if max iteration count reached
460-
subroutine s_advance_step(fRho, fP, fR, fV, fR0, fpb, fpbdot, alf, &
462+
pure subroutine s_advance_step(fRho, fP, fR, fV, fR0, fpb, fpbdot, alf, &
461463
fntait, fBtait, f_bub_adv_src, f_divu, &
462464
bub_id, fmass_v, fmass_n, fbeta_c, &
463465
fbeta_t, fCson, adap_dt_stop)
@@ -676,7 +678,7 @@ contains
676678
!! @param myV_tmp Bubble radial velocity at each stage
677679
!! @param myPb_tmp Internal bubble pressure at each stage (EL)
678680
!! @param myMv_tmp Mass of vapor in the bubble at each stage (EL)
679-
subroutine s_advance_substep(err, fRho, fP, fR, fV, fR0, fpb, fpbdot, alf, &
681+
pure subroutine s_advance_substep(err, fRho, fP, fR, fV, fR0, fpb, fpbdot, alf, &
680682
fntait, fBtait, f_bub_adv_src, f_divu, &
681683
bub_id, fmass_v, fmass_n, fbeta_c, &
682684
fbeta_t, fCson, h, &
@@ -705,8 +707,8 @@ contains
705707
if (bubbles_lagrange) then
706708
myPb_tmp(1) = fpb
707709
myMv_tmp(1) = fmass_v
708-
mydMvdt_tmp(1) = f_advance_EL(myR_tmp(1), myV_tmp(1), myPb_tmp(1), myMv_tmp(1), bub_id, &
709-
fmass_n, fbeta_c, fbeta_t, mydPbdt_tmp(1))
710+
call s_advance_EL(myR_tmp(1), myV_tmp(1), myPb_tmp(1), myMv_tmp(1), bub_id, &
711+
fmass_n, fbeta_c, fbeta_t, mydPbdt_tmp(1), mydMvdt_tmp(1))
710712
end if
711713
myA_tmp(1) = f_rddot(fRho, fP, myR_tmp(1), myV_tmp(1), fR0, &
712714
myPb_tmp(1), mydPbdt_tmp(1), alf, fntait, fBtait, &
@@ -719,8 +721,8 @@ contains
719721
if (bubbles_lagrange) then
720722
myPb_tmp(2) = myPb_tmp(1) + h*mydPbdt_tmp(1)
721723
myMv_tmp(2) = myMv_tmp(1) + h*mydMvdt_tmp(1)
722-
mydMvdt_tmp(2) = f_advance_EL(myR_tmp(2), myV_tmp(2), myPb_tmp(2), myMv_tmp(2), &
723-
bub_id, fmass_n, fbeta_c, fbeta_t, mydPbdt_tmp(2))
724+
call s_advance_EL(myR_tmp(2), myV_tmp(2), myPb_tmp(2), myMv_tmp(2), &
725+
bub_id, fmass_n, fbeta_c, fbeta_t, mydPbdt_tmp(2), mydMvdt_tmp(2))
724726
end if
725727
myA_tmp(2) = f_rddot(fRho, fP, myR_tmp(2), myV_tmp(2), fR0, &
726728
myPb_tmp(2), mydPbdt_tmp(2), alf, fntait, fBtait, &
@@ -733,8 +735,8 @@ contains
733735
if (bubbles_lagrange) then
734736
myPb_tmp(3) = myPb_tmp(1) + (h/4._wp)*(mydPbdt_tmp(1) + mydPbdt_tmp(2))
735737
myMv_tmp(3) = myMv_tmp(1) + (h/4._wp)*(mydMvdt_tmp(1) + mydMvdt_tmp(2))
736-
mydMvdt_tmp(3) = f_advance_EL(myR_tmp(3), myV_tmp(3), myPb_tmp(3), myMv_tmp(3), &
737-
bub_id, fmass_n, fbeta_c, fbeta_t, mydPbdt_tmp(3))
738+
call s_advance_EL(myR_tmp(3), myV_tmp(3), myPb_tmp(3), myMv_tmp(3), &
739+
bub_id, fmass_n, fbeta_c, fbeta_t, mydPbdt_tmp(3), mydMvdt_tmp(3))
738740
end if
739741
myA_tmp(3) = f_rddot(fRho, fP, myR_tmp(3), myV_tmp(3), fR0, &
740742
myPb_tmp(3), mydPbdt_tmp(3), alf, fntait, fBtait, &
@@ -747,8 +749,8 @@ contains
747749
if (bubbles_lagrange) then
748750
myPb_tmp(4) = myPb_tmp(1) + (h/6._wp)*(mydPbdt_tmp(1) + mydPbdt_tmp(2) + 4._wp*mydPbdt_tmp(3))
749751
myMv_tmp(4) = myMv_tmp(1) + (h/6._wp)*(mydMvdt_tmp(1) + mydMvdt_tmp(2) + 4._wp*mydMvdt_tmp(3))
750-
mydMvdt_tmp(4) = f_advance_EL(myR_tmp(4), myV_tmp(4), myPb_tmp(4), myMv_tmp(4), &
751-
bub_id, fmass_n, fbeta_c, fbeta_t, mydPbdt_tmp(4))
752+
call s_advance_EL(myR_tmp(4), myV_tmp(4), myPb_tmp(4), myMv_tmp(4), &
753+
bub_id, fmass_n, fbeta_c, fbeta_t, mydPbdt_tmp(4), mydMvdt_tmp(4))
752754
end if
753755
myA_tmp(4) = f_rddot(fRho, fP, myR_tmp(4), myV_tmp(4), fR0, &
754756
myPb_tmp(4), mydPbdt_tmp(4), alf, fntait, fBtait, &
@@ -780,20 +782,20 @@ contains
780782
!! @param fMv_tmp Mass of vapor in the bubble
781783
!! @param fdPbdt_tmp Rate of change of the internal bubble pressure
782784
!! @param fdMvdt_tmp Rate of change of the mass of vapor in the bubble
783-
function f_advance_EL(fR_tmp, fV_tmp, fPb_tmp, fMv_tmp, bub_id, &
784-
fmass_n, fbeta_c, fbeta_t, fdPbdt_tmp)
785+
pure elemental subroutine s_advance_EL(fR_tmp, fV_tmp, fPb_tmp, fMv_tmp, bub_id, &
786+
fmass_n, fbeta_c, fbeta_t, fdPbdt_tmp, advance_EL)
785787
!$acc routine seq
786788
real(wp), intent(IN) :: fR_tmp, fV_tmp, fPb_tmp, fMv_tmp
787789
real(wp), intent(IN) :: fmass_n, fbeta_c, fbeta_t
788790
integer, intent(IN) :: bub_id
789791
real(wp), intent(INOUT) :: fdPbdt_tmp
792+
real(wp), intent(out) :: advance_EL
793+
real(wp) :: fVapFlux, myR_m, mygamma_m
790794

791-
real(wp) :: fVapFlux, f_advance_EL, myR_m, mygamma_m
792-
793-
fVapFlux = f_vflux(fR_tmp, fV_tmp, fPb_tmp, fMv_tmp, bub_id, fmass_n, fbeta_c, myR_m, mygamma_m)
795+
call s_vflux(fR_tmp, fV_tmp, fPb_tmp, fMv_tmp, bub_id, fVapFlux, fmass_n, fbeta_c, myR_m, mygamma_m)
794796
fdPbdt_tmp = f_bpres_dot(fVapFlux, fR_tmp, fV_tmp, fPb_tmp, fMv_tmp, bub_id, fbeta_t, myR_m, mygamma_m)
795-
f_advance_EL = 4._wp*pi*fR_tmp**2._wp*fVapFlux
797+
advance_EL = 4._wp*pi*fR_tmp**2._wp*fVapFlux
796798

797-
end function f_advance_EL
799+
end subroutine s_advance_EL
798800

799801
end module m_bubbles

src/simulation/m_bubbles_EE.fpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,11 @@ contains
9292

9393
end subroutine s_comp_alpha_from_n
9494

95-
subroutine s_compute_bubbles_EE_rhs(idir, q_prim_vf)
95+
pure subroutine s_compute_bubbles_EE_rhs(idir, q_prim_vf, divu)
9696

9797
integer, intent(in) :: idir
9898
type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf
99+
type(scalar_field), intent(inout) :: divu !< matrix for div(u)
99100

100101
integer :: j, k, l
101102

@@ -152,7 +153,7 @@ contains
152153
!! that are needed for the bubble modeling
153154
!! @param q_prim_vf Primitive variables
154155
!! @param q_cons_vf Conservative variables
155-
subroutine s_compute_bubble_EE_source(q_cons_vf, q_prim_vf, t_step, rhs_vf)
156+
impure subroutine s_compute_bubble_EE_source(q_cons_vf, q_prim_vf, t_step, rhs_vf)
156157
type(scalar_field), dimension(sys_size), intent(inout) :: q_cons_vf
157158
type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf
158159
integer, intent(in) :: t_step
@@ -271,8 +272,8 @@ contains
271272
if (.not. polytropic) then
272273
pb = q_prim_vf(ps(q))%sf(j, k, l)
273274
mv = q_prim_vf(ms(q))%sf(j, k, l)
274-
call s_bwproperty(pb, q)
275-
vflux = f_vflux(myR, myV, pb, mv, q)
275+
call s_bwproperty(pb, q, chi_vw, k_mw, rho_mw)
276+
call s_vflux(myR, myV, pb, mv, q, vflux)
276277
pbdot = f_bpres_dot(vflux, myR, myV, pb, mv, q)
277278

278279
bub_p_src(j, k, l, q) = nbub*pbdot

src/simulation/m_bubbles_EL.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ contains
561561
myR0 = bub_R0(k)
562562

563563
! Vapor and heat fluxes
564-
myVapFlux = f_vflux(myR, myV, myPb, myMass_v, k, myMass_n, myBeta_c, myR_m, mygamma_m)
564+
call s_vflux(myR, myV, myPb, myMass_v, k, myVapFlux, myMass_n, myBeta_c, myR_m, mygamma_m)
565565
myPbdot = f_bpres_dot(myVapFlux, myR, myV, myPb, myMass_v, k, myBeta_t, myR_m, mygamma_m)
566566
myMvdot = 4._wp*pi*myR**2._wp*myVapFlux
567567

@@ -1017,7 +1017,7 @@ contains
10171017
!> This subroutine updates the Lagrange variables using the tvd RK time steppers.
10181018
!! The time derivative of the bubble variables must be stored at every stage to avoid precision errors.
10191019
!! @param stage Current tvd RK stage
1020-
subroutine s_update_lagrange_tdv_rk(stage)
1020+
impure subroutine s_update_lagrange_tdv_rk(stage)
10211021

10221022
integer, intent(in) :: stage
10231023

src/simulation/m_rhs.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ contains
838838
! RHS additions for sub-grid bubbles_euler
839839
if (bubbles_euler) then
840840
call nvtxStartRange("RHS-BUBBLES-COMPUTE")
841-
call s_compute_bubbles_EE_rhs(id, q_prim_qp%vf)
841+
call s_compute_bubbles_EE_rhs(id, q_prim_qp%vf, divu)
842842
call nvtxEndRange
843843
end if
844844

0 commit comments

Comments
 (0)