Skip to content

Commit 59d0c09

Browse files
XZTian64Xuzheng Tiansbryngelson
authored
Add Integer Check in Lint Source Workflow (#893)
Co-authored-by: Xuzheng Tian <xtian64@login-phoenix-rh9-3.pace.gatech.edu> Co-authored-by: Spencer Bryngelson <sbryngelson@gmail.com>
1 parent af68ebb commit 59d0c09

30 files changed

+246
-242
lines changed

.github/workflows/lint-source.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ jobs:
4242
run: |
4343
! grep -iR -e '\.\.\.' -e '\-\-\-' -e '===' ./src/*
4444
45+
- name: Looking for false integers
46+
run: |
47+
! grep -onRP '(?<![0-9.eE\-])\b[0-9]*_wp\b' src/
48+
4549
- name: Looking for junk comments in examples
4650
run: |
4751
! grep -R '# ===' ./benchmarks **/*.py

src/common/m_constants.fpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ module m_constants
88

99
character, parameter :: dflt_char = ' ' !< Default string value
1010

11-
real(wp), parameter :: dflt_real = -1e6_wp !< Default real value
12-
real(wp), parameter :: sgm_eps = 1e-16_wp !< Segmentation tolerance
13-
real(wp), parameter :: small_alf = 1e-11_wp !< Small alf tolerance
11+
real(wp), parameter :: dflt_real = -1.e6_wp !< Default real value
12+
real(wp), parameter :: sgm_eps = 1.e-16_wp !< Segmentation tolerance
13+
real(wp), parameter :: small_alf = 1.e-11_wp !< Small alf tolerance
1414
real(wp), parameter :: pi = 3.141592653589793_wp !< Pi
1515
real(wp), parameter :: verysmall = 1.e-12_wp !< Very small number
1616

@@ -26,7 +26,7 @@ module m_constants
2626
integer, parameter :: pathlen_max = 400
2727
integer, parameter :: nnode = 4 !< Number of QBMM nodes
2828
integer, parameter :: gp_layers = 3 !< Number of ghost point layers for IBM
29-
real(wp), parameter :: capillary_cutoff = 1e-6 !< color function gradient magnitude at which to apply the surface tension fluxes
29+
real(wp), parameter :: capillary_cutoff = 1.e-6 !< color function gradient magnitude at which to apply the surface tension fluxes
3030
real(wp), parameter :: acoustic_spatial_support_width = 2.5_wp !< Spatial support width of acoustic source, used in s_source_spatial
3131
real(wp), parameter :: dflt_vcfl_dt = 100._wp !< value of vcfl_dt when viscosity is off for computing adaptive timestep size
3232
real(wp), parameter :: broadband_spectral_level_constant = 20._wp !< The constant to scale the spectral level at the lower frequency bound
@@ -41,25 +41,25 @@ module m_constants
4141
integer, parameter :: Ifactor_bary_3D = 20 !< Multiple factor of the ratio (triangle area to cell face area) for interpolation on triangle facets for 3D models
4242
integer, parameter :: num_ray = 20 !< Default number of rays traced per cell
4343
real(wp), parameter :: ray_tracing_threshold = 0.9_wp !< Threshold above which the cell is marked as the model patch
44-
real(wp), parameter :: threshold_vector_zero = 1e-10 !< Threshold to treat the component of a vector to be zero
45-
real(wp), parameter :: threshold_edge_zero = 1e-10 !< Threshold to treat two edges to be overlapped
46-
real(wp), parameter :: threshold_bary = 1e-1 !< Threshold to interpolate a barycentric facet
47-
real(wp), parameter :: initial_distance_buffer = 1e12_wp !< Initialized levelset distance for the shortest path pair algorithm
44+
real(wp), parameter :: threshold_vector_zero = 1.e-10_wp !< Threshold to treat the component of a vector to be zero
45+
real(wp), parameter :: threshold_edge_zero = 1.e-10_wp !< Threshold to treat two edges to be overlapped
46+
real(wp), parameter :: threshold_bary = 1.e-1_wp !< Threshold to interpolate a barycentric facet
47+
real(wp), parameter :: initial_distance_buffer = 1.e12_wp !< Initialized levelset distance for the shortest path pair algorithm
4848

4949
! Lagrange bubbles constants
5050
integer, parameter :: mapCells = 3 !< Number of cells around the bubble where the smoothening function will have effect
5151
real(wp), parameter :: R_uni = 8314._wp ! Universal gas constant - J/kmol/K
5252

5353
! Strang Splitting constants
54-
real(wp), parameter :: dflt_adap_dt_tol = 1e-4_wp !< Default tolerance for adaptive step size
54+
real(wp), parameter :: dflt_adap_dt_tol = 1.e-4_wp !< Default tolerance for adaptive step size
5555
integer, parameter :: adap_dt_max_iters = 100 !< Maximum number of iterations
5656
! Constants of the algorithm described by Heirer, E. Hairer S.P.Nørsett G. Wanner, Solving Ordinary Differential Equations I, Chapter II.4
5757
! to choose the initial time step size for the adaptive time stepping routine
58-
real(wp), parameter :: threshold_first_guess = 1e-5_wp
59-
real(wp), parameter :: threshold_second_guess = 1e-15_wp
60-
real(wp), parameter :: scale_first_guess = 1e-3_wp
61-
real(wp), parameter :: scale_guess = 1e-2_wp
62-
real(wp), parameter :: small_guess = 1e-6_wp
58+
real(wp), parameter :: threshold_first_guess = 1.e-5_wp
59+
real(wp), parameter :: threshold_second_guess = 1.e-15_wp
60+
real(wp), parameter :: scale_first_guess = 1.e-3_wp
61+
real(wp), parameter :: scale_guess = 1.e-2_wp
62+
real(wp), parameter :: small_guess = 1.e-6_wp
6363

6464
! Relativity
6565
integer, parameter :: relativity_cons_to_prim_max_iter = 100

src/common/m_helper_basic.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module m_helper_basic
2121
!> This procedure checks if two floating point numbers of wp are within tolerance.
2222
!! @param a First number.
2323
!! @param b Second number.
24-
!! @param tol_input Relative error (default = 1e-10_wp).
24+
!! @param tol_input Relative error (default = 1.e-10_wp).
2525
!! @return Result of the comparison.
2626
logical pure elemental function f_approx_equal(a, b, tol_input) result(res)
2727
!$acc routine seq
@@ -32,7 +32,7 @@ logical pure elemental function f_approx_equal(a, b, tol_input) result(res)
3232
if (present(tol_input)) then
3333
tol = tol_input
3434
else
35-
tol = 1e-10_wp
35+
tol = 1.e-10_wp
3636
end if
3737

3838
if (a == b) then

src/common/m_phase_change.fpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,8 @@ contains
343343
344344
! Newton Solver for the pT-equilibrium
345345
ns = 0
346-
! change this relative error metric. 1e4_wp is just arbitrary
347-
do while ((abs(pS - pO) > palpha_eps) .and. (abs((pS - pO)/pO) > palpha_eps/1e4_wp) .or. (ns == 0))
346+
! change this relative error metric. 1.e4_wp is just arbitrary
347+
do while ((abs(pS - pO) > palpha_eps) .and. (abs((pS - pO)/pO) > palpha_eps/1.e4_wp) .or. (ns == 0))
348348
349349
! increasing counter
350350
ns = ns + 1
@@ -438,7 +438,7 @@ contains
438438
R2D(1) = 0.0_wp; R2D(2) = 0.0_wp
439439
DeltamP(1) = 0.0_wp; DeltamP(2) = 0.0_wp
440440
do while (((sqrt(R2D(1)**2 + R2D(2)**2) > ptgalpha_eps) &
441-
.and. ((sqrt(R2D(1)**2 + R2D(2)**2)/rhoe) > (ptgalpha_eps/1e6_wp))) &
441+
.and. ((sqrt(R2D(1)**2 + R2D(2)**2)/rhoe) > (ptgalpha_eps/1.e6_wp))) &
442442
.or. (ns == 0))
443443

444444
! Updating counter for the iterative procedure

src/common/m_variables_conversion.fpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ contains
280280
alpha_K(i) = min(max(0._wp, alpha_K(i)), 1._wp)
281281
end do
282282

283-
alpha_K = alpha_K/max(sum(alpha_K), 1e-16_wp)
283+
alpha_K = alpha_K/max(sum(alpha_K), 1.e-16_wp)
284284

285285
end if
286286

@@ -405,7 +405,7 @@ contains
405405
alpha_K(i) = min(max(0._wp, alpha_K(i)), 1._wp)
406406
end do
407407

408-
alpha_K = alpha_K/max(sum(alpha_K), 1e-16_wp)
408+
alpha_K = alpha_K/max(sum(alpha_K), 1.e-16_wp)
409409

410410
end if
411411

@@ -960,7 +960,7 @@ contains
960960

961961
dW = -f/df_dW
962962
W = W + dW
963-
if (abs(dW) < 1e-12*W) exit
963+
if (abs(dW) < 1.e-12_wp*W) exit
964964
end do
965965

966966
! Recalculate pressure using converged W
@@ -1014,7 +1014,7 @@ contains
10141014
if (model_eqns /= 4) then
10151015
qK_prim_vf(i)%sf(j, k, l) = qK_cons_vf(i)%sf(j, k, l) &
10161016
/rho_K
1017-
dyn_pres_K = dyn_pres_K + 5e-1_wp*qK_cons_vf(i)%sf(j, k, l) &
1017+
dyn_pres_K = dyn_pres_K + 5.e-1_wp*qK_cons_vf(i)%sf(j, k, l) &
10181018
*qK_prim_vf(i)%sf(j, k, l)
10191019
else
10201020
qK_prim_vf(i)%sf(j, k, l) = qK_cons_vf(i)%sf(j, k, l) &
@@ -1520,11 +1520,11 @@ contains
15201520
R_gas = gas_constant/mix_mol_weight
15211521
T_K = pres_K/rho_K/R_gas
15221522
call get_mixture_energy_mass(T_K, Y_K, E_K)
1523-
E_K = rho_K*E_K + 5e-1_wp*rho_K*vel_K_sum
1523+
E_K = rho_K*E_K + 5.e-1_wp*rho_K*vel_K_sum
15241524
else
15251525
! Computing the energy from the pressure
15261526
E_K = gamma_K*pres_K + pi_inf_K &
1527-
+ 5e-1_wp*rho_K*vel_K_sum + qv_K
1527+
+ 5.e-1_wp*rho_K*vel_K_sum + qv_K
15281528
end if
15291529

15301530
! mass flux, this should be \alpha_i \rho_i u_i
@@ -1659,7 +1659,7 @@ contains
16591659
(rho*(1._wp - adv(num_fluids)))
16601660
end if
16611661
else
1662-
c = ((H - 5e-1*vel_sum)/gamma)
1662+
c = ((H - 5.e-1*vel_sum)/gamma)
16631663
end if
16641664

16651665
if (mixture_err .and. c < 0._wp) then

src/post_process/m_data_output.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ contains
13291329
rho = rho + adv(l)*q_prim_vf(l)%sf(i, j, k)
13301330
end do
13311331
1332-
H = ((gamma + 1_wp)*pres + pi_inf)/rho
1332+
H = ((gamma + 1._wp)*pres + pi_inf)/rho
13331333
13341334
call s_compute_speed_of_sound(pres, rho, &
13351335
gamma, pi_inf, &

src/post_process/m_derived_variables.fpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ contains
212212
end if
213213

214214
if (mixture_err .and. q_sf(i, j, k) < 0._wp) then
215-
q_sf(i, j, k) = 1e-16_wp
215+
q_sf(i, j, k) = 1.e-16_wp
216216
else
217217
q_sf(i, j, k) = sqrt(q_sf(i, j, k))
218218
end if
@@ -285,8 +285,8 @@ contains
285285
end if
286286
end if
287287

288-
if (abs(top) < 1e-8_wp) top = 0._wp
289-
if (abs(bottom) < 1e-8_wp) bottom = 0._wp
288+
if (abs(top) < 1.e-8_wp) top = 0._wp
289+
if (abs(bottom) < 1.e-8_wp) bottom = 0._wp
290290

291291
if (f_approx_equal(top, bottom)) then
292292
slope = 1._wp
@@ -295,20 +295,20 @@ contains
295295
! (bottom == 0._wp .AND. top /= 0._wp)) THEN
296296
! slope = 0._wp
297297
else
298-
slope = (top*bottom)/(bottom**2._wp + 1e-16_wp)
298+
slope = (top*bottom)/(bottom**2._wp + 1.e-16_wp)
299299
end if
300300

301301
! Flux limiter function
302302
if (flux_lim == 1) then ! MINMOD (MM)
303303
q_sf(j, k, l) = max(0._wp, min(1._wp, slope))
304304
elseif (flux_lim == 2) then ! MUSCL (MC)
305-
q_sf(j, k, l) = max(0._wp, min(2._wp*slope, 5e-1_wp*(1._wp + slope), 2._wp))
305+
q_sf(j, k, l) = max(0._wp, min(2._wp*slope, 5.e-1_wp*(1._wp + slope), 2._wp))
306306
elseif (flux_lim == 3) then ! OSPRE (OP)
307-
q_sf(j, k, l) = (15e-1_wp*(slope**2._wp + slope))/(slope**2._wp + slope + 1._wp)
307+
q_sf(j, k, l) = (15.e-1_wp*(slope**2._wp + slope))/(slope**2._wp + slope + 1._wp)
308308
elseif (flux_lim == 4) then ! SUPERBEE (SB)
309309
q_sf(j, k, l) = max(0._wp, min(1._wp, 2._wp*slope), min(slope, 2._wp))
310310
elseif (flux_lim == 5) then ! SWEBY (SW) (beta = 1.5)
311-
q_sf(j, k, l) = max(0._wp, min(15e-1_wp*slope, 1._wp), min(slope, 15e-1_wp))
311+
q_sf(j, k, l) = max(0._wp, min(15.e-1_wp*slope, 1._wp), min(slope, 15.e-1_wp))
312312
elseif (flux_lim == 6) then ! VAN ALBADA (VA)
313313
q_sf(j, k, l) = (slope**2._wp + slope)/(slope**2._wp + 1._wp)
314314
elseif (flux_lim == 7) then ! VAN LEER (VL)

src/pre_process/include/2dHardcodedIC.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
real(wp) :: rhoH, rhoL, pRef, pInt, h, lam, wl, amp, intH, intL, alph
66
real(wp) :: factor
77

8-
eps = 1e-9_wp
8+
eps = 1.e-9_wp
99

1010
#:enddef
1111

@@ -35,7 +35,7 @@
3535
if (r < rmax) then
3636
q_prim_vf(momxb)%sf(i, j, 0) = -(y_cc(j) - 0.5_wp)*umax/rmax
3737
q_prim_vf(momxe)%sf(i, j, 0) = (x_cc(i) - 0.5_wp)*umax/rmax
38-
q_prim_vf(E_idx)%sf(i, j, 0) = p0 + umax**2*((r/rmax)**2/2._wp)
38+
q_prim_vf(E_idx)%sf(i, j, 0) = p0 + umax**2*((r/rmax)**2._wp/2._wp)
3939
else if (r < 2*rmax) then
4040
q_prim_vf(momxb)%sf(i, j, 0) = -((y_cc(j) - 0.5_wp)/r)*umax*(2._wp - r/rmax)
4141
q_prim_vf(momxe)%sf(i, j, 0) = ((x_cc(i) - 0.5_wp)/r)*umax*(2._wp - r/rmax)

src/pre_process/include/3dHardcodedIC.fpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
real(wp) :: eps
77

8-
eps = 1e-9_wp
8+
eps = 1.e-9_wp
99
#:enddef
1010

1111
#:def Hardcoded3D()
@@ -23,7 +23,7 @@
2323

2424
intH = amp*(sin(2._wp*pi*x_cc(i)/lam - pi/2._wp) + sin(2._wp*pi*z_cc(k)/lam - pi/2._wp)) + h
2525

26-
alph = 5e-1_wp*(1._wp + tanh((y_cc(j) - intH)/2.5e-3_wp))
26+
alph = 5.e-1_wp*(1._wp + tanh((y_cc(j) - intH)/2.5e-3_wp))
2727

2828
if (alph < eps) alph = eps
2929
if (alph > 1._wp - eps) alph = 1._wp - eps

src/pre_process/m_assign_variables.fpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ contains
181181
end if
182182
183183
! Updating the patch identities bookkeeping variable
184-
if (1._wp - eta < 1e-16_wp) patch_id_fp(j, k, l) = patch_id
184+
if (1._wp - eta < 1.e-16_wp) patch_id_fp(j, k, l) = patch_id
185185
186186
end subroutine s_assign_patch_mixture_primitive_variables
187187
@@ -199,8 +199,8 @@ contains
199199
real(wp) :: pres_mag, loc, n_tait, B_tait, p0
200200
real(wp) :: R3bar, n0, ratio, nH, vfH, velH, rhoH, deno
201201
202-
p0 = 101325
203-
pres_mag = 1e-1_wp
202+
p0 = 101325._wp
203+
pres_mag = 1.e-1_wp
204204
loc = x_cc(177)
205205
n_tait = fluid_pp(1)%gamma
206206
B_tait = fluid_pp(1)%pi_inf
@@ -214,7 +214,7 @@ contains
214214
215215
if (qbmm) then
216216
do i = 1, nb
217-
q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l) = q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l)*((p0 - fluid_pp(1)%pv)/(q_prim_vf(E_idx)%sf(j, k, l)*p0 - fluid_pp(1)%pv))**(1/3._wp)
217+
q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l) = q_prim_vf(bubxb + 1 + (i - 1)*nmom)%sf(j, k, l)*((p0 - fluid_pp(1)%pv)/(q_prim_vf(E_idx)%sf(j, k, l)*p0 - fluid_pp(1)%pv))**(1._wp/3._wp)
218218
end do
219219
end if
220220
@@ -687,7 +687,7 @@ contains
687687
end if
688688
689689
! Updating the patch identities bookkeeping variable
690-
if (1._wp - eta < 1e-16_wp) patch_id_fp(j, k, l) = patch_id
690+
if (1._wp - eta < 1.e-16_wp) patch_id_fp(j, k, l) = patch_id
691691
692692
end subroutine s_assign_patch_species_primitive_variables
693693

0 commit comments

Comments
 (0)