Open jduckerOWP opened 1 year ago
Updated documentation and Wiki pages have been created as a guide for compiling SCHISM source code and the BMI. Please refer to this moving forward SCHISM_BMI_wiki_pages
Documenting where Jason and I have gotten with this:
I installed the necessary packages in a clean Ubuntu docker container
And linked
ln -s /usr/bin/python3 /usr/bin/python
because the SCHISM build system runspython
in one or two spots to pre-process some things.
Enabled these variables in SCHISM to get behavior compatible with our intended BMI usage:
OLDIO
USE_ATMOS
USE_NWM_BMI
For library compilation to use -fPIC
to appropriately produce code that can be loaded with dlopen()
, rather than appending that to the CMAKE_{C,CXX,Fortran}_Flags
variables (which produced build errors for me because of ;
appearing in the resulting compilation command lines), I inserted
add_compile_options("-fPIC")
In the top-level SCHISM CMakeLists.txt
I posted one change to Jason's branch to replace literal directory paths with a CMake variable path pointing at the project source directory, https://github.com/jduckerOWP/schism_NWM_BMI/pull/1
After clearing all of the above, Jason and I looked into the BMI implementation code and discussed initialization and coupling data flow. There's a challenge posed by the time integration scheme that SCHISM uses, in that it wants the atmospheric forcing values for a timestep ahead of its own execution. As initially written, the SCHISM BMI implementation takes input for variables with names Foo_t0
and Foo_t1
corresponding directly to its internal structure, and exposes those to the driver (eventually, the ngen model engine). My sense was that this would require an excess of special-case code in the model engine to properly feed SCHISM forcings data, so we instead decided to expose the relevant input variables without _t0/_t1
elaboration, and have the first step initialize both arrays. Jason is revising that now.
We also checked our mutual understanding of the coupling scheme between inland hydraulics and SCHISM. For now, we expect to have SCHISM strictly downstream of the coastal outflows from the inland hydraulic routing, with the routing unaffected by the water levels SCHISM predicts at the coastline. This will at least allow for a demonstration of the external data flows of the fully coupled system, with refinement to possible two-way coupling able to be developed later.
Hi Phil, I've gone ahead and finished all the required tasks on my end for you to move forward with the SCHISM BMI test case scenario as a NextGen formulation. The completed tasks are highlighted below:
Once you've taken a look at all the products I've provided here, I would be happy to meet with you again at your convivence to game plan the NextGen formulation setup you intend to implement with the SCHISM Lake Champlain BMI model setup moving forward. Thanks again Phil for your work on this topic.
Here are some notes on how the current code aligns with the conventions for BMI that ngen
presently expects. These observations are not necessarily requests for or intentions to change, so much as discussion points.
https://github.com/NOAA-OWP/ngen/blob/master/doc/BMIconventions.md
Re "Time Control"
model_start_time
other than 0, while the framework expects models to always treat that as 0. I expect we'll need to change this in the not-too-distant future, to align with time-stamped forcings, hot-starts, data assimilation, and so forth. Also, the variable isn't used for anything meaningful besides get_start_time
model_end_time
, which is also unused for anything meaningful except get_end_time
dt
from schism_glbl
, and a time_step_size
defined in the BMI interface. If SCHISM has an internal notion of its time step, it's probably preferable to maintain a single point of truth and just set/reference thatVariable metadata: The set of variable covered by the various routines has some inconsistencies.
ETA2 | ETA2_bnd | RAINRATE | SFCPRS | SPFH2m | TMP2m | UU10m | VV10m | VX | VY | Q_bnd | BEDLEVEL | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
var_grid |
y | y | y | y | y | y | y | y | y | y | y | y |
var_type |
y | y | y | y | y | y | y | y | y | y | y | y |
var_units |
y | y | y | y | y | y | y | y | y | y | y | y |
var_itemsize |
y | y | y | y | y | y | y | y | y | y | y | y |
var_nbytes |
||||||||||||
var_location |
y | y | y | y | y | y | y | y | y | y | y | y |
input_vars |
y | y | y | y | y | y | y | y | ||||
set_double |
y | y | y | y | y | y | y | y | ||||
get_double |
y | y | y | y | y | |||||||
output_vars |
y | y | y | y |
The potentially problematic things I see in here are
var_type
for ETA2_bnd
and Q_bnd
(implemented in https://github.com/jduckerOWP/schism_NWM_BMI/pull/4)It's reasonable (for now) that only input variables are available to set
, and only output variables are available to get
. That may change down the line as we go to support serialization
For the sake of guiding work on integrating SCHISM with NextGen (mostly stuff I expect to be doing), here's a broad list of things that I see needing to get done along the way
I'll open and link issues for some of these as I approach them.
Based on the change in #712, SCHISM won't have to create any sub-communicator at all. It'll just get the handled passed by the framework, and use it directly, since it'll be in the form the MPI Fortran bindings expect.
The SCHISM BMI code will eventually get merged to the schism-dev/schism-esmf. The blocking step is having our MPI code in the BMI code, so I'll prioritize that.
After digging into the ESMF MPI_Finalize
issues, I checked and SCHISM has a very similar issue - its parallel_finalize
unconditionally calls MPI_Finalize
. That's actually all it does, so we could just drop the call to parallel_finalize
from the BMI finalize routine, but that would not necessarily be a durable solution.
Short description explaining the high-level reason for the new issue.
Steps to compile SCHISM model, BMI shared libraries, and BMI driver to test functionality (single thread)