Skip to content

MAP can't be used when writing checkpoint files#2915

Merged
deslaughter merged 4 commits intoOpenFAST:rc-4.1.2from
deslaughter:add-map-chkp-err
Jul 9, 2025
Merged

MAP can't be used when writing checkpoint files#2915
deslaughter merged 4 commits intoOpenFAST:rc-4.1.2from
deslaughter:add-map-chkp-err

Conversation

@deslaughter
Copy link
Copy Markdown
Collaborator

This PR is ready to merge.

Feature or improvement description

This PR adds error checks for when a user requests writing checkpoint files either for restart or mode shape visualization when the MAP module is active. If this should happen, an error message is displayed and OpenFAST will exit.

MAP can't be used with checkpoint files because MAP contains both Fortran and C components and the registry, which does the packing and unpacking of the checkpoint files, can't access some of the C data. Therefore, the checkpoint file can't contain the full state of the program so the restore won't work properly. MAP would likely need to be converted to Fortran to allow writing the checkpoint files.

While debugging this issue, some addition error handling was added to the registry to give better error messages in case a module tries to pack C_Obj%object data; hence the registry changes.

Related issue, if one exists

Closes #2887

Impacted areas of the software

  • registry_gen_fortran.cpp
  • MAP_Types.f90
  • ExternalInflow_Types.f90
  • ExtLoadsDX_Types.f90
  • FAST_Subs.f90

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces error guards to prevent unsupported operations when the MAP module is active and standardizes how registry packing failures report fatal errors.

  • Disallow writing checkpoint files if MAP is enabled.
  • Prevent VTK mode shape visualization under MAP.
  • Refactor registry pack routines to assign ErrStat/ErrMsg for C object packing failures.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
reg_tests/r-test Updated subproject commit reference.
modules/openfast-registry/src/registry_gen_fortran.cpp Refactored pack generator to manually set fatal error and message on C object.
modules/openfast-library/src/FAST_Subs.f90 Added fatal errors for VTK mode shapes and checkpoint creation with MAP.
modules/map/src/MAP_Types.f90 Updated all pack routines to set ErrID_Fatal and ErrMsg for C_obj packing.
modules/extloads/src/ExtLoadsDX_Types.f90 Updated pack routines to set ErrID_Fatal and ErrMsg for C_obj packing.
modules/externalinflow/src/ExternalInflow_Types.f90 Updated pack routines to set ErrID_Fatal and ErrMsg for C_obj packing.
Comments suppressed due to low confidence (4)

modules/openfast-library/src/FAST_Subs.f90:1136

  • Add or update regression tests to verify that requesting mode shape visualization with MAP active correctly triggers this fatal error path.
      ! If mode shape visualization requested when MAP is active, set error and return

modules/openfast-library/src/FAST_Subs.f90:1134

  • [nitpick] Consider removing or replacing the developer initials in this comment to improve clarity and adhere to codebase comment conventions.
      !bjj: until we modify this, MAP requires HydroDyn to be used. (perhaps we could send air density from AeroDyn or something...)

modules/openfast-registry/src/registry_gen_fortran.cpp:679

  • [nitpick] To maintain consistency with existing error handling, consider using the SetErrStat subroutine instead of manually assigning RF%ErrStat and RF%ErrMsg.
        w << indent << "   RF%ErrStat = ErrID_Fatal";

@andrew-platt
Copy link
Copy Markdown
Collaborator

Note: neither ExtLoads or ExternalInflow use the C_Obj%object data, so this will not affect the ability of AMR-Wind NALU-wind to do checkpoints.

@deslaughter deslaughter merged commit e97d5e0 into OpenFAST:rc-4.1.2 Jul 9, 2025
23 of 24 checks passed
@deslaughter deslaughter deleted the add-map-chkp-err branch July 10, 2025 14:15
@andrew-platt andrew-platt mentioned this pull request Aug 5, 2025
37 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants