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

Psyclone fixed format support #2192

Open
LonelyCat124 opened this issue Jun 27, 2023 · 2 comments
Open

Psyclone fixed format support #2192

LonelyCat124 opened this issue Jun 27, 2023 · 2 comments

Comments

@LonelyCat124
Copy link
Collaborator

LonelyCat124 commented Jun 27, 2023

Socrates contains a number of fixed-format files which are not handled correctly by PSyclone, using the NEMO API.

fparser throws an exception on this code:

      SUBROUTINE make_block_6_1(ierr
     &  , n_band, wave_length_short, wave_length_long
     &  , l_exclude, n_band_exclude, index_exclude
     &  , n_deg_fit, t_ref_thermal, thermal_coefficient
     &  , theta_planck_tbl, l_present_6, l_planck_tbl
     &  )

This is valid fixed-format Fortran, but will cause a standard F90 compiler to raise syntax errors (e.g. godbolt with no arguments). At the moment, PSyclone also fails to parse this with this error:

Parse Error: algorithm.py:parse_fp2: Syntax error in file './make_block_6_1.f':
at line 20
>>>      SUBROUTINE make_block_6_1(ierr

Andy's suggestions here were:

  1. Either retry with fixed format is parsing fails (could be expensive) or be a bit smarter and consider the file suffix when creating the parser.
  2. Add a command line flag to PSyclone to override this and force either fixed or free formatted Fortran parsing.

At least this breaks for make_block_6_* files and perhaps also the cause of issues in disort_interface for Socrates.

@LonelyCat124
Copy link
Collaborator Author

As an addendum to the original comment, its not clear what is causing the error for some files and not others. The subroutine header above causes Psyclone/fparser to fail, while this subroutine block is fine:

      SUBROUTINE write_profile(ierr
     &  , n_level, n_column_profile, i_data_group, i_data_type, profile
     &  , l_reference, n_level_ref, p_ref, z_ref
     &  , name_profile, length
     &  , nd_cdl_dimen, nd_cdl_dimen_size, nd_cdl_data, nd_cdl_var
     &  )

@LonelyCat124
Copy link
Collaborator Author

LonelyCat124 commented Jun 27, 2023

This may be an fparser issue not a PSyclone bug (not 100%), I will make an issue there.

FParser issue: stfc/fparser#420

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

No branches or pull requests

1 participant