Skip to content

Add AMReX-based inflow reader to AWAE for FAST.Farm #3238

Open
deslaughter wants to merge 54 commits intoOpenFAST:devfrom
andrew-platt:f/AMReX_reader
Open

Add AMReX-based inflow reader to AWAE for FAST.Farm #3238
deslaughter wants to merge 54 commits intoOpenFAST:devfrom
andrew-platt:f/AMReX_reader

Conversation

@deslaughter
Copy link
Collaborator

This PR is almost ready to merge, pending feedback from @rthedin.

Feature or improvement description

This PR adds an AMReX file reader to AWAE (must enable AMREX_READER=ON when configuring CMake) so it can use inflow files in this format.

Impacted areas of the software

  • AWAE module
  • FAST.Farm regression tests (input file changes) and new test for AMReX inflow

Additional supporting information

The AMReX reader is based on the AMReX library, which CMake fetches during configuration and then AWAE is linked against it during compilation. Two new modules were added which wrap this library and make it available to AWAE: amrex_utils.cpp and amrex_utils.F90. Since AMReX is a C++ library, the amrex_utils.cpp wraps the necessary calls and provides Fortran compatible functions which are wrapped in amrex_utils.F90 to be compatible with the standard types used in OpenFAST.

Generative AI usage

Test results, if applicable

  • r-test branch merging required

WeiqunZhang and others added 30 commits February 18, 2026 07:14
- rearranged some locations of files
- had to hard code locations of libraries from amrex.  I should not need to do this:
     target_link_libraries(amrex_reader ${CMAKE_BINARY_DIR}/dependencies/amrex/Src/libamrex.a)
     target_include_directories(amrex_reader PUBLIC  ${CMAKE_BINARY_DIR}/dependencies/amrex/mod_files_3d/)
Copy link
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

Adds an optional AMReX-based inflow reader to AWAE/FAST.Farm (enabled via AMREX_READER=ON) and integrates it into CI/regression/unit tests.

Changes:

  • Introduces C++/Fortran AMReX reader wrappers (amrex_utils.cpp + amrex_utils.F90) and wires AMReX FetchContent + linking in CMake.
  • Adds AMReX inflow mode (Mod_AmbWind=4) plumbing across AWAE + FAST.Farm I/O and summary output.
  • Adds a new AMReX unit test plus AMReX regression test and accompanying plotfile test data.

Reviewed changes

Copilot reviewed 74 out of 79 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
unit_tests/CMakeLists.txt Adds AMReX reader unit test target and copies required test data into the build tree.
reg_tests/r-test Updates r-test submodule pointer for new/updated regression inputs.
reg_tests/CTestList.cmake Registers a new FAST.Farm regression test case for AMReX inflow.
modules/version/tests/versioninfo_utest.F90 Forces serial execution of testdrive suites.
modules/nwtc-library/tests/nwtc_library_utest.F90 Forces serial execution of testdrive suites.
modules/inflowwind/tests/inflowwind_utest.F90 Forces serial execution of testdrive suites.
modules/beamdyn/tests/beamdyn_utest.F90 Forces serial execution of testdrive suites.
modules/aerodyn/tests/aerodyn_utest.F90 Forces serial execution of testdrive suites.
modules/awae/tests/test_AMReX_reader.f90 Adds unit tests for AMReX header/data reading and subvolume discovery logic.
modules/awae/tests/AMReX_reader_utest.F90 Adds a standalone testdrive runner for AMReX unit tests with AMReX init/finalize.
modules/awae/tests/data/subvolmultiple_1_00040/Level_0/Cell_H Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00040/Level_0/Cell_D_00065 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00040/Level_0/Cell_D_00064 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00040/Header Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00032/Level_0/Cell_H Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00032/Level_0/Cell_D_00065 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00032/Level_0/Cell_D_00064 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00032/Header Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00024/Level_0/Cell_H Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00024/Level_0/Cell_D_00065 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00024/Level_0/Cell_D_00064 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00024/Header Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00016/Level_0/Cell_H Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00016/Level_0/Cell_D_00065 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00016/Level_0/Cell_D_00064 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00016/Header Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00008/Level_0/Cell_H Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00008/Level_0/Cell_D_00065 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00008/Header Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00000/Level_0/Cell_H Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_1_00000/Header Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00040/Level_0/Cell_H Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00040/Level_0/Cell_D_00065 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00040/Level_0/Cell_D_00064 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00040/Header Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00036/Level_0/Cell_H Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00036/Level_0/Cell_D_00065 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00036/Level_0/Cell_D_00064 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00036/Header Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00030/Level_0/Cell_H Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00030/Level_0/Cell_D_00065 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00030/Level_0/Cell_D_00064 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00030/Header Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00024/Level_0/Cell_H Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00024/Level_0/Cell_D_00065 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00024/Level_0/Cell_D_00064 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00024/Header Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00018/Level_0/Cell_H Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00018/Level_0/Cell_D_00065 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00018/Level_0/Cell_D_00064 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00018/Header Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00012/Level_0/Cell_H Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00012/Level_0/Cell_D_00065 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00012/Level_0/Cell_D_00064 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00012/Header Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00006/Level_0/Cell_H Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00006/Level_0/Cell_D_00065 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00006/Level_0/Cell_D_00064 Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00006/Header Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00000/Level_0/Cell_H Adds AMReX plotfile fixture data for unit tests.
modules/awae/tests/data/subvolmultiple_0_00000/Header Adds AMReX plotfile fixture data for unit tests.
modules/awae/src/amrex_utils.cpp Implements C++ AMReX plotfile header/data reading and subvolume scanning for Fortran.
modules/awae/src/amrex_utils.F90 Adds Fortran wrappers around the C++ AMReX utilities and stubs when disabled.
modules/awae/src/AWAE_Types.f90 Extends AWAE types/serialization for AMReX directory indexing parameters.
modules/awae/src/AWAE_Registry.txt Updates AWAE registry to include new AMReX parameters in generated types.
modules/awae/src/AWAE_IO.f90 Adds AMReX read path and renames VTK reader routines for clarity.
modules/awae/src/AWAE.f90 Wires Mod_AmbWind=4 into initialization, validation, update states, and cleanup.
modules/awae/CMakeLists.txt Adds AMReX sources and links AMReX when AMREX_READER is enabled.
glue-codes/fast-farm/src/FAST_Farm_Subs.f90 Updates WAT discretization logic for AMReX ambient wind mode.
glue-codes/fast-farm/src/FAST_Farm_IO.f90 Adds AMReX configuration inputs and improves per-mode path/time-step handling.
glue-codes/fast-farm/src/FAST_Farm.f90 Initializes/finalizes AMReX runtime from the FAST.Farm main program.
docs/source/user/api_change.rst Documents new FAST.Farm primary-file inputs for AMReX mode (Mod_AmbWind=4).
CMakeLists.txt Adds AMREX_READER option + FetchContent integration for AMReX dependency.
.github/workflows/automated-dev-tests.yml Enables AMReX reader in CI builds and modifies workspace artifact packaging.
Comments suppressed due to low confidence (4)

modules/awae/tests/test_AMReX_reader.f90:1

  • This test module uses c_double, c_int, and c_float kind-suffixed literals, but does not use iso_c_binding to import those named constants. This should fail to compile on a standard-conforming compiler. Add use iso_c_binding, only: c_double, c_int, c_float (or switch these literals to the project’s DbKi/IntKi/SiKi kinds consistently).
    modules/awae/tests/test_AMReX_reader.f90:1
  • This test module uses c_double, c_int, and c_float kind-suffixed literals, but does not use iso_c_binding to import those named constants. This should fail to compile on a standard-conforming compiler. Add use iso_c_binding, only: c_double, c_int, c_float (or switch these literals to the project’s DbKi/IntKi/SiKi kinds consistently).
    modules/awae/tests/test_AMReX_reader.f90:1
  • This test module uses c_double, c_int, and c_float kind-suffixed literals, but does not use iso_c_binding to import those named constants. This should fail to compile on a standard-conforming compiler. Add use iso_c_binding, only: c_double, c_int, c_float (or switch these literals to the project’s DbKi/IntKi/SiKi kinds consistently).
    modules/awae/tests/test_AMReX_reader.f90:1
  • This test module uses c_double, c_int, and c_float kind-suffixed literals, but does not use iso_c_binding to import those named constants. This should fail to compile on a standard-conforming compiler. Add use iso_c_binding, only: c_double, c_int, c_float (or switch these literals to the project’s DbKi/IntKi/SiKi kinds consistently).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@deslaughter deslaughter requested a review from Copilot March 6, 2026 16:56
Copy link
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

Copilot reviewed 74 out of 79 changed files in this pull request and generated 10 comments.

Comments suppressed due to low confidence (1)

unit_tests/CMakeLists.txt:1

  • Using an ALL custom target for copying test data can add unnecessary work to every build (even when nothing changed). Consider tying the copy step to the AMReX unit test target (e.g., a POST_BUILD step or a custom command that generates a stamp output), so it runs only when building/running that test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@deslaughter deslaughter marked this pull request as ready for review March 9, 2026 20:25
@deslaughter deslaughter requested a review from rthedin March 9, 2026 20:26
@andrew-platt andrew-platt mentioned this pull request Mar 9, 2026
1 task
do nt = 1, p%NumTurbines

! Loop through high resolution grids
do i_hl = 0, n_high_low
Copy link
Collaborator

Choose a reason for hiding this comment

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

We'll have to update this indexing after merging 4.2.1 in. Some other logic as well.

deslaughter and others added 4 commits March 10, 2026 14:46
Co-authored-by: Andy Platt <andrew-platt@users.noreply.github.com>
Co-authored-by: Andy Platt <andrew-platt@users.noreply.github.com>
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.

4 participants