@@ -162,7 +162,7 @@ contains
162162
163163 end subroutine s_initialize_bubbles_EL_module
164164
165- !> The purpose of this procedure is to start lagrange bubble parameters applying nondimensionalization if needed
165+ !> The purpose of this procedure is to start the lagrange bubble parameters applying nondimensionalization if needed
166166 subroutine s_start_lagrange_inputs()
167167
168168 integer :: id_bubbles, id_host
@@ -197,7 +197,7 @@ contains
197197 Web = 1d0/ss
198198 Re_inv = mul0
199199
200- ! Need improvements to accept polytropic gas compression, isothermal and adiabatic thermal models, and
200+ ! Need improvement to accept polytropic gas compression, isothermal and adiabatic thermal models, and
201201 ! the Gilmore and RP bubble models.
202202 polytropic = .false. ! Forcing no polytropic model
203203 thermal = 3 ! Forcing constant transfer coefficient model based on Preston et al., 2007
@@ -350,7 +350,7 @@ contains
350350 rhol, gamma, pi_inf, qv, Re)
351351 dynP = 0d0
352352 do i = 1 , num_dims
353- dynP = dynP + 0.5 * q_cons_vf(contxe + i)%sf(cell(1 ), cell(2 ), cell(3 ))** 2 / rhol
353+ dynP = dynP + 0.5d0 * q_cons_vf(contxe + i)%sf(cell(1 ), cell(2 ), cell(3 ))** 2 / rhol
354354 end do
355355 pliq = (q_cons_vf(E_idx)%sf(cell(1 ), cell(2 ), cell(3 )) - dynP - pi_inf)/ gamma
356356 if (pliq < 0 ) print * , " Negative pressure" , proc_rank, &
@@ -359,14 +359,14 @@ contains
359359 ! Initial particle pressure
360360 gas_p(bub_id, 1 ) = pliq + 2d0 * (1d0 / Web)/ bub_R0(bub_id)
361361 if ((1d0 / Web) /= 0d0 ) then
362- pcrit = pv - 4d0 * (1d0 / Web)/ (3.d0 * sqrt (3d0 * gas_p(bub_id, 1 )* bub_R0(bub_id)** 3 / (2d0 * (1d0 / Web))))
362+ pcrit = pv - 4d0 * (1d0 / Web)/ (3d0 * sqrt (3d0 * gas_p(bub_id, 1 )* bub_R0(bub_id)** 3d0 / (2d0 * (1d0 / Web))))
363363 pref = gas_p(bub_id, 1 )
364364 else
365365 pcrit = 0d0
366366 end if
367367
368368 ! Initial particle mass
369- volparticle = 4d0 / 3d0 * pi* bub_R0(bub_id)** 3 ! volume
369+ volparticle = 4d0 / 3d0 * pi* bub_R0(bub_id)** 3d0 ! volume
370370 gas_mv(bub_id, 1 ) = pv* volparticle* (1d0 / (R_v* Tw))* (massflag) ! vapermass
371371 gas_mg(bub_id) = (gas_p(bub_id, 1 ) - pv* (massflag))* volparticle* (1d0 / (R_n* Tw)) ! gasmass
372372 if (gas_mg(bub_id) <= 0d0 ) then
@@ -473,9 +473,9 @@ contains
473473 indomain = particle_in_domain(inputvals(1 :3 ))
474474 if (indomain .and. (id > 0 )) then
475475 bub_id = bub_id + 1
476- nBubs = bub_id ! local number of bubbles
477- lag_id(bub_id, 1 ) = id ! global ID
478- lag_id(bub_id, 2 ) = bub_id ! local ID
476+ nBubs = bub_id ! local number of bubbles
477+ lag_id(bub_id, 1 ) = id ! global ID
478+ lag_id(bub_id, 2 ) = bub_id ! local ID
479479 mtn_pos(bub_id, 1 :3 , 1 ) = inputvals(1 :3 )
480480 mtn_posPrev(bub_id, 1 :3 , 1 ) = inputvals(4 :6 )
481481 mtn_vel(bub_id, 1 :3 , 1 ) = inputvals(7 :9 )
@@ -540,14 +540,14 @@ contains
540540 fV = intfc_vel(k, 2 )
541541 fpb = gas_p(k, 2 )
542542 pint = f_cpbw_KM(fR0, fR, fV, fpb)
543- pint = pint + 0.5d0 * fV** 2
543+ pint = pint + 0.5d0 * fV** 2d0
544544 if (lag_params%cluster_type == 2 ) then
545545 bub_dphidt(k) = (paux - pint) + term2
546546 ! Accounting for the potential induced by the bubble averaged over the control volume
547547 ! Note that this is based on the incompressible flow assumption near the bubble.
548548 Rb = intfc_rad(k, 2 )
549549 term1_fac = 3d0 / 2d0 * (Rb* (Romega** 2d0 - Rb** 2d0 ))/ (Romega** 3d0 - Rb** 3d0 )
550- bub_dphidt(k) = bub_dphidt(k)/ (1 - term1_fac)
550+ bub_dphidt(k) = bub_dphidt(k)/ (1d0 - term1_fac)
551551 end if
552552 end do
553553 end if
@@ -594,10 +594,10 @@ contains
594594 end do
595595 call s_convert_species_to_mixture_variables_acc(rhol, gamma, pi_inf, qv, myalpha, &
596596 myalpha_rho, Re, cell(1 ), cell(2 ), cell(3 ))
597- call s_compute_cson_from_pinf(k, q_prim_vf, pinf, cell, rhol, gamma, pi_inf, cson)
597+ call s_compute_cson_from_pinf(q_prim_vf, pinf, cell, rhol, gamma, pi_inf, cson)
598598
599599 ! Velocity correction due to massflux
600- velint = fV - gas_dmvdt(k, stage)/ (4d0 * pi* fR** 2 * rhol)
600+ velint = fV - gas_dmvdt(k, stage)/ (4d0 * pi* fR** 2d0 * rhol)
601601
602602 ! Interphase acceleration and update vars
603603 intfc_dveldt(k, stage) = f_rddot_KM(fpbdt, pinf, pliqint, rhol, fR, velint, fR0, cson)
@@ -641,20 +641,18 @@ contains
641641 !! @param gamma Liquid specific heat ratio
642642 !! @param pi_inf Liquid stiffness
643643 !! @param cson Calculated speed of sound
644- subroutine s_compute_cson_from_pinf (bub_id , q_prim_vf , pinf , cell , rhol , gamma , pi_inf , cson )
644+ subroutine s_compute_cson_from_pinf (q_prim_vf , pinf , cell , rhol , gamma , pi_inf , cson )
645645#ifdef _CRAYFTN
646646 !DIR$ INLINEALWAYS s_compute_cson_from_pinf
647647#else
648648 !$acc routine seq
649649#endif
650- integer , intent (in ) :: bub_id
651650 type(scalar_field), dimension (sys_size), intent (in ) :: q_prim_vf
652651 real (kind (0d0 )), intent (in ) :: pinf, rhol, gamma, pi_inf
653652 integer , dimension (3 ), intent (in ) :: cell
654653 real (kind (0d0 )), intent (out ) :: cson
655654
656655 real (kind (0d0 )) :: E, H
657- real (kind (0d0 )), dimension (3 ) :: scoord
658656 real (kind (0d0 )), dimension (num_dims) :: vel
659657 integer :: i
660658
@@ -817,7 +815,7 @@ contains
817815 real (kind (0d0 )), intent (out ), optional :: preterm1, term2, Romega
818816
819817 real (kind (0d0 )), dimension (3 ) :: scoord, psi
820- real (kind (0d0 )) :: dc, vol, aux, dist
818+ real (kind (0d0 )) :: dc, vol, aux
821819 real (kind (0d0 )) :: volgas, term1, Rbeq, denom
822820 real (kind (0d0 )) :: charvol, charpres, charvol2, charpres2
823821 integer , dimension (3 ) :: cellaux
@@ -998,22 +996,22 @@ contains
998996
999997 end if
1000998
1001- if (lag_params%pressure_corrector .and. present (preterm1) ) then
999+ if (lag_params%pressure_corrector) then
10021000
10031001 !Valid if only one bubble exists per cell
1004- volgas = intfc_rad(bub_id, 2 )** 3
1005- denom = intfc_rad(bub_id, 2 )** 2
1006- term1 = bub_dphidt(bub_id)* intfc_rad(bub_id, 2 )** 2
1007- term2 = intfc_vel(bub_id, 2 )* intfc_rad(bub_id, 2 )** 2
1002+ volgas = intfc_rad(bub_id, 2 )** 3d0
1003+ denom = intfc_rad(bub_id, 2 )** 2d0
1004+ term1 = bub_dphidt(bub_id)* intfc_rad(bub_id, 2 )** 2d0
1005+ term2 = intfc_vel(bub_id, 2 )* intfc_rad(bub_id, 2 )** 2d0
10081006
10091007 Rbeq = volgas** (1d0 / 3d0 ) !surrogate bubble radius
1010- aux = dc** 3 - Rbeq** 3
1008+ aux = dc** 3d0 - Rbeq** 3d0
10111009 term2 = term2/ denom
1012- term2 = 3d0 / 2d0 * term2** 2 * Rbeq** 3 * (1d0 - Rbeq/ dc)/ aux
1013- preterm1 = 3d0 / 2d0 * Rbeq* (dc** 2 - Rbeq** 2 )/ (aux* denom)
1010+ term2 = 3d0 / 2d0 * term2** 2d0 * Rbeq** 3d0 * (1d0 - Rbeq/ dc)/ aux
1011+ preterm1 = 3d0 / 2d0 * Rbeq* (dc** 2d0 - Rbeq** 2d0 )/ (aux* denom)
10141012
10151013 !Control volume radius
1016- if (present (Romega) ) Romega = dc
1014+ if (ptype == 2 ) Romega = dc
10171015
10181016 ! Getting p_inf
10191017 if (ptype == 1 ) then
@@ -1167,7 +1165,7 @@ contains
11671165
11681166 lag_largestep = 0d0
11691167 remove_id = 0
1170- !$acc parallel loop gang vector default(present) reduction(+ : lag_largestep, remove_id) private(k) copyin(RKstep)
1168+ !$acc parallel loop gang vector default(present) reduction(+ : lag_largestep) reduction(MAX: remove_id) private(k) copyin(RKstep)
11711169 do k = 1 , nBubs
11721170
11731171 radiusOld = intfc_rad(k, 2 )
@@ -1188,7 +1186,7 @@ contains
11881186 print * , ' Negative bubble radius encountered'
11891187 lag_largestep = lag_largestep + 1d0
11901188 if (dt < 2d0 * verysmall_dt) then
1191- remove_id = k
1189+ remove_id = max (remove_id, k)
11921190 end if
11931191 end if
11941192
@@ -1382,9 +1380,9 @@ contains
13821380 !! @param scoord Calculated particle coordinates
13831381 subroutine s_locate_cell (pos , cell , scoord )
13841382
1385- real (kind (0d0 )), dimension (3 ) :: pos
1386- real (kind (0d0 )), dimension (3 ), optional :: scoord
1387- integer , dimension (3 ) :: cell
1383+ real (kind (0d0 )), dimension (3 ), intent ( in ) :: pos
1384+ real (kind (0d0 )), dimension (3 ), intent ( out ) :: scoord
1385+ integer , dimension (3 ), intent ( inout ) :: cell
13881386
13891387 integer :: i
13901388
@@ -1420,16 +1418,14 @@ contains
14201418 ! In other words, the coordinate of the center of the cell is x_cc(cell).
14211419
14221420 !coordinates in computational space
1423- if (present (scoord)) then
1424- scoord(1 ) = cell(1 ) + (pos(1 ) - x_cb(cell(1 ) - 1 ))/ dx(cell(1 ))
1425- scoord(2 ) = cell(2 ) + (pos(2 ) - y_cb(cell(2 ) - 1 ))/ dy(cell(2 ))
1426- scoord(3 ) = 0d0
1427- if (p > 0 ) scoord(3 ) = cell(3 ) + (pos(3 ) - z_cb(cell(3 ) - 1 ))/ dz(cell(3 ))
1428- cell(:) = int (scoord(:))
1429- do i = 1 , num_dims
1430- if (scoord(i) < 0.0d0 ) cell(i) = cell(i) - 1
1431- end do
1432- end if
1421+ scoord(1 ) = cell(1 ) + (pos(1 ) - x_cb(cell(1 ) - 1 ))/ dx(cell(1 ))
1422+ scoord(2 ) = cell(2 ) + (pos(2 ) - y_cb(cell(2 ) - 1 ))/ dy(cell(2 ))
1423+ scoord(3 ) = 0d0
1424+ if (p > 0 ) scoord(3 ) = cell(3 ) + (pos(3 ) - z_cb(cell(3 ) - 1 ))/ dz(cell(3 ))
1425+ cell(:) = int (scoord(:))
1426+ do i = 1 , num_dims
1427+ if (scoord(i) < 0.0d0 ) cell(i) = cell(i) - 1
1428+ end do
14331429
14341430 end subroutine s_locate_cell
14351431
@@ -1847,7 +1843,7 @@ contains
18471843
18481844 integer :: k
18491845
1850- !$acc parallel loop gang vector default(present) reduction(MAX: Rmax_glb) reduction(MAX : Rmin_glb) private(k)
1846+ !$acc parallel loop gang vector default(present) reduction(MAX: Rmax_glb) reduction(MIN : Rmin_glb) private(k)
18511847 do k = 1 , nBubs
18521848 Rmax_glb = max (Rmax_glb, intfc_rad(k, 1 )/ bub_R0(k))
18531849 Rmin_glb = min (Rmin_glb, intfc_rad(k, 1 )/ bub_R0(k))
0 commit comments