MFC icon indicating copy to clipboard operation
MFC copied to clipboard

Module files are simply too long

Open sbryngelson opened this issue 3 years ago • 1 comments

Our module files are simply too long, no matter how you think about the code abstractions.

I suggest that modules should not be longer than 1000 lines, though much shorter or somewhat longer could be appropriate in specific cases. How things should be broken up exactly should be deliberated before starting the refactor.

Also, this issue should probably not be addressed until the GPU-3D-unmanaged branch is merged to master.

Here are the current line counts in the GPU-3D-unmanaged branch:

   36414 total
    3866 ./simulation_code/m_riemann_solvers.f90
    3827 ./simulation_code/m_rhs.f90
    2433 ./pre_process_code/m_initial_condition.f90
    2396 ./simulation_code/m_data_output.f90
    2099 ./pre_process_code/m_start_up.f90
    1779 ./post_process_code/m_mpi_proxy.f90
    1712 ./simulation_code/m_cbc.f90
    1614 ./simulation_code/m_weno.f90
    1547 ./simulation_code/m_mpi_proxy.f90
    1421 ./simulation_code/m_derived_variables.f90
    1137 ./post_process_code/m_data_output.f90
    1134 ./simulation_code/m_start_up.f90
    1086 ./post_process_code/m_data_input.f90
    1047 ./simulation_code/m_global_parameters.f90
     897 ./post_process_code/m_global_parameters.f90
     876 ./pre_process_code/m_global_parameters.f90
     826 ./pre_process_code/m_mpi_proxy.f90
     774 ./post_process_code/m_derived_variables.f90
     689 ./simulation_code/m_variables_conversion.f90
     576 ./post_process_code/m_start_up.f90
     514 ./post_process_code/p_main.f90
     491 ./simulation_code/m_time_steppers.f90
     484 ./simulation_code/m_bubbles.f90
     456 ./pre_process_code/m_variables_conversion.f90
     405 ./post_process_code/m_variables_conversion.f90
     400 ./pre_process_code/m_data_output.f90
     398 ./simulation_code/m_qbmm.f90
     324 ./pre_process_code/m_grid.f90
     301 ./master_scripts/m_silo_proxy.f90
     216 ./master_scripts/m_mpi_proxy.f90
     184 ./simulation_code/p_main.f90
     131 ./pre_process_code/m_derived_types.f90
     125 ./pre_process_code/p_main.f90
      96 ./simulation_code/m_derived_types.f90
      63 ./post_process_code/m_derived_types.f90
      30 ./simulation_code/m_compile_specific.f90
      30 ./pre_process_code/m_compile_specific.f90
      30 ./post_process_code/m_compile_specific.f90

sbryngelson avatar Nov 18 '21 23:11 sbryngelson

@henryleberre @anandrdbz the code seems to have grown since I opened this last year.

   41882 total
    5454 ./simulation/m_rhs.f90
    4686 ./simulation/m_riemann_solvers.fpp
    2754 ./simulation/m_cbc.f90
    2473 ./simulation/m_data_output.f90
    2432 ./pre_process/m_initial_condition.fpp
    2161 ./simulation/m_mpi_proxy.fpp
    2118 ./pre_process/m_start_up.fpp
    2107 ./simulation/m_weno.fpp
    1913 ./post_process/m_mpi_proxy.f90
    1418 ./simulation/m_derived_variables.f90
    1161 ./simulation/m_start_up.fpp
    1139 ./simulation/m_global_parameters.fpp
    1138 ./post_process/m_data_output.f90
    1098 ./post_process/m_data_input.f90
     928 ./post_process/m_derived_variables.f90
     920 ./post_process/m_global_parameters.f90
     911 ./pre_process/m_mpi_proxy.f90
     897 ./pre_process/m_global_parameters.fpp
     810 ./simulation/m_variables_conversion.f90
     571 ./post_process/m_start_up.f90
     522 ./simulation/m_time_steppers.f90
     511 ./post_process/p_main.f90
     493 ./simulation/m_qbmm.fpp
     480 ./simulation/m_bubbles.f90
     465 ./pre_process/m_variables_conversion.f90
     411 ./pre_process/m_data_output.f90
     411 ./post_process/m_variables_conversion.f90
     372 ./pre_process/m_grid.f90
     343 ./simulation/p_main.fpp
     286 ./simulation/m_fftw.fpp
     174 ./common/m_derived_types.f90
     173 ./pre_process/p_main.f90
      83 ./simulation/nvtx.f90
      54 ./common/m_compile_specific.f90
       5 ./simulation/case.fpp
       5 ./pre_process/case.fpp
       5 ./post_process/case.fpp

This doesn't make much sense since we now do metaprogramming, which should shorten the code significantly.

Regardless, I see several opportunities for making the code both shorter and more readable. For example, s_weno_alt (which has somehow replaced s_weno, which no longer exists) is 1200 line long subroutine.

sbryngelson avatar Oct 02 '22 15:10 sbryngelson

Deleting this in favor of other more specific issues

sbryngelson avatar Nov 09 '22 12:11 sbryngelson