MHKiT SWAN Example
Supported SWAN Output Files
- An ASCII table file ('SWANOUT.DAT'),
- An ASCII block file ('SWANOUTBlock.DAT')
- A binary block file ('SWANOUT.mat')
diff --git a/.github/workflows/code_compatibility_report.yml b/.github/workflows/code_compatibility_report.yml index 8f6add7b9..0fecf63ff 100644 --- a/.github/workflows/code_compatibility_report.yml +++ b/.github/workflows/code_compatibility_report.yml @@ -13,9 +13,8 @@ jobs: matrix: # os: [macos-13, ubuntu-latest, windows-latest] - os: [ubuntu-latest] - python-version: [3.8, 3.9, "3.10", 3.11] - matlab-version: [R2021b, R2022a, R2022b, R2023a, R2023b] + os: ["ubuntu-22.04"] + matlab-version: [R2022b, R2023a, R2023b, R2024a, R2024b, R2025a, latest] runs-on: ${{ matrix.os }} diff --git a/.github/workflows/unix_unit_tests.yml b/.github/workflows/unix_unit_tests.yml index f44342e60..403adacb2 100644 --- a/.github/workflows/unix_unit_tests.yml +++ b/.github/workflows/unix_unit_tests.yml @@ -1,10 +1,19 @@ name: MHKiT-MATLAB Unix Unit Tests +# Only run tests when MATLAB files or this workflow file changes on: push: branches: [ master, develop ] + paths: + - 'mhkit/**/*.m' + - 'examples/**/*.m' + - '.github/workflows/unix_unit_tests.yml' pull_request: branches: [ master, develop ] + paths: + - 'mhkit/**/*.m' + - 'examples/**/*.m' + - '.github/workflows/unix_unit_tests.yml' jobs: cache_population: @@ -12,9 +21,9 @@ jobs: fail-fast: false matrix: - os: [ubuntu-latest] - python-version: ["3.10"] - matlab-version: [R2022b] + os: ["ubuntu-22.04"] + python-version: ["3.11"] + matlab-version: [R2023b] runs-on: ${{ matrix.os }} @@ -37,6 +46,12 @@ jobs: conda activate mhkit_conda_env conda install numpy cython pip pytest hdf5 libnetcdf cftime netcdf4 + - name: Fix libstdc++ compatibility + if: matrix.os == 'ubuntu-22.04' + run: | + # Force MATLAB to use system libstdc++ + echo "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/lib/x86_64-linux-gnu/libstdc++.so.6" >> "$GITHUB_ENV" + - name: Check out MHKiT-MATLAB uses: actions/checkout@v4 @@ -122,7 +137,7 @@ jobs: fail-fast: false matrix: - os: [macos-13, ubuntu-latest] + os: [macos-13, "ubuntu-22.04"] python-version: ["3.10", 3.11, 3.12] # Note: It is preferred to use an actual release name as opposed to 'latest' matlab-version: [R2022b, R2023a, R2023b, R2024a, R2024b] @@ -130,7 +145,7 @@ jobs: exclude: - python-version: "3.10" # cache_population job matlab-version: R2022b - os: ubuntu-latest + os: "ubuntu-22.04" # Python 3.12 + MATLAB incompatability - matlab-version: R2024a python-version: 3.12 @@ -153,6 +168,10 @@ jobs: - matlab-version: R2024b python-version: 3.12 os: macos-13 + # Unable to resolve the name 'py.mhkit.wave.resource.jonswap_spectrum' + - matlab-version: R2023a + python-version: 3.10 + os: "ubuntu-22.04" runs-on: ${{ matrix.os }} @@ -179,9 +198,15 @@ jobs: conda activate mhkit_conda_env conda install numpy cython pip pytest hdf5 libnetcdf cftime netcdf4 - - name: Setup MATLAB Path on Ubuntu - if: ${{ matrix.os == 'ubuntu-latest' }} - run: echo "LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6" >> "$GITHUB_ENV" + - name: Fix libstdc++ compatibility + if: matrix.os == 'ubuntu-22.04' + run: | + # Force MATLAB to use system libstdc++ + echo "LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6:/lib/x86_64-linux-gnu/libstdc++.so.6" >> "$GITHUB_ENV" + + # - name: Setup MATLAB Path on Ubuntu + # if: ${{ matrix.os == '"ubuntu-22.04"' }} + # run: echo "LD_PRELOAD=/lib/x86_64-linux-gnu/libstdc++.so.6" >> "$GITHUB_ENV" - name: Print Python executable shell: bash -l {0} diff --git a/.github/workflows/windows_unit_tests.yml b/.github/workflows/windows_unit_tests.yml index 1d2206db8..5890e2323 100644 --- a/.github/workflows/windows_unit_tests.yml +++ b/.github/workflows/windows_unit_tests.yml @@ -1,10 +1,19 @@ name: MHKiT-MATLAB Windows Unit Tests +# Only run tests when MATLAB files or this workflow file changes on: push: branches: [ master, develop ] + paths: + - 'mhkit/**/*.m' + - 'examples/**/*.m' + - '.github/workflows/windows_unit_tests.yml' pull_request: branches: [ master, develop ] + paths: + - 'mhkit/**/*.m' + - 'examples/**/*.m' + - '.github/workflows/windows_unit_tests.yml' jobs: cache_population: @@ -12,7 +21,7 @@ jobs: fail-fast: false matrix: os: [windows-latest] - python-version: ["3.10"] + python-version: ["3.11"] matlab-version: [R2023b] runs-on: ${{ matrix.os }} @@ -80,6 +89,14 @@ jobs: with: release: ${{ matrix.matlab-version }} + - name: Set PYBIND11 GIL workaround + # if: ${{ matrix.matlab-version == 'R2025a' }} + shell: bash -l {0} + run: | + conda activate mhkit_conda_env + export PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF=1 + echo "PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF=1" >> $GITHUB_ENV + - name: Configure MATLAB pyenv Version and ExecutionMode if: ${{ matrix.os == 'windows-latest' }} shell: pwsh @@ -128,7 +145,8 @@ jobs: matrix: os: [windows-latest] python-version: ["3.10", 3.11, 3.12] - matlab-version: [R2022b, R2023a, R2023b, R2024a, R2024b] + # matlab-version: [R2022b, R2023a, R2023b, R2024a, R2024b] + matlab-version: [R2023a, R2023b, R2024a, R2024b] mhkit-python-version: ["0.9.0"] exclude: # Cache population job @@ -150,6 +168,11 @@ jobs: python-version: 3.11 - matlab-version: R2022b python-version: 3.11 + # Failing Job + # Python Error: ImportError: DLL load failed while importing pyexpat: The operating system cannot run %1 + - matlab-version: R2023a + python-version: "3.10" + runs-on: ${{ matrix.os }} env: @@ -197,6 +220,21 @@ jobs: # pip uninstall -y scipy # pip install scipy==1.10.1 # + + # Some tests fail with: + # Python Error: ImportError: DLL load failed while importing pyexpat: The operating system cannot run %1. + # One potential fix is to install expat and lxml + - name: Install Windows XML dependencies + if: ${{ matrix.os == 'windows-latest' }} + shell: bash -l {0} + run: | + conda activate mhkit_conda_env + # Simple single package install to avoid solver issues + conda install expat -y + # Alternative: use pip for XML parsing + pip install lxml + + - name: List installed pip modules shell: bash -l {0} run: | @@ -227,6 +265,14 @@ jobs: with: release: ${{ matrix.matlab-version }} + - name: Set PYBIND11 GIL workaround + # if: ${{ matrix.matlab-version == 'R2025a' }} + shell: bash -l {0} + run: | + conda activate mhkit_conda_env + export PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF=1 + echo "PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF=1" >> $GITHUB_ENV + - name: Add Python Dir to Path shell: bash -l {0} run: | diff --git a/changelog.md b/changelog.md index 77ebe081e..b06d15d32 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,68 @@ +# Version 1.0.0 + +## Release Highlights + +- New acoustics, and mooring modules +- Improvements to Wave, WDRT, and DOLFYN modules +- New examples for acoustics, mooring, and WEC-sim, and improved examples for DOLFYN and wave modules +- Multiple bug fixes and performance improvements + +## PR #174 - Acoustics Module + +- Authors: @hivanov-nrel, @simmsa +- Addition of acoustics module: + - Reading and standardization of of OceanSonics icListen and OceanInstruments Soundtrap hydrophone files + - Implementation of numerical computation sections IEC 62600-40 "Acoustic characterization of marine energy converters" standard + - Spectrogram data visualizations using `plot_spectrogram` + - Sound exposure level calculations with auditory weighting functions for 5 groups of marine mammals + - Complete example livescript in examples/acoustics_example.mlx + +## PR 176 - Wave Module Native MATLAB Implementation + +- Authors: @MShabara, @simmsa +- Convert wave module functions to native MATLAB code: + - wave/resource/standardize_wave_spectra_frequency.m: + - wave/resource/frequency_moment.m: + - wave/resource/energy_period.m: + - wave/resource/significant_wave_height.m: + - wave/resource/jonswap_spectrum.m: + - wave/resource/pierson_moskowitz_spectrum.m: + - wave/resource/surface_elevation.m: + +## PR 153 - Mooring Module + +- Author: @hivanov-nrel +- Addition of the mooring module, which includes + - Read in MoorDyn files into MATLAB + - Function to calculate mooring line lay length + - Functions to visualize mooring line dynamics in 2D or 3D. + - Example LiveScript demonstrating the functionality of the mooring module + +## PR #173 - Dolfyn Turbulence Functionality + +- Author: @simmsa, @browniea +- Addition of turbulence calculations for acoustic doppler instruments + - Turbulence intensity, noise, and reynolds stress calculations + - Updates to examples/adcp_example.mlx live script + +## PR 170 - WDRT leftovers + +- Author: @hivanov-nrel +- Expanded WDRT functionality by adding `automatic_hs_threshold` and `return_year_value` functions + +## PR 169 - Code Compatibility Improvements + +- Author: @simmsa +- Fix code compatibility issues detailed in issues #115, #116, #117, #118, #119, #120, #121, and #122 + +## Bug Fixes + +- Issue #172 - Fix Failing MLER Test - @hivanov-nrel +- Issue #152 - Fix dimensionality differences in environmental_contours_example - @simmsa +- Issue #146, #74 - Finish WDRT Parity - @hivanov-nrel +- Issue #145 - Fix build errors in documentation - @simmsa +- Issue #114, #115, #116, #117, #118, #119, #121, #122 - MATLAB code compatibility issues + # MHKiT-MATLAB v0.6.0 ## Release Highlights diff --git a/examples/SWAN_example.html b/examples/SWAN_example.html index 6457b344c..0ca252d01 100644 --- a/examples/SWAN_example.html +++ b/examples/SWAN_example.html @@ -70,7 +70,7 @@ .variableNameElement { margin-bottom: 3px; display: inline-block;} /* * Ellipses as base64 for HTML export. */.matrixElement .horizontalEllipsis,.rtcDataTipElement .matrixElement .horizontalEllipsis { display: inline-block; margin-top: 3px; /* base64 encoded version of images-liveeditor/HEllipsis.png */ width: 30px; height: 12px; background-repeat: no-repeat; background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAJCAYAAADO1CeCAAAAJUlEQVR42mP4//8/A70xw0i29BUDFPxnAEtTW37wWDqakIa4pQDvOOG89lHX2gAAAABJRU5ErkJggg==");} .matrixElement .verticalEllipsis,.textElement .verticalEllipsis,.rtcDataTipElement .matrixElement .verticalEllipsis,.rtcDataTipElement .textElement .verticalEllipsis { margin-left: 35px; /* base64 encoded version of images-liveeditor/VEllipsis.png */ width: 12px; height: 30px; background-repeat: no-repeat; background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAZCAYAAAAIcL+IAAAALklEQVR42mP4//8/AzGYgWyFMECMwv8QddRS+P//KyimlmcGUOFoOI6GI/UVAgDnd8Dd4+NCwgAAAABJRU5ErkJggg==");} -.S13 { border-left: 1px solid rgb(217, 217, 217); border-right: 1px solid rgb(217, 217, 217); border-top: 1px solid rgb(217, 217, 217); border-bottom: 0px none rgb(33, 33, 33); border-radius: 0px; padding: 6px 45px 0px 13px; line-height: 18.004px; min-height: 0px; white-space: nowrap; color: rgb(33, 33, 33); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px; }