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

Merge updates for NOAH-MP Interface #1994

Merged
merged 34 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
23290da
Add inital interface for NOAH-M
akashdhruv Jun 25, 2024
e3b48ee
Update NOAH module and the corresponding FindNetCDF cmake recipe
akashdhruv Jun 26, 2024
2ed392f
Initial interface for NOAH LSM
akashdhruv Aug 29, 2024
7f9e606
Initial interface for NOAH-MP land surface model
akashdhruv Sep 6, 2024
daccf60
Add linker options
akashdhruv Sep 6, 2024
6ae2d9b
Updates to cmake configuration to include NOAH
akashdhruv Sep 7, 2024
726e527
Update CMakeLists and move Fortran linkage to Noah-MP:
akashdhruv Sep 12, 2024
93cf87a
Update .gitmodules
akashdhruv Sep 16, 2024
b72f16e
Updates to NOAH-MP interface
akashdhruv Sep 20, 2024
be75e67
Saving some interface work
akashdhruv Sep 20, 2024
134d269
udpate gitmodules
akashdhruv Sep 29, 2024
8f91462
Merge with upstream development
akashdhruv Oct 21, 2024
aabbafa
checkpoint changes for merge
akashdhruv Oct 23, 2024
49cc9bf
Additional merge conflict resolution
akashdhruv Oct 23, 2024
27b6aa1
Update Noah-MP submodules to resolve cmake errors
akashdhruv Oct 23, 2024
c544b3e
Merge pull request #1 from AIEADA/adhruv/merged-noah-mp
akashdhruv Oct 23, 2024
959ffa9
Resolve style errors
akashdhruv Oct 23, 2024
0520002
Update gmake interface for noahmp and add a dev test
akashdhruv Oct 23, 2024
57d808a
Merge branch 'development' into adhruv/noah-mp
akashdhruv Oct 24, 2024
6b4ef34
Merge remote-tracking branch 'upstream/development' into adhruv/noah-mp
akashdhruv Nov 11, 2024
a8c62d5
Noah updates
akashdhruv Nov 11, 2024
4baa211
merge with upstream
akashdhruv Dec 3, 2024
4b94033
Remove unnecessary header file use
akashdhruv Dec 3, 2024
846e08b
fix whitespace errors
akashdhruv Dec 3, 2024
7224bb4
merge with upstream dev
akashdhruv Dec 5, 2024
f3e6646
Update interface
akashdhruv Dec 5, 2024
4a38fc2
Fix segfaults and make the interface concrete
akashdhruv Dec 16, 2024
b37ccf7
Merge with latest updates from upstream/development
akashdhruv Dec 16, 2024
b928cb2
Add documentation for NoahMP
akashdhruv Dec 17, 2024
b1fef8d
Merge remote-tracking branch 'upstream/development' into adhruv/noah-mp
akashdhruv Dec 17, 2024
781f3e3
Fix typo in docs
akashdhruv Dec 17, 2024
385ce9e
Fix white space errors
akashdhruv Dec 17, 2024
025600b
Fix AMReX bug
akashdhruv Dec 17, 2024
7b95dd1
Merge remote-tracking branch 'upstream/development' into adhruv/noah-mp
akashdhruv Dec 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions Docs/sphinx_doc/CouplingToNoahMP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
.. role:: cpp(code)
:language: c++

Coupling to Noah-MP
===================

Overview
--------

The NOAH Land Surface Model (LSM) is integrated with ERF to facilitate
interaction with the Noah-MP (Multi-Physics) land surface processes.

This documentation covers key components of this interface and its
associated data structures and routines, which are implemented in C++
and Fortran, and provides details on initialization and management of
data structures necessary for these processes.

Files Overview
--------------

- **Source/LandSurfaceModel/NOAH/ERF_NOAH.H**: Contains the declaration
of the NOAH class, which extends the NullSurf.

- **Source/LandSurfaceModel/NOAH/ERF_NOAH.cpp**: Implements the
initialization routine for the NOAH class.

- **Submodules/NOAH-MP/drivers/hrldas/NoahmpIO.H**: Defines the C++
`NoahmpIO_type` that is used to interface with Noah-MP implementations
following similar structure as the underlying Fortran interface
(https://dx.doi.org/10.5065/ew8g-yr95).

- **Submodules/NOAH-MP/drivers/hrldas/NoahmpIO.cpp**: Contains the
implementation of C++ routines interfacing with Fortran.

- **Submodules/NOAH-MP/drivers/hrldas/NoahmpIO_fi.F90**: Fortran module
responsible for managing mapping data between C++ and Fortran.

NOAH Class
----------

The NOAH class serves as the handler for initializing and managing the
data structures required for NOAH-MP operations. It inherits from the
`NullSurf` class. This class declares private variable `NoahmpIO_type
noahmpio`, that is passed to NoahMP routines similar to the Fortran
interface in the Noah-MP documentation
(https://dx.doi.org/10.5065/ew8g-yr95)

NoahmpIO_type Structure
-----------------------

This structure is key for handling the input and output operations for
NOAH-MP through C++ and Fortran interoperation. Contains various
variables for domain, memory, and tile configuration. Also, contains
arrays for geographic variables. At present this type exposes only a
select set of variables. More variables should be exposed as needed by
applications in ERF. The process of adding new variables is as follows:

#. In **Submodules/NOAH-MP/drivers/hrldas/NoahmpIO.H** add pointers to
the desired variable and set their initialization for
`NoahmpIO_type_fi` similar to implementation of `WSLAKEXY` and
`XLAT`.

#. In **Submodules/NOAH-MP/drivers/hrldas/NoahmpIO.H** declare objects
for Fortran-style multidimensional arrays for the same variables in
`NoahmpIO_type` similar to implemnation of `NoahArray2D<double> XLAT`
and `NoahArray2D<double> WSLAKEXY`.

#. In **Submodules/NOAH-MP/drivers/hrldas/NoahmpIO.cpp** cast the
pointers from `NoahmpIO_type_fi` to multidimensional arrays in
`NoahmpIO_type` within the implementation of `void
NoahmpIOVarInitDefault(NoahmpIO_type* noahmpio)`.

Fortran Interoperability
------------------------

The connection between C++ and Fortran is managed through `NoahmpIO_fi`.
This module contains a mirroring of the C++ structure for NOAH-MP
input-output operations.

The following functions are used to operate on the `NoahmpIO_type` and
interface with their respective Fortran implementations:

- `void NoahmpIOVarInitDefault(NoahmpIO_type* noahmpio)`: Initializes
default variables of `NoahmpIO_type`. Create C pointer for Fortran
data.

- `void NoahmpInitMain(NoahmpIO_type* noahmpio)`: Main initialization
function for the NOAH-MP operations in C++.

Usage
-----

To use the NOAH class and associated functions, ensure the correct
initialization sequence is followed within the simulation setup. The
interplay between C++ and Fortran necessitates careful memory and data
handling, which is crucial for ensuring performance and correctness in
simulations. The interface is designed to mimic the Fortran interface
from documentation(https://dx.doi.org/10.5065/ew8g-yr95), therefore
similar practices should be followed.
1 change: 1 addition & 0 deletions Docs/sphinx_doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ In addition to this documentation, there is API documentation for ERF generated

CouplingToAMRWind.rst
CouplingToWW3.rst
CouplingToNoahMP.rst

.. toctree::
:caption: ERF vs WRF
Expand Down
5 changes: 2 additions & 3 deletions Source/LandSurfaceModel/NOAH/ERF_NOAH.H
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ public:
const amrex::Geometry& geom,
const amrex::Real& dt) override;


private:

// C++ variable for NoahmpIO struct
NoahmpIO_struct noahmpio;
// C++ variable for NoahmpIO type
NoahmpIO_type noahmpio;

};
#endif
22 changes: 22 additions & 0 deletions Source/LandSurfaceModel/NOAH/ERF_NOAH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,29 @@ NOAH::Init (const MultiFab& cons_in,
* noahmpio.xend = 4;
* noahmpio.ystart = 1;
* noahmpio.yend = 2;
* noahmpio.nsoil = 1;
* noahmpio.nsnow = 3;
*
* noahmpio.ids = 1;
* noahmpio.ide = 1;
* noahmpio.ims = 1;
* noahmpio.ime = 1;
* noahmpio.its = 1;
* noahmpio.ite = 1;
*
* noahmpio.jds = 1;
* noahmpio.jde = 1;
* noahmpio.jms = 1;
* noahmpio.jme = 1;
* noahmpio.jts = 1;
* noahmpio.jte = 1;
*
* noahmpio.kds = 1;
* noahmpio.kde = 1;
* noahmpio.kms = 1;
* noahmpio.kme = 1;
* noahmpio.kts = 1;
* noahmpio.kte = 1;
*/

NoahmpIOVarInitDefault(&noahmpio);
Expand Down
Loading