20.07.2015 Views

PhD Thesis - staffweb - University of Greenwich

PhD Thesis - staffweb - University of Greenwich

PhD Thesis - staffweb - University of Greenwich

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>PhD</strong> <strong>Thesis</strong> by John Ewer.at the time when the legacy s<strong>of</strong>tware was used for re-engineering. The interested reader isdirected to the SMARTFIRE Technical Reference which is included in the Appendices section[See Appendix 11.4]. The Technical Reference covers the numerical and physics modellingcapabilities that exist in both the legacy and re-engineered CFD codes.3.6.1 Coding styleThe legacy code was written in standard FORTRAN-77 with no extensions to using compilerspecific features (e.g. no use is made <strong>of</strong> "DO..ENDDO", "DO..WHILE" or aggregate datatypes) that are available in FORTRAN-90 and as extensions in some FORTRAN-77 compilers.This was good from the point <strong>of</strong> view <strong>of</strong> portability but it did mean that "DO..WHILE(..)" loopswere actually implemented as "n CONTINUE..IF (..) GOTO n" which can be hard to followsemantically within large sections <strong>of</strong> code. These are fairly common constructs in the legacyCFD s<strong>of</strong>tware.Very little use was made <strong>of</strong> the computed GOTO or simple GOTO other than for theimplementation <strong>of</strong> DO..WHILE loops as described above. This meant that the legacy system hadreasonably clear execution paths, although some sections <strong>of</strong> the code were very long.The naming conventions used in the legacy s<strong>of</strong>tware followed the standard 6 characters foridentifiers and procedure names. Almost all variables were explicitly declared for dimensions andtype. The legacy code did not use any implicit typing except for a few loop index counters. Thefact that implicit typing was not used made the legacy code easier to reverse engineer but theuse <strong>of</strong> 6 character identifiers made the code quite hard to comprehend initially.Comments were only consistently applied to subroutine headers where they were used todescribed the argument list variables and their access modes. The remainder <strong>of</strong> the source codehad only a few scattered comments (typically 1 descriptive comment per 50 lines <strong>of</strong> code) toexplain the algorithms or the purpose <strong>of</strong> subroutines and functions. Generally the only internalcomments were for related code block title headings. This lack <strong>of</strong> comments meant that legacycode developer assistance and some background research was needed to understand the3-42

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!