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

Correct array constructor for strings in CABLE-POP_TRENDY #427

Open
wants to merge 7 commits into
base: CABLE-POP_TRENDY
Choose a base branch
from

Conversation

mcuntz
Copy link
Contributor

@mcuntz mcuntz commented Oct 18, 2024

CABLE

Description

The model did not compile with gfortran v14.2.

Possible dimension names in input files are defined as a character arrays in cable_common_module. They have different character lengths. The current notation is not Fortran standard compliant. I replaced

CHARACTER(LEN=16), DIMENSION(5), PARAMETER :: LatNames = &
    ["latitude", "lat", "lats", "y", "Latitude"]

with

CHARACTER(LEN=*), DIMENSION(*), PARAMETER :: LatNames = &
    [CHARACTER(LEN=8) :: "latitude", "lat", "lats", "y", "Latitude"]

Same for LonNames and TimeNames.
I found this very cool notation on stackoverflow.

Another error was also in cable_common, where the continuation character was within the string:

CALL handle_err(ok, "Failed to find any "//TRIM(DimNames(1))//" dimensions&
    from the list.")

The compiler does not know if & is part of the string or the continuation character. I pulled it out of the string.

I also extended VarNames in spatio_temporal_dataset from 16 to length 32 because they are used currently only in cable_cru_Trendy and the names used there had a maximum of 32 characters.

I finally compiled with debug flags, made both arguments of Fortran intrinsics (min) the same kind, removed all unused variables and unused module variables mainly in cable_input and casa_inout.

I would suggest adding '-e03' to the Intel debug flags for better standard compliance. I have not tested that and have not changed CMakeLists.txt.

Type of change

  • Bug fix

Checklist

  • The new content is accessible and located in the appropriate section.
  • I have checked that links are valid and point to the intended content.
  • I have checked my code/text and corrected any misspellings

@mcuntz mcuntz requested a review from Whyborn October 18, 2024 09:49
@Whyborn
Copy link

Whyborn commented Oct 24, 2024

Can you give a link to the documentation on that -e03 compiler flag? I can't find anything on it at the Intel Compiler Flag list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants