openfast icon indicating copy to clipboard operation
openfast copied to clipboard

Bug/pythonlib

Open deslaughter opened this issue 2 years ago • 2 comments

This pull request is ready for merging.

All regression tests are passing and development is complete. No additional documentation is required.

Feature or improvement description This pull request resolves an issue where the openfast_library.py file was allocating too much memory on large simulations.

Related issue, if one exists None

Impacted areas of the software

  • glue-codes/openfast/src/FastLibAPI.cpp
  • glue-codes/openfast/src/FastLibAPI.h
  • glue-codes/python/openfast_library.py
  • glue-codes/simulink/src/FAST_SFunc.c
  • modules/openfast-library/src/FAST_Library.f90
  • modules/openfast-library/src/FAST_Library.h

Additional supporting information The existing versions of openfast_library.py and FastLibAPI allocate an output array with a size NUM_OUTPUTS*(T_MAX/DT). This size is inconsistent with the output files which contain data written every DT_OUT seconds. The code changes in this PR cause the output data to be collected on the DT_OUT interval which reduces memory usage and matches current output files. DT_OUT was exposed to these libraries by adding it to the FAST_Sizes arguments which required changes to the Fortran, C, C++, Python, and Simulink libraries.

These changes also resolve a potential memory leak in FastLibAPI where the output data array was not freed by the parent class destructor. This was fixed by changing the output array to a vector of vectors which is automatically destroyed.

Test results, if applicable Developer testing showed a reduction is memory use due to allocation of smaller output arrays.

deslaughter avatar Aug 12 '22 15:08 deslaughter

Will the addition of the dt_out variable passing require updates to SOWFA / AMR-Wind or the Simulink interfaces?

andrew-platt avatar Aug 15 '22 14:08 andrew-platt

The Simulink interface is updated here, and the SOWFA / AMR-Wind interface aren't changed. Those use the OpFM routines that are separately defined in FAST Library.

rafmudaf avatar Aug 15 '22 15:08 rafmudaf

Is there any reason to wait on merging this?

andrew-platt avatar Aug 31 '22 14:08 andrew-platt