Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up the linted source #778

Merged
merged 5 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/lint-source.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ jobs:
run: pip install fortitude-lint ansi2txt

- name: Lint the source code
run: fortitude check --file-extensions=f90,fpp,fypp --ignore=E001,S001,S101,M011,F001,S041,T001,S101 ./src/** || true
run: fortitude check --file-extensions=f90,fpp,fypp --ignore=E001,S001,S101,M011,F001,S041,T001,S101,S102,T002,T011 ./src/** || true

- name: Ensure kind is specified
run: fortitude check --file-extensions=f90,fpp,fypp --select=P001 ./src/**

- name: Ensure subroutines are named
run: fortitude check --file-extensions=f90,fpp,fypp --select=S061 ./src/**

- name: No double precision intrinsics
run: |
! grep -iR 'double_precision\|dsqrt\|dexp\|dlog\|dble\|dabs\|double\ precision\|real(8)\|real(4)\|dprod\|dmin\|dmax\|dfloat\|dreal\|dcos\|dsin\|dtan\|dsign\|dtanh\|dsinh\|dcosh\|d0' --exclude-dir=syscheck --exclude="*nvtx*" --exclude="*precision_select*" ./src/*
Expand Down
2 changes: 1 addition & 1 deletion src/common/m_checker_common.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ contains
@:PROHIBIT(adv_n .and. (.not. bubbles_euler))
@:PROHIBIT(adv_n .and. num_fluids /= 1)
@:PROHIBIT(adv_n .and. qbmm)
end subroutine
end subroutine s_check_inputs_adv_n

!> Checks constraints on the hypoelasticity parameters.
!! Called by s_check_inputs_common for pre-processing and simulation
Expand Down
4 changes: 2 additions & 2 deletions src/common/m_helper.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
end do
write (*, fmt="(A1)") " "

end subroutine
end subroutine s_print_2D_array

Check warning on line 104 in src/common/m_helper.fpp

View check run for this annotation

Codecov / codecov/patch

src/common/m_helper.fpp#L104

Added line #L104 was not covered by tests

!> Initializes non-polydisperse bubble modeling
subroutine s_initialize_nonpoly
Expand Down Expand Up @@ -248,7 +248,7 @@

write (res, '(I0)') i
res = trim(res)
end subroutine
end subroutine s_int_to_str

!> Computes the Simpson weights for quadrature
subroutine s_simpson
Expand Down
1 change: 0 additions & 1 deletion src/common/m_mpi_common.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ contains

subroutine s_mpi_gather_data(my_vector, counts, gathered_vector, root)

implicit none
integer, intent(in) :: counts ! Array of vector lengths for each process
real(wp), intent(in), dimension(counts) :: my_vector ! Input vector on each process
integer, intent(in) :: root ! Rank of the root process
Expand Down
2 changes: 1 addition & 1 deletion src/common/m_phase_change.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ contains

!> This subroutine finalizes the phase change module
subroutine s_finalize_relaxation_solver_module
end subroutine
end subroutine s_finalize_relaxation_solver_module

#endif

Expand Down
2 changes: 2 additions & 0 deletions src/post_process/m_data_input.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ module m_data_input
!! @param t_step Current time-step to input
subroutine s_read_abstract_data_files(t_step)

implicit none

integer, intent(in) :: t_step

end subroutine s_read_abstract_data_files
Expand Down
8 changes: 4 additions & 4 deletions src/pre_process/include/2dHardcodedIC.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@
end if

case (205) ! 2D lung wave interaction problem
h = 0.0 !non dim origin y
lam = 1.0 !non dim lambda
h = 0.0_wp !non dim origin y
lam = 1.0_wp !non dim lambda
amp = patch_icpp(patch_id)%a(2) !to be changed later! !non dim amplitude

intH = amp*sin(2*pi*x_cc(i)/lam - pi/2) + h
Expand All @@ -115,8 +115,8 @@
end if

case (206) ! 2D lung wave interaction problem - horizontal domain
h = 0.0 !non dim origin y
lam = 1.0 !non dim lambda
h = 0.0_wp !non dim origin y
lam = 1.0_wp !non dim lambda
amp = patch_icpp(patch_id)%a(2)

intL = amp*sin(2*pi*y_cc(j)/lam - pi/2) + h
Expand Down
4 changes: 2 additions & 2 deletions src/pre_process/include/3dHardcodedIC.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
end if

case (301) ! (3D lung geometry in X direction, |sin(*)+sin(*)|)
h = 0.0
lam = 1.0
h = 0.0_wp
lam = 1.0_wp
amp = patch_icpp(patch_id)%a(2)
intH = amp*abs((sin(2*pi*y_cc(j)/lam - pi/2) + sin(2*pi*z_cc(k)/lam - pi/2)) + h)
if (x_cc(i) > intH) then
Expand Down
2 changes: 1 addition & 1 deletion src/pre_process/m_assign_variables.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,4 +692,4 @@ contains

end subroutine s_finalize_assign_variables_module

end module
end module m_assign_variables
2 changes: 1 addition & 1 deletion src/pre_process/m_compute_levelset.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ contains
type(levelset_field), intent(INOUT) :: levelset
type(levelset_norm_field), intent(INOUT) :: levelset_norm

integer :: ib_patch_id
integer, intent(in) :: ib_patch_id
real(wp) :: top_right(2), bottom_left(2)
real(wp) :: x, y, min_dist
real(wp) :: side_dists(4)
Expand Down
2 changes: 0 additions & 2 deletions src/pre_process/m_grid.f90
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ module m_grid

subroutine s_generate_abstract_grid

! integer, intent(IN), optional :: dummy

end subroutine s_generate_abstract_grid

end interface
Expand Down
11 changes: 7 additions & 4 deletions src/pre_process/m_model.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
call s_read_stl_binary(filepath, model)
end if

end subroutine
end subroutine s_read_stl

!> This procedure reads an OBJ file.
!! @param filepath Path to the odj file.
Expand Down Expand Up @@ -291,7 +291,7 @@

close (iunit)

end subroutine
end subroutine s_read_obj

Check warning on line 294 in src/pre_process/m_model.fpp

View check run for this annotation

Codecov / codecov/patch

src/pre_process/m_model.fpp#L294

Added line #L294 was not covered by tests

!> This procedure reads a mesh from a file.
!! @param filepath Path to the file to read.
Expand Down Expand Up @@ -709,7 +709,7 @@
integer, intent(inout) :: edge_index !< Edge index iterator
integer, intent(inout) :: edge_count !< Total number of edges
real(wp), intent(in), dimension(1:2, 1:2) :: edge !< Edges end points to be registered
real(wp), dimension(1:edge_count, 1:2, 1:2) :: temp_boundary_v !< Temporary edge end vertex buffer
real(wp), dimension(1:edge_count, 1:2, 1:2), intent(inout) :: temp_boundary_v !< Temporary edge end vertex buffer

! Increment edge index and store the edge
edge_index = edge_index + 1
Expand Down Expand Up @@ -804,7 +804,10 @@
t_vec3, intent(in) :: spacing
real(wp), allocatable, intent(inout), dimension(:, :) :: interpolated_boundary_v

integer :: i, j, num_segments, total_vertices, boundary_edge_count
integer, intent(inout) :: total_vertices, boundary_edge_count
integer :: num_segments
integer :: i, j

real(wp) :: edge_length, cell_width
real(wp), dimension(1:2) :: edge_x, edge_y, edge_del
real(wp), allocatable :: temp_boundary_v(:, :)
Expand Down
2 changes: 1 addition & 1 deletion src/pre_process/m_patches.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ contains

integer, intent(IN) :: patch_id
integer, intent(INOUT), dimension(0:m, 0:n, 0:p) :: patch_id_fp
type(scalar_field), dimension(1:sys_size) :: q_prim_vf
type(scalar_field), dimension(1:sys_size), intent(inout) :: q_prim_vf

real(wp) :: r, x_p, eps, phi
real(wp), dimension(2:9) :: as, Ps
Expand Down
2 changes: 1 addition & 1 deletion src/pre_process/m_perturbation.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ contains
subroutine s_instability_wave(alpha, beta, wave, shift)
real(wp), intent(in) :: alpha, beta !< spatial wavenumbers
real(wp), dimension(mixlayer_nvar, 0:m, 0:n, 0:p), intent(inout) :: wave !< instability wave
real(wp) :: shift !< phase shift
real(wp), intent(in) :: shift !< phase shift
real(wp), dimension(0:nbp - 1) :: u_mean !< mean density and velocity profiles
real(wp) :: rho_mean, p_mean !< mean density and pressure
real(wp), dimension(0:nbp - 1, 0:nbp - 1) :: d !< differential operator in y dir
Expand Down
4 changes: 2 additions & 2 deletions src/simulation/m_acoustic_src.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ contains
end do
end do
end do
end subroutine
end subroutine s_acoustic_src_calculations

!> This subroutine gives the temporally varying amplitude of the pulse
!! @param sim_time Simulation time
Expand Down Expand Up @@ -487,7 +487,7 @@ contains
end do
#endif

end subroutine
end subroutine s_precalculate_acoustic_spatial_sources

!> This subroutine gives the spatial support of the acoustic source
!! @param j x-index
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/m_boundary_conditions.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -1376,7 +1376,7 @@ contains

end if

end subroutine
end subroutine s_qbmm_extrapolation

subroutine s_populate_capillary_buffers(c_divs)

Expand Down
2 changes: 1 addition & 1 deletion src/simulation/m_fftw.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,4 +322,4 @@ contains

end subroutine s_finalize_fftw_module

end module
end module m_fftw
16 changes: 8 additions & 8 deletions src/simulation/m_nvtx.f90
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module m_nvtx
integer(c_int64_t) :: payload ! union uint,int,double
integer(c_int) :: messageType = 1 ! NVTX_MESSAGE_TYPE_ASCII = 1
type(c_ptr) :: message ! ascii char
end type
end type nvtxEventAttributes

#if defined(MFC_OpenACC) && defined(__PGI)

Expand All @@ -33,21 +33,21 @@ subroutine nvtxRangePushA(name) bind(C, name='nvtxRangePushA')
use iso_c_binding

character(kind=c_char, len=*) :: name
end subroutine
end subroutine nvtxRangePushA

! push range with custom label and custom color
subroutine nvtxRangePushEx(event) bind(C, name='nvtxRangePushEx')
use iso_c_binding

import :: nvtxEventAttributes
type(nvtxEventAttributes) :: event
end subroutine
end interface
end subroutine nvtxRangePushEx
end interface nvtxRangePush

interface nvtxRangePop
subroutine nvtxRangePop() bind(C, name='nvtxRangePop')
end subroutine
end interface
end subroutine nvtxRangePop
end interface nvtxRangePop

#endif

Expand All @@ -71,12 +71,12 @@ subroutine nvtxStartRange(name, id)
end if

#endif
end subroutine
end subroutine nvtxStartRange

subroutine nvtxEndRange
#if defined(MFC_OpenACC) && defined(__PGI)
call nvtxRangePop
#endif
end subroutine
end subroutine nvtxEndRange

end module m_nvtx
2 changes: 1 addition & 1 deletion src/simulation/m_qbmm.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ contains

end if

end subroutine
end subroutine s_compute_qbmm_rhs

!Coefficient array for non-polytropic model (pb and mv values are accounted in wght_pb and wght_mv)

Expand Down
46 changes: 26 additions & 20 deletions src/simulation/m_sim_helpers.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ subroutine s_compute_enthalpy(q_prim_vf, pres, rho, gamma, pi_inf, Re, H, alpha,
!$acc routine seq
#endif

type(scalar_field), dimension(sys_size) :: q_prim_vf
real(wp), dimension(num_fluids) :: alpha_rho
real(wp), dimension(num_fluids) :: alpha
real(wp), dimension(num_dims) :: vel
real(wp) :: rho, gamma, pi_inf, qv, vel_sum, E, H, pres
real(wp), dimension(2) :: Re
real(wp) :: G !< Cell-avg. fluid shear modulus
real(wp), dimension(num_fluids) :: Gs !< Cell-avg. fluid shear moduli
integer :: i, j, k, l
type(scalar_field), intent(in), dimension(sys_size) :: q_prim_vf
real(wp), intent(inout), dimension(num_fluids) :: alpha
real(wp), intent(inout), dimension(num_dims) :: vel
real(wp), intent(inout) :: rho, gamma, pi_inf, vel_sum, H, pres
integer, intent(in) :: j, k, l
real(wp), dimension(2), intent(inout) :: Re

real(wp), dimension(num_fluids) :: alpha_rho, Gs
real(wp) :: qv, E, G

integer :: i

!$acc loop seq
do i = 1, num_fluids
Expand Down Expand Up @@ -96,15 +98,16 @@ end subroutine s_compute_enthalpy
!! @param Rc_sf (optional) cell centered Rc
subroutine s_compute_stability_from_dt(vel, c, rho, Re_l, j, k, l, icfl_sf, vcfl_sf, Rc_sf)
!$acc routine seq
real(wp), dimension(num_dims) :: vel
real(wp) :: c, rho
real(wp), dimension(0:m, 0:n, 0:p) :: icfl_sf
real(wp), dimension(0:m, 0:n, 0:p), optional :: vcfl_sf, Rc_sf
real(wp), intent(in), dimension(num_dims) :: vel
real(wp), intent(in) :: c, rho
real(wp), dimension(0:m, 0:n, 0:p), intent(inout) :: icfl_sf
real(wp), dimension(0:m, 0:n, 0:p), intent(inout), optional :: vcfl_sf, Rc_sf
real(wp), dimension(2), intent(in) :: Re_l
integer, intent(in) :: j, k, l

real(wp) :: fltr_dtheta !<
!! Modified dtheta accounting for Fourier filtering in azimuthal direction.
integer :: j, k, l
integer :: Nfq
real(wp), dimension(2) :: Re_l

if (grid_geometry == 3) then
if (k == 0) then
Expand Down Expand Up @@ -192,14 +195,17 @@ end subroutine s_compute_stability_from_dt
!! @param l z coordinate
subroutine s_compute_dt_from_cfl(vel, c, max_dt, rho, Re_l, j, k, l)
!$acc routine seq
real(wp), dimension(num_dims) :: vel
real(wp) :: c, icfl_dt, vcfl_dt, rho
real(wp), dimension(0:m, 0:n, 0:p) :: max_dt
real(wp), dimension(num_dims), intent(in) :: vel
real(wp), intent(in) :: c, rho
real(wp), dimension(0:m, 0:n, 0:p), intent(inout) :: max_dt
real(wp), dimension(2), intent(in) :: Re_l
integer, intent(in) :: j, k, l

real(wp) :: icfl_dt, vcfl_dt
real(wp) :: fltr_dtheta !<
!! Modified dtheta accounting for Fourier filtering in azimuthal direction.
integer :: j, k, l

integer :: Nfq
real(wp), dimension(2) :: Re_l

if (grid_geometry == 3) then
if (k == 0) then
Expand Down
Loading