From 6babcb081f015ddba91f9c94b480f8b3f6f4d023 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sat, 28 Dec 2024 18:53:29 -0500 Subject: [PATCH 01/16] fix subroutine names --- .github/workflows/lint-source.yml | 5 ++++- src/common/m_checker_common.fpp | 2 +- src/common/m_helper.fpp | 4 ++-- src/common/m_phase_change.fpp | 2 +- src/pre_process/m_assign_variables.fpp | 2 +- src/pre_process/m_model.fpp | 4 ++-- src/simulation/m_acoustic_src.fpp | 4 ++-- src/simulation/m_boundary_conditions.fpp | 2 +- src/simulation/m_fftw.fpp | 2 +- src/simulation/m_nvtx.f90 | 16 ++++++++-------- src/simulation/m_qbmm.fpp | 2 +- 11 files changed, 24 insertions(+), 21 deletions(-) diff --git a/.github/workflows/lint-source.yml b/.github/workflows/lint-source.yml index aefd5495ab..a7ffb31aff 100644 --- a/.github/workflows/lint-source.yml +++ b/.github/workflows/lint-source.yml @@ -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 ./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/* diff --git a/src/common/m_checker_common.fpp b/src/common/m_checker_common.fpp index e8d6e1981d..2a1210ab66 100644 --- a/src/common/m_checker_common.fpp +++ b/src/common/m_checker_common.fpp @@ -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 diff --git a/src/common/m_helper.fpp b/src/common/m_helper.fpp index b290b5bbb3..d00439a9ba 100644 --- a/src/common/m_helper.fpp +++ b/src/common/m_helper.fpp @@ -101,7 +101,7 @@ contains end do write (*, fmt="(A1)") " " - end subroutine + end subroutine s_print_2D_array !> Initializes non-polydisperse bubble modeling subroutine s_initialize_nonpoly @@ -248,7 +248,7 @@ contains write (res, '(I0)') i res = trim(res) - end subroutine + end subroutine s_int_to_str !> Computes the Simpson weights for quadrature subroutine s_simpson diff --git a/src/common/m_phase_change.fpp b/src/common/m_phase_change.fpp index faa554bfec..f6a0e16665 100644 --- a/src/common/m_phase_change.fpp +++ b/src/common/m_phase_change.fpp @@ -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 diff --git a/src/pre_process/m_assign_variables.fpp b/src/pre_process/m_assign_variables.fpp index b6304949d0..edb636ad2b 100644 --- a/src/pre_process/m_assign_variables.fpp +++ b/src/pre_process/m_assign_variables.fpp @@ -692,4 +692,4 @@ contains end subroutine s_finalize_assign_variables_module -end module +end module m_assign_variables diff --git a/src/pre_process/m_model.fpp b/src/pre_process/m_model.fpp index 1e8df1621d..89d10ed53a 100644 --- a/src/pre_process/m_model.fpp +++ b/src/pre_process/m_model.fpp @@ -215,7 +215,7 @@ contains 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. @@ -291,7 +291,7 @@ contains close (iunit) - end subroutine + end subroutine s_read_obj !> This procedure reads a mesh from a file. !! @param filepath Path to the file to read. diff --git a/src/simulation/m_acoustic_src.fpp b/src/simulation/m_acoustic_src.fpp index 27901561d9..eea8368457 100644 --- a/src/simulation/m_acoustic_src.fpp +++ b/src/simulation/m_acoustic_src.fpp @@ -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 @@ -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 diff --git a/src/simulation/m_boundary_conditions.fpp b/src/simulation/m_boundary_conditions.fpp index b541a34d12..073c62d072 100644 --- a/src/simulation/m_boundary_conditions.fpp +++ b/src/simulation/m_boundary_conditions.fpp @@ -1376,7 +1376,7 @@ contains end if - end subroutine + end subroutine s_qbmm_extrapolation subroutine s_populate_capillary_buffers(c_divs) diff --git a/src/simulation/m_fftw.fpp b/src/simulation/m_fftw.fpp index fbc529d180..e50e7e3215 100644 --- a/src/simulation/m_fftw.fpp +++ b/src/simulation/m_fftw.fpp @@ -322,4 +322,4 @@ contains end subroutine s_finalize_fftw_module -end module +end module m_fftw diff --git a/src/simulation/m_nvtx.f90 b/src/simulation/m_nvtx.f90 index 2a49731f56..e2a493a497 100644 --- a/src/simulation/m_nvtx.f90 +++ b/src/simulation/m_nvtx.f90 @@ -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) @@ -33,7 +33,7 @@ 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') @@ -41,13 +41,13 @@ subroutine nvtxRangePushEx(event) bind(C, name='nvtxRangePushEx') 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 @@ -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 diff --git a/src/simulation/m_qbmm.fpp b/src/simulation/m_qbmm.fpp index 3c111c4fb1..4a23839afb 100644 --- a/src/simulation/m_qbmm.fpp +++ b/src/simulation/m_qbmm.fpp @@ -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) From cef8ddb326cee33a4d6b93ed185f7e22123986a5 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sat, 28 Dec 2024 19:09:15 -0500 Subject: [PATCH 02/16] more fixes --- .github/workflows/lint-source.yml | 2 +- src/common/m_mpi_common.fpp | 1 - src/post_process/m_data_input.f90 | 2 ++ src/pre_process/include/2dHardcodedIC.fpp | 8 ++++---- src/pre_process/include/3dHardcodedIC.fpp | 4 ++-- src/pre_process/m_grid.f90 | 2 -- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/lint-source.yml b/.github/workflows/lint-source.yml index a7ffb31aff..0b8a2bca89 100644 --- a/.github/workflows/lint-source.yml +++ b/.github/workflows/lint-source.yml @@ -29,7 +29,7 @@ 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,S102 ./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/** diff --git a/src/common/m_mpi_common.fpp b/src/common/m_mpi_common.fpp index c13709c0bd..405da58774 100644 --- a/src/common/m_mpi_common.fpp +++ b/src/common/m_mpi_common.fpp @@ -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 diff --git a/src/post_process/m_data_input.f90 b/src/post_process/m_data_input.f90 index 0f28032fc6..50a662f179 100644 --- a/src/post_process/m_data_input.f90 +++ b/src/post_process/m_data_input.f90 @@ -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 diff --git a/src/pre_process/include/2dHardcodedIC.fpp b/src/pre_process/include/2dHardcodedIC.fpp index 5732acbd3e..1505b99b42 100644 --- a/src/pre_process/include/2dHardcodedIC.fpp +++ b/src/pre_process/include/2dHardcodedIC.fpp @@ -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 @@ -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 diff --git a/src/pre_process/include/3dHardcodedIC.fpp b/src/pre_process/include/3dHardcodedIC.fpp index 5cf1f08eff..e0018598a7 100644 --- a/src/pre_process/include/3dHardcodedIC.fpp +++ b/src/pre_process/include/3dHardcodedIC.fpp @@ -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 diff --git a/src/pre_process/m_grid.f90 b/src/pre_process/m_grid.f90 index 0f92e8f22d..3afd8e85d3 100644 --- a/src/pre_process/m_grid.f90 +++ b/src/pre_process/m_grid.f90 @@ -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 From 92352ca7fd21ae53c1f4d65b810e16f665c5fbfe Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sat, 28 Dec 2024 19:21:58 -0500 Subject: [PATCH 03/16] helping --- src/simulation/m_fftw.fpp | 2 +- src/simulation/m_sim_helpers.f90 | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/simulation/m_fftw.fpp b/src/simulation/m_fftw.fpp index e50e7e3215..4adae18b14 100644 --- a/src/simulation/m_fftw.fpp +++ b/src/simulation/m_fftw.fpp @@ -322,4 +322,4 @@ contains end subroutine s_finalize_fftw_module -end module m_fftw +end module m_fftw diff --git a/src/simulation/m_sim_helpers.f90 b/src/simulation/m_sim_helpers.f90 index fdb387cbc5..97363cdb91 100644 --- a/src/simulation/m_sim_helpers.f90 +++ b/src/simulation/m_sim_helpers.f90 @@ -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 + 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(num_fluids) :: alpha_rho, Gs 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 + real(wp) :: qv, E, G + + integer :: i !$acc loop seq do i = 1, num_fluids From 1974870ed4b1f2d2b47d525e989b84313e7ab7e0 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sat, 28 Dec 2024 19:33:11 -0500 Subject: [PATCH 04/16] some intent --- src/simulation/m_sim_helpers.f90 | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/simulation/m_sim_helpers.f90 b/src/simulation/m_sim_helpers.f90 index 97363cdb91..0c6f95a672 100644 --- a/src/simulation/m_sim_helpers.f90 +++ b/src/simulation/m_sim_helpers.f90 @@ -40,9 +40,9 @@ subroutine s_compute_enthalpy(q_prim_vf, pres, rho, gamma, pi_inf, Re, H, 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), dimension(2) :: Re real(wp) :: qv, E, G integer :: i @@ -98,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 @@ -194,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 From 48aa981248dc1d49b3f3f7a239ed2c1bf6e1e275 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sat, 28 Dec 2024 19:51:40 -0500 Subject: [PATCH 05/16] more intent --- src/pre_process/m_compute_levelset.fpp | 2 +- src/pre_process/m_model.fpp | 7 +++++-- src/pre_process/m_patches.fpp | 2 +- src/pre_process/m_perturbation.fpp | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/pre_process/m_compute_levelset.fpp b/src/pre_process/m_compute_levelset.fpp index 3caad2cddd..d339157be6 100644 --- a/src/pre_process/m_compute_levelset.fpp +++ b/src/pre_process/m_compute_levelset.fpp @@ -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) diff --git a/src/pre_process/m_model.fpp b/src/pre_process/m_model.fpp index 89d10ed53a..bbd50e52bd 100644 --- a/src/pre_process/m_model.fpp +++ b/src/pre_process/m_model.fpp @@ -709,7 +709,7 @@ contains 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 @@ -804,7 +804,10 @@ contains 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(:, :) diff --git a/src/pre_process/m_patches.fpp b/src/pre_process/m_patches.fpp index 0afee832ed..39e354cb9e 100644 --- a/src/pre_process/m_patches.fpp +++ b/src/pre_process/m_patches.fpp @@ -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 diff --git a/src/pre_process/m_perturbation.fpp b/src/pre_process/m_perturbation.fpp index 5f92628914..ccb1b6175a 100644 --- a/src/pre_process/m_perturbation.fpp +++ b/src/pre_process/m_perturbation.fpp @@ -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 From aa3b39ea8eaf7ba7ae25b1470c4eb20e874921f3 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sat, 28 Dec 2024 20:03:34 -0500 Subject: [PATCH 06/16] last intent --- src/simulation/m_bubbles_EL.fpp | 16 +++++++++------- src/simulation/m_qbmm.fpp | 2 +- src/simulation/m_surface_tension.fpp | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/simulation/m_bubbles_EL.fpp b/src/simulation/m_bubbles_EL.fpp index 170bfe765e..b48f941a39 100644 --- a/src/simulation/m_bubbles_EL.fpp +++ b/src/simulation/m_bubbles_EL.fpp @@ -401,7 +401,7 @@ contains !! @param save_count File identifier subroutine s_restart_bubbles(bub_id, save_count) - integer :: bub_id, save_count + integer, intent(inout) :: bub_id, save_count character(LEN=path_len + 2*name_len) :: file_loc @@ -1460,7 +1460,7 @@ contains function particle_in_domain(pos_part) logical :: particle_in_domain - real(wp), dimension(3) :: pos_part + real(wp), dimension(3), intent(in) :: pos_part ! 2D if (p == 0 .and. cyl_coord .neqv. .true.) then @@ -1513,7 +1513,7 @@ contains function particle_in_domain_physical(pos_part) logical :: particle_in_domain_physical - real(wp), dimension(3) :: pos_part + real(wp), dimension(3), intent(in) :: pos_part particle_in_domain_physical = ((pos_part(1) < x_cb(m)) .and. (pos_part(1) >= x_cb(-1)) .and. & (pos_part(2) < y_cb(n)) .and. (pos_part(2) >= y_cb(-1))) @@ -1589,7 +1589,7 @@ contains !! @param q_time Current time subroutine s_write_lag_particles(qtime) - real(wp) :: qtime + real(wp), intent(in) :: qtime integer :: k character(LEN=path_len + 2*name_len) :: file_loc @@ -1631,7 +1631,8 @@ contains !! @param q_time Current time subroutine s_write_void_evol(qtime) - real(wp) :: qtime, volcell, voltot + real(wp), intent(in) :: qtime + real(wp) :: volcell, voltot real(wp) :: lag_void_max, lag_void_avg, lag_vol real(wp) :: void_max_glb, void_avg_glb, vol_glb @@ -1704,11 +1705,12 @@ contains subroutine s_write_restart_lag_bubbles(t_step) ! Generic string used to store the address of a particular file + integer, intent(in) :: t_step + character(LEN=path_len + 2*name_len) :: file_loc logical :: file_exist - - integer :: i, k, t_step integer :: bub_id, tot_part, tot_part_wrtn, npart_wrtn + integer :: i, k #ifdef MFC_MPI ! For Parallel I/O diff --git a/src/simulation/m_qbmm.fpp b/src/simulation/m_qbmm.fpp index 4a23839afb..11298e4f71 100644 --- a/src/simulation/m_qbmm.fpp +++ b/src/simulation/m_qbmm.fpp @@ -823,7 +823,7 @@ contains real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: pb, rhs_pb real(wp), dimension(startx:, starty:, startz:, 1:, 1:), intent(inout) :: mv, rhs_mv type(int_bounds_info), intent(in) :: ix, iy, iz - real(wp), dimension(startx:, starty:, startz:) :: nbub_sc !> Unused Variable not sure what to put as intent + real(wp), dimension(startx:, starty:, startz:), intent(inout) :: nbub_sc real(wp), dimension(nmom) :: moms, msum real(wp), dimension(nnode, nb) :: wght, abscX, abscY, wght_pb, wght_mv, wght_ht, ht diff --git a/src/simulation/m_surface_tension.fpp b/src/simulation/m_surface_tension.fpp index 0f9a24a51a..06b230c60e 100644 --- a/src/simulation/m_surface_tension.fpp +++ b/src/simulation/m_surface_tension.fpp @@ -70,7 +70,7 @@ contains flux_src_vf, & id, isx, isy, isz) - type(scalar_field), dimension(sys_size) :: q_prim_vf !> unused so unsure what intent to give it + type(scalar_field), dimension(sys_size), intent(in) :: q_prim_vf real(wp), dimension(-1:, 0:, 0:, 1:), intent(in) :: vSrc_rsx_vf real(wp), dimension(-1:, 0:, 0:, 1:), intent(in) :: vSrc_rsy_vf real(wp), dimension(-1:, 0:, 0:, 1:), intent(in) :: vSrc_rsz_vf From aa390de86067f1bfa1953db6c34b087b0cb99f59 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sun, 29 Dec 2024 10:05:14 -0500 Subject: [PATCH 07/16] clean parameters --- src/common/m_helper.fpp | 2 +- src/common/m_variables_conversion.fpp | 4 +++- src/pre_process/m_data_output.fpp | 2 +- src/pre_process/m_patches.fpp | 2 +- src/simulation/m_data_output.fpp | 2 +- src/simulation/m_hyperelastic.fpp | 4 ++-- src/simulation/m_start_up.fpp | 2 +- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/common/m_helper.fpp b/src/common/m_helper.fpp index d00439a9ba..0d849dbf68 100644 --- a/src/common/m_helper.fpp +++ b/src/common/m_helper.fpp @@ -244,7 +244,7 @@ contains subroutine s_int_to_str(i, res) integer, intent(in) :: i - character(len=*), intent(out) :: res + character(len=*), intent(inout) :: res write (res, '(I0)') i res = trim(res) diff --git a/src/common/m_variables_conversion.fpp b/src/common/m_variables_conversion.fpp index de910fc5f0..17d644259b 100644 --- a/src/common/m_variables_conversion.fpp +++ b/src/common/m_variables_conversion.fpp @@ -1081,7 +1081,7 @@ contains real(wp) :: dyn_pres real(wp) :: nbub, R3, vftmp, R3tmp real(wp), dimension(nb) :: Rtmp - real(wp) :: G = 0._wp + real(wp) :: G real(wp), dimension(2) :: Re_K integer :: i, j, k, l, q !< Generic loop iterators @@ -1090,6 +1090,8 @@ contains real(wp), dimension(num_species) :: Ys real(wp) :: e_mix, mix_mol_weight, T + G = 0._wp + #ifndef MFC_SIMULATION ! Converting the primitive variables to the conservative variables do l = 0, p diff --git a/src/pre_process/m_data_output.fpp b/src/pre_process/m_data_output.fpp index 4d194c5bf3..32b51e648c 100644 --- a/src/pre_process/m_data_output.fpp +++ b/src/pre_process/m_data_output.fpp @@ -831,7 +831,7 @@ contains ! Generic string used to store the address of a particular file character(LEN=len_trim(case_dir) + 2*name_len) :: file_loc character(len=15) :: temp - character(LEN=1), dimension(3) :: coord = (/'x', 'y', 'z'/) + character(LEN=1), dimension(3), parameter :: coord = (/'x', 'y', 'z'/) ! Generic logical used to check the existence of directories logical :: dir_check diff --git a/src/pre_process/m_patches.fpp b/src/pre_process/m_patches.fpp index 39e354cb9e..2a2ef17974 100644 --- a/src/pre_process/m_patches.fpp +++ b/src/pre_process/m_patches.fpp @@ -1416,7 +1416,7 @@ contains integer :: i, j, k !< generic loop iterators real(wp) :: epsilon, beta - complex(wp) :: cmplx_i = (0._wp, 1._wp) + complex(wp), parameter :: cmplx_i = (0._wp, 1._wp) complex(wp) :: H ! Transferring the patch's centroid and radius information diff --git a/src/simulation/m_data_output.fpp b/src/simulation/m_data_output.fpp index 6417dc7975..c2e6ddba27 100644 --- a/src/simulation/m_data_output.fpp +++ b/src/simulation/m_data_output.fpp @@ -110,7 +110,7 @@ contains !! time-step. subroutine s_open_run_time_information_file - character(LEN=name_len) :: file_name = 'run_time.inf' !< + character(LEN=name_len), parameter :: file_name = 'run_time.inf' !< !! Name of the run-time information file character(LEN=path_len + name_len) :: file_path !< diff --git a/src/simulation/m_hyperelastic.fpp b/src/simulation/m_hyperelastic.fpp index 5af5508c9a..46addb7685 100644 --- a/src/simulation/m_hyperelastic.fpp +++ b/src/simulation/m_hyperelastic.fpp @@ -227,7 +227,7 @@ contains integer, intent(in) :: j, k, l real(wp) :: trace - real(wp) :: f13 = 1_wp/3_wp + real(wp), parameter :: f13 = 1._wp/3._wp integer :: i !< Generic loop iterators ! tensor is the symmetric tensor & calculate the trace of the tensor @@ -266,7 +266,7 @@ contains integer, intent(in) :: j, k, l real(wp) :: trace - real(wp) :: f13 = 1_wp/3_wp + real(wp), parameter :: f13 = 1._wp/3._wp integer :: i !< Generic loop iterators !TODO Make this 1D and 2D capable diff --git a/src/simulation/m_start_up.fpp b/src/simulation/m_start_up.fpp index 6be30adc68..547502ff66 100644 --- a/src/simulation/m_start_up.fpp +++ b/src/simulation/m_start_up.fpp @@ -125,7 +125,7 @@ contains subroutine s_read_input_file ! Relative path to the input file provided by the user - character(LEN=name_len) :: file_path = './simulation.inp' + character(LEN=name_len), parameter :: file_path = './simulation.inp' logical :: file_exist !< !! Logical used to check the existence of the input file From 97db159114b065735a0b6df7058ca22ceba16c8f Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sun, 29 Dec 2024 10:58:16 -0500 Subject: [PATCH 08/16] toml and lint in CI --- .fortitude.toml | 5 +++++ .github/workflows/lint-source.yml | 14 ++++++++++---- src/post_process/m_data_output.fpp | 17 +---------------- toolchain/pyproject.toml | 2 ++ 4 files changed, 18 insertions(+), 20 deletions(-) create mode 100644 .fortitude.toml diff --git a/.fortitude.toml b/.fortitude.toml new file mode 100644 index 0000000000..c971773352 --- /dev/null +++ b/.fortitude.toml @@ -0,0 +1,5 @@ +[check] +# Ignored Rules and justification: +ignore = ["E001","S001","S101","M011","F001","S041","T001","S101","S102","T002","T011","T042","M001"] +file-extensions = ["f90","fpp","fypp"] +line-length = 5000 diff --git a/.github/workflows/lint-source.yml b/.github/workflows/lint-source.yml index 0b8a2bca89..58280b7c1c 100644 --- a/.github/workflows/lint-source.yml +++ b/.github/workflows/lint-source.yml @@ -25,11 +25,17 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Install Fortitude - run: pip install fortitude-lint ansi2txt + - name: Initialize MFC + run: ./mfc.sh init - - name: Lint the source code - run: fortitude check --file-extensions=f90,fpp,fypp --ignore=E001,S001,S101,M011,F001,S041,T001,S101,S102,T002,T011 ./src/** || true + # - name: Lint the source code + # run: fortitude check --file-extensions=f90,fpp,fypp --ignore=E001,S001,S101,M011,F001,S041,T001,S101,S102,T002,T011 ./src/** || true + + - name: Lint the full source + run: | + alias lintsource='find ./src -type f -not -name '*nvtx*' -exec command fortitude check {} \;' | + lintsource | + lintsource | wc -l | xargs -I{} sh -c '[ {} -gt 0 ] && exit 1 || exit 0' - name: Ensure kind is specified run: fortitude check --file-extensions=f90,fpp,fypp --select=P001 ./src/** diff --git a/src/post_process/m_data_output.fpp b/src/post_process/m_data_output.fpp index fbe6c051b3..5faf15f597 100644 --- a/src/post_process/m_data_output.fpp +++ b/src/post_process/m_data_output.fpp @@ -50,6 +50,7 @@ module m_data_output real(wp), allocatable, dimension(:, :, :), public :: q_sf real(wp), allocatable, dimension(:, :, :) :: q_root_sf real(wp), allocatable, dimension(:, :, :) :: cyl_q_sf + ! Single precision storage for flow variables real(sp), allocatable, dimension(:, :, :), public :: q_sf_s real(sp), allocatable, dimension(:, :, :) :: q_root_sf_s @@ -219,10 +220,6 @@ contains file_loc = trim(proc_rank_dir)//'/.' - !INQUIRE( DIRECTORY = TRIM(file_loc), & ! Intel compiler - !EXIST = dir_check ) - ! INQUIRE( FILE = TRIM(file_loc), & ! NAG/PGI/GCC compiler - ! EXIST = dir_check ) call my_inquire(file_loc, dir_check) if (dir_check .neqv. .true.) then call s_create_directory(trim(proc_rank_dir)) @@ -235,10 +232,6 @@ contains file_loc = trim(rootdir)//'/.' - !INQUIRE( DIRECTORY = TRIM(file_loc), & ! Intel compiler - ! EXIST = dir_check ) - ! INQUIRE( FILE = TRIM(file_loc), & ! NAG/PGI/GCC compiler - ! EXIST = dir_check ) call my_inquire(file_loc, dir_check) if (dir_check .neqv. .true.) then call s_create_directory(trim(rootdir)) @@ -259,10 +252,6 @@ contains file_loc = trim(proc_rank_dir)//'/.' - !INQUIRE( DIRECTORY = TRIM(file_loc), & ! Intel compiler - ! EXIST = dir_check ) - ! INQUIRE( FILE = TRIM(file_loc), & ! NAG/PGI/GCC compiler - ! EXIST = dir_check ) call my_inquire(file_loc, dir_check) if (dir_check .neqv. .true.) then @@ -276,10 +265,6 @@ contains file_loc = trim(rootdir)//'/.' - !INQUIRE( DIRECTORY = TRIM(file_loc), & ! Intel compiler - ! EXIST = dir_check ) - ! INQUIRE( FILE = TRIM(file_loc), & ! NAG/PGI/GCC compiler - ! EXIST = dir_check ) call my_inquire(file_loc, dir_check) if (dir_check .neqv. .true.) then diff --git a/toolchain/pyproject.toml b/toolchain/pyproject.toml index 0ede6a15c4..4af0412249 100644 --- a/toolchain/pyproject.toml +++ b/toolchain/pyproject.toml @@ -26,6 +26,8 @@ dependencies = [ "pylint", "fprettify", "black", + "fortitude-lint", + "ansi2txt", # Profiling "numpy", From 42367e218d50eb4183e5198974d167d9205ebff3 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sun, 29 Dec 2024 11:00:19 -0500 Subject: [PATCH 09/16] clean --- .github/workflows/lint-source.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/lint-source.yml b/.github/workflows/lint-source.yml index 58280b7c1c..bef19e88b1 100644 --- a/.github/workflows/lint-source.yml +++ b/.github/workflows/lint-source.yml @@ -28,9 +28,6 @@ jobs: - name: Initialize MFC run: ./mfc.sh init - # - name: Lint the source code - # run: fortitude check --file-extensions=f90,fpp,fypp --ignore=E001,S001,S101,M011,F001,S041,T001,S101,S102,T002,T011 ./src/** || true - - name: Lint the full source run: | alias lintsource='find ./src -type f -not -name '*nvtx*' -exec command fortitude check {} \;' | From 14ff8ecca5355bdfedd2bbae3df4c3de35de4fea Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sun, 29 Dec 2024 11:03:45 -0500 Subject: [PATCH 10/16] fix --- .github/workflows/lint-source.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/lint-source.yml b/.github/workflows/lint-source.yml index bef19e88b1..c3d9047475 100644 --- a/.github/workflows/lint-source.yml +++ b/.github/workflows/lint-source.yml @@ -30,16 +30,11 @@ jobs: - name: Lint the full source run: | + shopt -s expand_aliases alias lintsource='find ./src -type f -not -name '*nvtx*' -exec command fortitude check {} \;' | lintsource | lintsource | wc -l | xargs -I{} sh -c '[ {} -gt 0 ] && exit 1 || exit 0' - - 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/* From 804d755d307d53e0d74f895045c35e4555cbf57b Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sun, 29 Dec 2024 11:05:48 -0500 Subject: [PATCH 11/16] fix? --- .github/workflows/lint-source.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-source.yml b/.github/workflows/lint-source.yml index c3d9047475..291198551d 100644 --- a/.github/workflows/lint-source.yml +++ b/.github/workflows/lint-source.yml @@ -31,8 +31,8 @@ jobs: - name: Lint the full source run: | shopt -s expand_aliases - alias lintsource='find ./src -type f -not -name '*nvtx*' -exec command fortitude check {} \;' | - lintsource | + alias lintsource='find ./src -type f -not -name '*nvtx*' -exec command fortitude check {} \;' + lintsource lintsource | wc -l | xargs -I{} sh -c '[ {} -gt 0 ] && exit 1 || exit 0' - name: No double precision intrinsics From 0805659904fa8dbade372941d78c48faefe2c72c Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sun, 29 Dec 2024 11:09:01 -0500 Subject: [PATCH 12/16] fix? --- .github/workflows/lint-source.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint-source.yml b/.github/workflows/lint-source.yml index 291198551d..7bad08db00 100644 --- a/.github/workflows/lint-source.yml +++ b/.github/workflows/lint-source.yml @@ -30,10 +30,9 @@ jobs: - name: Lint the full source run: | - shopt -s expand_aliases - alias lintsource='find ./src -type f -not -name '*nvtx*' -exec command fortitude check {} \;' - lintsource - lintsource | wc -l | xargs -I{} sh -c '[ {} -gt 0 ] && exit 1 || exit 0' + pip install fortitude ansi2txt + find ./src -type f -not -name '*nvtx*' -exec command fortitude check {} \; + find ./src -type f -not -name '*nvtx*' -exec command fortitude check {} \; | wc -l | xargs -I{} sh -c '[ {} -gt 0 ] && exit 1 || exit 0' - name: No double precision intrinsics run: | From 30336d1206a5a0f254c4a717ba45747caf954ad8 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sun, 29 Dec 2024 11:21:13 -0500 Subject: [PATCH 13/16] fix --- .github/workflows/lint-source.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint-source.yml b/.github/workflows/lint-source.yml index 7bad08db00..2f93741b50 100644 --- a/.github/workflows/lint-source.yml +++ b/.github/workflows/lint-source.yml @@ -31,8 +31,8 @@ jobs: - name: Lint the full source run: | pip install fortitude ansi2txt - find ./src -type f -not -name '*nvtx*' -exec command fortitude check {} \; - find ./src -type f -not -name '*nvtx*' -exec command fortitude check {} \; | wc -l | xargs -I{} sh -c '[ {} -gt 0 ] && exit 1 || exit 0' + find ./src -type f -not -name '*nvtx*' -exec fortitude check {} \; + find ./src -type f -not -name '*nvtx*' -exec fortitude check {} \; | wc -l | xargs -I{} sh -c '[ {} -gt 0 ] && exit 1 || exit 0' - name: No double precision intrinsics run: | From cb289a98323f637596b569162d4682399293ade5 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sun, 29 Dec 2024 11:38:36 -0500 Subject: [PATCH 14/16] enter venv --- .github/workflows/lint-source.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-source.yml b/.github/workflows/lint-source.yml index 2f93741b50..6741084e06 100644 --- a/.github/workflows/lint-source.yml +++ b/.github/workflows/lint-source.yml @@ -30,9 +30,9 @@ jobs: - name: Lint the full source run: | - pip install fortitude ansi2txt - find ./src -type f -not -name '*nvtx*' -exec fortitude check {} \; - find ./src -type f -not -name '*nvtx*' -exec fortitude check {} \; | wc -l | xargs -I{} sh -c '[ {} -gt 0 ] && exit 1 || exit 0' + source build/venv/bin/activate + find ./src -type f -not -name '*nvtx*' -exec command fortitude check {} \; + find ./src -type f -not -name '*nvtx*' -exec command fortitude check {} \; | wc -l | xargs -I{} sh -c '[ {} -gt 0 ] && exit 1 || exit 0' - name: No double precision intrinsics run: | From 427eb870e5d6158877ee7110228b8279bf30615e Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sun, 29 Dec 2024 11:43:27 -0500 Subject: [PATCH 15/16] fix --- .github/workflows/lint-source.yml | 4 ++-- src/pre_process/m_perturbation.fpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint-source.yml b/.github/workflows/lint-source.yml index 6741084e06..eeb400b780 100644 --- a/.github/workflows/lint-source.yml +++ b/.github/workflows/lint-source.yml @@ -31,8 +31,8 @@ jobs: - name: Lint the full source run: | source build/venv/bin/activate - find ./src -type f -not -name '*nvtx*' -exec command fortitude check {} \; - find ./src -type f -not -name '*nvtx*' -exec command fortitude check {} \; | wc -l | xargs -I{} sh -c '[ {} -gt 0 ] && exit 1 || exit 0' + find ./src -type f -not -name '*nvtx*' -exec fortitude check {} \; + find ./src -type f -not -name '*nvtx*' -exec fortitude check {} \; | wc -l | xargs -I{} sh -c '[ {} -gt 0 ] && exit 1 || exit 0' - name: No double precision intrinsics run: | diff --git a/src/pre_process/m_perturbation.fpp b/src/pre_process/m_perturbation.fpp index ccb1b6175a..10c5b0f149 100644 --- a/src/pre_process/m_perturbation.fpp +++ b/src/pre_process/m_perturbation.fpp @@ -497,8 +497,8 @@ contains real(wp) :: ang, norm real(wp) :: tr, ti, cr, ci !< temporary memory real(wp) :: xratio - integer idx - integer i, j, k + integer :: idx + integer :: i, j, k xratio = mixlayer_vel_coef From c98d0a7136f55ef2c8a03c8731d1132b8b93a730 Mon Sep 17 00:00:00 2001 From: Spencer Bryngelson Date: Sun, 29 Dec 2024 11:49:46 -0500 Subject: [PATCH 16/16] format output --- .fortitude.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.fortitude.toml b/.fortitude.toml index c971773352..0d3dbcc7b8 100644 --- a/.fortitude.toml +++ b/.fortitude.toml @@ -2,4 +2,4 @@ # Ignored Rules and justification: ignore = ["E001","S001","S101","M011","F001","S041","T001","S101","S102","T002","T011","T042","M001"] file-extensions = ["f90","fpp","fypp"] -line-length = 5000 +output-format = "pylint"