Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
d22929a
WIP: Adding the EcoSIM for ATS PK (#335)
AndrewGraus Mar 16, 2026
745cbfc
Cleaned up ecosim CMakeLists.txt to align with new TPLs build of EcoSIM.
jd-moulton Apr 5, 2026
4c9f2a7
Hardcoding the Amanzi branch to david/ecosim-tpls.
jd-moulton Apr 5, 2026
4ac3f41
Minor changes to EcoSIM PKs owned variables and enabling registration…
AndrewGraus Apr 9, 2026
53f67cf
Re-activating transport code
AndrewGraus May 7, 2026
74743c6
Adding canopy-held snow to the coupling
AndrewGraus May 12, 2026
3ee92a0
reworking canopy snow dataset
AndrewGraus May 13, 2026
ea4f943
Added plant trait table input
AndrewGraus May 28, 2026
25fd905
Explicitly adding number of PFTs to parameterlist
AndrewGraus Jun 2, 2026
1b06dd1
Added support for multiple PFTs
AndrewGraus Jun 4, 2026
0cb1a7b
Updated Amanzi branch to master since EcoSIM TPLs branch was merged (…
jd-moulton Jun 19, 2026
aaaaaf3
Debugging the ats-regression-tests branch used in CI (refs #337).
jd-moulton Jun 22, 2026
74576ca
Using ATS_BRANCH explicitly in check on ats-regression-tests branch f…
jd-moulton Jun 22, 2026
190914d
Typo in check, misplaced double quote (refs #337).
jd-moulton Jun 22, 2026
a566a17
Adding feature specific ctest command to ensure these tests are run f…
jd-moulton Jun 24, 2026
bedefd8
Fixing name for EcoSIM feature tests (refs:#337).
jd-moulton Jun 24, 2026
f8d8bdd
Fixes to uninitialized data and snow datasets
AndrewGraus Jun 30, 2026
fff7ca1
Adding return statements where missing
AndrewGraus Jul 8, 2026
9799cd9
Updates to datasets to prevent memory issues
AndrewGraus Jul 13, 2026
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
58 changes: 49 additions & 9 deletions .github/workflows/ats-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
name: Build Docker
steps:
- name: Check out the Amanzi repo
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
repository: amanzi/amanzi
ref: master
Expand All @@ -36,13 +36,13 @@ jobs:
else
echo "ATS_BRANCH=$GITHUB_REF_NAME" >> $GITHUB_ENV
fi
- name: Does Amanzi branch of the same name exist?
- name: Set Amanzi branch to master (the EcoSIM TPLs branch was merged into master).
id: amanzi_branch
run: |
echo "AMANZI_BRANCH=$(git ls-remote --heads origin ${GITHUB_REF_NAME} | sed 's/.*refs\/heads\///')" >> $GITHUB_ENV
- name: If so, checkout Amanzi to get the right TPLs version
echo "AMANZI_BRANCH=master" >> $GITHUB_ENV
- name: Checkout Amanzi to get the right TPLs version
id: amanzi_branch_checkout
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
repository: amanzi/amanzi
ref: ${{env.AMANZI_BRANCH}}
Expand All @@ -51,7 +51,8 @@ jobs:
id: ats_tests_branch
working-directory: src/physics/ats/testing/ats-regression-tests
run: |
echo "ATS_TESTS_BRANCH=$(git ls-remote --heads origin ${GITHUB_REF_NAME} | sed 's/.*refs\/heads\///')" >> $GITHUB_ENV
echo "Looking for a tests branch with the same name: ${{env.ATS_BRANCH}}";
echo "ATS_TESTS_BRANCH=$(git ls-remote --heads origin ${{env.ATS_BRANCH}} | sed 's/.*refs\/heads\///')" >> $GITHUB_ENV
- name: Filter the branch name to generate a tag for Docker
id: tag
run: |
Expand All @@ -76,7 +77,7 @@ jobs:
echo "ARCH=amd64" >> $GITHUB_ENV
fi
- name: Login to Docker Hub
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
username: ${{secrets.DOCKERHUB_USERNAME}}
password: ${{secrets.DOCKERHUB_PASSWORD}}
Expand All @@ -92,6 +93,45 @@ jobs:
--build-arg ats_tests_branch=${{env.ATS_TESTS_BRANCH}} \
-t metsi/ats:${{env.ATS_BRANCH_TAG}}-${{env.ARCH}}-latest -f Dockerfile-ATS-build .
docker push ${{secrets.DOCKERHUB_USERNAME}}/ats:${{env.ATS_BRANCH_TAG}}-${{env.ARCH}}-latest
EcoSIM-feature-tests:
strategy:
matrix:
os: [ ubuntu-latest, ubuntu-24.04-arm ]
runs-on: ${{ matrix.os }}
name: EcoSIM feature tests
needs: build
steps:
- name: Check out the Amanzi repo
uses: actions/checkout@v7
with:
repository: amanzi/amanzi
ref: master
submodules: recursive
- name: Extract the ATS branch name
id: branch
working-directory: Docker
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "ATS_BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
else
echo "ATS_BRANCH=$GITHUB_REF_NAME" >> $GITHUB_ENV
fi
- name: Filter the branch name to generate a tag for Docker
id: tag
run: |
echo "ATS_BRANCH_TAG=$(echo ${{env.ATS_BRANCH}} | sed -e 's/\//--/g')" >> $GITHUB_ENV
- name: Get runner architecture
run: |
if [[ ${{matrix.os}} == "ubuntu-24.04-arm" ]]; then
echo "ARCH=arm64" >> $GITHUB_ENV
else
echo "ARCH=amd64" >> $GITHUB_ENV
fi
- name: Run tests
id: tests
working-directory: Docker
run:
docker run --rm ${{secrets.DOCKERHUB_USERNAME}}/ats:${{env.ATS_BRANCH_TAG}}-${{env.ARCH}}-latest /bin/bash -c "cd ~/amanzi_builddir/ats; ctest --output-on-failure -R 'ecosim'"
serial-reg15-tests:
strategy:
matrix:
Expand All @@ -101,7 +141,7 @@ jobs:
needs: build
steps:
- name: Check out the Amanzi repo
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
repository: amanzi/amanzi
ref: master
Expand Down Expand Up @@ -140,7 +180,7 @@ jobs:
needs: build
steps:
- name: Check out the Amanzi repo
uses: actions/checkout@v4
uses: actions/checkout@v7
with:
repository: amanzi/amanzi
ref: master
Expand Down
25 changes: 24 additions & 1 deletion src/executables/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ include_directories(${ATS_SOURCE_DIR}/src/pks/energy)
include_directories(${ATS_SOURCE_DIR}/src/pks/flow)
include_directories(${ATS_SOURCE_DIR}/src/pks/deform)
include_directories(${ATS_SOURCE_DIR}/src/pks/transport)
include_directories(${ATS_SOURCE_DIR}/src/pks/ecosim)
include_directories(${ATS_SOURCE_DIR}/src/operators/upwinding)
include_directories(${ATS_SOURCE_DIR}/src/operators/advection)
include_directories(${ATS_SOURCE_DIR}/src/operators/deformation)
Expand All @@ -63,6 +64,12 @@ include_evaluators_directories(LISTNAME ATS_BGC_REG_INCLUDES)
include_evaluators_directories(LISTNAME ATS_MPC_REG_INCLUDES)
include_evaluators_directories(LISTNAME SED_TRANSPORT_REG_INCLUDES)


include_evaluators_directories(LISTNAME ATS_ECOSIM_REG_INCLUDES)
include_evaluators_directories(LISTNAME ATS_ECOSIM_RELATIONS_REG_INCLUDES)
include_evaluators_directories(LISTNAME ATS_ECOSIM_DATA_REG_INCLUDES)


set(ats_src_files
ats_mesh_factory.cc
coordinator.cc
Expand Down Expand Up @@ -122,6 +129,21 @@ set(ats_link_libs
ats_transport_relations
)

if (ENABLE_ECOSIM)
list(APPEND ats_link_libs
ats_ecosim
ats_ecosim_data
# ats_ecosim_relations
)
endif()

#In theory covered by ECOSIM_LIBRARIES:
#If not place this in an if statement?
# ats_ecosim
# ats_ecosim_data
# ats_ecosim_relations

message(STATUS ">>>> JDM: In ATS ECOSIM_LIBRARIES = ${ECOSIM_LIBRARIES}")

# note, we can be inclusive here, because if they aren't enabled,
# these won't be defined and will result in empty strings.
Expand All @@ -137,7 +159,8 @@ set(tpl_link_libs
${HYPRE_LIBRARIES}
${HDF5_LIBRARIES}
${CLM_LIBRARIES}
)
${ECOSIM_LIBRARIES}
)

add_amanzi_library(ats_executable
SOURCE ${ats_src_files}
Expand Down
5 changes: 5 additions & 0 deletions src/executables/ats_registration_files.hh
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@
#ifdef ALQUIMIA_ENABLED
#include "pks_chemistry_reg.hh"
#endif
#ifdef ECOSIM_ENABLED
#include "ats_ecosim_registration.hh"
#include "ats_ecosim_relations_registration.hh"
#include "ats_ecosim_data_registration.hh"
#endif
4 changes: 4 additions & 0 deletions src/pks/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,7 @@ add_subdirectory(deform)
add_subdirectory(surface_balance)
add_subdirectory(biogeochemistry)
add_subdirectory(mpc)

if (ENABLE_ECOSIM)
add_subdirectory(ecosim)
endif()
124 changes: 124 additions & 0 deletions src/pks/ecosim/BGCEngine.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
/*
Basic architecture based on the Alquima interfece adapted for
use in the ATSEcoSIM PK

Copyright 2010-202x held jointly by LANS/LANL, LBNL, and PNNL.
Amanzi is released under the three-clause BSD License.
The terms of use and "as is" disclaimer for this license are
provided in the top-level COPYRIGHT file.

Authors: Jeffrey Johnson
Sergi Molins <smolins@lbl.gov>

This implements the Alquimia chemistry engine.
*/

#include <iostream>
#include <cstring>
#include <cstdio>
#include <assert.h>
#include "BGCEngine.hh"
#include "errors.hh"
#include "exceptions.hh"

// Support for manipulating floating point exception handling.
#ifdef _GNU_SOURCE
#define AMANZI_USE_FENV
#include <fenv.h>
#endif

namespace Amanzi {
namespace EcoSIM {

BGCEngine::BGCEngine(const std::string& engineName,
const std::string& inputFile) :
bgc_engine_name_(engineName),
bgc_engine_inputfile_(inputFile)
{
Errors::Message msg;

CreateBGCInterface(bgc_engine_name_.c_str(),
&bgc_);

}

BGCEngine::~BGCEngine()
{
bgc_.Shutdown();

//Did I forget to implement this?
//FreeBGCProperties(&props);
//FreeBGCState(&state);
//FreeBGCAuxiliaryData(&aux_data);
//FreeAlquimiaEngineStatus(&chem_status_);
}

const BGCSizes&
BGCEngine::Sizes() const
{
return sizes_;
}

void BGCEngine::InitState(BGCProperties& properties,
BGCState& state,
BGCAuxiliaryData& aux_data,
int ncells_per_col_,
int num_components,
int num_columns,
int num_pfts)
{
AllocateBGCProperties(&sizes_, &properties, ncells_per_col_, num_columns);
AllocateBGCState(&sizes_, &state, ncells_per_col_, num_components, num_columns, num_pfts);
}

void BGCEngine::FreeState(BGCProperties& properties,
BGCState& state,
BGCAuxiliaryData& aux_data)
{
FreeBGCProperties(&properties);
FreeBGCState(&state);
}

void BGCEngine::DataTest() {

bgc_.DataTest();
}

bool BGCEngine::Setup(BGCProperties& properties,
BGCState& state,
BGCSizes& sizes_,
int num_iterations,
int num_columns,
int ncells_per_col_)
{
bgc_.Setup(&properties,
&state,
&sizes_,
num_iterations,
num_columns,
ncells_per_col_);

return true;

}

bool BGCEngine::Advance(const double delta_time,
BGCProperties& properties,
BGCState& state,
BGCSizes& sizes_,
int num_iterations,
int num_columns)
{
bgc_.Advance(delta_time,
&properties,
&state,
&sizes_,
num_iterations,
num_columns);

return true;

}

} // namespace
} // namespace
Loading
Loading