Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
9a5d9bc
update submodule url to gitlab
mkarim-rtx Jun 5, 2024
d769a99
Merge branch 'development' into NGWPC-1966
mkarim-rtx Jun 19, 2024
aa49fc8
Merge branch 'NGWPC-1966' into 'development'
cmaynard-ngwpc Aug 6, 2024
1deef7d
Implementation of the new Logging mechanism for C-based modules - NGW…
ngwpcareg Sep 23, 2024
b7817d0
fix to CFE unit test for mass balance check
yuqiong77 Sep 27, 2024
a5f396b
Merge branch 'yliu_NJRT-89_CFE_unit_test' into 'development'
mkarim-rtx Sep 28, 2024
0f8d54b
More changes including the move of setup_logger call to BMI initializ…
ngwpcareg Sep 30, 2024
a97daae
Final change to make it work with environment variable NGEN_LOG_FILE_…
ngwpcareg Oct 1, 2024
48615cb
Merge branch 'development' into 'NGWPC-3889'
ngwpcareg Oct 1, 2024
9590232
Merge branch 'NGWPC-3889' into 'development'
zhengtaocui Oct 1, 2024
cee198f
Revert "Merge branch 'NGWPC-3889' into 'development'"
david-gillingham-rtx Oct 1, 2024
c4686e9
Merge branch 'revert-95902324' into 'development'
ngwpcareg Oct 1, 2024
c99ab26
recommit of logger changes for CFE module
ngwpcareg Oct 4, 2024
9bfa31b
Merge branch 'NGWPC-3889-fix-2' into 'development'
zhengtaocui Oct 4, 2024
d6d640d
NGWPC-4428 - CFE logging changes
ngwpcareg Oct 28, 2024
c684795
Merge branch 'NGWPC-4429' into 'development'
zhengtaocui Oct 29, 2024
c4f731a
Merge branch 'release-candidate' into 'master'
shanti99surapaneni Oct 31, 2024
5902488
Logger optimization
ngwpcareg Dec 3, 2024
158f5fa
Merge branch 'logger_optimization' into 'development'
zhengtaocui Dec 3, 2024
726ffb3
Added release number, date and commit hash of official release
cmaynard-ngwpc Dec 3, 2024
ef37895
Merge branch 'cmaynard_NGWPC-4611_version_file' into 'development'
cmaynard-ngwpc Dec 5, 2024
2945134
Adding feature for dynamically setting log level systemwide
ngwpcareg Dec 16, 2024
0fade9b
Merge branch 'logger_optimization' into 'development'
ngwpcareg Jan 6, 2025
a7e8451
changed the way logLevel char pointer is checked for NULL
ngwpcareg Jan 10, 2025
03cdee4
Merge remote-tracking branch 'origin/development' into logger_optimiz…
ngwpcareg Jan 10, 2025
13ace82
Merge branch 'logger_optimization' into 'development'
ngwpcareg Jan 10, 2025
3897405
Revert "changed the way logLevel char pointer is checked for NULL"
peterkronenberg-rtx Jan 14, 2025
8ce0fd1
Revert "Adding feature for dynamically setting log level systemwide"
peterkronenberg-rtx Jan 14, 2025
ce5414a
Merge branch 'peter_revert_cfe_logging' into 'development'
peterkronenberg-rtx Jan 15, 2025
a2bbe71
Merge branch 'development' into 'release-candidate'
cmaynard-ngwpc Jan 26, 2025
c6bf363
Updated version file for release rc-1.1.0
cmaynard-ngwpc Jan 26, 2025
71e0863
Merge branch 'release_rc-1.1.0_update_version_file' into 'release-can…
cmaynard-ngwpc Jan 26, 2025
162eded
enhancement to allow flexible order in cfe config
yuqiong77 Jan 28, 2025
701fb7b
Merge branch 'yliu_NGWPC-5407_cfe_config_order' into 'development'
yuqiong77 Jan 28, 2025
0ce4e7f
Merge branch 'development' into 'release-candidate'
cmaynard-ngwpc Jan 28, 2025
446a7d9
Update version file for release rc-1.1.0A
cmaynard-ngwpc Jan 28, 2025
ee76d80
Merge branch 'release_rc-1.1.0A_update_version_file' into 'release-ca…
cmaynard-ngwpc Jan 28, 2025
9b45fb0
Merge branch 'release-candidate' into 'development'
cmaynard-ngwpc Jan 28, 2025
0efb623
Merge branch 'release-candidate' into 'master'
cmaynard-ngwpc Feb 1, 2025
a8cafe5
Update version file for Release 1.1.0
cmaynard-ngwpc Feb 1, 2025
970223c
Merge branch 'release_1.1.0_update_version_file' into 'master'
cmaynard-ngwpc Feb 1, 2025
d625169
Merge branch 'master' into 'development'
cmaynard-ngwpc Feb 1, 2025
6e59657
fix cfe error
yuqiong77 Feb 3, 2025
4b56392
Merge branch 'fix_cfe_error' into 'master'
yuqiong77 Feb 3, 2025
810978f
Update version file for master hotfix 1.1.1
cmaynard-ngwpc Feb 3, 2025
d1c8ae8
Merge branch 'update_version_file' into 'master'
cmaynard-ngwpc Feb 3, 2025
1325308
Merge branch 'master' into merge_master_to_dev_1.1.1
cmaynard-ngwpc Feb 3, 2025
ba82611
Merge branch 'merge_master_to_dev_1.1.1' into 'development'
cmaynard-ngwpc Feb 3, 2025
dc6d5e7
Added RTX licensing verbiage
cmaynard-ngwpc Feb 6, 2025
0843fa0
Remove duplicated RTX licensing verbiage
cmaynard-ngwpc Feb 6, 2025
7e318d8
Merge branch 'add_rtx_licencing' into 'development'
cmaynard-ngwpc Feb 6, 2025
0626082
Merge branch 'development' into 'release-candidate'
cmaynard-ngwpc Feb 13, 2025
564e25f
Update version file for release rc-1.2.0 on 2025-02-12
cmaynard-ngwpc Feb 13, 2025
91060a0
Merge branch 'update_version_file_rc-1.2.0' into 'release-candidate'
cmaynard-ngwpc Feb 13, 2025
471ab69
Merge branch 'release-candidate' into 'development'
cmaynard-ngwpc Feb 13, 2025
90c72a7
Merge branch 'release-candidate' into 'master'
cmaynard-ngwpc Feb 26, 2025
bbac306
Update version file for release 1.2.0 on 2025-02-25
cmaynard-ngwpc Feb 26, 2025
8efdb00
Merge branch 'update_version_file_1.2.0' into 'master'
cmaynard-ngwpc Feb 26, 2025
2b47204
Merge branch 'master' into 'development'
cmaynard-ngwpc Feb 26, 2025
b2a11e7
Merge branch 'master' into 'release-candidate'
cmaynard-ngwpc Mar 14, 2025
6e6c6e6
Delete version.txt
peterkronenberg-rtx Mar 19, 2025
ae774cd
Merge branch 'peter_delete_version' into 'development'
peterkronenberg-rtx Apr 9, 2025
01314de
Refactor and add env var checking
cmaynard-ngwpc Apr 25, 2025
008815f
Change ENABLE to ENABLED for EWTS flag
cmaynard-ngwpc Apr 29, 2025
413b0f0
Update logger to be consistent with other module loggers
cmaynard-ngwpc May 6, 2025
c09f024
Change log levels ERROR to WARNING and WARNING to SEVERE
cmaynard-ngwpc May 6, 2025
b0d149e
Flush stdout after print
cmaynard-ngwpc May 6, 2025
1b6cf46
Merge branch 'cmaynard_NGWPC-6157_cfe_logger_udpates' into 'development'
cmaynard-ngwpc May 7, 2025
fc7fe35
Remove placholder comments
cmaynard-ngwpc May 15, 2025
8454fb1
Merge branch 'cmaynard_remove_logger_comments' into 'development'
cmaynard-ngwpc May 15, 2025
6cfc51a
Merge branch 'development' into 'release-candidate'
cmaynard-ngwpc Jun 11, 2025
6f99dcb
Merge remote-tracking branch 'github/master' into owp-merge-github-ma…
cmaynard-ngwpc Jul 18, 2025
3cbc26e
Fix merge errors
cmaynard-ngwpc Jul 21, 2025
c2d4de5
Fix header file reference
cmaynard-ngwpc Jul 21, 2025
41d216d
Merge branch 'owp-merge-github-master' into 'development'
cmaynard-ngwpc Jul 22, 2025
6182848
Created serialization methods for CFE state data
idtodd Aug 15, 2025
bd82641
Merge branch 'idt/bmi-serialization' into 'development'
cmaynard-ngwpc Aug 15, 2025
819fea9
Change malloc to calloc to ensure null pointers
idtodd Aug 20, 2025
c729b8b
Merge pull request #1 from NGWPC/fix-erroneous-free-call
cmaynard-ngwpc Aug 20, 2025
5bc8187
Fix log level from SEVERE to WARNING for a warning.
cmaynard-ngwpc Sep 3, 2025
4717734
Merge pull request #2 from NGWPC/cmaynard_NGWPC-7583_fix_warning_msgs
cmaynard-ngwpc Sep 3, 2025
4d3d6a5
fix flux larger than storage error
Sep 9, 2025
1aa4241
Merge pull request #3 from NGWPC/cfe_flux_error
cmaynard-ngwpc Sep 9, 2025
190a045
Merge pull request #4 from NGWPC/release-candidate
cmaynard-ngwpc Sep 9, 2025
6eea6d8
Merge pull request #5 from NGWPC/development
cmaynard-ngwpc Sep 9, 2025
bd53f46
changed warning msg per OWP request
Sep 11, 2025
289ed4d
Merge pull request #6 from NGWPC/yliu_bug7605_cfe_flux
cmaynard-ngwpc Sep 12, 2025
156c8f9
Express dimensionless units of ice_fraction_xinanjiang and soil_moist…
PhilMiller Sep 12, 2025
32ef0ed
Merge pull request #8 from NGWPC/release-candidate
cmaynard-ngwpc Sep 12, 2025
b941a5b
Merge pull request #7 from NGWPC/PhilMiller-7604-dimensionless-inputs
PhilMiller Sep 12, 2025
54e5de1
Throttle groundwater flux warning message to a single log entry.
cmaynard-ngwpc Sep 25, 2025
afc52d6
Adapt serialization to revised protocol
PhilMiller Sep 26, 2025
e11666d
ice_fraction_schaake (dimensionless)
mkarim-rtx Sep 17, 2025
7aab752
SURF_RUNOFF_SCHEME unit from None to 1 (dimensionless)
mkarim-rtx Sep 17, 2025
1d3ca6f
Merge pull request #12 from NGWPC/PhilMiller-8300-fix-protocol
PhilMiller Oct 9, 2025
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
9 changes: 0 additions & 9 deletions .github/workflows/Build_and_Run_Standalone_Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,6 @@ jobs:
make
cd ..
./run_cfe.sh FORCINGPET

- name : Build and Run AETROOTZONE option
run: |
git clone https://github.com/NOAA-OWP/SoilMoistureProfiles extern/SoilMoistureProfiles
cd build
cmake ../ -DAETROOTZONE=ON
make
cd ..
./run_cfe.sh AETROOTZONE

- name: Build and Run BMI Unit Test
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ngen_integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:

- name: Build the CFE Library
run: |
cmake -B cmake_build -S . -DNGEN=ON -DCMAKE_C_FLAGS='-g -Og -fsanitize=address -Werror'
cmake -B cmake_build -S . -DNGEN=ON
make -C cmake_build

- name: Save CFE to a Temp Directory
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
- name: Run NGen Test for CFE (cfe1.0) Coupled with PET
run: |
mv ${{ steps.ngen_id1.outputs.build-dir }} ./ngen-build/
inputfile='extern/cfe/cfe/realizations/realization_cfe_pet_surfgiuh.json'
inputfile='extern/cfe/cfe/realizations/realization_cfe_pet.json'
./ngen-build/ngen ./data/catchment_data.geojson "cat-27" ./data/nexus_data.geojson "nex-26" $inputfile

- name: Run Ngen Test for CFE (cfe2.0) Coupled with PET
Expand Down
58 changes: 38 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ set(Red "${Esc}[32m")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_C_COMPILER $ENV{CC})
set(CMAKE_CXX_COMPILER $ENV{CXX})

# module setup options

option(BASE "BASE" OFF)
Expand Down Expand Up @@ -43,6 +46,7 @@ endif()
# set the project name
project(cfebmi VERSION 1.0.0 DESCRIPTION "OWP CFE BMI Module Shared Library")

set(CMAKE_BUILD_TYPE Debug)
IF(CMAKE_BUILD_TYPE MATCHES Debug)
message("Debug build.")
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)
Expand All @@ -51,39 +55,49 @@ message(CMAKE_CXX_COMPILER " ${CMAKE_CXX_COMPILER}")
message(CMAKE_C_COMPILER " ${CMAKE_C_COMPILER}")
message("CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")

# add the executable

## cfe + aorc + pet + smp
if(AETROOTZONE)
add_executable(${exe_name} ./src/main_cfe_aorc_pet_rz_aet.cxx ./src/cfe.c ./src/bmi_cfe.c ./src/giuh.c
./src/conceptual_reservoir.c ./src/nash_cascade.c ./extern/aorc_bmi/src/aorc.c
./extern/aorc_bmi/src/bmi_aorc.c ./extern/evapotranspiration/src/pet.c
./extern/evapotranspiration/src/bmi_pet.c)

add_library(cfelib ./extern/SoilMoistureProfiles/src/bmi_soil_moisture_profile.cxx
./extern/SoilMoistureProfiles/src/soil_moisture_profile.cxx
./extern/SoilMoistureProfiles/include/bmi_soil_moisture_profile.hxx
./extern/SoilMoistureProfiles/include/soil_moisture_profile.hxx)
add_executable(${exe_name} ./src/main_cfe_aorc_pet_rz_aet.cxx ./src/cfe.c ./src/bmi_cfe.c ./src/logger.c ./src/giuh.c ./src/conceptual_reservoir.c
./extern/aorc_bmi/src/aorc.c ./extern/aorc_bmi/src/bmi_aorc.c ./extern/evapotranspiration/src/pet.c
./extern/evapotranspiration/src/bmi_pet.c ./src/bmi_serialization.cxx ./src/nash_cascade.c)

add_library(cfelib ./extern/SoilMoistureProfiles/src/bmi_soil_moisture_profile.cxx ./extern/SoilMoistureProfiles/src/soil_moisture_profile.cxx
./extern/SoilMoistureProfiles/include/bmi_soil_moisture_profile.hxx ./extern/SoilMoistureProfiles/include/soil_moisture_profile.hxx)
target_link_libraries(${exe_name} LINK_PUBLIC cfelib)
elseif(FORCING)
add_executable(${exe_name} ./src/main_pass_forcings.c ./src/cfe.c ./src/bmi_cfe.c ./src/giuh.c ./src/conceptual_reservoir.c
./src/nash_cascade.c ./extern/aorc_bmi/src/aorc.c ./extern/aorc_bmi/src/bmi_aorc.c)
add_executable(${exe_name} ./src/main_pass_forcings.c ./src/cfe.c ./src/bmi_cfe.c ./src/logger.c ./src/giuh.c ./src/conceptual_reservoir.c
./extern/aorc_bmi/src/aorc.c ./extern/aorc_bmi/src/bmi_aorc.c ./src/bmi_serialization.cxx ./src/nash_cascade.c)
elseif(FORCINGPET)
add_executable(${exe_name} ./src/main_cfe_aorc_pet.c ./src/cfe.c ./src/bmi_cfe.c ./src/giuh.c ./src/conceptual_reservoir.c
./src/nash_cascade.c ./extern/aorc_bmi/src/aorc.c ./extern/aorc_bmi/src/bmi_aorc.c
./extern/evapotranspiration/src/pet.c ./extern/evapotranspiration/src/bmi_pet.c)
add_executable(${exe_name} ./src/main_cfe_aorc_pet.c ./src/cfe.c ./src/bmi_cfe.c ./src/logger.c ./src/giuh.c ./src/conceptual_reservoir.c
./extern/aorc_bmi/src/aorc.c ./extern/aorc_bmi/src/bmi_aorc.c ./extern/evapotranspiration/src/pet.c
./extern/evapotranspiration/src/bmi_pet.c ./src/bmi_serialization.cxx ./src/nash_cascade.c)
elseif(BASE)
add_executable(${exe_name} ./src/main.c ./src/cfe.c ./src/bmi_cfe.c ./src/giuh.c ./src/conceptual_reservoir.c
./src/nash_cascade.c)
add_executable(${exe_name} ./src/main.c ./src/cfe.c ./src/bmi_cfe.c ./src/logger.c ./src/giuh.c ./src/conceptual_reservoir.c
./src/bmi_serialization.cxx ./src/nash_cascade.c)
elseif(UNITTEST)
add_executable(${exe_name} ./test/main_unit_test.c ./src/cfe.c ./src/bmi_cfe.c ./src/giuh.c ./src/conceptual_reservoir.c
./src/nash_cascade.c)
add_executable(${exe_name} ./test/main_unit_test.c ./src/cfe.c ./src/bmi_cfe.c ./src/logger.c ./src/giuh.c ./src/conceptual_reservoir.c
./src/bmi_serialization.cxx ./src/nash_cascade.c)
endif()


# -----------------------------------------------------------------------------
# Find the Boost library and configure usage
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.79.0 REQUIRED COMPONENTS serialization)



if(NOT NGEN)
target_link_libraries(${exe_name} PRIVATE m)
target_include_directories(${exe_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_link_libraries(${exe_name} PRIVATE Boost::serialization)
endif()


Expand All @@ -96,9 +110,11 @@ set(CFE_LIB_DESC_CMAKE "OWP CFE BMI Module Shared Library")
add_compile_definitions(BMI_ACTIVE)

if(WIN32)
add_library(cfebmi ./src/bmi_cfe.c ./src/cfe.c ./src/giuh.c ./src/conceptual_reservoir.c ./src/nash_cascade.c)
add_library(cfebmi ./src/bmi_cfe.c ./src/logger.c ./src/cfe.c ./src/giuh.c ./src/conceptual_reservoir.c
./src/bmi_serialization.cxx)
else()
add_library(cfebmi SHARED ./src/bmi_cfe.c ./src/cfe.c ./src/giuh.c ./src/conceptual_reservoir.c ./src/nash_cascade.c)
add_library(cfebmi SHARED ./src/bmi_cfe.c ./src/logger.c ./src/cfe.c ./src/giuh.c ./src/conceptual_reservoir.c
./src/bmi_serialization.cxx)
endif()

target_include_directories(cfebmi PRIVATE include)
Expand All @@ -107,6 +123,8 @@ set_target_properties(cfebmi PROPERTIES VERSION ${PROJECT_VERSION})

set_target_properties(cfebmi PROPERTIES PUBLIC_HEADER ./include/bmi_cfe.h)

target_link_libraries(cfebmi PRIVATE Boost::serialization)

include(GNUInstallDirs)

install(TARGETS cfebmi
Expand Down
27 changes: 25 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
Copyright 2025 Raytheon Company

Apache License
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

Licensed under: https://opensource.org/license/bsd-2-clause

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

All rights reserved. Based on Government sponsored work under contract GS-35F-204GA.

-----------------


“Software code created by U.S. Government employees is not subject to copyright
in the United States (17 U.S.C. §105). The United States/Department of Commerce
reserve all rights to seek and obtain copyright protection in countries other
than the United States for Software authored in its entirety by the Department
of Commerce. To this end, the Department of Commerce hereby grants to Recipient
a royalty-free, nonexclusive license to use, copy, and create derivative works
of the Software outside of the United States.”

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

Expand Down Expand Up @@ -199,4 +222,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

4 changes: 2 additions & 2 deletions bmi/bmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ SOFTWARE.
extern "C" {
#endif

const static int BMI_SUCCESS = 0;
const static int BMI_FAILURE = 1;
#define BMI_SUCCESS (0)
#define BMI_FAILURE (1)

#define BMI_MAX_UNITS_NAME (2048)
#define BMI_MAX_TYPE_NAME (2048)
Expand Down
84 changes: 84 additions & 0 deletions bmi/bmi.hxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// The Basic Model Interface (BMI) C++ specification.
//
// This language specification is derived from the Scientific
// Interface Definition Language (SIDL) file bmi.sidl located at
// https://github.com/csdms/bmi.

#ifndef BMI_HXX
#define BMI_HXX
#include <string>
#include <vector>

namespace bmixx {

//const int BMI_SUCCESS = 0;
// const int BMI_FAILURE = 1;

const int MAX_COMPONENT_NAME = 2048;
const int MAX_VAR_NAME = 2048;
const int MAX_UNITS_NAME = 2048;
const int MAX_TYPE_NAME = 2048;

class Bmi {
public:
// Model control functions.
virtual void Initialize(std::string config_file) = 0;
virtual void Update() = 0;
virtual void UpdateUntil(double time) = 0;
virtual void Finalize() = 0;

// Model information functions.
virtual std::string GetComponentName() = 0;
virtual int GetInputItemCount() = 0;
virtual int GetOutputItemCount() = 0;
virtual std::vector<std::string> GetInputVarNames() = 0;
virtual std::vector<std::string> GetOutputVarNames() = 0;

// Variable information functions
virtual int GetVarGrid(std::string name) = 0;
virtual std::string GetVarType(std::string name) = 0;
virtual std::string GetVarUnits(std::string name) = 0;
virtual int GetVarItemsize(std::string name) = 0;
virtual int GetVarNbytes(std::string name) = 0;
virtual std::string GetVarLocation(std::string name) = 0;

virtual double GetCurrentTime() = 0;
virtual double GetStartTime() = 0;
virtual double GetEndTime() = 0;
virtual std::string GetTimeUnits() = 0;
virtual double GetTimeStep() = 0;

// Variable getters
virtual void GetValue(std::string name, void *dest) = 0;
virtual void *GetValuePtr(std::string name) = 0;
virtual void GetValueAtIndices(std::string name, void *dest, int *inds, int count) = 0;

// Variable setters
virtual void SetValue(std::string name, void *src) = 0;
virtual void SetValueAtIndices(std::string name, int *inds, int count, void *src) = 0;

// Grid information functions
virtual int GetGridRank(const int grid) = 0;
virtual int GetGridSize(const int grid) = 0;
virtual std::string GetGridType(const int grid) = 0;

virtual void GetGridShape(const int grid, int *shape) = 0;
virtual void GetGridSpacing(const int grid, double *spacing) = 0;
virtual void GetGridOrigin(const int grid, double *origin) = 0;

virtual void GetGridX(const int grid, double *x) = 0;
virtual void GetGridY(const int grid, double *y) = 0;
virtual void GetGridZ(const int grid, double *z) = 0;

virtual int GetGridNodeCount(const int grid) = 0;
virtual int GetGridEdgeCount(const int grid) = 0;
virtual int GetGridFaceCount(const int grid) = 0;

virtual void GetGridEdgeNodes(const int grid, int *edge_nodes) = 0;
virtual void GetGridFaceEdges(const int grid, int *face_edges) = 0;
virtual void GetGridFaceNodes(const int grid, int *face_nodes) = 0;
virtual void GetGridNodesPerFace(const int grid, int *nodes_per_face) = 0;
};
}

#endif
5 changes: 2 additions & 3 deletions configs/cfe1.0/cfe_config_cat_87.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,12 @@ nash_storage=0.0,0.0
giuh_ordinates=0.06,0.51,0.28,0.12,0.03
num_timesteps=1
verbosity=2
surface_runoff_scheme=GIUH
surface_water_partitioning_scheme=Xinanjiang
surface_partitioning_scheme=Xinanjiang
a_Xinanjiang_inflection_point_parameter=1
b_Xinanjiang_shape_parameter=1
x_Xinanjiang_shape_parameter=1
urban_decimal_fraction=0.0
DEBUG=0
#surface_water_partitioning_scheme=Schaake
#surface_partitioning_scheme=Schaake
#ice_fraction=0
#ice_content_threshold=0.15
5 changes: 2 additions & 3 deletions configs/cfe1.0/cfe_config_laramie_pass_aet_rz.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ nash_storage=0.0,0.0
giuh_ordinates=0.06,0.51,0.28,0.12,0.03
num_timesteps=1
verbosity=1
surface_runoff_scheme=GIUH
surface_water_partitioning_scheme=Schaake
#surface_water_partitioning_scheme=Xinanjiang
surface_partitioning_scheme=Schaake
#surface_partitioning_scheme=Xinanjiang
#a_Xinanjiang_inflection_point_parameter=1
#b_Xinanjiang_shape_parameter=1
#x_Xinanjiang_shape_parameter=1
Expand Down
4 changes: 2 additions & 2 deletions include/bmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ SOFTWARE.
extern "C" {
#endif

const static int BMI_SUCCESS = 0;
const static int BMI_FAILURE = 1;
#define BMI_SUCCESS (0)
#define BMI_FAILURE (1)

#define BMI_MAX_UNITS_NAME (2048)
#define BMI_MAX_TYPE_NAME (2048)
Expand Down
4 changes: 4 additions & 0 deletions include/bmi_cfe.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extern "C" {

#include "./cfe.h"
#include "bmi.h"
#include <stdint.h>

//--------------------------------------------------
// Experiment to simplify BMI implementation (SDP)
Expand Down Expand Up @@ -111,6 +112,9 @@ struct cfe_state_struct {

int verbosity;

char* serialized;
uint64_t serialized_length; // needs a permanent anchor for get_value_ptr

};
typedef struct cfe_state_struct cfe_state_struct;

Expand Down
18 changes: 18 additions & 0 deletions include/bmi_serialization.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef CFE_BMI_SERIALIZATION
#define CFE_BMI_SERIALIZATION

#ifdef __cplusplus
extern "C" {
#endif

#include "bmi.h"

int free_serialized_cfe(Bmi* bmi);
int load_serialized_cfe(Bmi* bmi, const char* data);
int new_serialized_cfe(Bmi* bmi);

#ifdef __cplusplus
}
#endif

#endif
8 changes: 4 additions & 4 deletions include/cfe.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

// t-shirt approximation of the hydrologic routing funtionality of the National Water Model v 1.2, 2.0, and 2.1
// This code was developed to test the hypothesis that the National Water Model runoff generation, vadose zone
// dynamics, and conceptual groundwater model can be greatly simplified by acknowledging that it is truly a
// dynamics, and conceptual groundwater model can be greatly simplified by acknowledging that it is truly a
// conceptual model. The hypothesis is supported by a number of observations made during a 2017-2018 deep dive
// into the NWM code. Thesed are:
//
Expand All @@ -26,7 +26,7 @@
// function by Moore, 1985. The Schaake function is a single valued function of soil moisture deficit,
// predicts 100% runoff when the soil is saturated, like the curve-number method, and is fundamentally simple.
// 2. Run-on infiltration is strictly not calculated. Overland flow routing applies the Schaake function repeatedly
// to predict this phenomenon, which violates the underlying assumption of the PDM method that only rainfall
// to predict this phenomenon, which violates the underlying assumption of the PDM method that only rainfall
// inputs affect soil moisture.
// 3. The water-content based Richards' equation, applied using a coarse-discretization, can be replaced with a simple
// conceptual reservoir because it never allows saturation or infiltration-excess runoff unless deactivated by
Expand Down Expand Up @@ -118,8 +118,8 @@ struct massbal
double vol_soil_to_gw ; // this should equal vol_to_gw
double vol_soil_end ;
double vol_et_from_soil ;
double vol_et_from_rain ;
double vol_et_to_atm ;
double vol_et_from_rain ;
double vol_et_to_atm ;
double volin ;
double volout ;
double volend ;
Expand Down
2 changes: 1 addition & 1 deletion include/giuh.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
#define _GIUH_H

extern double giuh_convolution_integral(double runoff_m, int num_giuh_ordinates,
double *giuh_ordinates, double *runoff_queue_m_per_timestep);
double *giuh_ordinates, double *runoff_queue_m_per_timestep);

#endif
Loading