Skip to content

Commit 6eddb7a

Browse files
committed
Removed passing into global parameters
1 parent 40ac592 commit 6eddb7a

File tree

3 files changed

+26
-77
lines changed

3 files changed

+26
-77
lines changed

src/simulation/m_bubbles.fpp

Lines changed: 24 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -38,45 +38,37 @@ contains
3838
!! @param f_bub_adv_src Source for bubble volume fraction
3939
!! @param f_divu Divergence of velocity
4040
!! @param fCson Speed of sound from fP (EL)
41-
!! @param gam_l Physical Bubble parameter (pass in from global parameters)
42-
!! @param Ca_l Cavitation number (pass in from global parameters)
43-
!! @param Web_l Weber number (pass in from global parameters)
44-
!! @param Re_inv_l Inverse Reynolds number (pass in from global parameters)
45-
!! @param bubbles_euler_l Bubbles euler on/off (pass in from global parameters)
46-
!! @param polytropic_l Polytropic switch (pass in from global parameters)
47-
pure elemental function f_rddot(fRho, fP, fR, fV, fR0, fpb, fpbdot, alf, fntait, fBtait, f_bub_adv_src, f_divu, fCson, gam_l, Ca_l, Web_l, Re_inv_l, bubbles_euler_l, polytropic_l)
41+
pure elemental function f_rddot(fRho, fP, fR, fV, fR0, fpb, fpbdot, alf, fntait, fBtait, f_bub_adv_src, f_divu, fCson)
4842
!$acc routine seq
4943
real(wp), intent(in) :: fRho, fP, fR, fV, fR0, fpb, fpbdot, alf
5044
real(wp), intent(in) :: fntait, fBtait, f_bub_adv_src, f_divu
5145
real(wp), intent(in) :: fCson
52-
real(wp), intent(in) :: gam_l, Ca_l, Web_l, Re_inv_l
53-
logical, intent(in) :: bubbles_euler_l, polytropic_l
5446

5547
real(wp) :: fCpbw, fCpinf, fCpinf_dot, fH, fHdot, c_gas, c_liquid
5648
real(wp) :: f_rddot
5749

5850
if (bubble_model == 1) then
5951
! Gilmore bubbles
6052
fCpinf = fP - pref
61-
fCpbw = f_cpbw(fR0, fR, fV, fpb, gam_l, Ca_l, Web_l, Re_inv_l, polytropic_l)
53+
fCpbw = f_cpbw(fR0, fR, fV, fpb)
6254
fH = f_H(fCpbw, fCpinf, fntait, fBtait)
6355
c_gas = f_cgas(fCpinf, fntait, fBtait, fH)
6456
fCpinf_dot = f_cpinfdot(fRho, fP, alf, fntait, fBtait, f_bub_adv_src, f_divu)
65-
fHdot = f_Hdot(fCpbw, fCpinf, fCpinf_dot, fntait, fBtait, fR, fV, fR0, fpbdot, gam_l, Ca_l, Web_l, Re_inv_l, polytropic_l)
66-
f_rddot = f_rddot_G(fCpbw, fR, fV, fH, fHdot, c_gas, fntait, fBtait, Re_inv_l)
57+
fHdot = f_Hdot(fCpbw, fCpinf, fCpinf_dot, fntait, fBtait, fR, fV, fR0, fpbdot)
58+
f_rddot = f_rddot_G(fCpbw, fR, fV, fH, fHdot, c_gas, fntait, fBtait)
6759
else if (bubble_model == 2) then
6860
! Keller-Miksis bubbles
6961
fCpinf = fP
70-
fCpbw = f_cpbw_KM(fR0, fR, fV, fpb, gam_l, Ca_l, Web_l, Re_inv_l, polytropic_l)
71-
if (bubbles_euler_l) then
62+
fCpbw = f_cpbw_KM(fR0, fR, fV, fpb)
63+
if (bubbles_euler) then
7264
c_liquid = sqrt(fntait*(fP + fBtait)/(fRho*(1._wp - alf)))
7365
else
7466
c_liquid = fCson
7567
end if
76-
f_rddot = f_rddot_KM(fpbdot, fCpinf, fCpbw, fRho, fR, fV, fR0, c_liquid, gam_l, Ca_l, Web_l, Re_inv_l, polytropic_l)
68+
f_rddot = f_rddot_KM(fpbdot, fCpinf, fCpbw, fRho, fR, fV, fR0, c_liquid)
7769
else if (bubble_model == 3) then
7870
! Rayleigh-Plesset bubbles
79-
fCpbw = f_cpbw_KM(fR0, fR, fV, fpb, gam_l, Ca_l, Web_l, Re_inv_l, polytropic_l)
71+
fCpbw = f_cpbw_KM(fR0, fR, fV, fpb)
8072
f_rddot = f_rddot_RP(fP, fRho, fR, fV, fR0, fCpbw)
8173
end if
8274

@@ -87,7 +79,7 @@ contains
8779
!! @param fR Current bubble radius
8880
!! @param fV Current bubble velocity
8981
!! @param fpb Internal bubble pressure
90-
function f_cpbw(fR0, fR, fV, fpb)
82+
pure elemental function f_cpbw(fR0, fR, fV, fpb)
9183
!$acc routine seq
9284
real(wp), intent(in) :: fR0, fR, fV, fpb
9385

@@ -179,7 +171,7 @@ contains
179171
!! @param fV Current bubble velocity
180172
!! @param fR0 Equilibrium bubble radius
181173
!! @param fpbdot Time derivative of the internal bubble pressure
182-
function f_Hdot(fCpbw, fCpinf, fCpinf_dot, fntait, fBtait, fR, fV, fR0, fpbdot)
174+
pure elemental function f_Hdot(fCpbw, fCpinf, fCpinf_dot, fntait, fBtait, fR, fV, fR0, fpbdot)
183175
!$acc routine seq
184176
real(wp), intent(in) :: fCpbw, fCpinf, fCpinf_dot, fntait, fBtait
185177
real(wp), intent(in) :: fR, fV, fR0, fpbdot
@@ -238,7 +230,7 @@ contains
238230
!! @param fcgas Current gas sound speed
239231
!! @param fntait Tait EOS parameter
240232
!! @param fBtait Tait EOS parameter
241-
function f_rddot_G(fCpbw, fR, fV, fH, fHdot, fcgas, fntait, fBtait)
233+
pure elemental function f_rddot_G(fCpbw, fR, fV, fH, fHdot, fcgas, fntait, fBtait)
242234
!$acc routine seq
243235
real(wp), intent(in) :: fCpbw, fR, fV, fH, fHdot
244236
real(wp), intent(in) :: fcgas, fntait, fBtait
@@ -261,32 +253,15 @@ contains
261253
!! @param fR Current bubble radius
262254
!! @param fV Current bubble velocity
263255
!! @param fpb Internal bubble pressure
264-
function f_cpbw_KM(fR0, fR, fV, fpb)
256+
pure elemental function f_cpbw_KM(fR0, fR, fV, fpb)
265257
!$acc routine seq
266258
real(wp), intent(in) :: fR0, fR, fV, fpb
267-
<<<<<<< HEAD
268-
real(wp), intent(in) :: gam_l, Ca_l, Web_l, Re_inv_l
269-
logical, intent(in) :: polytropic_l
270-
271-
real(wp) :: f_cpbw_KM
272-
273-
if (polytropic_l) then
274-
f_cpbw_KM = Ca_l*((fR0/fR)**(3._wp*gam_l)) - Ca_l + 1._wp
275-
if (.not. f_is_default(Web_l)) f_cpbw_KM = f_cpbw_KM + &
276-
<<<<<<< HEAD
277-
(2._wp/(Web_l*fR0))*((fR0/fR)**(3._wp*gam_l))
278-
=======
279-
280259
real(wp) :: f_cpbw_KM
281260

282261
if (polytropic) then
283262
f_cpbw_KM = Ca*((fR0/fR)**(3._wp*gam)) - Ca + 1._wp
284263
if (.not. f_is_default(Web)) f_cpbw_KM = f_cpbw_KM + &
285264
(2._wp/(Web*fR0))*((fR0/fR)**(3._wp*gam))
286-
>>>>>>> parent of 1c9d815a (Refactoring functions to not use globals)
287-
=======
288-
(2._wp/(Web_l*fR0))*((fR0/fR)**(3._wp*gam_l))
289-
>>>>>>> parent of 2090b48f (Made bubble functions pure)
290265
else
291266
f_cpbw_KM = fpb
292267
end if
@@ -305,43 +280,17 @@ contains
305280
!! @param fV Current bubble velocity
306281
!! @param fR0 Equilibrium bubble radius
307282
!! @param fC Current sound speed
308-
<<<<<<< HEAD
309-
!! @param gam_l Physical Bubble parameter (pass in from global parameters)
310-
!! @param Ca_l Cavitation number (pass in from global parameters)
311-
!! @param Web_l Weber number (pass in from global parameters)
312-
!! @param Re_inv_l Inverse Reynolds number (pass in from global parameters)
313-
!! @param polytropic_l Polytropic switch (pass in from global parameters)
314-
pure elemental function f_rddot_KM(fpbdot, fCp, fCpbw, fRho, fR, fV, fR0, fC, gam_l, Ca_l, Web_l, Re_inv_l, polytropic_l)
283+
pure elemental function f_rddot_KM(fpbdot, fCp, fCpbw, fRho, fR, fV, fR0, fC)
315284
!$acc routine seq
316285
real(wp), intent(in) :: fpbdot, fCp, fCpbw
317286
real(wp), intent(in) :: fRho, fR, fV, fR0, fC
318-
real(wp), intent(in) :: gam_l, Ca_l, Web_l, Re_inv_l
319-
logical, intent(in) :: polytropic_l
320-
=======
321-
function f_rddot_KM(fpbdot, fCp, fCpbw, fRho, fR, fV, fR0, fC)
322-
!$acc routine seq
323-
real(wp), intent(in) :: fpbdot, fCp, fCpbw
324-
real(wp), intent(in) :: fRho, fR, fV, fR0, fC
325-
>>>>>>> parent of 1c9d815a (Refactoring functions to not use globals)
326287

327288
real(wp) :: tmp1, tmp2, cdot_star
328289
real(wp) :: f_rddot_KM
329-
330-
<<<<<<< HEAD
331-
if (polytropic_l) then
332-
cdot_star = -3._wp*gam_l*Ca_l*((fR0/fR)**(3._wp*gam_l))*fV/fR
333-
if (.not. f_is_default(Web_l)) cdot_star = cdot_star - &
334-
<<<<<<< HEAD
335-
3._wp*gam_l*(2._wp/(Web_l*fR0))*((fR0/fR)**(3._wp*gam_l))*fV/fR
336-
=======
337290
if (polytropic) then
338291
cdot_star = -3._wp*gam*Ca*((fR0/fR)**(3._wp*gam))*fV/fR
339292
if (.not. f_is_default(Web)) cdot_star = cdot_star - &
340293
3._wp*gam*(2._wp/(Web*fR0))*((fR0/fR)**(3._wp*gam))*fV/fR
341-
>>>>>>> parent of 1c9d815a (Refactoring functions to not use globals)
342-
=======
343-
3._wp*gam_l*(2._wp/(Web_l*fR0))*((fR0/fR)**(3._wp*gam_l))*fV/fR
344-
>>>>>>> parent of 2090b48f (Made bubble functions pure)
345294
else
346295
cdot_star = fpbdot
347296
end if
@@ -365,7 +314,7 @@ contains
365314
!> Subroutine that computes bubble wall properties for vapor bubbles
366315
!! @param pb Internal bubble pressure
367316
!! @param iR0 Current bubble size index
368-
subroutine s_bwproperty(pb, iR0)
317+
impure elemental subroutine s_bwproperty(pb, iR0)
369318
!$acc routine seq
370319
real(wp), intent(in) :: pb
371320
integer, intent(in) :: iR0
@@ -451,7 +400,7 @@ contains
451400
!! @param fbeta_t Mass transfer coefficient (EL)
452401
!! @param fR_m Mixture gas constant (EL)
453402
!! @param fgamma_m Mixture gamma (EL)
454-
function f_bpres_dot(fvflux, fR, fV, fpb, fmass_v, iR0, fbeta_t, fR_m, fgamma_m)
403+
pure elemental function f_bpres_dot(fvflux, fR, fV, fpb, fmass_v, iR0, fbeta_t, fR_m, fgamma_m)
455404
!$acc routine seq
456405
real(wp), intent(in) :: fvflux
457406
real(wp), intent(in) :: fR
@@ -643,7 +592,7 @@ contains
643592
!! @param f_divu Divergence of velocity
644593
!! @param fCson Speed of sound (EL)
645594
!! @param h Time step size
646-
subroutine s_initial_substep_h(fRho, fP, fR, fV, fR0, fpb, fpbdot, alf, &
595+
pure subroutine s_initial_substep_h(fRho, fP, fR, fV, fR0, fpb, fpbdot, alf, &
647596
fntait, fBtait, f_bub_adv_src, f_divu, &
648597
fCson, h)
649598
#ifdef _CRAYFTN
@@ -667,7 +616,7 @@ contains
667616
myA_tmp(1) = f_rddot(fRho, fP, myR_tmp(1), myV_tmp(1), fR0, &
668617
fpb, fpbdot, alf, fntait, fBtait, &
669618
f_bub_adv_src, f_divu, &
670-
fCson, gam, Ca, Web, Re_inv, bubbles_euler, polytropic)
619+
fCson)
671620

672621
! Compute d_0 = ||y0|| and d_1 = ||f(x0,y0)||
673622
d_norms(1) = sqrt((myR_tmp(1)**2._wp + myV_tmp(1)**2._wp)/2._wp)
@@ -684,7 +633,7 @@ contains
684633
myA_tmp(2) = f_rddot(fRho, fP, myR_tmp(2), myV_tmp(2), fR0, &
685634
fpb, fpbdot, alf, fntait, fBtait, &
686635
f_bub_adv_src, f_divu, &
687-
fCson, gam, Ca, Web, Re_inv, bubbles_euler, polytropic)
636+
fCson)
688637

689638
! Compute d_2 = ||f(x0+h0,y0+h0*f(x0,y0))-f(x0,y0)||/h0
690639
d_norms(3) = sqrt(((myV_tmp(2) - myV_tmp(1))**2._wp + (myA_tmp(2) - myA_tmp(1))**2._wp)/2._wp)/h_size(1)
@@ -762,7 +711,7 @@ contains
762711
myA_tmp(1) = f_rddot(fRho, fP, myR_tmp(1), myV_tmp(1), fR0, &
763712
myPb_tmp(1), mydPbdt_tmp(1), alf, fntait, fBtait, &
764713
f_bub_adv_src, f_divu, &
765-
fCson, gam, Ca, Web, Re_inv, bubbles_euler, polytropic)
714+
fCson)
766715

767716
! Stage 1
768717
myR_tmp(2) = myR_tmp(1) + h*myV_tmp(1)
@@ -776,7 +725,7 @@ contains
776725
myA_tmp(2) = f_rddot(fRho, fP, myR_tmp(2), myV_tmp(2), fR0, &
777726
myPb_tmp(2), mydPbdt_tmp(2), alf, fntait, fBtait, &
778727
f_bub_adv_src, f_divu, &
779-
fCson, gam, Ca, Web, Re_inv, bubbles_euler, polytropic)
728+
fCson)
780729

781730
! Stage 2
782731
myR_tmp(3) = myR_tmp(1) + (h/4._wp)*(myV_tmp(1) + myV_tmp(2))
@@ -790,7 +739,7 @@ contains
790739
myA_tmp(3) = f_rddot(fRho, fP, myR_tmp(3), myV_tmp(3), fR0, &
791740
myPb_tmp(3), mydPbdt_tmp(3), alf, fntait, fBtait, &
792741
f_bub_adv_src, f_divu, &
793-
fCson, gam, Ca, Web, Re_inv, bubbles_euler, polytropic)
742+
fCson)
794743

795744
! Stage 3
796745
myR_tmp(4) = myR_tmp(1) + (h/6._wp)*(myV_tmp(1) + myV_tmp(2) + 4._wp*myV_tmp(3))
@@ -804,7 +753,7 @@ contains
804753
myA_tmp(4) = f_rddot(fRho, fP, myR_tmp(4), myV_tmp(4), fR0, &
805754
myPb_tmp(4), mydPbdt_tmp(4), alf, fntait, fBtait, &
806755
f_bub_adv_src, f_divu, &
807-
fCson, gam, Ca, Web, Re_inv, bubbles_euler, polytropic)
756+
fCson)
808757

809758
! Estimate error
810759
err_R = (-5._wp*h/24._wp)*(myV_tmp(2) + myV_tmp(3) - 2._wp*myV_tmp(4)) &
@@ -841,8 +790,8 @@ contains
841790

842791
real(wp) :: fVapFlux, f_advance_EL, myR_m, mygamma_m
843792

844-
fVapFlux = f_vflux(fR_tmp, fV_tmp, fPb_tmp, fMv_tmp, bub_id, mass_n0, Re_trans_c, chi_vw, rho_mw, Pe_c, pv, R_v, Tw, thermal, bubbles_lagrange, fmass_n, fbeta_c, myR_m, mygamma_m)
845-
fdPbdt_tmp = f_bpres_dot(fVapFlux, fR_tmp, fV_tmp, fPb_tmp, fMv_tmp, bub_id, Tw, R_v, pv, pb0, mass_n0, mass_v0, Pe_T, Re_trans_T, k_mw, thermal, bubbles_lagrange, fbeta_t, myR_m, mygamma_m)
793+
fVapFlux = f_vflux(fR_tmp, fV_tmp, fPb_tmp, fMv_tmp, bub_id, fmass_n, fbeta_c, myR_m, mygamma_m)
794+
fdPbdt_tmp = f_bpres_dot(fVapFlux, fR_tmp, fV_tmp, fPb_tmp, fMv_tmp, bub_id, fbeta_t, myR_m, mygamma_m)
846795
f_advance_EL = 4._wp*pi*fR_tmp**2._wp*fVapFlux
847796

848797
end function f_advance_EL

src/simulation/m_bubbles_EE.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ contains
299299
rddot = f_rddot(myRho, myP, myR, myV, R0(q), &
300300
pb, pbdot, alf, n_tait, B_tait, &
301301
bub_adv_src(j, k, l), divu%sf(j, k, l), &
302-
dmCson, gam, Ca, Web, Re_inv, bubbles_euler, polytropic)
302+
dmCson)
303303
bub_v_src(j, k, l, q) = nbub*rddot
304304
bub_r_src(j, k, l, q) = q_cons_vf(vs(q))%sf(j, k, l)
305305
end if

src/simulation/m_bubbles_EL.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ contains
600600
intfc_dveldt(k, stage) = f_rddot(myRho, myPinf, myR, myV, myR0, &
601601
myPb, myPbdot, dmalf, dmntait, dmBtait, &
602602
dm_bub_adv_src, dm_divu, &
603-
myCson, gam, Ca, Web, Re_inv, bubbles_euler, polytropic)
603+
myCson)
604604
intfc_draddt(k, stage) = myV
605605
gas_dmvdt(k, stage) = myMvdot
606606
gas_dpdt(k, stage) = myPbdot

0 commit comments

Comments
 (0)