Skip to content

Commit 687659c

Browse files
author
Diego Vaca
committed
Removing stop commands
1 parent 314c05a commit 687659c

File tree

4 files changed

+30
-50
lines changed

4 files changed

+30
-50
lines changed

src/simulation/m_bubbles_EL.fpp

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ contains
251251
end do
252252
close (94)
253253
else
254-
stop "if you include lagrange bubbles, you have to initialize them in input/lag_bubbles.dat"
254+
stop "Lagrange bubbles: you have to initialize them in input/lag_bubbles.dat"
255255
end if
256256
else
257257
if (proc_rank == 0) print *, 'Restarting lagrange bubbles at save_count: ', save_count
@@ -338,6 +338,16 @@ contains
338338
cell = -buff_size
339339
call s_locate_cell(mtn_pos(bub_id, 1:3, 1), cell, mtn_s(bub_id, 1:3, 1))
340340

341+
! Check if the bubble is located in the ghost cell of a symmetric boundary
342+
if (bc_x%beg == -2 .and. cell(1) < 0) stop "Lagrange bubble is in the ghost cells of a symmetric boundary (bc_x%beg)."
343+
if (bc_x%end == -2 .and. cell(1) > m) stop "Lagrange bubble is in the ghost cells of a symmetric boundary (bc_x%end)."
344+
if (bc_y%beg == -2 .and. cell(2) < 0) stop "Lagrange bubble is in the ghost cells of a symmetric boundary (bc_y%beg)."
345+
if (bc_y%end == -2 .and. cell(2) > n) stop "Lagrange bubble is in the ghost cells of a symmetric boundary (bc_y%end)."
346+
if (p > 0) then
347+
if (bc_z%beg == -2 .and. cell(3) < 0) stop "Lagrange bubble is in the ghost cells of a symmetric boundary (bc_z%beg)."
348+
if (bc_z%end == -2 .and. cell(3) > p) stop "Lagrange bubble is in the ghost cells of a symmetric boundary (bc_z%end)."
349+
end if
350+
341351
! If particle is in the ghost cells, find the closest non-ghost cell
342352
cell(1) = min(max(cell(1), 0), m)
343353
cell(2) = min(max(cell(2), 0), n)
@@ -366,17 +376,15 @@ contains
366376
gas_mv(bub_id, 1) = pv*volparticle*(1._wp/(R_v*Tw))*(massflag) ! vapermass
367377
gas_mg(bub_id) = (gas_p(bub_id, 1) - pv*(massflag))*volparticle*(1._wp/(R_n*Tw)) ! gasmass
368378
if (gas_mg(bub_id) <= 0._wp) then
369-
stop 'the initial mass of gas inside the bubble is negative. Check your initial conditions'
379+
stop "The initial mass of gas inside the bubble is negative. Check your initial conditions."
370380
end if
371381
totalmass = gas_mg(bub_id) + gas_mv(bub_id, 1) ! totalmass
372382

373383
! Bubble natural frequency
374384
concvap = gas_mv(bub_id, 1)/(gas_mv(bub_id, 1) + gas_mg(bub_id))
375385
omegaN = (3._wp*(gas_p(bub_id, 1) - pv*(massflag)) + 4._wp*(1._wp/Web)/bub_R0(bub_id))/rhol
376386
if (pv*(massflag) > gas_p(bub_id, 1)) then
377-
print *, 'Not allowed: bubble initially located in a region with pressure below the vapor pressure'
378-
print *, 'location:', mtn_pos(bub_id, 1:3, 1)
379-
stop
387+
stop "Lagrange bubble initially located in a region with pressure below the vapor pressure."
380388
end if
381389
omegaN = sqrt(omegaN/bub_R0(bub_id)**2._wp)
382390

@@ -906,11 +914,7 @@ contains
906914
! Bubble dynamic closure from Maeda and Colonius (2018)
907915

908916
! Range of cells included in Omega
909-
if (lag_params%smooth_type == 1) then
910-
mapCells_pinf = mapCells
911-
else
912-
stop "lag_params%cluster_type: 2 requires lag_params%smooth_type: 1."
913-
end if
917+
mapCells_pinf = mapCells
914918

915919
! Include the cell that contains the bubble (mapCells+1+mapCells)
916920
smearGrid = mapCells_pinf - (-mapCells_pinf) + 1
@@ -987,9 +991,6 @@ contains
987991
f_pinfl = charpres2/charvol2
988992
vol = charvol
989993
dc = (3._wp*abs(vol)/(4._wp*pi))**(1._wp/3._wp)
990-
else
991-
992-
stop "Check cluterflag. Exiting."
993994

994995
end if
995996

@@ -1038,7 +1039,6 @@ contains
10381039
mtn_vel(k, 1:3, 1) = mtn_vel(k, 1:3, 1) + dt*mtn_dveldt(k, 1:3, 1)
10391040
gas_p(k, 1) = gas_p(k, 1) + dt*gas_dpdt(k, 1)
10401041
gas_mv(k, 1) = gas_mv(k, 1) + dt*gas_dmvdt(k, 1)
1041-
if (intfc_rad(k, 1) <= 0._wp) stop "Negative bubble radius encountered, please reduce dt"
10421042
end do
10431043

10441044
call s_transfer_data_to_tmp()
@@ -1061,7 +1061,6 @@ contains
10611061
mtn_vel(k, 1:3, 2) = mtn_vel(k, 1:3, 1) + dt*mtn_dveldt(k, 1:3, 1)
10621062
gas_p(k, 2) = gas_p(k, 1) + dt*gas_dpdt(k, 1)
10631063
gas_mv(k, 2) = gas_mv(k, 1) + dt*gas_dmvdt(k, 1)
1064-
if (intfc_rad(k, 2) <= 0._wp) stop "Negative bubble radius encountered, please reduce dt"
10651064
end do
10661065

10671066
elseif (stage == 2) then
@@ -1074,7 +1073,6 @@ contains
10741073
mtn_vel(k, 1:3, 1) = mtn_vel(k, 1:3, 1) + dt*(mtn_dveldt(k, 1:3, 1) + mtn_dveldt(k, 1:3, 2))/2._wp
10751074
gas_p(k, 1) = gas_p(k, 1) + dt*(gas_dpdt(k, 1) + gas_dpdt(k, 2))/2._wp
10761075
gas_mv(k, 1) = gas_mv(k, 1) + dt*(gas_dmvdt(k, 1) + gas_dmvdt(k, 2))/2._wp
1077-
if (intfc_rad(k, 1) <= 0._wp) stop "Negative bubble radius encountered, please reduce dt"
10781076
end do
10791077

10801078
call s_transfer_data_to_tmp()
@@ -1099,7 +1097,6 @@ contains
10991097
mtn_vel(k, 1:3, 2) = mtn_vel(k, 1:3, 1) + dt*mtn_dveldt(k, 1:3, 1)
11001098
gas_p(k, 2) = gas_p(k, 1) + dt*gas_dpdt(k, 1)
11011099
gas_mv(k, 2) = gas_mv(k, 1) + dt*gas_dmvdt(k, 1)
1102-
if (intfc_rad(k, 2) <= 0._wp) stop "Negative bubble radius encountered, please reduce dt"
11031100
end do
11041101

11051102
elseif (stage == 2) then
@@ -1112,7 +1109,6 @@ contains
11121109
mtn_vel(k, 1:3, 2) = mtn_vel(k, 1:3, 1) + dt*(mtn_dveldt(k, 1:3, 1) + mtn_dveldt(k, 1:3, 2))/4._wp
11131110
gas_p(k, 2) = gas_p(k, 1) + dt*(gas_dpdt(k, 1) + gas_dpdt(k, 2))/4._wp
11141111
gas_mv(k, 2) = gas_mv(k, 1) + dt*(gas_dmvdt(k, 1) + gas_dmvdt(k, 2))/4._wp
1115-
if (intfc_rad(k, 2) <= 0._wp) stop "Negative bubble radius encountered, please reduce dt"
11161112
end do
11171113
elseif (stage == 3) then
11181114
!$acc parallel loop gang vector default(present) private(k)
@@ -1124,7 +1120,6 @@ contains
11241120
mtn_vel(k, 1:3, 1) = mtn_vel(k, 1:3, 1) + (2._wp/3._wp)*dt*(mtn_dveldt(k, 1:3, 1)/4._wp + mtn_dveldt(k, 1:3, 2)/4._wp + mtn_dveldt(k, 1:3, 3))
11251121
gas_p(k, 1) = gas_p(k, 1) + (2._wp/3._wp)*dt*(gas_dpdt(k, 1)/4._wp + gas_dpdt(k, 2)/4._wp + gas_dpdt(k, 3))
11261122
gas_mv(k, 1) = gas_mv(k, 1) + (2._wp/3._wp)*dt*(gas_dmvdt(k, 1)/4._wp + gas_dmvdt(k, 2)/4._wp + gas_dmvdt(k, 3))
1127-
if (intfc_rad(k, 1) <= 0._wp) stop "Negative bubble radius encountered, please reduce dt"
11281123
end do
11291124

11301125
call s_transfer_data_to_tmp()

src/simulation/m_bubbles_EL_kernels.fpp

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -317,51 +317,27 @@ contains
317317

318318
! x-dir
319319
if (bc_x%beg == -2 .and. (cell(1) <= mapCells - 1)) then
320-
if (cell(1) >= 0) then
321-
cellaux(1) = abs(cellaux(1)) - 1
322-
else
323-
stop "Lagrangian bubbles must not be located in the ghost cells of a symmetric boundary (bc_x%beg)."
324-
end if
320+
cellaux(1) = abs(cellaux(1)) - 1
325321
end if
326322
if (bc_x%end == -2 .and. (cell(1) >= m + 1 - mapCells)) then
327-
if (cell(1) <= m) then
328-
cellaux(1) = cellaux(1) - (2*(cellaux(1) - m) - 1)
329-
else
330-
stop "Lagrangian bubbles must not be located in the ghost cells of a symmetric boundary (bc_x%end)."
331-
end if
323+
cellaux(1) = cellaux(1) - (2*(cellaux(1) - m) - 1)
332324
end if
333325

334326
!y-dir
335327
if (bc_y%beg == -2 .and. (cell(2) <= mapCells - 1)) then
336-
if (cell(2) >= 0) then
337-
cellaux(2) = abs(cellaux(2)) - 1
338-
else
339-
stop "Lagrangian bubbles must not be located in the ghost cells of a symmetric boundary (bc_y%beg)."
340-
end if
328+
cellaux(2) = abs(cellaux(2)) - 1
341329
end if
342330
if (bc_y%end == -2 .and. (cell(2) >= n + 1 - mapCells)) then
343-
if (cell(2) <= n) then
344-
cellaux(2) = cellaux(2) - (2*(cellaux(2) - n) - 1)
345-
else
346-
stop "Lagrangian bubbles must not be located in the ghost cells of a symmetric boundary (bc_y%end)."
347-
end if
331+
cellaux(2) = cellaux(2) - (2*(cellaux(2) - n) - 1)
348332
end if
349333

350334
if (p > 0) then
351335
!z-dir
352336
if (bc_z%beg == -2 .and. (cell(3) <= mapCells - 1)) then
353-
if (cell(3) >= 0) then
354-
cellaux(3) = abs(cellaux(3)) - 1
355-
else
356-
stop "Lagrangian bubbles must not be located in the ghost cells of a symmetric boundary (bc_z%beg)."
357-
end if
337+
cellaux(3) = abs(cellaux(3)) - 1
358338
end if
359339
if (bc_z%end == -2 .and. (cell(3) >= p + 1 - mapCells)) then
360-
if (cell(3) <= p) then
361-
cellaux(3) = cellaux(3) - (2*(cellaux(3) - p) - 1)
362-
else
363-
stop "Lagrangian bubbles must not be located in the ghost cells of a symmetric boundary (bc_z%end)."
364-
end if
340+
cellaux(3) = cellaux(3) - (2*(cellaux(3) - p) - 1)
365341
end if
366342
end if
367343

src/simulation/m_checker.fpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ contains
330330
@:PROHIBIT(bubbles_lagrange .and. file_per_process, "file_per_process must be false for bubbles_lagrange")
331331
@:PROHIBIT(bubbles_lagrange .and. n==0, "bubbles_lagrange accepts 2D and 3D simulations only")
332332
@:PROHIBIT(bubbles_lagrange .and. model_eqns==3, "The 6-equation flow model does not support bubbles_lagrange")
333+
@:PROHIBIT(lag_params%cluster_type>=2 .and. lag_params%smooth_type/=1, "cluster_type=2 requires smooth_type=1")
333334
end subroutine s_check_inputs_bubbles_lagrange
334335
335336
!> Checks miscellaneous constraints,

src/simulation/m_start_up.fpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,9 +1395,17 @@ contains
13951395
end if
13961396

13971397
if (bubbles_lagrange) then
1398+
!$acc update host(intfc_rad)
1399+
do i = 1, nBubs
1400+
if (ieee_is_nan(intfc_rad(i, 1)) .or. intfc_rad(i, 1) <= 0._wp) then
1401+
print *, "Bubble radius is negative or NaN", proc_rank, t_step, i, intfc_rad(i, 1)
1402+
error stop "Bubble radius is negative or NaN, please reduce dt"
1403+
end if
1404+
end do
1405+
13981406
!$acc update host(q_beta%vf(1)%sf)
13991407
call s_write_data_files(q_cons_ts(1)%vf, q_T_sf, q_prim_vf, save_count, q_beta%vf(1))
1400-
!$acc update host(Rmax_stats, Rmin_stats, gas_p, gas_mv, intfc_rad, intfc_vel)
1408+
!$acc update host(Rmax_stats, Rmin_stats, gas_p, gas_mv, intfc_vel)
14011409
call s_write_restart_lag_bubbles(save_count) !parallel
14021410
if (lag_params%write_bubbles_stats) call s_write_lag_bubble_stats()
14031411
else

0 commit comments

Comments
 (0)