rsofun
rsofun copied to clipboard
Making the Fortran codebase more maintainable
I noted the following things that I believe will make it difficult to maintain the codebase in the future:
- Mixing of attributes from different models in a same top-level derived type class (ex:
vegn_tile_type
,cohort_type
). Instead, attributes that are specific to a certain model should be grouped in one derived type which can be added to the top-level type as one attribute. Separation of concerns in important! - Mixing of attributes from different time resolutions (ex:
annualGpp
,dailyGpp
). Instead, it would be much better to group all daily (resp. annual) diagnostics in their own derived type and add a pointer tocohort_type
. The advantage is that one can discard the old diagnostic data by dropping the pointer and replacing it with a new fresh instance (with appropriate default values). Subroutines such asZero_diagnostics
, which are highly undesirable (!!) would then become unnecessary. - Non initialization of all attributes. Instead any attribute defined in a derived type should be initialized with a sensible default value or a dummy value (ex: -9999, or better: IEEE NaN), if no good default exists. In other words, any attribute defined in
datatypes.mod.f90
andclassdefs.mod.f90
should have a default value. - A detail, but there is no reason to add
.mod
in the Fortran file names. This extension is used for compiled files and it is a bit confusing to have it in the source files. - The
analysis
directory should not be committed to master.